(refs #231)Fix anchor icon style and apply URL encoding to non-ascii chars in anchor name.

This commit is contained in:
takezoe
2014-02-19 03:40:39 +09:00
parent 78073babe4
commit 8536824d7e
2 changed files with 5 additions and 4 deletions

View File

@@ -143,12 +143,10 @@ object GitBucketHtmlSerializer {
private val Whitespace = "[\\s]".r
private val SpecialChars = "[^\\w-]".r
def generateAnchorName(text: String): String = {
val noWhitespace = Whitespace.replaceAllIn(text, "-")
val normalized = Normalizer.normalize(noWhitespace, Normalizer.Form.NFD)
val noSpecialChars = SpecialChars.replaceAllIn(normalized, "")
val noSpecialChars = StringUtil.urlEncode(normalized)
noSpecialChars.toLowerCase(Locale.ENGLISH)
}
}

View File

@@ -857,7 +857,6 @@ div.markdown-body table colgroup + tbody tr:first-child td:last-child {
a.markdown-anchor-link {
position: absolute;
top: 16px;
left: -20px;
width: 32px;
height: 16px;
@@ -865,3 +864,7 @@ a.markdown-anchor-link {
background-repeat: no-repeat;
display: none;
}
h1 a.markdown-anchor-link, h2 a.markdown-anchor-link, h3 a.markdown-anchor-link {
top: 10px;
}