flowchart.js support, search multi language support
This commit is contained in:
parent
59fbf3cc1d
commit
3ca6ba3f1b
|
@ -240,6 +240,7 @@ enableToc = true
|
||||||
enableTocSwitch = true
|
enableTocSwitch = true
|
||||||
itemsPerCategory = 5
|
itemsPerCategory = 5
|
||||||
enableSideSubscribe = false
|
enableSideSubscribe = false
|
||||||
|
searchLanguages = ['en'] # checkout lunr.js supported language
|
||||||
|
|
||||||
# comment
|
# comment
|
||||||
enableComment = false
|
enableComment = false
|
||||||
|
|
|
@ -24,6 +24,7 @@ enableToc = true
|
||||||
enableTocSwitch = true
|
enableTocSwitch = true
|
||||||
itemsPerCategory = 5
|
itemsPerCategory = 5
|
||||||
enableSideSubscribe = false
|
enableSideSubscribe = false
|
||||||
|
searchLanguages = ['en']
|
||||||
|
|
||||||
# footer
|
# footer
|
||||||
showPoweredBy = true
|
showPoweredBy = true
|
||||||
|
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,4 +22,20 @@
|
||||||
# css
|
# css
|
||||||
[css.katex]
|
[css.katex]
|
||||||
sri = "sha256-V8SV2MO1FUb63Bwht5Wx9x6PVHNa02gv8BgH/uH3ung="
|
sri = "sha256-V8SV2MO1FUb63Bwht5Wx9x6PVHNa02gv8BgH/uH3ung="
|
||||||
url = "https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css"
|
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"
|
||||||
|
|
|
@ -50,6 +50,7 @@ rssLimit = 100
|
||||||
enableTocSwitch = true
|
enableTocSwitch = true
|
||||||
itemsPerCategory = 5
|
itemsPerCategory = 5
|
||||||
enableSideSubscribe = false
|
enableSideSubscribe = false
|
||||||
|
searchLanguages = ['en']
|
||||||
|
|
||||||
# footer
|
# footer
|
||||||
showPoweredBy = true
|
showPoweredBy = true
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</span>
|
</span>
|
||||||
<main class="main archive">
|
<main class="main archive">
|
||||||
<div>
|
<div>
|
||||||
{{ 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") }}
|
||||||
<span class="archive__key">{{ .Key }}</span>
|
<span class="archive__key">{{ .Key }}</span>
|
||||||
<ul class="archive__ul">
|
<ul class="archive__ul">
|
||||||
{{ range .Pages }}
|
{{ range .Pages }}
|
||||||
|
|
|
@ -43,13 +43,20 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if in .Params.Libraries "flowchartjs" }}
|
{{ if in .Params.Libraries "flowchartjs" }}
|
||||||
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"flowchartjs\"></script>" $js.flowchartjs.url $js.flowchartjs.sri | safeHTML }}
|
|
||||||
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"raphael\"></script>" $js.raphael.url $js.raphael.sri | safeHTML }}
|
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"raphael\"></script>" $js.raphael.url $js.raphael.sri | safeHTML }}
|
||||||
<script>
|
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"flowchartjs\"></script>" $js.flowchartjs.url $js.flowchartjs.sri | safeHTML }}
|
||||||
var diagramContent = $('#diagram').text().trim();
|
|
||||||
$('#diagram').text('');
|
<script>
|
||||||
|
{{ $flowchartjs := .Site.Data.flowchartjs }}
|
||||||
|
var options = JSON.parse({{ $flowchartjs | jsonify }});
|
||||||
|
|
||||||
|
$('.diagram').each(function() {
|
||||||
|
var diagramContent = $(this).text();
|
||||||
|
$(this).text('');
|
||||||
|
|
||||||
|
var diagram = flowchart.parse(diagramContent);
|
||||||
|
diagram.drawSVG('diagram', options);
|
||||||
|
});
|
||||||
|
|
||||||
// var diagram = flowchart.parse(diagramContent);
|
|
||||||
// diagram.drawSVG('diagram');
|
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
|
@ -12,17 +12,35 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ partial "sidebar/site-mark" . }}
|
{{ partial "sidebar/site-mark" . }}
|
||||||
|
|
||||||
{{ $lunr := resources.Get "js/lunr.min.js" | resources.Fingerprint }}
|
{{ $lunr := resources.Get "js/lunr.min.js" | resources.Fingerprint }}
|
||||||
<script defer src="{{ $lunr.RelPermalink }}"></script>
|
<script defer src="{{ $lunr.RelPermalink }}"></script>
|
||||||
|
|
||||||
|
{{ $stemmer := .Site.Data.lib.js.stemmer }}
|
||||||
|
{{ printf "<script defer src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"%s\"></script>" $stemmer.url $stemmer.sri $stemmer.code | safeHTML }}
|
||||||
|
|
||||||
|
{{ $multi := .Site.Data.lib.js.multi_language }}
|
||||||
|
{{ printf "<script defer src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"%s\"></script>" $multi.url $multi.sri $multi.code | safeHTML }}
|
||||||
|
|
||||||
|
{{ range .Site.Data.lib.lunr }}
|
||||||
|
{{ printf "<script defer src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"%s\"></script>" .url .sri .code | safeHTML }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
{{ if .Site.IsMultiLingual }}
|
{{ if .Site.IsMultiLingual }}
|
||||||
var baseurl = "{{.Site.BaseURL}}{{.Site.LanguagePrefix}}";
|
var baseurl = "{{.Site.BaseURL}}{{.Site.LanguagePrefix}}";
|
||||||
{{ else }}
|
{{ else }}
|
||||||
var baseurl = "{{.Site.BaseURL}}";
|
var baseurl = "{{.Site.BaseURL}}";
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
{{ $searchLanguages := .Site.Params.searchLanguages }}
|
||||||
|
var searchLanguages = JSON.parse({{ $searchLanguages | jsonify }});
|
||||||
|
|
||||||
|
if (!searchLanguages) {
|
||||||
|
searchLanguages = ['en'];
|
||||||
|
}
|
||||||
|
|
||||||
var lunrIndex = null;
|
var lunrIndex = null;
|
||||||
var pagesIndex = null;
|
var pagesIndex = null;
|
||||||
var searchResults = null;
|
var searchResults = null;
|
||||||
|
@ -41,10 +59,11 @@
|
||||||
.done(function (index) {
|
.done(function (index) {
|
||||||
pagesIndex = index;
|
pagesIndex = index;
|
||||||
lunrIndex = lunr(function () {
|
lunrIndex = lunr(function () {
|
||||||
|
this.use(lunr.multiLanguage(...searchLanguages));
|
||||||
this.ref('uri');
|
this.ref('uri');
|
||||||
this.field('title');
|
this.field('title');
|
||||||
this.field('description');
|
this.field('description');
|
||||||
//this.field('content');
|
this.field('content');
|
||||||
//this.field('tags');
|
//this.field('tags');
|
||||||
//this.field('series');
|
//this.field('series');
|
||||||
//this.field('categories');
|
//this.field('categories');
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<div id="diagram">
|
<div id="diagram" class="diagram">
|
||||||
{{- safeHTML .Inner -}}
|
{{- safeHTML .Inner -}}
|
||||||
</div>
|
</div>
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue