mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-17 19:06:40 +02:00
docs: backport layouts updates from the main branch
This commit is contained in:
@@ -18,6 +18,6 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{ partial "ads.html" . }}
|
{{ partial "ads" . }}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
{{- $vendor := resources.Match "js/vendor/*.js" -}}
|
{{- $vendor := resources.Match "js/vendor/*.js" -}}
|
||||||
{{- $js := resources.Match "js/*.js" -}}
|
{{- $js := resources.Match "js/*.js" -}}
|
||||||
{{- $targetDocsJSPath := printf "/docs/%s/assets/js/docs.js" .Site.Params.docs_version -}}
|
{{- $targetDocsJSPath := path.Join "/docs" .Site.Params.docs_version "assets/js/docs.js" -}}
|
||||||
{{- $docsJs := append $js $vendor | resources.Concat $targetDocsJSPath -}}
|
{{- $docsJs := append $js $vendor | resources.Concat $targetDocsJSPath -}}
|
||||||
|
|
||||||
{{- if eq hugo.Environment "production" -}}
|
{{- if eq hugo.Environment "production" -}}
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- if (ne .Page.Layout "examples") }}
|
{{- if (ne .Page.Layout "examples") }}
|
||||||
{{- $targetDocsCssPath := printf "/docs/%s/assets/css/docs.css" .Site.Params.docs_version -}}
|
{{- $targetDocsCssPath := path.Join "/docs" .Site.Params.docs_version "assets/css/docs.css" -}}
|
||||||
{{- $sassOptions := dict "targetPath" $targetDocsCssPath "outputStyle" "expanded" "precision" 6 -}}
|
{{- $sassOptions := dict "targetPath" $targetDocsCssPath "outputStyle" "expanded" "precision" 6 -}}
|
||||||
{{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}}
|
{{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}}
|
||||||
|
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
{{- /*
|
{{- /*
|
||||||
Usage: `callout "type"`,
|
Usage: `callout "type"`, where `type` is one of info (default), danger, or warning
|
||||||
where type is one of info (default), danger, warning
|
|
||||||
*/ -}}
|
*/ -}}
|
||||||
|
|
||||||
{{- $css_class := .Get 0 | default "info" -}}
|
{{- $css_class := .Get 0 | default "info" -}}
|
||||||
|
@@ -1 +1 @@
|
|||||||
{{- relref . ((printf "docs/%s%s" $.Site.Params.docs_version (.Get 0)) | relURL) -}}
|
{{- relref . ((path.Join "docs" $.Site.Params.docs_version (.Get 0)) | relURL) -}}
|
||||||
|
@@ -1,26 +1,28 @@
|
|||||||
{{- /*
|
{{- /*
|
||||||
Usage: `example [args]`
|
Usage: `example args`
|
||||||
|
|
||||||
`args` are optional and can be one of the following:
|
`args` are all optional and can be one of the following:
|
||||||
id: the `div`'s id - default: ""
|
* id: the `div`'s id - default: ""
|
||||||
class: any extra class(es) to be added to the `div` - default ""
|
* class: any extra class(es) to be added to the `div` - default: ""
|
||||||
show_preview: if the preview should be output in the HTML - default: `true`
|
* show_preview: if the preview should be output in the HTML - default: `true`
|
||||||
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`
|
||||||
*/ -}}
|
*/ -}}
|
||||||
|
|
||||||
|
{{- $id := .Get "id" -}}
|
||||||
|
{{- $class := .Get "class" -}}
|
||||||
{{- $lang := .Get "lang" | default "html" -}}
|
{{- $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 -}}
|
||||||
|
|
||||||
{{- if eq $show_preview true -}}
|
{{- if eq $show_preview true -}}
|
||||||
<div{{ with .Get "id" }} id="{{ . }}"{{ end }} class="bd-example{{ with .Get "class" }} {{ . }}{{ end }}">
|
<div{{ with $id }} id="{{ . }}"{{ end }} class="bd-example{{ with $class }} {{ . }}{{ end }}">
|
||||||
{{- $input -}}
|
{{- $input -}}
|
||||||
</div>
|
</div>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- 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") $lang "" -}}
|
{{- highlight (trim $content "\n") $lang "" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@@ -1,11 +1,13 @@
|
|||||||
{{- /*
|
{{- /*
|
||||||
Work around wrong escapes in integrity attributes.
|
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 -}}
|
{{- $name := .Get 0 -}}
|
||||||
{{- with $name -}}
|
{{- with $name -}}
|
||||||
{{- $value := $.Page.Param . -}}
|
{{- $value := $.Page.Param . -}}
|
||||||
{{- if in $name "_hash" -}}
|
{{- /* If any parameter ends with `_hash`, mark the string as safe HTML */ -}}
|
||||||
|
{{- if (strings.HasSuffix $name "_hash") -}}
|
||||||
{{- $value = $value | safeHTML -}}
|
{{- $value = $value | safeHTML -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with $value }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}}
|
{{- with $value }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}}
|
||||||
|
@@ -1,21 +1,24 @@
|
|||||||
{{- /*
|
{{- /*
|
||||||
Usage: `placeholder args`
|
Usage: `placeholder args`
|
||||||
|
|
||||||
args can be one of the following:
|
`args` are all optional and can be one of the following:
|
||||||
title: Used in the SVG `title` tag, default "Placeholder"
|
* title: Used in the SVG `title` tag - default: "Placeholder"
|
||||||
text: The text to show in the image - default: "width x height"
|
* text: The text to show in the image - default: "width x height"
|
||||||
class: default: "bd-placeholder-img"
|
* class: Class to add to the `svg` - default: "bd-placeholder-img"
|
||||||
color: The text color (foreground) - default: "#dee2e6"
|
* color: The text color (foreground) - default: "#dee2e6"
|
||||||
background: The background color - default: "#868e96"
|
* background: The background color - default: "#868e96"
|
||||||
width: default: 100%
|
* width: default: "100%"
|
||||||
height: default: 180px
|
* height: default: "180px"
|
||||||
*/ -}}
|
*/ -}}
|
||||||
|
|
||||||
{{- $grays := $.Site.Data.grays -}}
|
{{- $grays := $.Site.Data.grays -}}
|
||||||
|
{{- $default_color := (index $grays 2).hex -}}
|
||||||
|
{{- $default_background := (index $grays 5).hex -}}
|
||||||
|
|
||||||
{{- $title := .Get "title" | default "Placeholder" -}}
|
{{- $title := .Get "title" | default "Placeholder" -}}
|
||||||
{{- $class := .Get "class" -}}
|
{{- $class := .Get "class" -}}
|
||||||
{{- $color := .Get "color" | default (index $grays 2).hex -}}
|
{{- $color := .Get "color" | default $default_color -}}
|
||||||
{{- $background := .Get "background" | default (index $grays 5).hex -}}
|
{{- $background := .Get "background" | default $default_background -}}
|
||||||
{{- $width := .Get "width" | default "100%" -}}
|
{{- $width := .Get "width" | default "100%" -}}
|
||||||
{{- $height := .Get "height" | default "180" -}}
|
{{- $height := .Get "height" | default "180" -}}
|
||||||
{{- $text := .Get "text" | default (printf "%sx%s" $width $height) -}}
|
{{- $text := .Get "text" | default (printf "%sx%s" $width $height) -}}
|
||||||
@@ -24,7 +27,7 @@
|
|||||||
{{- $show_text := not (eq $text "false") -}}
|
{{- $show_text := not (eq $text "false") -}}
|
||||||
|
|
||||||
<svg class="bd-placeholder-img{{ with $class }} {{ . }}{{ end }}" width="{{ $width }}" height="{{ $height }}" xmlns="http://www.w3.org/2000/svg"{{ if (or $show_title $show_text) }} role="img" aria-label="{{ if $show_title }}{{ $title }}{{ if $show_text }}: {{ end }}{{ end }}{{ if ($show_text) }}{{ $text }}{{ end }}"{{ else }} aria-hidden="true"{{ end }} preserveAspectRatio="xMidYMid slice" focusable="false">
|
<svg class="bd-placeholder-img{{ with $class }} {{ . }}{{ end }}" width="{{ $width }}" height="{{ $height }}" xmlns="http://www.w3.org/2000/svg"{{ if (or $show_title $show_text) }} role="img" aria-label="{{ if $show_title }}{{ $title }}{{ if $show_text }}: {{ end }}{{ end }}{{ if ($show_text) }}{{ $text }}{{ end }}"{{ else }} aria-hidden="true"{{ end }} preserveAspectRatio="xMidYMid slice" focusable="false">
|
||||||
{{- if $show_title -}}<title>{{ $title }}</title>{{- end -}}
|
{{- if $show_title }}<title>{{ $title }}</title>{{ end -}}
|
||||||
<rect width="100%" height="100%" fill="{{ $background }}"/>
|
<rect width="100%" height="100%" fill="{{ $background }}"/>
|
||||||
{{- if $show_text -}}<text x="50%" y="50%" fill="{{ $color }}" dy=".3em">{{ $text }}</text>{{- end -}}
|
{{- if $show_text }}<text x="50%" y="50%" fill="{{ $color }}" dy=".3em">{{ $text }}</text>{{ end -}}
|
||||||
</svg>
|
</svg>
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
{{- /*
|
{{- /* Outputs the current year */ -}}
|
||||||
Output the current year
|
|
||||||
*/ -}}
|
|
||||||
|
|
||||||
{{- now.Format "2006" -}}
|
{{- now.Format "2006" -}}
|
||||||
|
Reference in New Issue
Block a user