0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

shortcodes/example.html: allow specifying the highlighting language

This commit is contained in:
XhmikosR 2020-05-02 18:38:25 +03:00
parent 9a5b4766ae
commit 08742abda3

View File

@ -8,6 +8,7 @@
show_markup: if the markup should be output in the HTML - default: `true` show_markup: if the markup should be output in the HTML - default: `true`
*/ -}} */ -}}
{{- $lang := .Get "lang" | default "html" -}}
{{- $show_preview := .Get "show_preview" | default true -}} {{- $show_preview := .Get "show_preview" | default true -}}
{{- $show_markup := .Get "show_markup" | default true -}} {{- $show_markup := .Get "show_markup" | default true -}}
{{- $input := .Inner -}} {{- $input := .Inner -}}
@ -21,5 +22,5 @@
{{- if eq $show_markup true -}} {{- if eq $show_markup true -}}
{{- $content := replaceRE `<svg class="bd\-placeholder\-img(?:\-lg)?(?: *?bd\-placeholder\-img\-lg)? ?(.*?)".*?<\/svg>\n` `<img src="..." class="$1" alt="...">` $input -}} {{- $content := replaceRE `<svg class="bd\-placeholder\-img(?:\-lg)?(?: *?bd\-placeholder\-img\-lg)? ?(.*?)".*?<\/svg>\n` `<img src="..." class="$1" alt="...">` $input -}}
{{- $content = replaceRE `(class=" *?")` "" $content -}} {{- $content = replaceRE `(class=" *?")` "" $content -}}
{{- highlight (trim $content "\n") "html" "" -}} {{- highlight (trim $content "\n") $lang "" -}}
{{- end -}} {{- end -}}