1 |
efrain |
1 |
{{- /*
|
|
|
2 |
Usage: `example args`
|
|
|
3 |
|
|
|
4 |
`args` are all optional and can be one of the following:
|
|
|
5 |
* id: the `div`'s id - default: ""
|
|
|
6 |
* class: any extra class(es) to be added to the `div` - default: ""
|
|
|
7 |
* show_preview: if the preview should be output in the HTML - default: `true`
|
|
|
8 |
* show_markup: if the markup should be output in the HTML - default: `true`
|
|
|
9 |
*/ -}}
|
|
|
10 |
|
|
|
11 |
{{- $id := .Get "id" -}}
|
|
|
12 |
{{- $class := .Get "class" -}}
|
|
|
13 |
{{- $lang := .Get "lang" | default "html" -}}
|
|
|
14 |
{{- $show_preview := .Get "show_preview" | default true -}}
|
|
|
15 |
{{- $show_markup := .Get "show_markup" | default true -}}
|
|
|
16 |
{{- $input := .Inner -}}
|
|
|
17 |
|
|
|
18 |
{{- if eq $show_preview true -}}
|
|
|
19 |
<div{{ with $id }} id="{{ . }}"{{ end }} class="bd-example{{ with $class }} {{ . }}{{ end }}">
|
|
|
20 |
{{- $input -}}
|
|
|
21 |
</div>
|
|
|
22 |
{{- end -}}
|
|
|
23 |
|
|
|
24 |
{{- if eq $show_markup true -}}
|
|
|
25 |
{{- $content := replaceRE `<svg class="bd-placeholder-img(?:-lg)?(?: *?bd-placeholder-img-lg)? ?(.*?)".*?<\/svg>\n` `<img src="..." class="$1" alt="...">` $input -}}
|
|
|
26 |
{{- $content = replaceRE ` (class=" *?")` "" $content -}}
|
|
|
27 |
{{- highlight (trim $content "\n") $lang "" -}}
|
|
|
28 |
{{- end -}}
|