Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zwbetz-gh/cupper-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Betz <zwbetz@gmail.com>2019-02-26 19:16:01 +0300
committerZachary Betz <zwbetz@gmail.com>2019-02-26 19:16:01 +0300
commit35ccaa287e7749b646a2b7d4c9ea0bf1b04fa650 (patch)
tree62c1511bccc08ae68eadd241dea4d5754fe53f98
parent564570024365a6f66c9cb516e45893baeab8ca12 (diff)
Handle non-ascii chars in toc id
-rw-r--r--layouts/partials/toc.html6
1 files changed, 5 insertions, 1 deletions
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
index 39c3cb2..86ee3b6 100644
--- a/layouts/partials/toc.html
+++ b/layouts/partials/toc.html
@@ -5,7 +5,11 @@
<ol>
{{ range $headings }}
<li>
- <a href="#{{ . | htmlUnescape | plainify | urlize }}">
+ {{ $id := findRE "id=\".*\"" . }}
+ {{ $id = index $id 0 }}
+ {{ $id = strings.TrimPrefix "id=\"" $id }}
+ {{ $id = strings.TrimSuffix "\"" $id }}
+ <a href="#{{ $id }}">
{{ . | htmlUnescape | plainify }}
</a>
</li>