]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
shortcodes/example.html: allow specifying the highlighting language
authorXhmikosR <xhmikosr@gmail.com>
Sat, 2 May 2020 15:38:25 +0000 (18:38 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Wed, 3 Jun 2020 12:57:20 +0000 (15:57 +0300)
site/layouts/shortcodes/example.html

index 6701b1377b2b1e27521da25cc2c1e85f8b4a8906..cebb06ad47ae21334af86f4084d8bc34582c1d74 100644 (file)
@@ -8,6 +8,7 @@
     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_markup := .Get "show_markup" | default true -}}
 {{- $input := .Inner -}}
@@ -21,5 +22,5 @@
 {{- 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 `(class=" *?")` "" $content -}}
-  {{- highlight (trim $content "\n") "html" "" -}}
+  {{- highlight (trim $content "\n") $lang "" -}}
 {{- end -}}