Skip to content

Commit 535e283

Browse files
authored
Simpler http(s) regex for GsSimpleMarkdownParser (PR gsantner#2606)
1 parent 7e7086b commit 535e283

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/net/gsantner/opoc/format/GsSimpleMarkdownParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public String filter(String text) {
6161
.replaceAll("(?m)^# (.*)$", "<br/><big><big><big><b><font color='#000000'>$1</font></b></big></big></big><br/><br/>") // h1 (DEP: h2,h3)
6262
.replaceAll("!\\[(.*?)\\]\\((.*?)\\)", "<a href=\\'$2\\'>$1</a>") // img
6363
.replaceAll("\\[(.*?)\\]\\((.*?)\\)", "<a href=\\'$2\\'>$1</a>") // a href (DEP: img)
64-
.replaceAll("<(http|https):\\/\\/(.*)>", "<a href='$1://$2'>$1://$2</a>") // a href (DEP: img)
64+
.replaceAll("<http(s?):\\/\\/(.*)>", "<a href='http$1://$2'>$1://$2</a>") // a href (DEP: img)
6565
.replaceAll("(?m)^([-*] )(.*)$", "<font color='#000001'>&#8226;</font> $2<br/>") // unordered list + end line
6666
.replaceAll("(?m)^ (-|\\*) ([^<]*)$", "&nbsp;&nbsp;<font color='#000001'>&#8226;</font> $2<br/>") // unordered list2 + end line
6767
.replaceAll("`([^<]*)`", "<font face='monospace'>$1</font>") // code
@@ -90,7 +90,7 @@ public String filter(String text) {
9090
.replaceAll("(?m)^## (.*)$", "<h2>$1</h2>") /// h2 (DEP: h3)
9191
.replaceAll("(?m)^# (.*)$", "<h1>$1</h1>") // h1 (DEP: h2,h3)
9292
.replaceAll("!\\[(.*?)\\]\\((.*?)\\)", "<img src=\\'$2\\' alt='$1' />") // img
93-
.replaceAll("<(http|https):\\/\\/(.*)>", "<a href='$1://$2'>$1://$2</a>") // a href (DEP: img)
93+
.replaceAll("<http(s?):\\/\\/(.*)>", "<a href='http$1://$2'>$1://$2</a>") // a href (DEP: img)
9494
.replaceAll("\\[(.*?)\\]\\((.*?)\\)", "<a href=\\'$2\\'>$1</a>") // a href (DEP: img)
9595
.replaceAll("(?m)^[-*] (.*)$", "<font color='#000001'>&#8226;</font> $1 ") // unordered list + end line
9696
.replaceAll("(?m)^ [-*] (.*)$", "&nbsp;&nbsp;<font color='#000001'>&#8226;</font> $1 ") // unordered list2 + end line

0 commit comments

Comments
 (0)