mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
Bump Markedj to 1.0.16 (#2292)
This commit is contained in:
@@ -41,7 +41,7 @@ libraryDependencies ++= Seq(
|
|||||||
"org.json4s" %% "json4s-jackson" % "3.5.2",
|
"org.json4s" %% "json4s-jackson" % "3.5.2",
|
||||||
"commons-io" % "commons-io" % "2.6",
|
"commons-io" % "commons-io" % "2.6",
|
||||||
"io.github.gitbucket" % "solidbase" % "1.0.3",
|
"io.github.gitbucket" % "solidbase" % "1.0.3",
|
||||||
"io.github.gitbucket" % "markedj" % "1.0.15",
|
"io.github.gitbucket" % "markedj" % "1.0.16",
|
||||||
"org.apache.commons" % "commons-compress" % "1.18",
|
"org.apache.commons" % "commons-compress" % "1.18",
|
||||||
"org.apache.commons" % "commons-email" % "1.5",
|
"org.apache.commons" % "commons-email" % "1.5",
|
||||||
"org.apache.httpcomponents" % "httpclient" % "4.5.6",
|
"org.apache.httpcomponents" % "httpclient" % "4.5.6",
|
||||||
|
|||||||
@@ -169,24 +169,33 @@ object Markdown {
|
|||||||
private def fixUrl(url: String, branch: String, isImage: Boolean = false): String = {
|
private def fixUrl(url: String, branch: String, isImage: Boolean = false): String = {
|
||||||
lazy val urlWithRawParam: String = url + (if (isImage && !url.endsWith("?raw=true")) "?raw=true" else "")
|
lazy val urlWithRawParam: String = url + (if (isImage && !url.endsWith("?raw=true")) "?raw=true" else "")
|
||||||
|
|
||||||
if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("mailto:") || url.startsWith("/")) {
|
if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("mailto:")) {
|
||||||
url
|
url
|
||||||
|
} else if (url.startsWith("/")) {
|
||||||
|
context.baseUrl + url
|
||||||
} else if (url.startsWith("#")) {
|
} else if (url.startsWith("#")) {
|
||||||
("#" + generateAnchorName(url.substring(1)))
|
("#" + generateAnchorName(url.substring(1)))
|
||||||
} else if (!enableWikiLink) {
|
} else {
|
||||||
|
// Relative path
|
||||||
|
if (!enableWikiLink) {
|
||||||
if (context.currentPath.contains("/blob/")) {
|
if (context.currentPath.contains("/blob/")) {
|
||||||
urlWithRawParam
|
val paths = context.currentPath.split("/").dropRight(1)
|
||||||
|
val path = if (paths.length > 3) paths.drop(4).mkString("/") else branch
|
||||||
|
repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/blob/" + path + "/" + urlWithRawParam
|
||||||
} else if (context.currentPath.contains("/tree/")) {
|
} else if (context.currentPath.contains("/tree/")) {
|
||||||
val paths = context.currentPath.split("/")
|
val paths = context.currentPath.split("/")
|
||||||
val path = if (paths.length > 3) paths.drop(4).mkString("/") else branch
|
val path = if (paths.length > 3) paths.drop(4).mkString("/") else branch
|
||||||
repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/blob/" + path + "/" + urlWithRawParam
|
repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/blob/" + path + "/" + urlWithRawParam
|
||||||
} else {
|
} else {
|
||||||
repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/blob/" + branch + "/" + urlWithRawParam
|
repository.httpUrl
|
||||||
|
.replaceFirst("/git/", "/")
|
||||||
|
.stripSuffix(".git") + "/blob/" + branch + "/" + urlWithRawParam
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/_blob/" + url
|
repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/_blob/" + url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,14 +218,18 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
|
|||||||
.replaceAll(
|
.replaceAll(
|
||||||
"\\[branch:([^\\s]+?)/([^\\s]+?)#([^\\s]+?)\\]",
|
"\\[branch:([^\\s]+?)/([^\\s]+?)#([^\\s]+?)\\]",
|
||||||
(m: Match) =>
|
(m: Match) =>
|
||||||
s"""<a href="${context.path}/${m.group(1)}/${m.group(2)}/tree/${encodeRefName(m.group(3))}">${m
|
s"""<a href="${context.path}/${m.group(1)}/${m.group(2)}/tree/${encodeRefName(m.group(3))}">${StringUtil
|
||||||
.group(3)}</a>"""
|
.escapeHtml(
|
||||||
|
m.group(3)
|
||||||
|
)}</a>"""
|
||||||
)
|
)
|
||||||
.replaceAll(
|
.replaceAll(
|
||||||
"\\[tag:([^\\s]+?)/([^\\s]+?)#([^\\s]+?)\\]",
|
"\\[tag:([^\\s]+?)/([^\\s]+?)#([^\\s]+?)\\]",
|
||||||
(m: Match) =>
|
(m: Match) =>
|
||||||
s"""<a href="${context.path}/${m.group(1)}/${m.group(2)}/tree/${encodeRefName(m.group(3))}">${m
|
s"""<a href="${context.path}/${m.group(1)}/${m.group(2)}/tree/${encodeRefName(m.group(3))}">${StringUtil
|
||||||
.group(3)}</a>"""
|
.escapeHtml(
|
||||||
|
m.group(3)
|
||||||
|
)}</a>"""
|
||||||
)
|
)
|
||||||
.replaceAll("\\[user:([^\\s]+?)\\]", (m: Match) => user(m.group(1)).body)
|
.replaceAll("\\[user:([^\\s]+?)\\]", (m: Match) => user(m.group(1)).body)
|
||||||
.replaceAll(
|
.replaceAll(
|
||||||
@@ -237,8 +241,10 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
|
|||||||
.replaceAll(
|
.replaceAll(
|
||||||
"\\[release:([^\\s]+?)/([^\\s]+?)/([^\\s]+?):(.+)\\]",
|
"\\[release:([^\\s]+?)/([^\\s]+?)/([^\\s]+?):(.+)\\]",
|
||||||
(m: Match) =>
|
(m: Match) =>
|
||||||
s"""<a href="${context.path}/${m.group(1)}/${m.group(2)}/releases/${encodeRefName(m.group(3))}">${m
|
s"""<a href="${context.path}/${m.group(1)}/${m.group(2)}/releases/${encodeRefName(m.group(3))}">${StringUtil
|
||||||
.group(4)}</a>"""
|
.escapeHtml(
|
||||||
|
m.group(4)
|
||||||
|
)}</a>"""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,14 @@
|
|||||||
@account.description.map { description =>
|
@account.description.map { description =>
|
||||||
<p style="color: #999">@description</p>
|
<p style="color: #999">@description</p>
|
||||||
}
|
}
|
||||||
@if(account.url.isDefined){
|
@account.url.map { url =>
|
||||||
<p style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
<p style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
||||||
<i class="octicon octicon-home"></i> <a href="@account.url">@account.url</a>
|
<i class="octicon octicon-home"></i>
|
||||||
|
@if(url.startsWith("http://") || url.startsWith("https://")){
|
||||||
|
<a href="@url">@url</a>
|
||||||
|
} else {
|
||||||
|
<span style="color: #999">@url</span>
|
||||||
|
}
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
@if(context.settings.showMailAddress){
|
@if(context.settings.showMailAddress){
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ tasks
|
|||||||
)(context)
|
)(context)
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
html == """<p><a href="CHANGELOG.md">ChangeLog</a></p>"""
|
html == """<p><a href="http://localhost:8080/user/repo/blob/master/sub/dir/CHANGELOG.md">ChangeLog</a></p>"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user