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

github.com/wangchucheng/hugo-eureka.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Chucheng <me@wangchucheng.com>2021-03-27 20:06:07 +0300
committerWang Chucheng <me@wangchucheng.com>2021-03-27 20:06:07 +0300
commit4b0bb031102826fccf891a648f44713636f33dd0 (patch)
tree1b7b8575530d09fc632b7eb48ae0c298ea3c42b1 /layouts
parent4be09f66c077d885dc3e3f64e55d662d95168c11 (diff)
fix: make KaTeX options case sensitive
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/head.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 6df2990..24f81e9 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -99,6 +99,17 @@
{{- end }}
{{- end }}
+{{ define "partials/camelize" }}
+{{ $input := . }}
+{{ $regexp := "(-|_)([a-z])" }}
+{{ $matches := findRE $regexp $input }}
+{{ range $matches }}
+ {{ $input = $input | replaceRE . (upper .) }}
+{{ end }}
+{{ $input = $input | replaceRE "(-|_)" "" }}
+{{ return $input }}
+{{ end }}
+
{{- if and (eq .Site.Params.math.handler "katex") $enableMath }}
<link rel="stylesheet" href="{{ printf $assets.katex.css.url $assets.katex.version }}"
{{ with $assets.katex.css.sri }} integrity="{{ . }}" {{ end }} media="print"
@@ -118,6 +129,7 @@
],
{{- range $key, $value := .Site.Params.math.katex }}
{{- if and (ne $value nil) (ne $value "") }}
+ {{- $key = partial "partials/camelize" $key }}
{{- $key | safeJS -}}: {{- $value | safeJS }},
{{- end }}
{{- end }}