redesign 2023
This commit is contained in:
9
themes/FixIt/layouts/partials/function/checkbox.html
Normal file
9
themes/FixIt/layouts/partials/function/checkbox.html
Normal file
@ -0,0 +1,9 @@
|
||||
{{- /* Checkbox unchecked */ -}}
|
||||
{{- $old := `<input disabled="" type="checkbox">` -}}
|
||||
{{- $new := dict "Class" "fa-regular fa-square fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- $content := replace . $old $new -}}
|
||||
|
||||
{{- /* Checkbox checked */ -}}
|
||||
{{- $old = `<input checked="" disabled="" type="checkbox">` -}}
|
||||
{{- $new := dict "Class" "fa-regular fa-check-square fa-fw" | partial "plugin/icon.html" -}}
|
||||
{{- return replace $content $old $new -}}
|
23
themes/FixIt/layouts/partials/function/content.html
Normal file
23
themes/FixIt/layouts/partials/function/content.html
Normal file
@ -0,0 +1,23 @@
|
||||
{{- $content := .Content -}}
|
||||
|
||||
{{- if $content -}}
|
||||
|
||||
{{- if .Ruby -}}
|
||||
{{- $content = partial "function/ruby.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Fraction -}}
|
||||
{{- $content = partial "function/fraction.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Fontawesome -}}
|
||||
{{- $content = partial "function/fontawesome.html" $content -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $content = partial "function/checkbox.html" $content -}}
|
||||
|
||||
{{- $content = partial "function/escape.html" $content -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{- return $content -}}
|
4
themes/FixIt/layouts/partials/function/dos2unix.html
Normal file
4
themes/FixIt/layouts/partials/function/dos2unix.html
Normal file
@ -0,0 +1,4 @@
|
||||
{{- /* Unify new lines symbol */ -}}
|
||||
{{- /* See https://en.wikipedia.org/wiki/Newline */ -}}
|
||||
|
||||
{{- return replace . "\r\n" "\n" -}}
|
5
themes/FixIt/layouts/partials/function/escape.html
Normal file
5
themes/FixIt/layouts/partials/function/escape.html
Normal file
@ -0,0 +1,5 @@
|
||||
{{- /* Escape character */ -}}
|
||||
{{- /* {?X} -> X */ -}}
|
||||
{{- $REin := `\{\?(.)\}` -}}
|
||||
{{- $REout := `$1` -}}
|
||||
{{- return replaceRE $REin $REout . -}}
|
6
themes/FixIt/layouts/partials/function/escapeurl.html
Normal file
6
themes/FixIt/layouts/partials/function/escapeurl.html
Normal file
@ -0,0 +1,6 @@
|
||||
{{- /* Escape url special characters to query format, e.g: `#` -> `%23` */ -}}
|
||||
{{- /* https://github.com/hugo-fixit/FixIt/issues/245 */ -}}
|
||||
|
||||
{{- $content := . -}}
|
||||
{{- $content = replace $content "#" "%23" -}}
|
||||
{{- return $content -}}
|
14
themes/FixIt/layouts/partials/function/fontawesome.html
Normal file
14
themes/FixIt/layouts/partials/function/fontawesome.html
Normal file
@ -0,0 +1,14 @@
|
||||
{{- /* Font Awesome */ -}}
|
||||
{{- /* :(fa-regular fa-circle): -> <i class="fa-regular fa-circle" aria-hidden="true"></i> */ -}}
|
||||
|
||||
{{- $REin := ` (:\([\w- ]+?\):)` -}}
|
||||
{{- $REout := ` $1` -}}
|
||||
{{- $content := replaceRE $REin $REout . -}}
|
||||
|
||||
{{- $REin = `(:\([\w- ]+?\):) ` -}}
|
||||
{{- $REout = `$1 ` -}}
|
||||
{{- $content = replaceRE $REin $REout . -}}
|
||||
|
||||
{{- $REin = `:\(([\w- ]+?)\):` -}}
|
||||
{{- $REout = `<i class="$1" aria-hidden="true"></i>` -}}
|
||||
{{- return replaceRE $REin $REout $content -}}
|
5
themes/FixIt/layouts/partials/function/fraction.html
Normal file
5
themes/FixIt/layouts/partials/function/fraction.html
Normal file
@ -0,0 +1,5 @@
|
||||
{{- /* Fraction */ -}}
|
||||
{{- /* [A]/[B] -> <sup>A</sup>/<sub>B</sub> */ -}}
|
||||
{{- $REin := `\[(.+?)\]/\[(.+?)\]` -}}
|
||||
{{- $REout := `<sup>$1</sup>/<sub>$2</sub>` -}}
|
||||
{{- return replaceRE $REin $REout . -}}
|
14
themes/FixIt/layouts/partials/function/id.html
Normal file
14
themes/FixIt/layouts/partials/function/id.html
Normal file
@ -0,0 +1,14 @@
|
||||
{{- /* ID */ -}}
|
||||
{{- $id := "" -}}
|
||||
{{- with .Id -}}
|
||||
{{- /* If an ID is specified, then just use it.*/ -}}
|
||||
{{- $id = printf "%v" . -}}
|
||||
{{- else -}}
|
||||
{{- $count := ($.Scratch.Get "this").count | default 1 -}}
|
||||
{{- $id = printf "id-%d" $count -}}
|
||||
{{- $count | add 1 | $.Scratch.SetInMap "this" "count" -}}
|
||||
{{- end -}}
|
||||
{{- with .Content -}}
|
||||
{{- dict $id . | dict "data" | dict "config" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
|
||||
{{- end -}}
|
||||
{{- return $id -}}
|
4
themes/FixIt/layouts/partials/function/path.html
Normal file
4
themes/FixIt/layouts/partials/function/path.html
Normal file
@ -0,0 +1,4 @@
|
||||
{{- /* https://discourse.gohugo.io/t/how-decode-urls-in-hugo/7549/4 */ -}}
|
||||
{{- $URL := partial "function/escapeurl.html" . -}}
|
||||
{{- $URL = $URL | urlize | urls.Parse -}}
|
||||
{{- return $URL.Path -}}
|
16
themes/FixIt/layouts/partials/function/resource.html
Normal file
16
themes/FixIt/layouts/partials/function/resource.html
Normal file
@ -0,0 +1,16 @@
|
||||
{{- $resource := 0 -}}
|
||||
{{- $url := urls.Parse .Path -}}
|
||||
{{- if not $url.Host | and $url.Path | and (strings.HasSuffix $url.Path "/" | not) -}}
|
||||
{{- if .Resources -}}
|
||||
{{- with .Resources.GetMatch $url.Path -}}
|
||||
{{- $resource = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if not $resource -}}
|
||||
{{- with resources.Get $url.Path -}}
|
||||
{{- $resource = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $resource -}}
|
5
themes/FixIt/layouts/partials/function/ruby.html
Normal file
5
themes/FixIt/layouts/partials/function/ruby.html
Normal file
@ -0,0 +1,5 @@
|
||||
{{- /* Ruby */ -}}
|
||||
{{- /* [EN]^(English) -> <strong><ruby>EN<rt>English</rt></ruby></strong> */ -}}
|
||||
{{- $REin := `\[(.+?)\]\^\((.+?)\)` -}}
|
||||
{{- $REout := `<strong><ruby>$1<rt>$2</rt></ruby></strong>` -}}
|
||||
{{- return replaceRE $REin $REout . -}}
|
Reference in New Issue
Block a user