mirror of https://github.com/twbs/bootstrap.git
Merge 7640243cec
into 99a0dc628a
This commit is contained in:
commit
cff2ab8fe2
|
@ -92,8 +92,6 @@ Using Sass variables, you may customize the overflow utilities by changing the `
|
|||
|
||||
## CSS
|
||||
|
||||
### Sass utilities API
|
||||
|
||||
Overflow utilities are declared in our utilities API in `scss/_utilities.scss`. [Learn how to use the utilities API.]({{< docsref "/utilities/api#using-the-api" >}})
|
||||
|
||||
{{< scss-docs name="utils-overflow" file="scss/_utilities.scss" >}}
|
||||
{{< sass-utilities-api-section title="Overflow" name="utils-overflow" file="scss/_utilities.scss" >}}
|
||||
{{% docsref urlPath="/utilities/api#using-the-api/" %}}
|
||||
{{< /sass-utilities-api-section >}}
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
{{- /*
|
||||
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 := .Params.name -}}
|
||||
{{- $file := .Params.file -}}
|
||||
{{- $strip_default := .Get "strip-default" | default "true" -}}
|
||||
|
||||
{{- /* If any parameters are missing, print an error and exit */ -}}
|
||||
{{- if or (not $name) (not $file) -}}
|
||||
{{- errorf "%s: %q: Missing required parameters! Got: name=%q file=%q!" .Position .Name $name $file -}}
|
||||
{{- else -}}
|
||||
{{- $capture_start := printf "// scss-docs-start %s\n" $name -}}
|
||||
{{- $capture_end := printf "// scss-docs-end %s\n" $name -}}
|
||||
{{- $regex := printf `%s((?:.|\n)*)%s` $capture_start $capture_end -}}
|
||||
{{- $regex_nested := printf `// scss-docs-.*\n` -}}
|
||||
|
||||
{{- /*
|
||||
TODO: figure out why we can't do the following and get the first group (the only capturing one)...
|
||||
$regex := printf `(?:// scss-docs-start %s\n)((?:.|\n)*)(?:\n// scss-docs-end %s)` $name $name
|
||||
*/ -}}
|
||||
|
||||
{{- $match := findRE $regex (readFile $file) -}}
|
||||
{{- $match = index $match 0 -}}
|
||||
|
||||
{{- if not $match -}}
|
||||
{{- errorf "%s: %q: Got no matches for name=%q in file=%q!" .Position .Name $name $file -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $match = replace $match $capture_start "" -}}
|
||||
{{- $match = replace $match $capture_end "" -}}
|
||||
|
||||
{{- $match_nested := findRE $regex_nested $match -}}
|
||||
{{- range $to_remove := $match_nested -}}
|
||||
{{- $match = replace $match $to_remove "" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (ne $strip_default "false") -}}
|
||||
{{- $match = replace $match " !default" "" -}}
|
||||
{{- end -}}
|
||||
|
||||
<div class="bd-example-snippet bd-code-snippet bd-file-ref">
|
||||
<div class="d-flex align-items-center highlight-toolbar ps-3 pe-2 py-1 border-bottom">
|
||||
<a class="font-monospace link-secondary link-underline-secondary link-underline-opacity-0 link-underline-opacity-100-hover small" href="{{ .Site.Params.repo }}/blob/v{{ .Site.Params.current_version }}/{{ $file | replaceRE `\\` "/" }}">
|
||||
{{- $file -}}
|
||||
</a>
|
||||
<div class="d-flex ms-auto">
|
||||
<button type="button" class="btn-clipboard mt-0 me-0" title="Copy to clipboard">
|
||||
<svg class="bi" aria-hidden="true"><use xlink:href="#clipboard"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{- $unindent := 0 -}}
|
||||
{{- $found := false -}}
|
||||
{{- $first_line:= index (split $match "\n") 0 -}}
|
||||
{{- range $char := split $first_line "" -}}
|
||||
{{- if and (eq $char " ") (not $found) -}}
|
||||
{{- $unindent = add $unindent 1 -}}
|
||||
{{- else -}}
|
||||
{{- $found = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $output := "" -}}
|
||||
{{- if (gt $unindent 0) -}}
|
||||
{{- $prefix := (strings.Repeat $unindent " ") -}}
|
||||
{{- range $line := split $match "\n" -}}
|
||||
{{- $line = strings.TrimPrefix $prefix $line -}}
|
||||
{{ $output = printf "%s%s\n" $output $line }}
|
||||
{{- end -}}
|
||||
{{- $output = chomp $output -}}
|
||||
{{- else -}}
|
||||
{{- $output = $match -}}
|
||||
{{- end -}}
|
||||
{{- highlight $output "scss" "" -}}
|
||||
</div>
|
||||
{{- end -}}
|
|
@ -1,2 +1,9 @@
|
|||
{{- $pageToReference := path.Join "docs" $.Site.Params.docs_version (.Get 0) -}}
|
||||
{{- $urlPath := .Get "urlPath" -}}
|
||||
|
||||
{{- if and (not $urlPath) (index .Params 0) -}}
|
||||
{{- $urlPath = index .Params 0 -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $pageToReference := path.Join "docs" $.Site.Params.docs_version $urlPath -}}
|
||||
|
||||
{{- relref . $pageToReference | relURL -}}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<h3>Sass utilities API</h3>
|
||||
|
||||
<p>
|
||||
{{ index .Params.title }} utilities are declared in our utilities API in <code>scss/_utilities.scss</code>. <a href="{{ replaceRE "(\\s)" "" .Inner }}">Learn how to use the utilities API.</a>
|
||||
</p>
|
||||
|
||||
{{- partial "scss-docs" . -}}
|
|
@ -1,82 +1 @@
|
|||
{{- /*
|
||||
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" -}}
|
||||
|
||||
{{- /* If any parameters are missing, print an error and exit */ -}}
|
||||
{{- if or (not $name) (not $file) -}}
|
||||
{{- errorf "%s: %q: Missing required parameters! Got: name=%q file=%q!" .Position .Name $name $file -}}
|
||||
{{- else -}}
|
||||
{{- $capture_start := printf "// scss-docs-start %s\n" $name -}}
|
||||
{{- $capture_end := printf "// scss-docs-end %s\n" $name -}}
|
||||
{{- $regex := printf `%s((?:.|\n)*)%s` $capture_start $capture_end -}}
|
||||
{{- $regex_nested := printf `// scss-docs-.*\n` -}}
|
||||
|
||||
{{- /*
|
||||
TODO: figure out why we can't do the following and get the first group (the only capturing one)...
|
||||
$regex := printf `(?:// scss-docs-start %s\n)((?:.|\n)*)(?:\n// scss-docs-end %s)` $name $name
|
||||
*/ -}}
|
||||
|
||||
{{- $match := findRE $regex (readFile $file) -}}
|
||||
{{- $match = index $match 0 -}}
|
||||
|
||||
{{- if not $match -}}
|
||||
{{- errorf "%s: %q: Got no matches for name=%q in file=%q!" .Position .Name $name $file -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $match = replace $match $capture_start "" -}}
|
||||
{{- $match = replace $match $capture_end "" -}}
|
||||
|
||||
{{- $match_nested := findRE $regex_nested $match -}}
|
||||
{{- range $to_remove := $match_nested -}}
|
||||
{{- $match = replace $match $to_remove "" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (ne $strip_default "false") -}}
|
||||
{{- $match = replace $match " !default" "" -}}
|
||||
{{- end -}}
|
||||
|
||||
<div class="bd-example-snippet bd-code-snippet bd-file-ref">
|
||||
<div class="d-flex align-items-center highlight-toolbar ps-3 pe-2 py-1 border-bottom">
|
||||
<a class="font-monospace link-secondary link-underline-secondary link-underline-opacity-0 link-underline-opacity-100-hover small" href="{{ .Site.Params.repo }}/blob/v{{ .Site.Params.current_version }}/{{ $file | replaceRE `\\` "/" }}">
|
||||
{{- $file -}}
|
||||
</a>
|
||||
<div class="d-flex ms-auto">
|
||||
<button type="button" class="btn-clipboard mt-0 me-0" title="Copy to clipboard">
|
||||
<svg class="bi" aria-hidden="true"><use xlink:href="#clipboard"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{- $unindent := 0 -}}
|
||||
{{- $found := false -}}
|
||||
{{- $first_line:= index (split $match "\n") 0 -}}
|
||||
{{- range $char := split $first_line "" -}}
|
||||
{{- if and (eq $char " ") (not $found) -}}
|
||||
{{- $unindent = add $unindent 1 -}}
|
||||
{{- else -}}
|
||||
{{- $found = true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $output := "" -}}
|
||||
{{- if (gt $unindent 0) -}}
|
||||
{{- $prefix := (strings.Repeat $unindent " ") -}}
|
||||
{{- range $line := split $match "\n" -}}
|
||||
{{- $line = strings.TrimPrefix $prefix $line -}}
|
||||
{{ $output = printf "%s%s\n" $output $line }}
|
||||
{{- end -}}
|
||||
{{- $output = chomp $output -}}
|
||||
{{- else -}}
|
||||
{{- $output = $match -}}
|
||||
{{- end -}}
|
||||
{{- highlight $output "scss" "" -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- partial "scss-docs" . }}
|
||||
|
|
Loading…
Reference in New Issue