diff options
| author | Mark Otto <[email protected]> | 2020-04-13 15:34:08 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-04-13 15:34:08 -0700 |
| commit | febdcefcd7d65b02b9d23807d7940b1e60053f43 (patch) | |
| tree | 16b6ac57144ca5bcf8faa25bd4cdfbd6fbd86402 /site/layouts | |
| parent | 232de79db8efb39a925b340a8b3de4e5834de643 (diff) | |
| parent | 1004e3e786f707853043dd427317cd4033a04211 (diff) | |
| download | bootstrap-febdcefcd7d65b02b9d23807d7940b1e60053f43.tar.xz bootstrap-febdcefcd7d65b02b9d23807d7940b1e60053f43.zip | |
Merge branch 'master' into release-drafter
Diffstat (limited to 'site/layouts')
| -rw-r--r-- | site/layouts/_default/docs.html | 2 | ||||
| -rw-r--r-- | site/layouts/partials/docs-sidebar.html | 16 | ||||
| -rw-r--r-- | site/layouts/partials/docs-subnav.html | 2 | ||||
| -rw-r--r-- | site/layouts/partials/docs-versions.html | 18 | ||||
| -rw-r--r-- | site/layouts/shortcodes/scss-docs.html | 33 |
5 files changed, 52 insertions, 19 deletions
diff --git a/site/layouts/_default/docs.html b/site/layouts/_default/docs.html index b1efb6b13..383ff0f0c 100644 --- a/site/layouts/_default/docs.html +++ b/site/layouts/_default/docs.html @@ -11,7 +11,7 @@ <div class="container-xl my-4"> <div class="row flex-xl-nowrap"> - <div class="col-md-3 bd-sidebar"> + <div class="col-md-3"> {{ partial "docs-sidebar" . }} </div> diff --git a/site/layouts/partials/docs-sidebar.html b/site/layouts/partials/docs-sidebar.html index 772cbd7f7..9af562340 100644 --- a/site/layouts/partials/docs-sidebar.html +++ b/site/layouts/partials/docs-sidebar.html @@ -2,7 +2,7 @@ {{- $url := split .Permalink "/" -}} {{- $page_slug := index $url (sub (len $url) 2) -}} - <ul class="list-unstyled"> + <ul class="list-unstyled mb-0"> {{- range $group := .Site.Data.sidebar -}} {{- $link := $group.title -}} {{- $link_slug := $link | urlize -}} @@ -15,17 +15,17 @@ {{- $group_slug := $group.title | urlize -}} {{- $active_group := eq $.Page.Params.group $group_slug }} - <li class="bd-sidenav-group my-1{{ if $active_group }} active{{ end }} js-sidenav-group{{ if $group.pages }} has-children{{ end }}"> - <a class="d-inline-flex align-items-center bd-sidenav-group-link" href="/docs/{{ $.Site.Params.docs_version }}/{{ $group_slug }}/{{ if $group.pages }}{{ $link_slug }}/{{ end }}"{{ if $active_group }} aria-current="true"{{ end }}> + <li class="my-1{{ if $active_group }} active{{ end }}"> + <a class="{{ if not $active_group }} collapsed{{ end }}" data-toggle="collapse" href="#{{ $group_slug }}-collapse" role="button" aria-expanded="{{ $active_group }}"{{ if $active_group }} aria-current="true"{{ end }}> {{ $group.title }} </a> {{- if $group.pages }} - <ul class="nav bd-sidenav flex-column mb-2"> + <ul class="list-unstyled mb-2 collapse{{ if $active_group }} show{{ end }}" id="{{ $group_slug }}-collapse"> {{- range $doc := $group.pages -}} {{- $doc_slug := $doc.title | urlize }} - <li{{ if and $active_group (eq $page_slug $doc_slug) }} class="active bd-sidenav-active"{{ end }}> - <a href="/docs/{{ $.Site.Params.docs_version }}/{{ $group_slug }}/{{ $doc_slug }}/"{{ if and $active_group (eq $page_slug $doc_slug) }} aria-current="page"{{ end }}> + <li> + <a href="/docs/{{ $.Site.Params.docs_version }}/{{ $group_slug }}/{{ $doc_slug }}/"{{ if and $active_group (eq $page_slug $doc_slug) }} class="active" aria-current="page"{{ end }}> {{- $doc.title -}} </a> </li> @@ -36,8 +36,8 @@ {{- end }} <li class="my-3 mx-4 border-top"></li> - <li class="bd-sidenav-group pl-3"> - <a class="d-inline-flex align-items-center bd-sidenav-group-link" href="/docs/{{ $.Site.Params.docs_version }}/migration/"> + <li{{ if eq $page_slug "migration" }} class="active"{{ end }}> + <a href="/docs/{{ $.Site.Params.docs_version }}/migration/"> Migration </a> </li> diff --git a/site/layouts/partials/docs-subnav.html b/site/layouts/partials/docs-subnav.html index 08f205897..6d60640ef 100644 --- a/site/layouts/partials/docs-subnav.html +++ b/site/layouts/partials/docs-subnav.html @@ -6,7 +6,7 @@ {{ partial "docs-versions" . }} - <button class="btn btn-link bd-search-docs-toggle d-md-none p-0 ml-3 order-3 ml-auto" type="button" data-toggle="collapse" data-target="#bd-docs-nav" aria-controls="bd-docs-nav" aria-expanded="false" aria-label="Toggle docs navigation"> + <button class="btn bd-search-docs-toggle d-md-none p-0 ml-3 order-3 ml-auto" type="button" data-toggle="collapse" data-target="#bd-docs-nav" aria-controls="bd-docs-nav" aria-expanded="false" aria-label="Toggle docs navigation"> {{ partial "icons/menu.svg" (dict "width" "30" "height" "30") }} </button> </div> diff --git a/site/layouts/partials/docs-versions.html b/site/layouts/partials/docs-versions.html index cddf4a116..bfe3c2a55 100644 --- a/site/layouts/partials/docs-versions.html +++ b/site/layouts/partials/docs-versions.html @@ -2,13 +2,13 @@ <button class="btn btn-bd-light dropdown-toggle" id="bd-versions" data-toggle="dropdown" aria-expanded="false" data-display="static"> Bootstrap v{{ .Site.Params.docs_version }} </button> - <div class="dropdown-menu dropdown-menu-md-right" aria-labelledby="bd-versions"> - <a class="dropdown-item active" aria-current="true" href="/docs/{{ .Site.Params.docs_version }}/">Latest (5.0.x)</a> - <div class="dropdown-divider"></div> - <a class="dropdown-item" href="https://getbootstrap.com/docs/4.4/">v4.4.1</a> - <a class="dropdown-item" href="https://getbootstrap.com/docs/3.4/">v3.4.1</a> - <a class="dropdown-item" href="https://getbootstrap.com/2.3.2/">v2.3.2</a> - <div class="dropdown-divider"></div> - <a class="dropdown-item" href="/docs/versions/">All versions</a> - </div> + <ul class="dropdown-menu dropdown-menu-md-right" aria-labelledby="bd-versions"> + <li><a class="dropdown-item current" aria-current="true" href="/docs/{{ .Site.Params.docs_version }}/">Latest (5.0.x)</a></li> + <li><hr class="dropdown-divider"></li> + <li><a class="dropdown-item" href="https://getbootstrap.com/docs/4.4/">v4.4.1</a></li> + <li><a class="dropdown-item" href="https://getbootstrap.com/docs/3.4/">v3.4.1</a></li> + <li><a class="dropdown-item" href="https://getbootstrap.com/2.3.2/">v2.3.2</a></li> + <li><hr class="dropdown-divider"></li> + <li><a class="dropdown-item" href="/docs/versions/">All versions</a></li> + </ul> </div> diff --git a/site/layouts/shortcodes/scss-docs.html b/site/layouts/shortcodes/scss-docs.html new file mode 100644 index 000000000..4a525e4de --- /dev/null +++ b/site/layouts/shortcodes/scss-docs.html @@ -0,0 +1,33 @@ +{{- /* + 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" -}} + +{{- $start := printf "// scss-docs-start %s\n" $name -}} +{{- $end := printf "\n// scss-docs-end %s" $name -}} +{{- $regex := printf "%s(.|\n)*%s" $start $end -}} + +{{- $css := readFile $file -}} +{{- $match := findRE $regex $css 1 -}} + +{{- if (eq (len $match) 0) -}} + {{- errorf "Got no matches for %q in %q! (called in %q)" $name $file $.Page.Path -}} +{{- end -}} + +{{- $remove_start := replace (index $match 0) $start "" -}} +{{- $result := replace $remove_start $end "" -}} + +{{- if (ne $strip_default "false") -}} + {{- $result = replace $result " !default" "" -}} +{{- end -}} + +{{- highlight $result "scss" "" -}} |
