1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-21 12:51:52 +02:00

Switch to Hugo.

No more Ruby dependency and most important more than 10 times less build time (at least on Windows)!
This commit is contained in:
XhmikosR
2019-01-08 18:33:28 +02:00
parent 6aa475c82e
commit d95d30029f
310 changed files with 3874 additions and 3186 deletions

View File

@@ -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 -}}

View File

@@ -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>

View File

@@ -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 -}}

View File

@@ -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 -}}

View File

@@ -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>

View File

@@ -0,0 +1 @@
{{- .Inner | markdownify -}}

View File

@@ -0,0 +1 @@
{{ partial (.Get 0) . }}

View File

@@ -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>

View File

@@ -0,0 +1,5 @@
{{- /*
Output the current year
*/ -}}
{{- now.Format "2006" -}}