From 3bad8d155d5a9fd841fe21f46bbbaa218626b58a Mon Sep 17 00:00:00 2001 From: Louis-Maxime Piton Date: Wed, 6 Mar 2024 16:51:43 +0100 Subject: [PATCH] Add a way to skip or change things inside examples --- .../content/docs/5.3/components/list-group.md | 43 +++++++++++++++++++ site/layouts/shortcodes/example.html | 31 ++++++------- 2 files changed, 59 insertions(+), 15 deletions(-) diff --git a/site/content/docs/5.3/components/list-group.md b/site/content/docs/5.3/components/list-group.md index 7f7e1457c0..a159a9141d 100644 --- a/site/content/docs/5.3/components/list-group.md +++ b/site/content/docs/5.3/components/list-group.md @@ -333,6 +333,49 @@ Loop that generates the modifier classes with an overriding of CSS variables. Use the tab JavaScript plugin—include it individually or through the compiled `bootstrap.js` file—to extend our list group to create tabbable panes of local content. +{{< example >}} +
+
+ +
+
+ +
+
+{{< /example >}} +
diff --git a/site/layouts/shortcodes/example.html b/site/layouts/shortcodes/example.html index 5b398e6814..450219af12 100644 --- a/site/layouts/shortcodes/example.html +++ b/site/layouts/shortcodes/example.html @@ -22,28 +22,29 @@
{{- if eq $show_preview true }} - {{ $content }} + {{ replaceRE `(?U){{-?\s*rendering\s*-?}}([\s\S]*){{-?\s*end\s*-?}}` "$1" (replaceRE `(?U){{-?\s*code\s*-?}}(?:[\s\S]*){{-?\s*end\s*-?}}` "" $content) | safeHTML }}
{{- end }} - {{- if eq $show_markup true -}} - {{- if eq $show_preview true -}} -
- {{ $lang }} -
- - -
-
- {{- end -}} +
+ {{ $lang }} +
+ {{- if eq $show_preview true -}} + + {{- end -}} + +
+
+ {{- if eq $show_markup true -}} {{- $content = replaceRE `` `...` $content -}} {{- $content = replaceRE `` `...` $content -}} {{- $content = replaceRE ` (class=" *?")` "" $content -}} + {{- $content = replaceRE `(?U)(?:\s*){{-?\s*code\s*-?}}([\s\S]*){{-?\s*end\s*-?}}(?:\s*)(\S)` "$1$2" (replaceRE `(?U)(?:\s*){{-?\s*rendering\s*-?}}(?:[\s\S]*){{-?\s*end\s*-?}}(?: *)\n` "" $content) -}} {{- highlight (trim $content "\n") $lang "" -}} {{- end }}