<classpathentry kind="lib" path="ext/lucene-memory-3.6.1.jar" sourcepath="ext/src/lucene-memory-3.6.1.jar" />
<classpathentry kind="lib" path="ext/lucene-queries-3.6.1.jar" sourcepath="ext/src/lucene-queries-3.6.1.jar" />
<classpathentry kind="lib" path="ext/jakarta-regexp-1.4.jar" />
- <classpathentry kind="lib" path="ext/markdownpapers-core-1.3.2.jar" sourcepath="ext/src/markdownpapers-core-1.3.2.jar" />
+ <classpathentry kind="lib" path="ext/pegdown-1.4.1.jar" sourcepath="ext/src/pegdown-1.4.1.jar" />
+ <classpathentry kind="lib" path="ext/parboiled-java-1.1.5.jar" sourcepath="ext/src/parboiled-java-1.1.5.jar" />
+ <classpathentry kind="lib" path="ext/parboiled-core-1.1.5.jar" sourcepath="ext/src/parboiled-core-1.1.5.jar" />
+ <classpathentry kind="lib" path="ext/asm-4.1.jar" sourcepath="ext/src/asm-4.1.jar" />
+ <classpathentry kind="lib" path="ext/asm-tree-4.1.jar" sourcepath="ext/src/asm-tree-4.1.jar" />
+ <classpathentry kind="lib" path="ext/asm-analysis-4.1.jar" sourcepath="ext/src/asm-analysis-4.1.jar" />
+ <classpathentry kind="lib" path="ext/asm-util-4.1.jar" sourcepath="ext/src/asm-util-4.1.jar" />
<classpathentry kind="lib" path="ext/org.eclipse.jgit-3.1.0.201310021548-r.jar" sourcepath="ext/src/org.eclipse.jgit-3.1.0.201310021548-r.jar" />
<classpathentry kind="lib" path="ext/jsch-0.1.46.jar" sourcepath="ext/src/jsch-0.1.46.jar" />
<classpathentry kind="lib" path="ext/JavaEWAH-0.5.6.jar" sourcepath="ext/src/JavaEWAH-0.5.6.jar" />
\r
https://github.com/wicketstuff/core/wiki/GoogleCharts \r
\r
----------------------------------------------------------------------------\r
-MarkdownPapers\r
----------------------------------------------------------------------------\r
- MarkdownPapers, released under the\r
- Apache Software License, Version 2.0.\r
-\r
- http://markdown.tautua.org\r
- \r
---------------------------------------------------------------------------\r
Jetty\r
---------------------------------------------------------------------------\r
Apache License 2.0.\r
\r
http://commons.apache.org/proper/commons-codec\r
-
\ No newline at end of file
+\r
+---------------------------------------------------------------------------\r
+pegdown\r
+---------------------------------------------------------------------------\r
+ pegdown, release under the\r
+ Apache License 2.0.\r
+ \r
+ https://github.com/sirthias/pegdown\r
+
\ No newline at end of file
- compile 'org.apache.lucene:lucene-core:${lucene.version}' :war :fedclient
- compile 'org.apache.lucene:lucene-highlighter:${lucene.version}' :war :fedclient
- compile 'org.apache.lucene:lucene-memory:${lucene.version}' :war :fedclient
-- compile 'org.tautua.markdownpapers:markdownpapers-core:1.3.2' :war
+- compile 'org.pegdown:pegdown:1.4.1' :war
- compile 'org.eclipse.jgit:org.eclipse.jgit:${jgit.version}' :war :fedclient :manager :authority
- compile 'org.eclipse.jgit:org.eclipse.jgit.http.server:${jgit.version}' :war :fedclient :manager :authority
- compile 'org.bouncycastle:bcprov-jdk15on:${bouncycastle.version}' :war :authority
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="markdownpapers-core-1.3.2.jar">
+ <library name="pegdown-1.4.1.jar">
<CLASSES>
- <root url="jar://$MODULE_DIR$/ext/markdownpapers-core-1.3.2.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/pegdown-1.4.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$MODULE_DIR$/ext/src/markdownpapers-core-1.3.2.jar!/" />
+ <root url="jar://$MODULE_DIR$/ext/src/pegdown-1.4.1.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="parboiled-java-1.1.5.jar">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/ext/parboiled-java-1.1.5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/ext/src/parboiled-java-1.1.5.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="parboiled-core-1.1.5.jar">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/ext/parboiled-core-1.1.5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/ext/src/parboiled-core-1.1.5.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="asm-4.1.jar">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/ext/asm-4.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/ext/src/asm-4.1.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="asm-tree-4.1.jar">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/ext/asm-tree-4.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/ext/src/asm-tree-4.1.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="asm-analysis-4.1.jar">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/ext/asm-analysis-4.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/ext/src/asm-analysis-4.1.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="asm-util-4.1.jar">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/ext/asm-util-4.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/ext/src/asm-util-4.1.jar!/" />
</SOURCES>
</library>
</orderEntry>
dependencyChanges:
- updated to Jetty 7.6.13
- updated to JGit 3.1.0
+ - replaced MarkdownPapers with pegdown 1.4.1
settings:
- { name: 'git.createRepositoriesShared', defaultValue: 'false' }
- { name: 'git.allowAnonymousPushes', defaultValue: 'false' }
import java.nio.charset.Charset;
import java.security.Principal;
import java.text.MessageFormat;
-import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
try {
String prepared = processCommitMessageRegex(repository.name, text);
return MarkdownUtils.transformMarkdown(prepared);
- } catch (ParseException e) {
+ } catch (Exception e) {
logger.error("Failed to render commit message as markdown", e);
}
break;
*/\r
package com.gitblit.utils;\r
\r
+import static org.pegdown.Extensions.ALL;\r
+\r
import java.io.IOException;\r
import java.io.Reader;\r
-import java.io.StringReader;\r
import java.io.StringWriter;\r
\r
-import org.slf4j.LoggerFactory;\r
-import org.tautua.markdownpapers.Markdown;\r
-import org.tautua.markdownpapers.parser.ParseException;\r
+import org.apache.commons.io.IOUtils;\r
+import org.pegdown.PegDownProcessor;\r
\r
/**\r
* Utility methods for transforming raw markdown text to html.\r
* @return html version of markdown text\r
* @throws java.text.ParseException\r
*/\r
- public static String transformMarkdown(String markdown) throws java.text.ParseException {\r
- try {\r
- StringReader reader = new StringReader(markdown);\r
- String html = transformMarkdown(reader);\r
- reader.close();\r
- return html;\r
- } catch (IllegalArgumentException e) {\r
- throw new java.text.ParseException(e.getMessage(), 0);\r
- } catch (NullPointerException p) {\r
- throw new java.text.ParseException("Markdown string is null!", 0);\r
- }\r
+ public static String transformMarkdown(String markdown) {\r
+ PegDownProcessor pd = new PegDownProcessor(ALL);\r
+ String html = pd.markdownToHtml(markdown);\r
+ return html;\r
}\r
\r
/**\r
* @return html version of the markdown text\r
* @throws java.text.ParseException\r
*/\r
- public static String transformMarkdown(Reader markdownReader) throws java.text.ParseException {\r
+ public static String transformMarkdown(Reader markdownReader) throws IOException {\r
// Read raw markdown content and transform it to html\r
StringWriter writer = new StringWriter();\r
try {\r
- Markdown md = new Markdown();\r
- md.transform(markdownReader, writer);\r
- return writer.toString().trim();\r
- } catch (StringIndexOutOfBoundsException e) {\r
- LoggerFactory.getLogger(MarkdownUtils.class).error("MarkdownPapers failed to parse Markdown!", e);\r
- throw new java.text.ParseException(e.getMessage(), 0);\r
- } catch (ParseException p) {\r
- LoggerFactory.getLogger(MarkdownUtils.class).error("MarkdownPapers failed to parse Markdown!", p);\r
- throw new java.text.ParseException(p.getMessage(), 0);\r
- } catch (Exception e) {\r
- LoggerFactory.getLogger(MarkdownUtils.class).error("MarkdownPapers failed to parse Markdown!", e);\r
- throw new java.text.ParseException(e.getMessage(), 0);\r
+ IOUtils.copy(markdownReader, writer);\r
+ String markdown = writer.toString();\r
+ return transformMarkdown(markdown);\r
} finally {\r
try {\r
writer.close();\r
package com.gitblit.wicket.pages;\r
\r
import java.text.MessageFormat;\r
-import java.text.ParseException;\r
\r
import org.apache.wicket.PageParameters;\r
import org.apache.wicket.markup.html.basic.Label;\r
String htmlText;\r
try {\r
htmlText = MarkdownUtils.transformMarkdown(markdownText);\r
- } catch (ParseException p) {\r
+ } catch (Exception e) {\r
+ logger.error("failed to transform markdown", e);\r
markdownText = MessageFormat.format("<div class=\"alert alert-error\"><strong>{0}:</strong> {1}</div>{2}", getString("gb.error"), getString("gb.markdownFailure"), markdownText);\r
htmlText = StringUtils.breakLinesForHtml(markdownText);\r
}\r
\r
public abstract class RepositoryPage extends RootPage {\r
\r
- private final Logger logger = LoggerFactory.getLogger(getClass());\r
+ protected final Logger logger = LoggerFactory.getLogger(getClass());\r
\r
private final String PARAM_STAR = "star";\r
\r
import java.awt.Color;\r
import java.awt.Dimension;\r
import java.text.MessageFormat;\r
-import java.text.ParseException;\r
import java.util.ArrayList;\r
import java.util.List;\r
\r
markdownText = JGitUtils.getStringContent(r, head.getTree(), readme, encodings);\r
htmlText = MarkdownUtils.transformMarkdown(markdownText);\r
}\r
- } catch (ParseException p) {\r
+ } catch (Exception e) {\r
+ logger.error("failed to transform markdown", e);\r
markdownText = MessageFormat.format("<div class=\"alert alert-error\"><strong>{0}:</strong> {1}</div>{2}", getString("gb.error"), getString("gb.markdownFailure"), markdownText);\r
htmlText = StringUtils.breakLinesForHtml(markdownText);\r
}\r
- [JGit][jgit] (EDL 1.0)\r
- [Wicket](http://wicket.apache.org) (Apache 2.0)\r
- [WicketStuff GoogleCharts](https://github.com/wicketstuff/core/wiki/GoogleCharts) (Apache 2.0)\r
-- [MarkdownPapers](http://markdown.tautua.org) (Apache 2.0)\r
- [Jetty](http://eclipse.org/jetty) (Apache 2.0, EPL 1.0)\r
- [SLF4J](http://www.slf4j.org) (MIT/X11)\r
- [Log4j](http://logging.apache.org/log4j) (Apache 2.0)\r
- [Guava](https://code.google.com/p/guava-libraries) (Apache 2.0)\r
- [libpam4j](https://github.com/kohsuke/libpam4j) (MIT)\r
- [commons-codec](http://commons.apache.org/proper/commons-codec) (Apache 2.0)\r
+- [pegdown](https://github.com/sirthias/pegdown) (Apache 2.0)\r
\r
### Other Build Dependencies\r
- [Fancybox image viewer](http://fancybox.net) (MIT and GPL dual-licensed)\r
package com.gitblit.tests;\r
\r
import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.text.ParseException;\r
\r
import org.junit.Test;\r
\r
\r
@Test\r
public void testMarkdown() throws Exception {\r
- assertEquals("<h1> H1</h1>", MarkdownUtils.transformMarkdown("# H1"));\r
- assertEquals("<h2> H2</h2>", MarkdownUtils.transformMarkdown("## H2"));\r
+ assertEquals("<h1>H1</h1>", MarkdownUtils.transformMarkdown("# H1"));\r
+ assertEquals("<h2>H2</h2>", MarkdownUtils.transformMarkdown("## H2"));\r
assertEquals("<p><strong>THIS</strong> is a test</p>",\r
MarkdownUtils.transformMarkdown("**THIS** is a test"));\r
assertEquals("<p>** THIS ** is a test</p>",\r
MarkdownUtils.transformMarkdown("<table><tr><td>test</td></tr></table>"));\r
assertEquals("<table><tr><td><test></td></tr></table>",\r
MarkdownUtils.transformMarkdown("<table><tr><td><test></td></tr></table>"));\r
-\r
- try {\r
- MarkdownUtils.transformMarkdown((String) null);\r
- assertTrue(false);\r
- } catch (ParseException p) {\r
- assertTrue(p != null);\r
- }\r
}\r
}
\ No newline at end of file