Update wrapper shortcode to accommodate changes made in Hugo 0.55 to how the % delimiter works in shortcodes.

This commit is contained in:
Fredrik Jonsson 2019-04-24 18:01:02 +02:00
commit 5342b34f1b
2 changed files with 27 additions and 5 deletions

View file

@ -216,19 +216,41 @@ blablabla # Displayed below of the image.
### Wrapper
A simple, but useful, shortcode to wrap content in a div with a class.
A simple, but useful, shortcode to wrap content in a div with a class. The content will be run through "markdownify".
```
{{% wrapper class-name-you-want %}}
{{< wrapper class-name-you-want markdown >}}
The **content** that should be wrapped.
{{% /wrapper %}}
Some more content.
{{< /wrapper >}}
```
This will produce:
```
<div class="class-name-you-want">
The <strong>content</strong> that should be wrapped.
<p>The <strong>content</strong> that should be wrapped.</p>
<p>Some more content.</p>
</div>
```
If the content should be left untouched add "nomarkdown" after the class name.
```
{{< wrapper class-name-you-want nomarkdown >}}
The **content** that should be wrapped.
Some more content.
{{< /wrapper >}}
```
This will produce:
```
<div class="class-name-you-want">
The **content** that should be wrapped. Some more content.
</div>
```

View file

@ -1 +1 @@
<div class="{{ .Get 0 }}">{{ .Inner }}</div>
<div class="{{ .Get 0 }}">{{ if eq (.Get 1) "nomarkdown" }}{{ .Inner }}{{ else }}{{ .Inner | markdownify }}{{ end }}</div>