Add shortcode demo

This commit is contained in:
mjang
2024-03-06 08:09:02 -08:00
parent e3c0fa7f17
commit 27e772f2eb
34 changed files with 898 additions and 0 deletions
@@ -0,0 +1,18 @@
{{ .Page.Store.Set "hasmhchem" true -}}
{{/* set default delimiters */ -}}
{{ $delimiter_left := "$$" -}}
{{ $delimiter_right := "$$" -}}
{{/* override delimiters if set in config file */ -}}
{{ with $.Page.Site.Params.katex.options.delimiters -}}
{{ range first 1 ( where . "display" true ) -}}
{{ $delimiter_left = index . "left" -}}
{{ $delimiter_right = index . "right" -}}
{{ end -}}
{{ end -}}
{{/* output of chemical formulae */}}
<div class="chem">{{ $delimiter_left -}}
{{ .Inner | safeHTML -}}
{{ $delimiter_right -}}</div>{{ "" -}}
@@ -0,0 +1,18 @@
{{ .Page.Store.Set "hasKaTeX" true -}}
{{/* set default delimiters */ -}}
{{ $delimiter_left := "$$" -}}
{{ $delimiter_right := "$$" -}}
{{/* override delimiters if set in config file */ -}}
{{ with $.Page.Site.Params.katex.options.delimiters -}}
{{ range first 1 ( where . "display" true ) -}}
{{ $delimiter_left = index . "left" -}}
{{ $delimiter_right = index . "right" -}}
{{ end -}}
{{ end -}}
{{/* output of equation */}}
<div class="math">{{ $delimiter_left -}}
{{ .Inner | safeHTML -}}
{{ $delimiter_right }}</div>{{ "" -}}
@@ -0,0 +1,5 @@
{{ .Page.Store.Set "hasmermaid" true -}}
<pre class="mermaid">
{{- .Inner -}}
</pre>
@@ -0,0 +1,8 @@
<h{{ .Level }} id="{{- .Anchor | safeURL -}}">
{{- .Text | safeHTML -}}
{{ template "_default/_markup/_td-heading-self-link.html" . -}}
</h{{ .Level }}>
{{- define "_default/_markup/_td-heading-self-link.html" -}}
<a class="td-heading-self-link" href="#{{ .Anchor | safeURL }}" aria-label="Heading self-link"></a>
{{- end -}}
@@ -0,0 +1,18 @@
<div class="td-content">
<h1>{{ .Title }}</h1>
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
<header class="article-meta">
{{ partial "taxonomy_terms_article_wrapper.html" . -}}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) -}}
{{ partial "reading-time.html" . -}}
{{ end -}}
</header>
{{ .Content }}
{{ partial "feedback.html" . -}}
{{ if (.Site.Params.DisqusShortname) -}}
<br />
{{- partial "disqus-comment.html" . -}}
{{ end -}}
{{ partial "page-meta-lastmod.html" . }}
</div>
{{/**/ -}}
@@ -0,0 +1,3 @@
{{ define "main" -}}
{{ .Content -}}
{{ end }}
@@ -0,0 +1,43 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ .Site.Title }} – {{ .Title }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ if not $.Section }}
{{ $sections := .Site.Params.rss_sections | default (slice "blog") }}
{{ .Scratch.Set "rss_pages" (first 50 (where $.Site.RegularPages "Type" "in" $sections )) }}
{{ else }}
{{ if $.Parent.IsHome }}
{{ .Scratch.Set "rss_pages" (first 50 (where $.Site.RegularPages "Type" $.Section )) }}
{{ else }}
{{ .Scratch.Set "rss_pages" (first 50 $.Pages) }}
{{ end }}
{{ end }}
{{ range (.Scratch.Get "rss_pages") }}
<item>
<title>{{ .Section | title }}: {{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>
{{ $img := (.Resources.ByType "image").GetMatch "*featured*" }}
{{ with $img }}
{{ $img := .Resize "640x" }}
{{ printf "<![CDATA[<img src=\"%s\" width=\"%d\" height=\"%d\"/>]]>" $img.Permalink $img.Width $img.Height | safeHTML }}
{{ end }}
{{ .Content | html }}
</description>
</item>
{{ end }}
</channel>
</rss>
@@ -0,0 +1,21 @@
{{ define "main" -}}
<section class="row td-search-result">
<div class="col-12 col-md-8 offset-md-2">
<h2 class="ms-4">{{ .Title }}</h2>
{{ with .Site.Params.gcs_engine_id -}}
<script>
(function() {
var cx = '{{ . }}';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:searchresults-only></gcse:searchresults-only>
{{ end -}}
</div>
</section>
{{ end }}
@@ -0,0 +1,3 @@
{{ define "main" -}}
{{ .Content -}}
{{ end }}
@@ -0,0 +1,32 @@
{{ define "main" }}
<div class="td-content">
<main class="taxonomy-taxonomy-page">
<h1>{{ with .Data.Singular }}{{ . | humanize }}: {{ end }}<span>{{ .Title }}</span></h1>
<div>
{{ .Content }}
</div>
<div>
{{ range .Pages }}
{{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }}
<article class="card article-teaser article-type-{{ with .Type }}{{ ( urlize . ) }}{{ end }}">
<h3><a href="{{ $manualLink }}"{{ with .Params.manualLinkTitle }} title="{{ . }}"{{ end }}{{ with .Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }}>{{- .Title -}}</a></h3>
{{ if not .Site.Params.ui.taxonomy_breadcrumb_disable -}}
{{/* Use breadcrumb partial, but remove attributes that are invalid or inappropriate in this page-summary context. */ -}}
{{ partial "breadcrumb.html" .
| replaceRE ` aria-\w+=\".*?\"|(breadcrumb-item) active` "$1" | safeHTML
-}}
{{ end -}}
<p>{{ .Description | markdownify }}</p>
<header class="article-meta">
{{ partial "taxonomy_terms_article_wrapper.html" . -}}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) -}}
{{ partial "reading-time.html" . -}}
{{ end -}}
</header>
</article>
{{ end }}
</div>
<a href="{{ with .Site.GetPage (printf "/%s" ( lower .Data.Plural )) }}{{ .Permalink }}{{ end }}" class="all-taxonomy-terms">{{ humanize ( T "ui_all" ) }} {{ with .Data.Plural }}{{ . | humanize }}{{ end }}</a>
</main>
</div>
{{ end }}
@@ -0,0 +1,8 @@
{{ define "main" -}}
<div class="td-content">
<main class="taxonomy-terms-page">
<h1>{{ .Title }}</h1>
{{ partial "taxonomy_terms_cloud.html" (dict "context" . "taxo" ( lower .Title ) ) -}}
</main>
</div>
{{- end }}