Skip to content

Commit

Permalink
Merge pull request support-project#13 from support-project/develop
Browse files Browse the repository at this point in the history
Release v1.5.0
  • Loading branch information
koda-masaru authored Aug 5, 2016
2 parents 7607b78 + 8d6c901 commit 1a5a46f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.support-project</groupId>
<artifactId>markedj</artifactId>
<packaging>jar</packaging>
<version>1.4.0</version>
<version>1.5.0</version>
<name>markedj</name>
<url>https://github.com/gitbucket/markedj</url>
<description>Fork from gitbucket markedj because knowledge's issue. markedj is JVM port of graceful markdown processor marked.js</description>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/gitbucket/markedj/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static String escape(String html, boolean encode){
if(!encode){
html = html.replaceAll("&(?!#?\\w+;)", "&amp;");
} else {
html = html.replace("&", "&amp");
html = html.replace("&", "&amp;");
}
return html.replace("<", "&lt;").replace(">", "&gt;").replace("\"", "&quot;").replace("'", "&#39;");
}
Expand Down
47 changes: 47 additions & 0 deletions src/test/java/io/github/gitbucket/markedj/ExtendParseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,53 @@ public void testLinkTarget() throws Exception {
assertEquals(expect, result);
}




@Test
public void testUNC() throws Exception {
Options options = new Options();
options.setBreaks(true);
options.setLinkTargetBlank(true);
String md = "[UNCPathLink](¥¥hoge¥data \"UNCPathLink\")";
String result = Marked.marked(md, options);
String expect = "<p><a href=\"¥¥hoge¥data\" title=\"UNCPathLink\">UNCPathLink</a></p>\n";
assertEquals(expect, result);
}

@Test
public void testFile() throws Exception {
Options options = new Options();
options.setBreaks(true);
options.setLinkTargetBlank(true);
String md = "[UNCPathLink](file://hoge/data \"UNCPathLink\")";
String result = Marked.marked(md, options);
String expect = "<p><a href=\"file://hoge/data\" title=\"UNCPathLink\">UNCPathLink</a></p>\n";
assertEquals(expect, result);
}


@Test
public void testSmb() throws Exception {
Options options = new Options();
options.setBreaks(true);
options.setLinkTargetBlank(true);
String md = "[UNCPathLink](smb://hoge/data \"UNCPathLink\")";
String result = Marked.marked(md, options);
String expect = "<p><a href=\"smb://hoge/data\" title=\"UNCPathLink\">UNCPathLink</a></p>\n";
assertEquals(expect, result);
}


@Test
public void testAmp() {
String markdown = "```\n&read_data\n```";
String result = Marked.marked(markdown);
String check = "<pre><code>&amp;read_data\n</code></pre>\n";
org.junit.Assert.assertEquals(check, result);
}


private String loadResourceAsString(String path) throws IOException {
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
try {
Expand Down

0 comments on commit 1a5a46f

Please sign in to comment.