diff options
Diffstat (limited to 'themes/CodeIT/layouts/shortcodes')
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/admonition.html | 41 | ||||
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/bilibili.html | 7 | ||||
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/echarts.html | 6 | ||||
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/image.html | 29 | ||||
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/link.html | 15 | ||||
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/mapbox.html | 38 | ||||
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/mermaid.html | 3 | ||||
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/music.html | 50 | ||||
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/script.html | 2 | ||||
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/style.html | 8 | ||||
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/typeit.html | 31 | ||||
-rw-r--r-- | themes/CodeIT/layouts/shortcodes/version.html | 13 |
12 files changed, 0 insertions, 243 deletions
diff --git a/themes/CodeIT/layouts/shortcodes/admonition.html b/themes/CodeIT/layouts/shortcodes/admonition.html deleted file mode 100644 index bfe1452..0000000 --- a/themes/CodeIT/layouts/shortcodes/admonition.html +++ /dev/null @@ -1,41 +0,0 @@ -{{- $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" -}} - -{{- 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"> - <i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get "title" | default (T $type) }}<i class="details-icon {{ $iconDetails }}"></i> - </div> - <div class="details-content"> - <div class="admonition-content"> - {{- $inner -}} - </div> - </div> - </div> -{{- else -}} - {{- $type := .Get 0 | default "note" -}} - <div class="details admonition {{ $type }}{{ if .Get 2 | ne false }} open{{ end }}"> - <div class="details-summary admonition-title"> - <i class="icon {{ index $iconMap $type | default (index $iconMap "note") }}"></i>{{ .Get 1 | default (T $type) }}<i class="details-icon {{ $iconDetails }}"></i> - </div> - <div class="details-content"> - <div class="admonition-content"> - {{- $inner -}} - </div> - </div> - </div> -{{- end -}} diff --git a/themes/CodeIT/layouts/shortcodes/bilibili.html b/themes/CodeIT/layouts/shortcodes/bilibili.html deleted file mode 100644 index c14cdc9..0000000 --- a/themes/CodeIT/layouts/shortcodes/bilibili.html +++ /dev/null @@ -1,7 +0,0 @@ -<div class="bilibili"> - {{- if .IsNamedParams -}} - <iframe src="//player.bilibili.com/player.html?bvid={{ .Get `id` }}&page={{ .Get `p` | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe> - {{- else -}} - <iframe src="//player.bilibili.com/player.html?bvid={{ .Get 0 }}&page={{ .Get 1 | default 1 }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe> - {{- end -}} -</div> diff --git a/themes/CodeIT/layouts/shortcodes/echarts.html b/themes/CodeIT/layouts/shortcodes/echarts.html deleted file mode 100644 index f13be36..0000000 --- a/themes/CodeIT/layouts/shortcodes/echarts.html +++ /dev/null @@ -1,6 +0,0 @@ -{{- $content := .Inner | transform.Unmarshal | jsonify -}} -{{- $id := dict "Content" $content "Scratch" .Page.Scratch | partial "function/id.html" -}} -{{- $width := cond .IsNamedParams (.Get "width") (.Get 0) | default "100%" -}} -{{- $height := cond .IsNamedParams (.Get "height") (.Get 1) | default "30rem" -}} -<div class="echarts" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div> -{{- .Page.Scratch.SetInMap "this" "echarts" true -}} diff --git a/themes/CodeIT/layouts/shortcodes/image.html b/themes/CodeIT/layouts/shortcodes/image.html deleted file mode 100644 index 4bb365a..0000000 --- a/themes/CodeIT/layouts/shortcodes/image.html +++ /dev/null @@ -1,29 +0,0 @@ -{{- $options := cond .IsNamedParams (.Get "src") (.Get 0) | dict "Src" -}} -{{- $options = cond .IsNamedParams (.Get "alt") (.Get 1) | .Page.RenderString | dict "Alt" | merge $options -}} -{{- $caption := cond .IsNamedParams (.Get "caption") (.Get 2) | .Page.RenderString -}} -{{- $options = dict "Caption" $caption | merge $options -}} - -{{- if .IsNamedParams -}} - {{- $options = dict "Title" (.Get "title") | merge $options -}} - {{- $options = dict "SrcSmall" (.Get "src_s") | merge $options -}} - {{- $options = dict "SrcLarge" (.Get "src_l") | merge $options -}} - {{- $options = dict "Height" (.Get "height") | merge $options -}} - {{- $options = dict "Width" (.Get "width") | merge $options -}} - {{- $options = .Get "linked" | ne false | dict "Linked" | merge $options -}} - {{- $options = dict "Rel" (.Get "rel") | merge $options -}} -{{- else -}} - {{- $options = cond $caption true false | dict "Linked" | merge $options -}} -{{- end -}} - -{{- $options = dict "Resources" .Page.Resources | merge $options -}} - -{{- with $caption -}} - <figure{{ with cond $.IsNamedParams ($.Get "class") "" }} class="{{ . }}"{{ end }}> - {{- partial "plugin/image.html" $options -}} - <figcaption class="image-caption"> - {{- . | safeHTML -}} - </figcaption> - </figure> -{{- else -}} - {{- partial "plugin/image.html" $options -}} -{{- end -}} diff --git a/themes/CodeIT/layouts/shortcodes/link.html b/themes/CodeIT/layouts/shortcodes/link.html deleted file mode 100644 index cac09e9..0000000 --- a/themes/CodeIT/layouts/shortcodes/link.html +++ /dev/null @@ -1,15 +0,0 @@ -{{- $destination := cond .IsNamedParams (.Get "href") (.Get 0) -}} -{{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}} - {{- $destination = .RelPermalink -}} -{{- end -}} -{{- $options := dict "Destination" $destination -}} -{{- if .IsNamedParams -}} - {{- $options = dict "Content" (.Get "content") | merge $options -}} - {{- $options = dict "Title" (.Get "title") | merge $options -}} - {{- $options = dict "Class" (.Get "class") | merge $options -}} - {{- $options = dict "Rel" (.Get "rel") | merge $options -}} -{{- else -}} - {{- $options = dict "Content" (.Get 1 | default (.Get 0)) | merge $options -}} - {{- $options = dict "Title" (.Get 2) | merge $options -}} -{{- end -}} -{{- partial "plugin/link.html" $options -}} diff --git a/themes/CodeIT/layouts/shortcodes/mapbox.html b/themes/CodeIT/layouts/shortcodes/mapbox.html deleted file mode 100644 index 5ae9d76..0000000 --- a/themes/CodeIT/layouts/shortcodes/mapbox.html +++ /dev/null @@ -1,38 +0,0 @@ -{{- $mapbox := (.Page.Scratch.Get "params").mapbox | default dict -}} - -{{- $lng := cond .IsNamedParams (.Get "lng") (.Get 0) -}} -{{- $lat := cond .IsNamedParams (.Get "lat") (.Get 1) -}} -{{- $zoom := cond .IsNamedParams (.Get "zoom") (.Get 2) | default 10 -}} -{{- $marked := cond .IsNamedParams (.Get "marked") (.Get 3) | ne false -}} -{{- $lightStyle := $mapbox.lightStyle -}} -{{- $darkStyle := $mapbox.darkStyle -}} -{{- $navigation := $mapbox.navigation -}} -{{- $geolocate := $mapbox.geolocate -}} -{{- $scale := $mapbox.scale -}} -{{- $fullscreen := $mapbox.fullscreen -}} -{{- $width := "100%" -}} -{{- $height := "20rem" -}} -{{- $properties := "" -}} - -{{- if .IsNamedParams -}} - {{- $lightStyle = .Get "light-style" | default $lightStyle -}} - {{- $darkStyle = .Get "dark-style" | default $darkStyle -}} - {{- $navigation = .Get "navigation" | ne false | and $navigation -}} - {{- $geolocate = .Get "geolocate" | ne false | and $geolocate -}} - {{- $scale = .Get "scale" | ne false | and $scale -}} - {{- $fullscreen = .Get "fullscreen" | ne false | and $fullscreen -}} - {{- $width = .Get "width" | default $width -}} - {{- $height = .Get "height" | default $height -}} - {{- $properties = .Get "properties" | default "" -}} -{{- else -}} - {{- $lightStyle = .Get 4 | default $lightStyle -}} - {{- $darkStyle = .Get 5 | default $darkStyle -}} -{{- end -}} - -{{- $optionsJson := getJSON $properties -}} - -{{- $darkStyle = $darkStyle | default $lightStyle -}} -{{- $options := dict "lng" $lng "lat" $lat "zoom" $zoom "marked" $marked "lightStyle" $lightStyle "darkStyle" $darkStyle "geolocate" $geolocate "navigation" $navigation "scale" $scale "fullscreen" $fullscreen "optionsJson" $optionsJson -}} -{{- $id := dict "Content" $options "Scratch" .Page.Scratch | partial "function/id.html" -}} -<div class="mapbox" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div> -{{- .Page.Scratch.SetInMap "this" "mapbox" true -}} diff --git a/themes/CodeIT/layouts/shortcodes/mermaid.html b/themes/CodeIT/layouts/shortcodes/mermaid.html deleted file mode 100644 index e96ead7..0000000 --- a/themes/CodeIT/layouts/shortcodes/mermaid.html +++ /dev/null @@ -1,3 +0,0 @@ -{{- $id := dict "Content" (trim .Inner "\n") "Scratch" .Page.Scratch | partial "function/id.html" -}} -<div class="mermaid" id="{{ $id }}"></div> -{{- .Page.Scratch.SetInMap "this" "mermaid" true -}} diff --git a/themes/CodeIT/layouts/shortcodes/music.html b/themes/CodeIT/layouts/shortcodes/music.html deleted file mode 100644 index 904ad5b..0000000 --- a/themes/CodeIT/layouts/shortcodes/music.html +++ /dev/null @@ -1,50 +0,0 @@ -{{- $theme := "#448aff" -}} -{{- if .IsNamedParams -}} - {{- $theme = .Get "theme" | default $theme -}} - {{- if .Get "url" -}} - {{- $url := .Get "url" -}} - {{- with dict "Path" $url "Resources" .Page.Resources | partial "function/resource.html" -}} - {{- $url = .RelPermalink -}} - {{- end -}} - {{- $cover := .Get "cover" -}} - {{- with dict "Path" $cover "Resources" .Page.Resources | partial "function/resource.html" -}} - {{- $cover = .RelPermalink -}} - {{- end -}} - <meting-js url="{{ $url }}" name="{{ .Get `name` }}" artist="{{ .Get `artist` }}" cover="{{ $cover }}" theme="{{ $theme }}" - {{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}} - {{- with .Get "mini" }} mini="{{ . }}"{{ end -}} - {{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}} - {{- with .Get "volume" }} volume="{{ . }}"{{ end -}} - {{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}} - ></meting-js> - {{- else if .Get "auto" -}} - <meting-js auto="{{ .Get `auto` }}" theme="{{ $theme }}" - {{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}} - {{- with .Get "mini" }} mini="{{ . }}"{{ end -}} - {{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}} - {{- with .Get "loop" }} loop="{{ . }}"{{ end -}} - {{- with .Get "order" }} order="{{ . }}"{{ end -}} - {{- with .Get "volume" }} volume="{{ . }}"{{ end -}} - {{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}} - {{- with .Get "list-folded" }} list-folded="{{ . }}"{{ end -}} - {{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}} - ></meting-js> - {{- else -}} - <meting-js server="{{ .Get `server` }}" type="{{ .Get `type` }}" id="{{ .Get `id` }}" theme="{{ $theme }}" - {{- with .Get "fixed" }} fixed="{{ . }}"{{ end -}} - {{- with .Get "mini" }} mini="{{ . }}"{{ end -}} - {{- with .Get "autoplay" }} autoplay="{{ . }}"{{ end -}} - {{- with .Get "loop" }} loop="{{ . }}"{{ end -}} - {{- with .Get "order" }} order="{{ . }}"{{ end -}} - {{- with .Get "volume" }} volume="{{ . }}"{{ end -}} - {{- with .Get "mutex" }} mutex="{{ . }}"{{ end -}} - {{- with .Get "list-folded" }} list-folded="{{ . }}"{{ end -}} - {{- with .Get "list-max-height" }} list-max-height="{{ . }}"{{ end -}} - ></meting-js> - {{- end -}} -{{- else if (.Get 0 | urls.Parse).Host -}} - <meting-js auto="{{ .Get 0 }}" theme="{{ $theme }}"></meting-js> -{{- else -}} - <meting-js server="{{ .Get 0 }}" type="{{ .Get 1 }}" id="{{ .Get 2 }}" theme="{{ $theme }}"></meting-js> -{{- end -}} -{{- .Page.Scratch.SetInMap "this" "music" true -}} diff --git a/themes/CodeIT/layouts/shortcodes/script.html b/themes/CodeIT/layouts/shortcodes/script.html deleted file mode 100644 index 278232d..0000000 --- a/themes/CodeIT/layouts/shortcodes/script.html +++ /dev/null @@ -1,2 +0,0 @@ -{{- $scriptArr := (.Page.Scratch.Get "this").scriptArr | default slice -}} -{{- $scriptArr | append (trim .Inner "\n") | .Page.Scratch.SetInMap "this" "scriptArr" -}} diff --git a/themes/CodeIT/layouts/shortcodes/style.html b/themes/CodeIT/layouts/shortcodes/style.html deleted file mode 100644 index 8e03596..0000000 --- a/themes/CodeIT/layouts/shortcodes/style.html +++ /dev/null @@ -1,8 +0,0 @@ -{{- $content := .Inner | .Page.RenderString -}} -{{- $id := dict "Scratch" .Page.Scratch | partial "function/id.html" -}} -{{- $tag := .Get 1 | default "div" -}} -{{- printf `<%v id="%v">%v</%v>` $tag $id $content $tag | safeHTML -}} - -{{- $style := .Get 0 | printf "#%v{%v}" $id -}} -{{- $styleArr := (.Page.Scratch.Get "this").styleArr | default slice -}} -{{- $styleArr | append $style | .Page.Scratch.SetInMap "this" "styleArr" -}} diff --git a/themes/CodeIT/layouts/shortcodes/typeit.html b/themes/CodeIT/layouts/shortcodes/typeit.html deleted file mode 100644 index 1d2ea01..0000000 --- a/themes/CodeIT/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> diff --git a/themes/CodeIT/layouts/shortcodes/version.html b/themes/CodeIT/layouts/shortcodes/version.html deleted file mode 100644 index 186f275..0000000 --- a/themes/CodeIT/layouts/shortcodes/version.html +++ /dev/null @@ -1,13 +0,0 @@ -{{- $version := .Get 0 -}} -{{- $url := printf "https://github.com/sunt-programator/CodeIT/releases/tag/v%v" $version -}} -{{- $type := .Get 1 | default "new" | lower -}} -{{- $label := T $type -}} -{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}} -{{- $pathTemplate := cond .Site.IsMultiLingual (printf "svg/version/%%v-%%v.%v.svg" .Page.Language.Lang) "svg/version/%v-%v.svg" -}} -{{- $path := printf $pathTemplate $version $type -}} -{{- $resource := resources.Get "svg/version.template.svg" -}} -{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}} -{{- $alt := printf "CodeIT %v | %v" $label $version -}} -<a href="{{ $url }}" rel="noopener noreferrer" target="_blank"> - {{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}} -</a>
\ No newline at end of file |