mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 05:55:51 +01:00
(refs #34)@xxxx in markdown as link.
This commit is contained in:
@@ -99,11 +99,14 @@ class GitBucketHtmlSerializer(
|
||||
}
|
||||
|
||||
override def visit(node: TextNode) {
|
||||
// convert commit id to link.
|
||||
val text = if(enableCommitLink) node.getText.replaceAll("(^|\\W)([0-9a-f]{40})(\\W|$)",
|
||||
s"""<a href="${context.path}/${repository.owner}/${repository.name}/commit/$$2">$$2</a>""")
|
||||
// convert commit id and username to link.
|
||||
val text = if(enableCommitLink) node.getText
|
||||
.replaceAll("(^|\\W)([0-9a-f]{40})(\\W|$)", s"""$$1<a href="${context.path}/${repository.owner}/${repository.name}/commit/$$2">$$2</a>$$3""")
|
||||
.replaceAll("(^|\\W)@([a-zA-Z0-9\\-_]+)(\\W|$)", s"""$$1<a href="${context.path}/$$2">@$$2</a>$$3""")
|
||||
else node.getText
|
||||
|
||||
println(text)
|
||||
|
||||
if (abbreviations.isEmpty) {
|
||||
printer.print(text)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user