summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorFlorian Zschocke <f.zschocke+git@gmail.com>2020-11-16 21:10:24 +0100
committerFlorian Zschocke <f.zschocke+git@gmail.com>2020-11-16 21:39:41 +0100
commitb23269acc0f460f583311c679d751925b8402563 (patch)
treef92325e9890a20cae1c3b29e7ae1481a85378444 /src/main
parent2c822678597ff3d4c10a4a340fd86ea94f009c7e (diff)
downloadgitblit-b23269acc0f460f583311c679d751925b8402563.tar.gz
gitblit-b23269acc0f460f583311c679d751925b8402563.zip
fix: Also parse exp links in MD pages
Add a link parser also for `ExpLinks` because we need to escape paths to files in subfolders. This closes #1358
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/gitblit/wicket/MarkupProcessor.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/wicket/MarkupProcessor.java b/src/main/java/com/gitblit/wicket/MarkupProcessor.java
index b2032049..7facc59e 100644
--- a/src/main/java/com/gitblit/wicket/MarkupProcessor.java
+++ b/src/main/java/com/gitblit/wicket/MarkupProcessor.java
@@ -47,6 +47,7 @@ import org.pegdown.LinkRenderer;
import org.pegdown.ToHtmlSerializer;
import org.pegdown.VerbatimSerializer;
import org.pegdown.ast.ExpImageNode;
+import org.pegdown.ast.ExpLinkNode;
import org.pegdown.ast.RefImageNode;
import org.pegdown.ast.WikiLinkNode;
import org.pegdown.plugins.ToHtmlSerializerPlugin;
@@ -356,6 +357,13 @@ public class MarkupProcessor {
String url = getWicketUrl(DocPage.class, repositoryName, commitId, path);
return new Rendering(url, name);
}
+
+ @Override
+ public Rendering render(ExpLinkNode node, String text) {
+ String path = doc.getRelativePath(node.url);
+ String url = getWicketUrl(DocPage.class, repositoryName, commitId, path);
+ return new Rendering(url, text);
+ }
};
final String content = MarkdownUtils.transformMarkdown(doc.markup, renderer);