Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/uPagge/uBlogger.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDillon ZENG <dillonzq@outlook.com>2019-11-23 20:10:17 +0300
committerDillon ZENG <dillonzq@outlook.com>2019-11-23 20:10:17 +0300
commit2578aba9ca8c4f45cbc6d379b57bca49ab9b9ea8 (patch)
treed4db15d0c07481304701867f85f4a9f02ebb0027 /layouts/shortcodes
parentb20fe1bb4f89c64b3bb82b31dbc0448ec565cd37 (diff)
feat(mermaid): improve mermaid style and render
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r--layouts/shortcodes/align-center.html4
-rw-r--r--layouts/shortcodes/align-left.html4
-rw-r--r--layouts/shortcodes/align-right.html4
-rw-r--r--layouts/shortcodes/align.html5
-rw-r--r--layouts/shortcodes/countdown.html2
-rw-r--r--layouts/shortcodes/dev/echarts.html (renamed from layouts/shortcodes/echarts.html)6
-rw-r--r--layouts/shortcodes/diagram.html5
-rw-r--r--layouts/shortcodes/float-right.html4
-rw-r--r--layouts/shortcodes/float.html5
-rw-r--r--layouts/shortcodes/mermaid.html10
-rw-r--r--layouts/shortcodes/typeit.html2
11 files changed, 25 insertions, 26 deletions
diff --git a/layouts/shortcodes/align-center.html b/layouts/shortcodes/align-center.html
deleted file mode 100644
index eebd24c..0000000
--- a/layouts/shortcodes/align-center.html
+++ /dev/null
@@ -1,4 +0,0 @@
-{{ $_hugo_config := `{ "version": 1 }` -}}
-<div class="align-center">
- {{- .Inner -}}
-</div> \ No newline at end of file
diff --git a/layouts/shortcodes/align-left.html b/layouts/shortcodes/align-left.html
deleted file mode 100644
index b4cb051..0000000
--- a/layouts/shortcodes/align-left.html
+++ /dev/null
@@ -1,4 +0,0 @@
-{{ $_hugo_config := `{ "version": 1 }` -}}
-<div class="align-left">
- {{- .Inner -}}
-</div> \ No newline at end of file
diff --git a/layouts/shortcodes/align-right.html b/layouts/shortcodes/align-right.html
deleted file mode 100644
index 1886582..0000000
--- a/layouts/shortcodes/align-right.html
+++ /dev/null
@@ -1,4 +0,0 @@
-{{ $_hugo_config := `{ "version": 1 }` -}}
-<div class="align-right">
- {{- .Inner -}}
-</div> \ No newline at end of file
diff --git a/layouts/shortcodes/align.html b/layouts/shortcodes/align.html
new file mode 100644
index 0000000..51f2617
--- /dev/null
+++ b/layouts/shortcodes/align.html
@@ -0,0 +1,5 @@
+{{ $_hugo_config := `{ "version": 1 }` -}}
+<!-- [left, center, right] -->
+<div class={{ .Get 0 | printf "align-%s" }}>
+ {{- .Inner -}}
+</div> \ No newline at end of file
diff --git a/layouts/shortcodes/countdown.html b/layouts/shortcodes/countdown.html
index 6eb8e59..fd28e0c 100644
--- a/layouts/shortcodes/countdown.html
+++ b/layouts/shortcodes/countdown.html
@@ -1,6 +1,6 @@
{{ if .Get "date" -}}
{{ $date := .Get "date" }}
- {{ $id := delimit (split (md5 $date) "" | shuffle) "" | printf "cd-%s" -}}
+ {{ $id := delimit (split (md5 $date) "" | shuffle) "" | printf "countdown-%s" -}}
{{ $defaultPattern := printf "%%D %s %%H %s %%M %s %%S %s" (T "day") (T "hour") (T "minute") (T "second") }}
{{ $new := dict $id (dict "date" $date "pattern" (.Get "pattern" | default $defaultPattern)) }}
{{ with .Page.Scratch.Get "countdownMap" -}}
diff --git a/layouts/shortcodes/echarts.html b/layouts/shortcodes/dev/echarts.html
index c3025a4..5b70bfa 100644
--- a/layouts/shortcodes/echarts.html
+++ b/layouts/shortcodes/dev/echarts.html
@@ -1,10 +1,10 @@
<!-- shuffle md5 as id -->
-{{ $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "ec-%s" -}}
+{{ $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "echarts-%s" -}}
{{ $echartsMap := .Page.Scratch.Get "echartsMap" -}}
{{ if $echartsMap -}}
- {{ $echartsMap = dict $id .Inner | merge $echartsMap -}}
+ {{ $echartsMap = .Inner | printf "{%s}" | dict $id | merge $echartsMap -}}
{{ else -}}
- {{ $echartsMap = dict $id .Inner -}}
+ {{ $echartsMap = .Inner | printf "{%s}" | dict $id -}}
{{ end -}}
{{ .Page.Scratch.Set "echartsMap" $echartsMap -}}
<div class="echarts" id="{{ $id }}"></div> \ No newline at end of file
diff --git a/layouts/shortcodes/diagram.html b/layouts/shortcodes/diagram.html
deleted file mode 100644
index 1c30b9b..0000000
--- a/layouts/shortcodes/diagram.html
+++ /dev/null
@@ -1,5 +0,0 @@
-{{ $_hugo_config := `{ "version": 1 }` -}}
-{{ .Page.Scratch.Set "diagram" "true" }}
-<div class="mermaid">
- {{- .Inner -}}
-</div> \ No newline at end of file
diff --git a/layouts/shortcodes/float-right.html b/layouts/shortcodes/float-right.html
deleted file mode 100644
index 799c5f1..0000000
--- a/layouts/shortcodes/float-right.html
+++ /dev/null
@@ -1,4 +0,0 @@
-{{ $_hugo_config := `{ "version": 1 }` -}}
-<div class="float-right">
- {{- .Inner -}}
-</div> \ No newline at end of file
diff --git a/layouts/shortcodes/float.html b/layouts/shortcodes/float.html
new file mode 100644
index 0000000..f2a8140
--- /dev/null
+++ b/layouts/shortcodes/float.html
@@ -0,0 +1,5 @@
+{{ $_hugo_config := `{ "version": 1 }` -}}
+<!-- [left, right] -->
+<div class={{ .Get 0 | printf "float-%s" }}>
+ {{- .Inner -}}
+</div> \ No newline at end of file
diff --git a/layouts/shortcodes/mermaid.html b/layouts/shortcodes/mermaid.html
new file mode 100644
index 0000000..ebf406a
--- /dev/null
+++ b/layouts/shortcodes/mermaid.html
@@ -0,0 +1,10 @@
+<!-- shuffle md5 as id -->
+{{ $id := delimit (split (md5 .Inner) "" | shuffle) "" | printf "mermaid-%s" -}}
+{{ $mermaidMap := .Page.Scratch.Get "mermaidMap" -}}
+{{ if $mermaidMap -}}
+ {{ $mermaidMap = trim .Inner "\n" | dict $id | merge $mermaidMap -}}
+{{ else -}}
+ {{ $mermaidMap = trim .Inner "\n" | dict $id -}}
+{{ end -}}
+{{ .Page.Scratch.Set "mermaidMap" $mermaidMap -}}
+<div class="mermaid" id="{{ $id }}"></div> \ No newline at end of file
diff --git a/layouts/shortcodes/typeit.html b/layouts/shortcodes/typeit.html
index 6ad3545..9ecb84c 100644
--- a/layouts/shortcodes/typeit.html
+++ b/layouts/shortcodes/typeit.html
@@ -1,7 +1,7 @@
<!-- only the trailing newline is retained -->
{{ $content := replaceRE `(?s)^\n*(.*?)\n*$` "$1\n" .Inner }}
<!-- shuffle md5 as id -->
-{{ $id := delimit (split (md5 $content) "" | shuffle) "" | printf "tp-%s" }}
+{{ $id := delimit (split (md5 $content) "" | shuffle) "" | printf "typeit-%s" }}
<div class={{ .Get "class" | default "typeit" }}>
<!-- raw html content -->