Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
feat(shortcodes): replace [align]/[float] with [style] and add [style]
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq committed Mar 2, 2020
1 parent aaff151 commit f8a7fd1
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 33 deletions.
20 changes: 0 additions & 20 deletions assets/css/_page/_single.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
6 changes: 3 additions & 3 deletions exampleSite/content/posts/test.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions layouts/shortcodes/align.html

This file was deleted.

4 changes: 0 additions & 4 deletions layouts/shortcodes/float.html

This file was deleted.

16 changes: 16 additions & 0 deletions layouts/shortcodes/image.html
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 3 additions & 0 deletions layouts/shortcodes/style.html
Original file line number Diff line number Diff line change
@@ -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 -}}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -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="}}

0 comments on commit f8a7fd1

Please sign in to comment.