github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/shortcodes/math.html (about) 1 {{- $page := .page }} 2 {{- if and (not $page) .context }} 3 {{- $page = .context }} 4 {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'math' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }} 5 {{- end }} 6 {{- $content := .content }} 7 {{- $align := .align | default "center" }} 8 9 {{- /* separate shortcode attributes from rest */}} 10 {{- $attributes := .attributes | default dict }} 11 {{- $otherAttributes := dict }} 12 {{- range $k, $v := $attributes }} 13 {{- if eq $k "align" }} 14 {{- else }} 15 {{- $otherAttributes = (dict $k $v) | merge $otherAttributes }} 16 {{- end }} 17 {{- end }} 18 {{- $attributes = $otherAttributes }} 19 20 {{- /* enrich attributes */}} 21 {{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) "math" slice) " ")) }} 22 {{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) (printf "align-%s" $align) slice) " ")) }} 23 24 {{- with $page }} 25 <span 26 {{- range $k, $v := $attributes }} 27 {{- if $v }} 28 {{- printf " %s=%q" $k $v | safeHTMLAttr }} 29 {{- end }} 30 {{- end }}>{{ $content | safeHTML }}</span> 31 {{- .Store.Set "hasMathJax" true }} 32 {{- end }}