Compare commits

...
Sign in to create a new pull request.

4 commits

Author SHA1 Message Date
XhmikosR
5bcb6df688 Use the gh shortcode 2021-01-13 23:08:08 +02:00
XhmikosR
1e4d088c00 Revert "WIP" 2021-01-13 22:59:00 +02:00
XhmikosR
d51374f9b9 WIP 2021-01-13 22:59:00 +02:00
XhmikosR
e3624bb986 Add a gh shortcode 2021-01-13 22:59:00 +02:00
4 changed files with 28 additions and 3 deletions

View file

@ -198,7 +198,7 @@ Note that for security reasons the `sanitize`, `sanitizeFn`, and `allowList` opt
<td><code>selector</code></td> <td><code>selector</code></td>
<td>string | false</td> <td>string | false</td>
<td><code>false</code></td> <td><code>false</code></td>
<td>If a selector is provided, popover objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See <a href="{{< param repo >}}/issues/4215">this</a> and <a href="https://codepen.io/team/bootstrap/pen/zYBXGwX?editors=1010">an informative example</a>.</td> <td>If a selector is provided, popover objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See {{< gh "issue 4215" >}} and <a href="https://codepen.io/team/bootstrap/pen/zYBXGwX?editors=1010">an informative example</a>.</td>
</tr> </tr>
<tr> <tr>
<td><code>template</code></td> <td><code>template</code></td>

View file

@ -220,7 +220,7 @@ Note that for security reasons the `sanitize`, `sanitizeFn`, and `allowList` opt
<td><code>selector</code></td> <td><code>selector</code></td>
<td>string | false</td> <td>string | false</td>
<td><code>false</code></td> <td><code>false</code></td>
<td>If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to also apply tooltips to dynamically added DOM elements (<code>jQuery.on</code> support). See <a href="{{< param repo >}}/issues/4215">this</a> and <a href="https://codepen.io/team/bootstrap/pen/zYBXGwX?editors=1010">an informative example</a>.</td> <td>If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to also apply tooltips to dynamically added DOM elements (<code>jQuery.on</code> support). See {{< gh "issue 4215" >}} and <a href="https://codepen.io/team/bootstrap/pen/zYBXGwX?editors=1010">an informative example</a>.</td>
</tr> </tr>
<tr> <tr>
<td><code>template</code></td> <td><code>template</code></td>

View file

@ -169,7 +169,7 @@ While this approach is understandable, please pay attention to the following:
1. When switching `.ltr` and `.rtl`, make sure you add `dir` and `lang` attributes accordingly. 1. When switching `.ltr` and `.rtl`, make sure you add `dir` and `lang` attributes accordingly.
2. Loading both files can be a real performance bottleneck: consider some [optimization]({{< docsref "/customize/optimize" >}}), and maybe try to [load one of those files asynchronously](https://www.filamentgroup.com/lab/load-css-simpler/). 2. Loading both files can be a real performance bottleneck: consider some [optimization]({{< docsref "/customize/optimize" >}}), and maybe try to [load one of those files asynchronously](https://www.filamentgroup.com/lab/load-css-simpler/).
3. Nesting styles this way will prevent our `form-validation-state()` mixin from working as intended, thus require you tweak it a bit by yourself. [See #31223](https://github.com/twbs/bootstrap/issues/31223). 3. Nesting styles this way will prevent our `form-validation-state()` mixin from working as intended, thus require you tweak it a bit by yourself. See {{< gh "issue 31223" >}}.
{{< /callout >}} {{< /callout >}}
## The breadcrumb case ## The breadcrumb case

View file

@ -0,0 +1,25 @@
{{- /*
Usage: gh "foo", where foo can be:
* "pr 1" -> <a href="https://github.com/twbs/bootstrap/pull/1">#1</a>
* "issue 2" -> <a href="https://github.com/twbs/bootstrap/issues/2">#2</a>
* "@XhmikosR" -> <a href="https://github.com/XhmikosR">@XhmikosR</a>
* "a3b09530fb31cfe6bd14d49965c19e8f89c1b023" -> <a href="https://github.com/twbs/bootstrap/commit/a3b09530fb31cfe6bd14d49965c19e8f89c1b023">a3b0953</a>
* "a3b0953" -> <a href="https://github.com/twbs/bootstrap/commit/a3b09530fb31cfe6bd14d49965c19e8f89c1b023">a3b0953</a>
Quotes are not always needed, but Hugo can choke on some characters like @, in which case wrap the parameter with quotes. Also, they are needed for PR and Issue
*/ -}}
{{ range .Params -}}
{{- if hasPrefix . "@" -}}
<a href="https://github.com/{{ substr . 1 }}">{{ . }}</a>
{{- else if hasPrefix (. | lower) "pr" -}}
<a href="{{ $.Site.Params.repo }}/pull/{{ trim (substr . 2) " " }}">#{{ trim (substr . 2) " " }}</a>
{{- else if hasPrefix (. | lower) "issue" -}}
<a href="{{ $.Site.Params.repo }}/issues/{{ trim (substr . 5) " " }}">#{{ trim (substr . (len "issue")) " " }}</a>
{{- else if or (eq (len .) 7) (eq (len .) 40) -}}
<a href="{{ $.Site.Params.repo }}/commit/{{ trim . " " }}">{{ trim (substr . 0 7) " " }}</a>
{{- else -}}
{{ errorf `Wrong parameter passed in %q shortcode: %s` $.Name $.Position }}
{{- end -}}
{{- end -}}