diff options
author | Joel-Liang <liangyuzhou@gmail.com> | 2016-12-27 11:37:20 +0800 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2016-12-26 22:37:20 -0500 |
commit | d674cb7f20e62f7f1c68465768b3fc7784008897 (patch) | |
tree | 91db264a174eac8b92c11c070826b347dfa44a0d | |
parent | 114c179e5a50e3313f7a5894100693805e64e440 (diff) |
Fix wrong anchors for non-latin headings (#3981)
Change Javascript regular expression to match non-latin characters
The regex comes from here: http://stackoverflow.com/questions/150033/regular-expression-to-match-non-english-characters#comment22322603_150078
And this patch should fixed these two issues: #3919 #3843
-rw-r--r-- | public/js/gogs.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js index d7fca174..6aadea59 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -1347,7 +1347,7 @@ $(document).ready(function () { var headers = {}; $(this).find('h1, h2, h3, h4, h5, h6').each(function () { var node = $(this); - var val = encodeURIComponent(node.text().toLowerCase().replace(/[^\w\- ]/g, '').replace(/[ ]/g, '-')); + var val = encodeURIComponent(node.text().toLowerCase().replace(/[^\u00C0-\u1FFF\u2C00-\uD7FF\w\- ]/g, '').replace(/[ ]/g, '-')); var name = val; if (headers[val] > 0) { name = val + '-' + headers[val]; |