Revert "replace to work with Hugo before 0.48 #40"

This reverts commit 3510227568.

revert changes
This commit is contained in:
Huy Tran 2018-09-23 09:50:55 +10:00
parent 3b0d6601f5
commit 1bd94c5f7a
2 changed files with 11 additions and 11 deletions

View file

@ -1,19 +1,18 @@
{{ if .Site.Params.highlightjs }}
{{ if or (not (isset .Params "highlight")) (.Params.highlight) }}
{{ .Scratch.Set "hl_languages" (union (.Site.Params.highlightjslanguages) (.Params.highlightjslanguages)) }}
{{ $hl := newScratch }}
{{ $hl.Set "languages" (union (.Site.Params.highlightjslanguages) (.Params.highlightjslanguages)) }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
{{ with .Scratch.Get "hl_languages" }}
{{ with $hl.Get "languages" }}
{{ range . }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/{{.}}.min.js"></script>
{{ end }}
{{ end }}
<script type="text/javascript">
{{ with .Scratch.Get "hl_languages" }}
hljs.configure({languages: [{{(delimit . ", ")}}]});
{{ end }}
hljs.configure({languages: []});
hljs.initHighlightingOnLoad();
</script>
{{ .Scratch.Delete "hl_languages" }}
{{ $hl.Delete "languages" }}
{{ end }}
{{ end }}

View file

@ -1,7 +1,8 @@
{{ $fig := newScratch }}
{{ if .Get "caption" }}
{{ $.Scratch.Set "caption" (.Get "caption") }}
{{ $fig.Set "caption" (.Get "caption") }}
{{ else if .Get "alt" }}
{{ $.Scratch.Set "caption" (.Get "alt") }}
{{ $fig.Set "caption" (.Get "alt") }}
{{ end }}
<!-- resolve absolute image path -->
{{ $permalink := $.Page.Permalink }}
@ -28,10 +29,10 @@
/>
{{ if .Get "link"}}</a>{{ end }}
<!-- caption and attr-->
{{ if ($.Scratch.Get "caption") }}
{{ if ($fig.Get "caption") }}
<figcaption>
<span class="img--caption">
Figure {{ $.Page.Scratch.Get "fig" }}. {{ $.Scratch.Get "caption" | markdownify | plainify }}
Figure {{ $.Page.Scratch.Get "fig" }}. {{ $fig.Get "caption" | markdownify | plainify }}
{{ if .Get "attr" }}
[{{- with .Get "attrlink"}}<a href="{{ . }}">{{ end }}{{ .Get "attr" | markdownify }}{{ if .Get "attrlink"}}</a>{{ end -}}]
{{ end }}
@ -40,4 +41,4 @@
{{ end }}
</figure>
{{ .Page.Scratch.Add "fig" 1 }}
{{ $.Scratch.Delete "caption"}}
{{ $fig.Delete "caption"}}