diff options
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r-- | layouts/shortcodes/admonition.html | 30 | ||||
-rw-r--r-- | layouts/shortcodes/ads.html | 16 | ||||
-rw-r--r-- | layouts/shortcodes/block-media-left.html | 3 | ||||
-rw-r--r-- | layouts/shortcodes/series.html | 11 | ||||
-rw-r--r-- | layouts/shortcodes/typeit.html | 31 |
5 files changed, 44 insertions, 47 deletions
diff --git a/layouts/shortcodes/admonition.html b/layouts/shortcodes/admonition.html index 7cef754..0fafb19 100644 --- a/layouts/shortcodes/admonition.html +++ b/layouts/shortcodes/admonition.html @@ -1,29 +1,27 @@ {{- $inner := .Inner | .Page.RenderString -}} -{{- $iconMap := dict "note" "fas fa-pencil-alt fa-fw" -}} -{{- $iconMap = dict "abstract" "fas fa-list-ul fa-fw" | merge $iconMap -}} -{{- $iconMap = dict "info" "fas fa-info-circle fa-fw" | merge $iconMap -}} -{{- $iconMap = dict "tip" "fas fa-lightbulb fa-fw" | merge $iconMap -}} -{{- $iconMap = dict "success" "fas fa-check-circle fa-fw" | merge $iconMap -}} -{{- $iconMap = dict "question" "fas fa-question-circle fa-fw" | merge $iconMap -}} -{{- $iconMap = dict "warning" "fas fa-exclamation-triangle fa-fw" | merge $iconMap -}} -{{- $iconMap = dict "failure" "fas fa-times-circle fa-fw" | merge $iconMap -}} -{{- $iconMap = dict "danger" "fas fa-skull-crossbones fa-fw" | merge $iconMap -}} -{{- $iconMap = dict "bug" "fas fa-bug fa-fw" | merge $iconMap -}} -{{- $iconMap = dict "example" "fas fa-list-ol fa-fw" | merge $iconMap -}} -{{- $iconMap = dict "quote" "fas fa-quote-right fa-fw" | merge $iconMap -}} -{{- $iconDetails := "fas fa-angle-right fa-fw" -}} +{{- $iconMap := dict "note" "admonition-icon icon-note" -}} +{{- $iconMap = dict "abstract" "admonition-icon icon-abstract" | merge $iconMap -}} +{{- $iconMap = dict "info" "admonition-icon icon-info" | merge $iconMap -}} +{{- $iconMap = dict "tip" "admonition-icon icon-tip" | merge $iconMap -}} +{{- $iconMap = dict "success" "admonition-icon icon-success" | merge $iconMap -}} +{{- $iconMap = dict "question" "admonition-icon icon-question" | merge $iconMap -}} +{{- $iconMap = dict "warning" "admonition-icon icon-warning" | merge $iconMap -}} +{{- $iconMap = dict "failure" "admonition-icon icon-failure" | merge $iconMap -}} +{{- $iconMap = dict "danger" "admonition-icon icon-danger" | merge $iconMap -}} +{{- $iconMap = dict "bug" "admonition-icon icon-bug" | merge $iconMap -}} +{{- $iconMap = dict "example" "admonition-icon icon-example" | merge $iconMap -}} +{{- $iconMap = dict "quote" "admonition-icon icon-quote" | merge $iconMap -}} +{{- $iconDetails := "admonition-icon admonition-icon-arrow-right" -}} {{- if .IsNamedParams -}} {{- $type := .Get "type" | default "note" -}} <div class="details admonition {{ $type }}{{ if .Get `open` | ne false }} open{{ end }}"> - - <div class="details-summary admonition-title" {{- if not (.Get "title") -}}style="display:none"{{- end -}}> + <div class="details-summary admonition-title {{ if not (.Get `title`) }}admonition-title-none{{ end }}"> {{- with (.Get "title") -}} <i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ . | default (T $type) }}<i class="details-icon {{ $iconDetails }}"></i> {{- end -}} </div> - <div class="details-content"> <div class="admonition-content"> {{- $inner -}} diff --git a/layouts/shortcodes/ads.html b/layouts/shortcodes/ads.html new file mode 100644 index 0000000..713ff02 --- /dev/null +++ b/layouts/shortcodes/ads.html @@ -0,0 +1,16 @@ +{{ with cond $.IsNamedParams ($.Get "slot") "" | default $.Site.Params.Advertising.Google.Slot }} +<div class="{{ if $.Get `circuit` | ne false }}cat-cit{{ end }}"> + <div class="no-adb"> + <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> + <ins class="adsbygoogle" + style="display:block; text-align:center;" + data-ad-layout="in-article" + data-ad-format="fluid" + data-ad-client="{{- with $.Site.Params.Advertising.Google.Client -}}{{ . }}{{ end }}" + data-ad-slot="{{ . }}"></ins> + <script> + (adsbygoogle = window.adsbygoogle || []).push({}); + </script> + </div> +</div> +{{ end }}
\ No newline at end of file diff --git a/layouts/shortcodes/block-media-left.html b/layouts/shortcodes/block-media-left.html new file mode 100644 index 0000000..89c307d --- /dev/null +++ b/layouts/shortcodes/block-media-left.html @@ -0,0 +1,3 @@ +<div class="block-media block-media_left"> + {{ .Inner | $.Page.RenderString }} +</div>
\ No newline at end of file diff --git a/layouts/shortcodes/series.html b/layouts/shortcodes/series.html new file mode 100644 index 0000000..dea5141 --- /dev/null +++ b/layouts/shortcodes/series.html @@ -0,0 +1,11 @@ +{{ $series_name := .Get 0 | urlize }} + +{{ range $key, $taxonomy := .Site.Taxonomies.series }} +{{ if eq $key $series_name }} +<ul> + {{ range $taxonomy.Pages.ByDate }} + <li hugo-nav="{{ .RelPermalink }}"><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li> + {{ end }} +</ul> +{{ end }} +{{ end }}
\ No newline at end of file diff --git a/layouts/shortcodes/typeit.html b/layouts/shortcodes/typeit.html deleted file mode 100644 index 1d2ea01..0000000 --- a/layouts/shortcodes/typeit.html +++ /dev/null @@ -1,31 +0,0 @@ -{{- $content := trim .Inner "\n" -}} -{{- $classList := .Get "class" | slice -}} -{{- $tag := .Get "tag" | default "div" -}} - -{{- with .Get "code" -}} - {{- /* highlight code content without line number */ -}} - {{- $content = highlight $content . "linenos=false" -}} - {{- /* delete outer label */ -}} - {{- $content = replaceRE `<div class="highlight"><pre class="chroma"><code[^<>]*>(?s)(.*)</code></pre></div>` "$1" $content -}} - {{- /* parsing markdown links */ -}} - {{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=$4>$3</a>$1$5$6" $content -}} - {{- /* replace " " to " " and replace "\n" to "<br />" */ -}} - {{- $content = replaceRE ` ` " " $content | replaceRE `(<\w+) ` "$1 " | replaceRE `\n` "<br />" -}} - {{- /* fix "<br />" location error which is a bug of Typeit HTML parser */ -}} - {{- $content = replaceRE `<br /></span>` "</span><br />" $content -}} - {{- $classList = $classList | append "highlight" -}} -{{- else -}} - {{- $content = $content | .Page.RenderString -}} -{{- end -}} - -{{- /* trim the newline */ -}} -{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}} -{{- $key := .Get "group" | string | default $id -}} -{{- $typeitMap := (.Page.Scratch.Get "this").typeitMap | default dict -}} -{{- $group := index $typeitMap $key -}} -{{- $group = $group | default slice | append $id -}} -{{- dict $key $group | merge $typeitMap | .Page.Scratch.SetInMap "this" "typeitMap" -}} - -<div class="typeit"> - {{- printf `<%v id="%v" class="%v"></%v>` $tag $id (delimit $classList " ") $tag | safeHTML -}} -</div> |