Add all config to docshelper.json

Also consolidate so the mediaTypes and outputFormats are listed once only.

Fixes #11328
This commit is contained in:
Bjørn Erik Pedersen 2023-08-07 10:52:52 +02:00
parent a7e1e9be85
commit 420f7aa698
6 changed files with 987 additions and 691 deletions

View File

@ -112,7 +112,7 @@ deep
Note that you don't need to be so verbose as in the default setup below; a `_merge` value higher up will be inherited if not set. Note that you don't need to be so verbose as in the default setup below; a `_merge` value higher up will be inherited if not set.
{{< code-toggle config="mergeStrategy" skipHeader=true />}} {{< code-toggle file="hugo" dataKey="config_helpers.mergeStrategy" skipHeader=true />}}
## All configuration settings ## All configuration settings

View File

@ -20,7 +20,7 @@ A [media type] (also known as _MIME type_ and _content type_) is a two-part iden
This is the full set of built-in media types in Hugo: This is the full set of built-in media types in Hugo:
{{< datatable "media" "types" "type" "suffixes" >}} {{< datatable "config" "mediaTypes" "_key" "suffixes" >}}
**Note:** **Note:**
@ -61,7 +61,7 @@ Given a media type and some additional configuration, you get an **Output Format
This is the full set of Hugo's built-in output formats: This is the full set of Hugo's built-in output formats:
{{< datatable "output" "formats" "name" "mediaType" "path" "baseName" "rel" "protocol" "isPlainText" "isHTML" "noUgly" "permalinkable" >}} {{< datatable "config" "outputFormats" "name" "mediaType" "path" "baseName" "rel" "protocol" "isPlainText" "isHTML" "noUgly" "permalinkable" >}}
- A page can be output in as many output formats as you want, and you can have an infinite amount of output formats defined **as long as they resolve to a unique path on the file system**. In the above table, the best example of this is `AMP` vs. `HTML`. `AMP` has the value `amp` for `Path` so it doesn't overwrite the `HTML` version; e.g. we can now have both `/index.html` and `/amp/index.html`. - A page can be output in as many output formats as you want, and you can have an infinite amount of output formats defined **as long as they resolve to a unique path on the file system**. In the above table, the best example of this is `AMP` vs. `HTML`. `AMP` has the value `amp` for `Path` so it doesn't overwrite the `HTML` version; e.g. we can now have both `/index.html` and `/amp/index.html`.
- The `MediaType` must match the `Type` of an already defined media type. - The `MediaType` must match the `Type` of an already defined media type.

File diff suppressed because it is too large Load Diff

View File

@ -2,13 +2,18 @@
<div class="w-100 ph4 pb5 pb6-ns pt1 mt4 pt3-ns"> <div class="w-100 ph4 pb5 pb6-ns pt1 mt4 pt3-ns">
<div class="flex-l"> <div class="flex-l">
<div class="order-2 w-100 w-20-l ph5-m ph0-l mb4 sticky"> <div class="order-2 w-100 w-20-l ph5-m ph0-l mb4 sticky">
<aside class="fixed-lTK mw5-l right-0 f6 bl-l b--moon-gray pv4 pv0-ns ph4-l nested-list-reset nested-links nested-copy-line-height"> <aside
class="fixed-lTK mw5-l right-0 f6 bl-l b--moon-gray pv4 pv0-ns ph4-l nested-list-reset nested-links nested-copy-line-height">
<p class="b">What's on this Page</p> <p class="b">What's on this Page</p>
<ul> <ul>
<li><a href="#last-updated">Last Updated</a></li> <li><a href="#last-updated">Last Updated</a></li>
<li><a href="#least-recently-updated">Least Recently Updated</a></li> <li>
<a href="#least-recently-updated">Least Recently Updated</a>
</li>
<li><a href="#todos">Pages marked with TODO</a></li> <li><a href="#todos">Pages marked with TODO</a></li>
<li><a href="#dependencies">Project dependencies (Hugo Modules)</a></li> <li>
<a href="#dependencies">Project dependencies (Hugo Modules)</a>
</li>
</ul> </ul>
</aside> </aside>
</div> </div>
@ -31,6 +36,7 @@
<h2 id="todos">Pages marked with TODO</h2> <h2 id="todos">Pages marked with TODO</h2>
{{ partial "maintenance-pages-table.html" (.Scratch.Get "todos") }} {{ partial "maintenance-pages-table.html" (.Scratch.Get "todos") }}
<h2 id="dependencies">Dependencies</h2> <h2 id="dependencies">Dependencies</h2>
<table class="collapse ba br2 b--black-10 pv2 ph3"> <table class="collapse ba br2 b--black-10 pv2 ph3">
<thead> <thead>
@ -47,21 +53,25 @@
{{ range $index, $element := hugo.Deps }} {{ range $index, $element := hugo.Deps }}
<tr class="striped--light-gray"> <tr class="striped--light-gray">
<th class="pv2 ph3">{{ add $index 1 }}</th> <th class="pv2 ph3">{{ add $index 1 }}</th>
<td class="pv2 ph3">{{ with $element.Owner }}{{.Path }}{{ end }}</td> <td class="pv2 ph3">
{{ with $element.Owner }}{{ .Path }}{{ end }}
</td>
<td class="pv2 ph3"> <td class="pv2 ph3">
{{ $element.Path }} {{ $element.Path }}
{{ with $element.Replace }} {{ with $element.Replace }}
=> {{ .Path }} =>
{{ .Path }}
{{ end }} {{ end }}
</td> </td>
<td class="pv2 ph3">{{ $element.Version }}</td> <td class="pv2 ph3">{{ $element.Version }}</td>
<td class="pv2 ph3">{{ with $element.Time }}{{ . }}{{ end }}</td> <td class="pv2 ph3">
{{ with $element.Time }}{{ . }}{{ end }}
</td>
<td class="pv2 ph3">{{ $element.Vendor }}</td> <td class="pv2 ph3">{{ $element.Vendor }}</td>
</tr> </tr>
{{ end }} {{ end }}
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>

View File

@ -12,6 +12,7 @@ Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
{{- /* Initialize. */}} {{- /* Initialize. */}}
{{- $config := "" }} {{- $config := "" }}
{{- $dataKey := "" }}
{{- $copy := true }} {{- $copy := true }}
{{- $file := "" }} {{- $file := "" }}
{{- $fm := false }} {{- $fm := false }}
@ -19,6 +20,7 @@ Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
{{- /* Get parameters. */}} {{- /* Get parameters. */}}
{{- $config = .Get "config" }} {{- $config = .Get "config" }}
{{- $dataKey = .Get "dataKey" }}
{{- $file = .Get "file" }} {{- $file = .Get "file" }}
{{- if in (slice "false" false 0) (.Get "copy") }} {{- if in (slice "false" false 0) (.Get "copy") }}
{{- $copy = false }} {{- $copy = false }}
@ -43,14 +45,18 @@ Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
{{- /* Render. */}} {{- /* Render. */}}
{{- $code := "" }} {{- $code := "" }}
{{- with $config }} {{- if $config }}
{{- $file = $file | default "hugo" }} {{- $file = $file | default "hugo" }}
{{- $sections := (split . ".") }} {{- $sections := (split $config ".") }}
{{- $configSection := index $.Site.Data.docs.config $sections }} {{- $configSection := index $.Site.Data.docs.config $sections }}
{{- $code = dict $sections $configSection }} {{- $code = dict $sections $configSection }}
{{- if $skipHeader }} {{- if $skipHeader }}
{{- $code = $configSection }} {{- $code = $configSection }}
{{- end }} {{- end }}
{{- else if $dataKey }}
{{- $file = $file | default $dataKey }}
{{- $sections := (split $dataKey ".") }}
{{- $code = index $.Site.Data.docs $sections }}
{{- else }} {{- else }}
{{- $code = $.Inner }} {{- $code = $.Inner }}
{{- end }} {{- end }}
@ -62,7 +68,9 @@ Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
</div> </div>
{{- end }} {{- end }}
{{- range $langs }} {{- range $langs }}
<button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" "" }} ba san-serif f6 dib lh-solid ph2 pv2"> <button
data-toggle-tab="{{ . }}"
class="tab-button {{ cond (eq . "yaml") "active" "" }} ba san-serif f6 dib lh-solid ph2 pv2">
{{ . }} {{ . }}
</button> </button>
&nbsp; &nbsp;
@ -70,7 +78,9 @@ Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
</div> </div>
<div class="tab-content"> <div class="tab-content">
{{- range $langs }} {{- range $langs }}
<div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" "" }}"> <div
data-pane="{{ . }}"
class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" "" }}">
{{- $hCode := $code | transform.Remarshal . }} {{- $hCode := $code | transform.Remarshal . }}
{{- if and $fm (in (slice "toml" "yaml") .) }} {{- if and $fm (in (slice "toml" "yaml") .) }}
{{- $hCode = printf "%s\n%s\n%s" $placeHolder $hCode $placeHolder }} {{- $hCode = printf "%s\n%s\n%s" $placeHolder $hCode $placeHolder }}
@ -79,7 +89,11 @@ Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
{{ highlight $hCode . "" | replaceRE $placeHolder (index $delimiters .) | safeHTML }} {{ highlight $hCode . "" | replaceRE $placeHolder (index $delimiters .) | safeHTML }}
</div> </div>
{{- if $copy }} {{- if $copy }}
<button class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button"></button> <button
class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2"
title="Copy this code to your clipboard."
data-clipboard-action="copy"
aria-label="copy button"></button>
{{- /* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}} {{- /* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -3,19 +3,30 @@
{{ $list := (index (index .Site.Data.docs $package) $listname) }} {{ $list := (index (index .Site.Data.docs $package) $listname) }}
{{ $fields := after 2 .Params }} {{ $fields := after 2 .Params }}
<table class="table table-bordered"> <table class="table table-bordered">
<tr> <tr>
{{ range $fields }} {{ range $fields }}
<th>{{ . }}</th> {{ $s := . }}
{{ if eq $s "_key" }}
{{ $s = "Type" }}
{{ end }}
<th>{{ $s }}</th>
{{ end }} {{ end }}
</tr> </tr>
{{ range $list }} {{ range $k1, $v1 := $list }}
<tr> <tr>
{{ range $k, $v := . }} {{ range $k2, $v2 := . }}
{{ $.Scratch.Set $k $v }} {{ $.Scratch.Set $k2 $v2 }}
{{ end }} {{ end }}
{{ range $fields }} {{ range $fields }}
<td>{{ $.Scratch.Get . }}</td> {{ $s := "" }}
{{ if eq . "_key" }}
{{ $s = $k1 }}
{{ else }}
{{ $s = $.Scratch.Get . }}
{{ end }}
<td>{{ $s }}</td>
{{ end }} {{ end }}
</tr> </tr>
{{ end }} {{ end }}