From 3ca6ba3f1bbb71023014566a49ee3197ffa69069 Mon Sep 17 00:00:00 2001 From: zzossig Date: Thu, 14 Nov 2019 17:18:50 +0900 Subject: [PATCH] flowchart.js support, search multi language support --- README.md | 1 + data/_config/_default/params.toml | 1 + data/flowchartjs.json | 58 +++++++++++++++++++ data/lib.toml | 18 +++++- exampleSite/config.toml | 1 + layouts/archive/list.html | 2 +- layouts/partials/body/lib.html | 19 ++++-- layouts/partials/sidebar/site-search.html | 23 +++++++- layouts/shortcodes/flowchartjs.html | 2 +- ...s_e680761d791774b6351b18d537b957bb.content | 2 +- 10 files changed, 115 insertions(+), 12 deletions(-) create mode 100644 data/flowchartjs.json diff --git a/README.md b/README.md index d1510dd..0ca101a 100644 --- a/README.md +++ b/README.md @@ -240,6 +240,7 @@ enableToc = true enableTocSwitch = true itemsPerCategory = 5 enableSideSubscribe = false +searchLanguages = ['en'] # checkout lunr.js supported language # comment enableComment = false diff --git a/data/_config/_default/params.toml b/data/_config/_default/params.toml index 0f41a3f..62e5527 100644 --- a/data/_config/_default/params.toml +++ b/data/_config/_default/params.toml @@ -24,6 +24,7 @@ enableToc = true enableTocSwitch = true itemsPerCategory = 5 enableSideSubscribe = false +searchLanguages = ['en'] # footer showPoweredBy = true diff --git a/data/flowchartjs.json b/data/flowchartjs.json new file mode 100644 index 0000000..e4d35a5 --- /dev/null +++ b/data/flowchartjs.json @@ -0,0 +1,58 @@ +{ + "x": 0, + "y": 0, + "line-width": 3, + "line-length": 50, + "text-margin": 10, + "font-size": 14, + "font-color": "black", + "line-color": "black", + "element-color": "black", + "fill": "white", + "yes-text": "yes", + "no-text": "no", + "arrow-end": "block", + "scale": 1, + "symbols": { + "start": { + "font-color": "red", + "element-color": "green", + "fill": "yellow" + }, + "end": { + "class": "end-element" + } + }, + "flowstate": { + "past": { + "fill": "#CCCCCC", + "font-size": 12 + }, + "current": { + "fill": "yellow", + "font-color": "red", + "font-weight": "bold" + }, + "future": { + "fill": "#FFFF99" + }, + "request": { + "fill": "blue" + }, + "invalid": { + "fill": "#444444" + }, + "approved": { + "fill": "#58C4A3", + "font-size": 12, + "yes-text": "APPROVED", + "no-text": "n/a" + }, + "rejected": { + "fill": "#C45879", + "font-size": 12, + "yes-text": "n/a", + "no-text": "REJECTED" + } + } +} \ No newline at end of file diff --git a/data/lib.toml b/data/lib.toml index ac9bc10..2df8707 100644 --- a/data/lib.toml +++ b/data/lib.toml @@ -22,4 +22,20 @@ # css [css.katex] sri = "sha256-V8SV2MO1FUb63Bwht5Wx9x6PVHNa02gv8BgH/uH3ung=" - url = "https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" \ No newline at end of file + url = "https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" + +# lunr languages +[js.stemmer] + code = "stemmer" + sri = "sha256-LnITYFhGoYAU7HUJEMsYqKTGC7IyABA7P62e8nsQxwU=" + url = "https://cdn.jsdelivr.net/npm/lunr-languages@1.4.0/min/lunr.stemmer.support.min.js" + +[js.multi_language] + code = "multiLanguage" + sri = "sha256-l2H0da5582Qg/3FN+ZUO+yZO/8+SMO/VW1EaDeiZ6Xk=" + url = "https://cdn.jsdelivr.net/npm/lunr-languages@1.4.0/min/lunr.multi.min.js" + +[lunr.fr] + code = "fr" + sri = "sha256-TdVqolUedwrSbvS4UJLNMUR2ceDoSzlRQnhUf1QXc3c=" + url = "https://cdn.jsdelivr.net/npm/lunr-languages@1.4.0/min/lunr.fr.min.js" diff --git a/exampleSite/config.toml b/exampleSite/config.toml index ffe9bc3..73aac79 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -50,6 +50,7 @@ rssLimit = 100 enableTocSwitch = true itemsPerCategory = 5 enableSideSubscribe = false + searchLanguages = ['en'] # footer showPoweredBy = true diff --git a/layouts/archive/list.html b/layouts/archive/list.html index adabbaa..04f5d54 100644 --- a/layouts/archive/list.html +++ b/layouts/archive/list.html @@ -10,7 +10,7 @@
- {{ range (and (where .Site.RegularPages "Type" "!=" "about") (where .Site.RegularPages "Type" "!=" "archive")).GroupByDate (.Site.Params.archiveGroupByDate | default 2006) }} + {{ range (and (where .Site.RegularPages "Type" "!=" "about") (where .Site.RegularPages "Type" "!=" "archive")).GroupByDate (.Site.Params.archiveGroupByDate | default "2006") }} {{ .Key }}
    {{ range .Pages }} diff --git a/layouts/partials/body/lib.html b/layouts/partials/body/lib.html index fad4d06..bc4826f 100644 --- a/layouts/partials/body/lib.html +++ b/layouts/partials/body/lib.html @@ -43,13 +43,20 @@ {{ end }} {{ if in .Params.Libraries "flowchartjs" }} - {{ printf "" $js.flowchartjs.url $js.flowchartjs.sri | safeHTML }} {{ printf "" $js.raphael.url $js.raphael.sri | safeHTML }} - " $js.flowchartjs.url $js.flowchartjs.sri | safeHTML }} + + {{ end }} \ No newline at end of file diff --git a/layouts/partials/sidebar/site-search.html b/layouts/partials/sidebar/site-search.html index f8da567..e15c47c 100644 --- a/layouts/partials/sidebar/site-search.html +++ b/layouts/partials/sidebar/site-search.html @@ -12,17 +12,35 @@
{{ partial "sidebar/site-mark" . }} + {{ $lunr := resources.Get "js/lunr.min.js" | resources.Fingerprint }} +{{ $stemmer := .Site.Data.lib.js.stemmer }} +{{ printf "" $stemmer.url $stemmer.sri $stemmer.code | safeHTML }} + +{{ $multi := .Site.Data.lib.js.multi_language }} +{{ printf "" $multi.url $multi.sri $multi.code | safeHTML }} + +{{ range .Site.Data.lib.lunr }} + {{ printf "" .url .sri .code | safeHTML }} +{{ end }} +