mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-13 01:08:58 +01:00
b46f05a948
This commit includes all the needed workarounds and most changes from the main branch for everything to work, like: * removing empty lines in raw HTML that break output * read .browserslistrc, CSS variables from disk instead of duplicating it * using Hugo mounts * using Hugo for the docs CSS/JS * move ToC Sass code to a separate file while adapting it for Hugo Thus, this patch makes our npm scripts faster since lint runs on one step and there's no separate docs assets processing.
31 lines
1.6 KiB
HTML
31 lines
1.6 KiB
HTML
{{- /*
|
|
Usage: `placeholder args`
|
|
|
|
args 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: 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 -}}
|
|
{{- $title := .Get "title" | default "Placeholder" -}}
|
|
{{- $class := .Get "class" -}}
|
|
{{- $color := .Get "color" | default (index $grays 2).hex -}}
|
|
{{- $background := .Get "background" | default (index $grays 5).hex -}}
|
|
{{- $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") -}}
|
|
|
|
<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 -}}
|
|
<rect width="100%" height="100%" fill="{{ $background }}"/>
|
|
{{- if $show_text -}}<text x="50%" y="50%" fill="{{ $color }}" dy=".3em">{{ $text }}</text>{{- end -}}
|
|
</svg>
|