Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'site/layouts/shortcodes')
-rw-r--r--site/layouts/shortcodes/bugify.html40
-rw-r--r--site/layouts/shortcodes/callout.html10
-rw-r--r--site/layouts/shortcodes/example.html53
-rw-r--r--site/layouts/shortcodes/list-examples.html19
-rw-r--r--site/layouts/shortcodes/list-versions.html20
-rw-r--r--site/layouts/shortcodes/markdown.html1
-rw-r--r--site/layouts/shortcodes/partial.html1
-rw-r--r--site/layouts/shortcodes/placeholder.html30
-rw-r--r--site/layouts/shortcodes/year.html5
9 files changed, 179 insertions, 0 deletions
diff --git a/site/layouts/shortcodes/bugify.html b/site/layouts/shortcodes/bugify.html
new file mode 100644
index 0000000000..b064d29a5e
--- /dev/null
+++ b/site/layouts/shortcodes/bugify.html
@@ -0,0 +1,40 @@
+{{- $words := (split .Inner " ") -}}
+
+{{- range $word := $words -}}
+ {{- if (strings.Contains $word "#") -}}
+ {{- $separator := false -}}
+
+ {{- if (strings.Contains $word ",") -}}
+ {{- $separator = true -}}
+ {{- end -}}
+
+ {{- $data := split $word "#" -}}
+ {{- $bug_cat := replace (index $data 0) "\n" "" -}}
+ {{- $bug_id := replace (index $data 1) "\n" "" -}}
+ {{- $bug_id = replace $bug_id "," "" -}}
+
+ {{- if (eq $bug_cat "Bootstrap") -}}
+ <a href="https://github.com/twbs/bootstrap/issues/{{ $bug_id }}">#{{ $bug_id }}</a>
+ {{- else if (eq $bug_cat "Edge") -}}
+ <a href="https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/{{ $bug_id }}/">Edge issue #{{ $bug_id }}</a>
+ {{- else if (eq $bug_cat "A11yUserVoice") -}}
+ <a href="https://microsoftaccessibility.uservoice.com/forums/307429-microsoft-accessibility-feedback/suggestions/{{ $bug_id }}">Microsoft A11y UserVoice idea #{{ $bug_id }}</a>
+ {{- else if (eq $bug_cat "UserVoice") -}}
+ <a href="https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/{{ $bug_id }}">Edge UserVoice idea #{{ $bug_id }}</a>
+ {{- else if (eq $bug_cat "Mozilla") -}}
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id={{ $bug_id }}">Mozilla bug #{{ $bug_id }}</a>
+ {{- else if (eq $bug_cat "Chromium") -}}
+ <a href="https://bugs.chromium.org/p/chromium/issues/detail?id={{ $bug_id }}">Chromium issue #{{ $bug_id }}</a>
+ {{- else if (eq $bug_cat "WebKit") -}}
+ <a href="https://bugs.webkit.org/show_bug.cgi?id={{ $bug_id }}">WebKit bug #{{ $bug_id }}</a>
+ {{- else if (eq $bug_cat "Safari") -}}
+ <a href="https://openradar.appspot.com/{{ $bug_id }}">Apple Safari Radar #{{ $bug_id }}</a>
+ {{- else if (eq $bug_cat "Normalize") -}}
+ <a href="https://github.com/necolas/normalize.css/issues/{{ $bug_id }}">Normalize #{{ $bug_id }}</a>
+ {{- end -}}
+ {{- if (eq $separator true) }}, {{ end -}}
+
+ {{- else -}}
+ {{- $word -}}
+ {{- end -}}
+{{- end -}}
diff --git a/site/layouts/shortcodes/callout.html b/site/layouts/shortcodes/callout.html
new file mode 100644
index 0000000000..007f8a8e8e
--- /dev/null
+++ b/site/layouts/shortcodes/callout.html
@@ -0,0 +1,10 @@
+{{- /*
+ Usage: `callout "type"`,
+ where type is one of info (default), danger, warning
+*/ -}}
+
+{{- $css_class := .Get 0 | default "info" -}}
+
+<div class="bd-callout bd-callout-{{ $css_class }}">
+{{ .Inner | markdownify }}
+</div>
diff --git a/site/layouts/shortcodes/example.html b/site/layouts/shortcodes/example.html
new file mode 100644
index 0000000000..67813b70fe
--- /dev/null
+++ b/site/layouts/shortcodes/example.html
@@ -0,0 +1,53 @@
+{{- /*
+ Usage: `example [args]`
+
+ `args` are 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 ""
+ 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_preview := .Get "show_preview" | default true -}}
+{{- $show_markup := .Get "show_markup" | default true -}}
+{{- $input := .Inner -}}
+
+{{- if eq $show_preview true -}}
+<div{{ with .Get "id" }} id="{{ . }}"{{ end }} class="bd-example{{ with .Get "class" }} {{ . }}{{ end }}">
+ {{- $input -}}
+</div>
+{{- end -}}
+
+{{- if eq $show_markup true -}}
+ {{- $.Scratch.Set "highlight_content" $input -}}
+
+ {{- if (strings.Contains $input `<svg class="bd-placeholder-img`) -}}
+ {{- $.Scratch.Set "highlight_content" "" -}}
+ {{- $image_class := "" -}}
+
+ {{- $modified_content := replace $input `<svg class="bd-placeholder-img` `✂️<svg class="bd-placeholder-img` -}}
+ {{- $modified_content = replace $modified_content "</svg>\n" "</svg>✂️" -}}
+ {{- $modified_content = split $modified_content "✂️" -}}
+
+ {{- if (strings.Contains $input `<svg class="bd-placeholder-img `) -}}
+ {{- $image_class = replace $input "bd-placeholder-img " "bd-placeholder-img ✂️ " -}}
+ {{- $image_class = split (replace $image_class `" width="` `✂️" width="`) "✂️" -}}
+ {{- $image_class = replace (index $image_class 1) "bd-placeholder-img-lg" "" -}}
+ {{- $image_class = trim $image_class " " -}}
+ {{- end -}}
+
+ {{- range $i, $content_chunk := $modified_content -}}
+ {{- if (strings.Contains $content_chunk `<svg class="bd-placeholder-img`) -}}
+ {{- if $image_class -}}
+ {{- $.Scratch.Add "highlight_content" (printf `<img src="..." class="%s" alt="...">` $image_class) -}}
+ {{- else -}}
+ {{- $.Scratch.Add "highlight_content" `<img src="..." alt="...">` -}}
+ {{- end -}}
+ {{- else -}}
+ {{- $.Scratch.Add "highlight_content" $content_chunk -}}
+ {{- end -}}
+ {{- end -}}
+ {{- end -}}
+
+ {{- highlight (trim ($.Scratch.Get "highlight_content") "\n") "html" "" -}}
+{{- end -}}
diff --git a/site/layouts/shortcodes/list-examples.html b/site/layouts/shortcodes/list-examples.html
new file mode 100644
index 0000000000..33b3c33c7d
--- /dev/null
+++ b/site/layouts/shortcodes/list-examples.html
@@ -0,0 +1,19 @@
+{{ range $entry := $.Site.Data.examples -}}
+ <h2>{{ $entry.category }}</h2>
+ <p>{{ $entry.description }}</p>
+
+ {{ range $i, $example := $entry.examples -}}
+ {{- $len := len $entry.examples -}}
+ {{ if (eq $i 0) }}<div class="row">{{ end }}
+ <div class="col-sm-6 col-md-4 col-xl-3 mb-3">
+ <a href="/docs/{{ $.Site.Params.docs_version }}/examples/{{ $example.name | urlize }}/">
+ <img class="img-thumbnail mb-3" srcset="/docs/{{ $.Site.Params.docs_version }}/assets/img/examples/{{ $example.name | urlize }}.png,
+ /docs/{{ $.Site.Params.docs_version }}/assets/img/examples/{{ $example.name | urlize }}@2x.png 2x"
+ src="/docs/{{ $.Site.Params.docs_version }}/assets/img/examples/{{ $example.name | urlize }}.png" alt="{{ $example.name }} screenshot" width="480" height="300">
+ <h5 class="mb-1">{{ $example.name }}</h5>
+ </a>
+ <p class="text-muted">{{ $example.description }}</p>
+ </div>
+ {{ if (eq (add $i 1) $len) }}</div>{{ end }}
+ {{ end -}}
+{{ end -}}
diff --git a/site/layouts/shortcodes/list-versions.html b/site/layouts/shortcodes/list-versions.html
new file mode 100644
index 0000000000..5c7f0445a0
--- /dev/null
+++ b/site/layouts/shortcodes/list-versions.html
@@ -0,0 +1,20 @@
+<div class="row">
+ {{- range $release := (index $.Site.Data "docs-versions") }}
+ <div class="col-md">
+ <h2>{{ $release.group }}</h2>
+ <p>{{ $release.description }}</p>
+ {{- $versions := sort $release.versions "v" "desc" -}}
+ {{- range $i, $version := $versions }}
+ {{- $len := len $versions -}}
+ {{ if (eq $i 0) }}<div class="list-group">{{ end }}
+ <a class="list-group-item list-group-item-action py-2 text-primary{{ if (eq $version.v $.Site.Params.docs_version) }} d-flex justify-content-between align-items-center{{ end }}" href="{{ $release.baseurl }}/{{ $version.v }}/">
+ {{ $version.v }}
+ {{ if (eq $version.v $.Site.Params.docs_version) -}}
+ <span class="badge badge-primary">Latest</span>
+ {{- end }}
+ </a>
+ {{ if (eq (add $i 1) $len) }}</div>{{ end }}
+ {{ end -}}
+ </div>
+ {{ end -}}
+</div>
diff --git a/site/layouts/shortcodes/markdown.html b/site/layouts/shortcodes/markdown.html
new file mode 100644
index 0000000000..82107bcef9
--- /dev/null
+++ b/site/layouts/shortcodes/markdown.html
@@ -0,0 +1 @@
+{{- .Inner | markdownify -}}
diff --git a/site/layouts/shortcodes/partial.html b/site/layouts/shortcodes/partial.html
new file mode 100644
index 0000000000..c9d3496de7
--- /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 0000000000..83f44aec9e
--- /dev/null
+++ b/site/layouts/shortcodes/placeholder.html
@@ -0,0 +1,30 @@
+{{- /*
+ 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) }} aria-label="{{ if $show_title }}{{ $title }}{{ if $show_text }}: {{ end }}{{ end }}{{ if ($show_text) }}{{ $text }}{{ end }}"{{ end }} preserveAspectRatio="xMidYMid slice" role="img">
+ {{- 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>
diff --git a/site/layouts/shortcodes/year.html b/site/layouts/shortcodes/year.html
new file mode 100644
index 0000000000..bc9dd300d1
--- /dev/null
+++ b/site/layouts/shortcodes/year.html
@@ -0,0 +1,5 @@
+{{- /*
+ Output the current year
+*/ -}}
+
+{{- now.Format "2006" -}}