From 3ea39841c8049525e31e9f4d6300f0c60cdb42de Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 24 Jan 2023 13:33:51 +0100 Subject: Adding upstream version 5.2.3+dfsg. Signed-off-by: Daniel Baumann --- site/layouts/shortcodes/added-in.html | 5 ++++ site/layouts/shortcodes/bs-table.html | 9 ++++++ site/layouts/shortcodes/callout.html | 9 ++++++ site/layouts/shortcodes/docsref.html | 1 + site/layouts/shortcodes/example.html | 47 ++++++++++++++++++++++++++++++++ site/layouts/shortcodes/js-dismiss.html | 15 ++++++++++ site/layouts/shortcodes/markdown.html | 1 + site/layouts/shortcodes/param.html | 14 ++++++++++ site/layouts/shortcodes/partial.html | 1 + site/layouts/shortcodes/placeholder.html | 33 ++++++++++++++++++++++ site/layouts/shortcodes/scss-docs.html | 43 +++++++++++++++++++++++++++++ site/layouts/shortcodes/table.html | 31 +++++++++++++++++++++ site/layouts/shortcodes/year.html | 3 ++ 13 files changed, 212 insertions(+) create mode 100644 site/layouts/shortcodes/added-in.html create mode 100644 site/layouts/shortcodes/bs-table.html create mode 100644 site/layouts/shortcodes/callout.html create mode 100644 site/layouts/shortcodes/docsref.html create mode 100644 site/layouts/shortcodes/example.html create mode 100644 site/layouts/shortcodes/js-dismiss.html create mode 100644 site/layouts/shortcodes/markdown.html create mode 100644 site/layouts/shortcodes/param.html create mode 100644 site/layouts/shortcodes/partial.html create mode 100644 site/layouts/shortcodes/placeholder.html create mode 100644 site/layouts/shortcodes/scss-docs.html create mode 100644 site/layouts/shortcodes/table.html create mode 100644 site/layouts/shortcodes/year.html (limited to 'site/layouts/shortcodes') diff --git a/site/layouts/shortcodes/added-in.html b/site/layouts/shortcodes/added-in.html new file mode 100644 index 0000000..ca461c2 --- /dev/null +++ b/site/layouts/shortcodes/added-in.html @@ -0,0 +1,5 @@ +{{- /* Outputs badge to identify the first version something was added */ -}} + +{{- $version := .Get 0 -}} + +Added in v{{ $version }} diff --git a/site/layouts/shortcodes/bs-table.html b/site/layouts/shortcodes/bs-table.html new file mode 100644 index 0000000..9eec109 --- /dev/null +++ b/site/layouts/shortcodes/bs-table.html @@ -0,0 +1,9 @@ +{{- /* + Usage: `bs-table "class class-foo"`, where class can be any string +*/ -}} + +{{- $css_class := .Get 0 | default "table" -}} +{{- $html_table := .Inner | markdownify -}} +{{- $html_table = replace $html_table "" (printf `
` $css_class) -}} +{{- $html_table = replace $html_table "
" "" -}} +{{- $html_table | safeHTML -}} diff --git a/site/layouts/shortcodes/callout.html b/site/layouts/shortcodes/callout.html new file mode 100644 index 0000000..86683ec --- /dev/null +++ b/site/layouts/shortcodes/callout.html @@ -0,0 +1,9 @@ +{{- /* + Usage: `callout "type"`, where `type` is one of info (default), danger, or warning +*/ -}} + +{{- $css_class := .Get 0 | default "info" -}} + +
+{{ .Inner | markdownify }} +
diff --git a/site/layouts/shortcodes/docsref.html b/site/layouts/shortcodes/docsref.html new file mode 100644 index 0000000..2379de2 --- /dev/null +++ b/site/layouts/shortcodes/docsref.html @@ -0,0 +1 @@ +{{- relref . ((path.Join "docs" $.Site.Params.docs_version (.Get 0)) | relURL) -}} diff --git a/site/layouts/shortcodes/example.html b/site/layouts/shortcodes/example.html new file mode 100644 index 0000000..c6dcddb --- /dev/null +++ b/site/layouts/shortcodes/example.html @@ -0,0 +1,47 @@ +{{- /* + Usage: `example args` + + `args` are all optional and can be one of the following: + * id: the `div`'s id - default: "" + * class: any extra class(es) to be added to the `div` - default: "" + * lang: language used to display the code - default: "html" + * show_markup: if the markup should be output in the HTML - default: `true` + * show_preview: if the preview should be output in the HTML - default: `true` + * stackblitz_add_js: if extra JS snippet should be added to StackBlitz - default: `false` +*/ -}} + +{{- $id := .Get "id" -}} +{{- $class := .Get "class" -}} +{{- $lang := .Get "lang" | default "html" -}} +{{- $stackblitz_add_js := .Get "stackblitz_add_js" | default false -}} +{{- $show_markup := .Get "show_markup" | default true -}} +{{- $show_preview := .Get "show_preview" | default true -}} +{{- $input := .Inner -}} + +
+ {{- if eq $show_preview true -}} + + {{- $input -}} +
+ {{- end -}} + + {{- if eq $show_markup true -}} + {{- if eq $show_preview true -}} +
+ {{- $lang -}} +
+ + +
+
+ {{- end -}} + + {{- $content := replaceRE `\n` `...` $input -}} + {{- $content = replaceRE ` (class=" *?")` "" $content -}} + {{- highlight (trim $content "\n") $lang "" -}} + {{- end -}} + diff --git a/site/layouts/shortcodes/js-dismiss.html b/site/layouts/shortcodes/js-dismiss.html new file mode 100644 index 0000000..45d72d0 --- /dev/null +++ b/site/layouts/shortcodes/js-dismiss.html @@ -0,0 +1,15 @@ +{{- /* Usage: js-dismiss "ComponentName" */ -}} + +{{- $name := .Get 0 -}} + +Dismissal can be achieved with the `data` attribute on a button **within the {{ $name }}** as demonstrated below: + +```html + +``` + +or on a button **outside the {{ $name }}** using the `data-bs-target` as demonstrated below: + +```html + +``` diff --git a/site/layouts/shortcodes/markdown.html b/site/layouts/shortcodes/markdown.html new file mode 100644 index 0000000..82107bc --- /dev/null +++ b/site/layouts/shortcodes/markdown.html @@ -0,0 +1 @@ +{{- .Inner | markdownify -}} diff --git a/site/layouts/shortcodes/param.html b/site/layouts/shortcodes/param.html new file mode 100644 index 0000000..34ad00c --- /dev/null +++ b/site/layouts/shortcodes/param.html @@ -0,0 +1,14 @@ +{{- /* + Work around wrong escapes in integrity attributes. + Original: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/shortcodes/param.html +*/ -}} + +{{- $name := .Get 0 -}} +{{- with $name -}} +{{- $value := $.Page.Param . -}} +{{- /* If any parameter ends with `_hash`, mark the string as safe HTML */ -}} +{{- if (strings.HasSuffix $name "_hash") -}} + {{- $value = $value | safeHTML -}} +{{- end -}} +{{- with $value }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}} +{{- else }}{{ errorf "Missing param key: %s" $.Position }}{{ end -}} diff --git a/site/layouts/shortcodes/partial.html b/site/layouts/shortcodes/partial.html new file mode 100644 index 0000000..c9d3496 --- /dev/null +++ b/site/layouts/shortcodes/partial.html @@ -0,0 +1 @@ +{{ partial (.Get 0) . }} diff --git a/site/layouts/shortcodes/placeholder.html b/site/layouts/shortcodes/placeholder.html new file mode 100644 index 0000000..c267bf4 --- /dev/null +++ b/site/layouts/shortcodes/placeholder.html @@ -0,0 +1,33 @@ +{{- /* + Usage: `placeholder args` + + `args` are all optional and can be one of the following: + * title: Used in the SVG `title` tag - default: "Placeholder" + * text: The text to show in the image - default: "width x height" + * class: Class to add to the `svg` - default: "bd-placeholder-img" + * color: The text color (foreground) - default: "#dee2e6" + * background: The background color - default: "#868e96" + * width: default: "100%" + * height: default: "180px" +*/ -}} + +{{- $grays := $.Site.Data.grays -}} +{{- $default_color := (index $grays 2).hex -}} +{{- $default_background := (index $grays 5).hex -}} + +{{- $title := .Get "title" | default "Placeholder" -}} +{{- $class := .Get "class" -}} +{{- $color := .Get "color" | default $default_color -}} +{{- $background := .Get "background" | default $default_background -}} +{{- $width := .Get "width" | default "100%" -}} +{{- $height := .Get "height" | default "180" -}} +{{- $text := .Get "text" | default (printf "%sx%s" $width $height) -}} + +{{- $show_title := not (eq $title "false") -}} +{{- $show_text := not (eq $text "false") -}} + + diff --git a/site/layouts/shortcodes/scss-docs.html b/site/layouts/shortcodes/scss-docs.html new file mode 100644 index 0000000..3d1cd09 --- /dev/null +++ b/site/layouts/shortcodes/scss-docs.html @@ -0,0 +1,43 @@ +{{- /* + Usage: `scss-docs name="name" file="file/_location.scss"` + + Prints everything between `// scss-docs-start "name"` and `// scss-docs-end "name"` + comments in the docs. + + Optional parameters: + * strip-default: Remove the ` !default` flag from variable assignments - default: `true` +*/ -}} + +{{- $name := .Get "name" -}} +{{- $file := .Get "file" -}} +{{- $strip_default := .Get "strip-default" | default "true" -}} + +{{- /* If any parameters are missing, print an error and exit */ -}} +{{- if or (not $name) (not $file) -}} + {{- errorf "%s: %q: Missing required parameters! Got: name=%q file=%q!" .Position .Name $name $file -}} +{{- else -}} + {{- $capture_start := printf "// scss-docs-start %s\n" $name -}} + {{- $capture_end := printf "// scss-docs-end %s" $name -}} + {{- $regex := printf `%s((?:.|\n)*)%s` $capture_start $capture_end -}} + + {{- /* + TODO: figure out why we can't do the following and get the first group (the only capturing one)... + $regex := printf `(?:// scss-docs-start %s\n)((?:.|\n)*)(?:\n// scss-docs-end %s)` $name $name + */ -}} + + {{- $match := findRE $regex (readFile $file) -}} + {{- $match = index $match 0 -}} + + {{- if not $match -}} + {{- errorf "%s: %q: Got no matches for name=%q in file=%q!" .Position .Name $name $file -}} + {{- end -}} + + {{- $match = replace $match $capture_start "" -}} + {{- $match = replace $match $capture_end "" -}} + + {{- if (ne $strip_default "false") -}} + {{- $match = replace $match " !default" "" -}} + {{- end -}} + + {{- highlight $match "scss" "" -}} +{{- end -}} diff --git a/site/layouts/shortcodes/table.html b/site/layouts/shortcodes/table.html new file mode 100644 index 0000000..a98b5eb --- /dev/null +++ b/site/layouts/shortcodes/table.html @@ -0,0 +1,31 @@ +{{- /* + Usage: `table [args]` + + `args` are optional and can be one of the following: + * class: any class(es) to be added to the `table` - default "" + * simplified: show a simplified version in the examples - default `true` +*/ -}} + +{{- $class := .Get "class" -}} +{{- $simplified := .Get "simplified" | default true -}} + +{{- $table_attributes := "" -}} +{{- $table_content := " ...\n" -}} + +{{- with $class -}} + {{- $table_attributes = printf ` class="%s"` . -}} +{{- end -}} + +{{- if eq $simplified "false" -}} + {{- $table_content = partialCached "table-content" . -}} +{{- end -}} + +{{- $table := printf "\n%s" $table_attributes $table_content -}} + +
+ + {{ partialCached "table-content" . }} + +
+ +{{- highlight $table "html" "" -}} diff --git a/site/layouts/shortcodes/year.html b/site/layouts/shortcodes/year.html new file mode 100644 index 0000000..db7f18e --- /dev/null +++ b/site/layouts/shortcodes/year.html @@ -0,0 +1,3 @@ +{{- /* Outputs the current year */ -}} + +{{- now.Format "2006" -}} -- cgit v1.2.3