Merge pull request #104 from dillonzq/feature/add_some_shortcodes

feat(shortcodes): replace [align]/[float] with [style] and add [style]
This commit is contained in:
Dillon 2020-03-02 16:50:23 +08:00 committed by GitHub
commit f83b1c14c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 33 deletions

View file

@ -321,26 +321,6 @@
word-break: break-all;
}
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
.float-left {
float: left;
}
.float-right {
float: right;
}
}
@import "../_partial/_single/footer";

View file

@ -393,11 +393,11 @@ Here is a story about love...
int a = 1;
{{< /typeit >}}
## Test Align
## Test Style
{{% align right %}}
{{< style "text-align: right">}}
**Test Text**
{{% /align %}}
{{< /style >}}
## Test Katex

View file

@ -1,4 +0,0 @@
{{- /* [left, center, right] */ -}}
<div class={{ .Get 0 | printf "align-%s" }}>
{{- .Inner | .Page.RenderString -}}
</div>

View file

@ -1,4 +0,0 @@
{{- /* [left, right] */ -}}
<div class={{ .Get 0 | printf "float-%s" }}>
{{- .Inner | .Page.RenderString -}}
</div>

View file

@ -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>

View file

@ -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 -}}

View file

@ -1 +1 @@
{"Target":"css/style.min.5313a7cd528e285a82280f60228e0e2501181a5445bde1bc99d7c7dbdb7a4767.css","MediaType":"text/css","Data":{"Integrity":"sha256-UxOnzVKOKFqCKA9gIo4OJQEYGlRFveG8mdfH29t6R2c="}}
{"Target":"css/style.min.22797a679118d2eb3f376ecb55adbba6052c813ae165d44e004bbf861d5a1ed1.css","MediaType":"text/css","Data":{"Integrity":"sha256-Inl6Z5EY0us/N27LVa27pgUsgTrhZdROAEu/hh1aHtE="}}