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 <dillonzq@outlook.com>2020-03-02 11:47:28 +0300
committerDillon <dillonzq@outlook.com>2020-03-02 11:47:28 +0300
commitf8a7fd1df98f3a8c1426044b7d627306b91e6e7a (patch)
tree6efa7d9796ed912082187f7ec7df45680b3d3eb7 /layouts/shortcodes
parentaaff1514db6ef154465dc016845442829d620a39 (diff)
feat(shortcodes): replace [align]/[float] with [style] and add [style]
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r--layouts/shortcodes/align.html4
-rw-r--r--layouts/shortcodes/float.html4
-rw-r--r--layouts/shortcodes/image.html16
-rw-r--r--layouts/shortcodes/style.html3
4 files changed, 19 insertions, 8 deletions
diff --git a/layouts/shortcodes/align.html b/layouts/shortcodes/align.html
deleted file mode 100644
index 8ef2b2c..0000000
--- a/layouts/shortcodes/align.html
+++ /dev/null
@@ -1,4 +0,0 @@
-{{- /* [left, center, right] */ -}}
-<div class={{ .Get 0 | printf "align-%s" }}>
- {{- .Inner | .Page.RenderString -}}
-</div>
diff --git a/layouts/shortcodes/float.html b/layouts/shortcodes/float.html
deleted file mode 100644
index 0845ba6..0000000
--- a/layouts/shortcodes/float.html
+++ /dev/null
@@ -1,4 +0,0 @@
-{{- /* [left, right] */ -}}
-<div class={{ .Get 0 | printf "float-%s" }}>
- {{- .Inner | .Page.RenderString -}}
-</div>
diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html
new file mode 100644
index 0000000..e2d4f77
--- /dev/null
+++ b/layouts/shortcodes/image.html
@@ -0,0 +1,16 @@
+<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
+ {{- $options := .Get "src" | dict "src" -}}
+ {{- $options = .Get "src_s" | dict "src_s" | merge $options -}}
+ {{- $options = .Get "src_l" | dict "src_l" | merge $options -}}
+ {{- $options = .Get "title" | dict "title" | merge $options -}}
+ {{- $options = .Get "description" | dict "description" | merge $options -}}
+ {{- $lightgallery := ne .Page.Site.Params.page.lightgallery false | and (ne .Page.Params.lightgallery false) -}}
+ {{- $options = $lightgallery | dict "lightgallery" | merge $options -}}
+ {{- $options = .Page.Scratch.Get "scratch" | dict "scratch" | merge $options -}}
+ {{- partial "plugin/image.html" $options -}}
+ {{- with (.Get "title" | default .Get "description") -}}
+ <figcaption class="image-caption">
+ {{- . | safeHTML -}}
+ </figcaption>
+ {{- end -}}
+</figure>
diff --git a/layouts/shortcodes/style.html b/layouts/shortcodes/style.html
new file mode 100644
index 0000000..f5848c5
--- /dev/null
+++ b/layouts/shortcodes/style.html
@@ -0,0 +1,3 @@
+{{- $content := .Inner | .Page.RenderString -}}
+{{- $tag := .Get 1 | default "div" -}}
+{{- printf `<%s style="%s">%s</%s>` $tag ($.Get 0) $content $tag | safeHTML -}}