fix issue #36
This commit is contained in:
parent
93bb015db6
commit
10ae1fcf36
19
exampleSite/content/post/multiple-expandable-test.md
Normal file
19
exampleSite/content/post/multiple-expandable-test.md
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
---
|
||||||
|
title: "Multiple Expandable Test"
|
||||||
|
date: 2020-06-17T22:01:14-05:00
|
||||||
|
tags: [issue]
|
||||||
|
---
|
||||||
|
|
||||||
|
Testing out GitHub issue https://github.com/zwbetz-gh/cupper-hugo-theme/issues/36 -- Multiple expandable shortcodes do not work if they have the same inner text.
|
||||||
|
|
||||||
|
{{< expandable label="expandable 1" level="2" >}}
|
||||||
|
Same inner text.
|
||||||
|
{{< /expandable >}}
|
||||||
|
|
||||||
|
{{< expandable label="expandable 2" level="2" >}}
|
||||||
|
Same inner text.
|
||||||
|
{{< /expandable >}}
|
||||||
|
|
||||||
|
{{< expandable label="expandable 3" level="2" >}}
|
||||||
|
Different inner text.
|
||||||
|
{{< /expandable >}}
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
title: "Special Character Test"
|
title: "Special Character Test"
|
||||||
date: 2019-09-10T20:26:08-05:00
|
date: 2019-09-10T20:26:08-05:00
|
||||||
tags: []
|
tags: [issue]
|
||||||
---
|
---
|
||||||
|
|
||||||
Testing out GitHub issue https://github.com/zwbetz-gh/cupper-hugo-theme/issues/16
|
Testing out GitHub issue https://github.com/zwbetz-gh/cupper-hugo-theme/issues/16
|
||||||
|
|
|
@ -2,7 +2,12 @@
|
||||||
{{ if .Get "level" }}
|
{{ if .Get "level" }}
|
||||||
<h{{ .Get "level" }}>
|
<h{{ .Get "level" }}>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<button aria-expanded="{{ with .Get "open" }}true{{ else }}false{{ end }}" data-expands="js-expandable-{{ .Inner | md5 }}">
|
{{/* 1. Get the md5 hash of the expandable inner text */}}
|
||||||
|
{{/* 2. Split the hash string into an array */}}
|
||||||
|
{{/* 3. Shuffle the array */}}
|
||||||
|
{{/* 4. Convert the array back into a string */}}
|
||||||
|
{{ $random := delimit (shuffle (split (md5 .Inner) "" )) "" }}
|
||||||
|
<button aria-expanded="{{ with .Get "open" }}true{{ else }}false{{ end }}" data-expands="js-expandable-{{ $random }}">
|
||||||
<span class="expandable-label">{{ .Get "label" | default "More info" }}</span>
|
<span class="expandable-label">{{ .Get "label" | default "More info" }}</span>
|
||||||
<svg aria-hidden="true" focusable="false" viewBox="0 0 70.866142 70.866141">
|
<svg aria-hidden="true" focusable="false" viewBox="0 0 70.866142 70.866141">
|
||||||
<g transform="translate(0 -981.5)">
|
<g transform="translate(0 -981.5)">
|
||||||
|
@ -14,7 +19,7 @@
|
||||||
{{ if .Get "level" }}
|
{{ if .Get "level" }}
|
||||||
</h{{ .Get "level"}}>
|
</h{{ .Get "level"}}>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div id="js-expandable-{{ .Inner | md5 }}" {{ with .Get "open" | not }}hidden{{ end }}>
|
<div id="js-expandable-{{ $random }}" {{ with .Get "open" | not }}hidden{{ end }}>
|
||||||
{{ .Inner | markdownify }}
|
{{ .Inner | markdownify }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user