]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Add all config to docshelper.json
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 7 Aug 2023 08:52:52 +0000 (10:52 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 7 Aug 2023 11:42:54 +0000 (13:42 +0200)
Also consolidate so the mediaTypes and outputFormats are listed once only.

Fixes #11328

16 files changed:
commands/gen.go
config/allconfig/alldecoders.go
config/allconfig/docshelper.go [new file with mode: 0644]
config/docshelper.go [deleted file]
config/security/docshelper.go [deleted file]
docs/content/en/getting-started/configuration.md
docs/content/en/templates/output-formats.md
docs/data/docs.json
docs/layouts/maintenance/list.html
docs/layouts/shortcodes/code-toggle.html
docs/layouts/shortcodes/datatable.html
docshelper/docs.go
markup/markup_config/config.go
media/docshelper.go [deleted file]
minifiers/config.go
output/docshelper.go

index 1a3cf2174e6ac9a58a48412e8b8fa37d09ace7a2..02df720c8c774527662697847bc3c7876eb7bfa8 100644 (file)
@@ -30,6 +30,8 @@ import (
        "github.com/gohugoio/hugo/docshelper"
        "github.com/gohugoio/hugo/helpers"
        "github.com/gohugoio/hugo/hugofs"
+       "github.com/gohugoio/hugo/hugolib"
+       "github.com/gohugoio/hugo/parser"
        "github.com/spf13/cobra"
        "github.com/spf13/cobra/doc"
 )
@@ -197,6 +199,14 @@ url: %s
                                enc := json.NewEncoder(f)
                                enc.SetIndent("", "  ")
 
+                               configProvider := func() docshelper.DocProvider {
+                                       conf := hugolib.DefaultConfig()
+                                       conf.CacheDir = "" // The default value does not make sense in the docs.
+                                       defaultConfig := parser.LowerCaseCamelJSONMarshaller{Value: conf}
+                                       return docshelper.DocProvider{"config": defaultConfig}
+                               }
+
+                               docshelper.AddDocProviderFunc(configProvider)
                                if err := enc.Encode(docshelper.GetDocProvider()); err != nil {
                                        return err
                                }
index 6b8a4568cfdd4b148686f1eb2a1a3972e3b791e0..24f9b9677aadde9641c035e156a03b4cd03c1f98 100644 (file)
@@ -49,10 +49,11 @@ type decodeConfig struct {
 }
 
 type decodeWeight struct {
-       key         string
-       decode      func(decodeWeight, decodeConfig) error
-       getCompiler func(c *Config) configCompiler
-       weight      int
+       key                  string
+       decode               func(decodeWeight, decodeConfig) error
+       getCompiler          func(c *Config) configCompiler
+       weight               int
+       internalOrDeprecated bool // Hide it from the docs.
 }
 
 var allDecoderSetups = map[string]decodeWeight{
@@ -340,6 +341,7 @@ var allDecoderSetups = map[string]decodeWeight{
                        p.c.Author = maps.CleanConfigStringMap(p.p.GetStringMap(d.key))
                        return nil
                },
+               internalOrDeprecated: true,
        },
        "social": {
                key: "social",
@@ -347,6 +349,7 @@ var allDecoderSetups = map[string]decodeWeight{
                        p.c.Social = maps.CleanConfigStringMapString(p.p.GetStringMapString(d.key))
                        return nil
                },
+               internalOrDeprecated: true,
        },
        "uglyurls": {
                key: "uglyurls",
@@ -362,12 +365,14 @@ var allDecoderSetups = map[string]decodeWeight{
                        }
                        return nil
                },
+               internalOrDeprecated: true,
        },
        "internal": {
                key: "internal",
                decode: func(d decodeWeight, p decodeConfig) error {
                        return mapstructure.WeakDecode(p.p.GetStringMap(d.key), &p.c.Internal)
                },
+               internalOrDeprecated: true,
        },
 }
 
diff --git a/config/allconfig/docshelper.go b/config/allconfig/docshelper.go
new file mode 100644 (file)
index 0000000..48a09de
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright 2023 The Hugo Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package allconfig
+
+import (
+       "github.com/gohugoio/hugo/common/maps"
+       "github.com/gohugoio/hugo/config"
+       "github.com/gohugoio/hugo/docshelper"
+)
+
+// This is is just some helpers used to create some JSON used in the Hugo docs.
+func init() {
+       docsProvider := func() docshelper.DocProvider {
+
+               cfg := config.New()
+               for configRoot, v := range allDecoderSetups {
+                       if v.internalOrDeprecated {
+                               continue
+                       }
+                       cfg.Set(configRoot, make(maps.Params))
+               }
+               lang := maps.Params{
+                       "en": maps.Params{
+                               "menus":  maps.Params{},
+                               "params": maps.Params{},
+                       },
+               }
+               cfg.Set("languages", lang)
+               cfg.SetDefaultMergeStrategy()
+
+               configHelpers := map[string]any{
+                       "mergeStrategy": cfg.Get(""),
+               }
+               return docshelper.DocProvider{"config_helpers": configHelpers}
+       }
+
+       docshelper.AddDocProviderFunc(docsProvider)
+}
diff --git a/config/docshelper.go b/config/docshelper.go
deleted file mode 100644 (file)
index e34c53c..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2021 The Hugo Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package config
-
-import (
-       "github.com/gohugoio/hugo/common/maps"
-       "github.com/gohugoio/hugo/docshelper"
-)
-
-// This is is just some helpers used to create some JSON used in the Hugo docs.
-func init() {
-       docsProvider := func() docshelper.DocProvider {
-
-               cfg := New()
-               for _, configRoot := range ConfigRootKeys {
-                       cfg.Set(configRoot, make(maps.Params))
-               }
-               lang := maps.Params{
-                       "en": maps.Params{
-                               "menus":  maps.Params{},
-                               "params": maps.Params{},
-                       },
-               }
-               cfg.Set("languages", lang)
-               cfg.SetDefaultMergeStrategy()
-
-               configHelpers := map[string]any{
-                       "mergeStrategy": cfg.Get(""),
-               }
-               return docshelper.DocProvider{"config": configHelpers}
-       }
-
-       docshelper.AddDocProviderFunc(docsProvider)
-}
diff --git a/config/security/docshelper.go b/config/security/docshelper.go
deleted file mode 100644 (file)
index ade0356..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2021 The Hugo Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package security
-
-import (
-       "github.com/gohugoio/hugo/docshelper"
-)
-
-func init() {
-       docsProvider := func() docshelper.DocProvider {
-
-               return docshelper.DocProvider{"config": DefaultConfig.ToSecurityMap()}
-       }
-       docshelper.AddDocProviderFunc(docsProvider)
-}
index ea82f1b53be51cfb86c19bb56ea84b4f07f308ee..2ed46cb10640cebb01fc44ab0d99fc2733a28b04 100644 (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.
 
-{{< code-toggle config="mergeStrategy" skipHeader=true />}}
+{{< code-toggle file="hugo" dataKey="config_helpers.mergeStrategy" skipHeader=true />}}
 
 ## All configuration settings
 
index 3983acc2440e81e35c6b6e225f640d1507bb7ddc..d1f5f3bfe488f07c3961ec5bf1003b9a17008fe6 100644 (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:
 
-{{< datatable "media" "types" "type" "suffixes" >}}
+{{< datatable "config" "mediaTypes" "_key" "suffixes" >}}
 
 **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:
 
-{{< 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`.
 - The `MediaType` must match the `Type` of an already defined media type.
index 8d130b2fc988423887ccadda9ba334273184c88a..23f9710bb6f50b7b940576c155d91060b183ea04 100644 (file)
     ]
   },
   "config": {
+    "baseURL": "",
+    "buildDrafts": false,
+    "buildExpired": false,
+    "buildFuture": false,
+    "copyright": "",
+    "defaultContentLanguage": "en",
+    "defaultContentLanguageInSubdir": false,
+    "disableAliases": false,
+    "disablePathToLower": false,
+    "disableKinds": null,
+    "disableLanguages": null,
+    "disableHugoGeneratorInject": false,
+    "disableLiveReload": false,
+    "enableEmoji": false,
+    "mainSections": null,
+    "enableRobotsTXT": false,
+    "enableGitInfo": false,
+    "templateMetrics": false,
+    "templateMetricsHints": false,
+    "noBuildLock": false,
+    "ignoreErrors": null,
+    "ignoreFiles": [],
+    "ignoreCache": false,
+    "enableMissingTranslationPlaceholders": false,
+    "panicOnWarning": false,
+    "environment": "production",
+    "languageCode": "",
+    "hasCJKLanguage": false,
+    "paginate": 10,
+    "paginatePath": "page",
+    "pluralizeListTitles": true,
+    "canonifyURLs": false,
+    "relativeURLs": false,
+    "removePathAccents": false,
+    "printUnusedTemplates": false,
+    "printI18nWarnings": false,
+    "printPathWarnings": false,
+    "refLinksNotFoundURL": "",
+    "refLinksErrorLevel": "",
+    "sectionPagesMenu": "",
+    "summaryLength": 70,
+    "title": "",
+    "theme": null,
+    "timeout": "30s",
+    "timeZone": "",
+    "titleCaseStyle": "AP",
+    "newContentEditor": "",
+    "noTimes": false,
+    "noChmod": false,
+    "cleanDestinationDir": false,
+    "ignoreVendorPaths": "",
+    "themesDir": "themes",
+    "publishDir": "public",
+    "resourceDir": "resources",
+    "workingDir": "",
+    "cacheDir": "",
+    "contentDir": "content",
+    "dataDir": "data",
+    "layoutDir": "layouts",
+    "i18nDir": "i18n",
+    "archeTypeDir": "archetypes",
+    "assetDir": "assets",
+    "staticDir": [
+      "static"
+    ],
+    "staticDir0": null,
+    "staticDir1": null,
+    "staticDir2": null,
+    "staticDir3": null,
+    "staticDir4": null,
+    "staticDir5": null,
+    "staticDir6": null,
+    "staticDir7": null,
+    "staticDir8": null,
+    "staticDir9": null,
+    "staticDir10": null,
+    "author": {},
+    "social": null,
+    "build": {
+      "useResourceCacheWhen": "fallback",
+      "buildStats": {
+        "enable": false,
+        "disableTags": false,
+        "disableClasses": false,
+        "disableIDs": false
+      },
+      "noJSConfigInAssets": false,
+      "cacheBusters": [
+        {
+          "source": "assets/.*\\.(js|ts|jsx|tsx)",
+          "target": "(js|scripts|javascript)"
+        },
+        {
+          "source": "assets/.*\\.(css|sass|scss)$",
+          "target": "(css|styles|scss|sass)"
+        },
+        {
+          "source": "(postcss|tailwind)\\.config\\.js",
+          "target": "(css|styles|scss|sass)"
+        },
+        {
+          "source": "assets/.*\\.(.*)$",
+          "target": "$1"
+        }
+      ]
+    },
+    "caches": {
+      "assets": {
+        "maxAge": -1,
+        "dir": ":resourceDir/_gen",
+        "isResourceDir": true
+      },
+      "getcsv": {
+        "maxAge": -1,
+        "dir": ":cacheDir/:project",
+        "isResourceDir": false
+      },
+      "getjson": {
+        "maxAge": -1,
+        "dir": ":cacheDir/:project",
+        "isResourceDir": false
+      },
+      "getresource": {
+        "maxAge": -1,
+        "dir": ":cacheDir/:project",
+        "isResourceDir": false
+      },
+      "images": {
+        "maxAge": 1800000000000000,
+        "dir": ":cacheDir/images",
+        "isResourceDir": false
+      },
+      "modules": {
+        "maxAge": -1,
+        "dir": ":cacheDir/modules",
+        "isResourceDir": false
+      }
+    },
     "markup": {
       "defaultMarkdownHandler": "goldmark",
       "highlight": {
         "preserveTOC": false
       }
     },
-    "mergeStrategy": {
-      "build": {
-        "_merge": "none"
-      },
-      "caches": {
-        "_merge": "none"
-      },
-      "cascade": {
-        "_merge": "none"
-      },
-      "frontmatter": {
-        "_merge": "none"
-      },
-      "imaging": {
-        "_merge": "none"
-      },
-      "languages": {
-        "_merge": "none",
-        "en": {
-          "_merge": "none",
-          "menus": {
-            "_merge": "shallow"
-          },
-          "params": {
-            "_merge": "deep"
-          }
-        }
-      },
-      "markup": {
-        "_merge": "none"
-      },
-      "mediatypes": {
-        "_merge": "shallow"
-      },
-      "menus": {
-        "_merge": "shallow"
-      },
-      "minify": {
-        "_merge": "none"
-      },
-      "module": {
-        "_merge": "none"
-      },
-      "outputformats": {
-        "_merge": "shallow"
-      },
-      "params": {
-        "_merge": "deep"
-      },
-      "permalinks": {
-        "_merge": "none"
-      },
-      "privacy": {
-        "_merge": "none"
-      },
-      "related": {
-        "_merge": "none"
-      },
-      "security": {
-        "_merge": "none"
-      },
-      "sitemap": {
-        "_merge": "none"
-      },
-      "taxonomies": {
-        "_merge": "none"
-      }
-    },
-    "minify": {
-      "minifyOutput": false,
-      "disableHTML": false,
-      "disableCSS": false,
-      "disableJS": false,
-      "disableJSON": false,
-      "disableSVG": false,
-      "disableXML": false,
-      "tdewolff": {
-        "html": {
-          "keepComments": false,
-          "keepConditionalComments": true,
-          "keepDefaultAttrVals": true,
-          "keepDocumentTags": true,
-          "keepEndTags": true,
-          "keepQuotes": false,
-          "keepWhitespace": false
-        },
-        "css": {
-          "keepCSS2": true,
-          "precision": 0
-        },
-        "js": {
-          "precision": 0,
-          "keepVarNames": false,
-          "version": 2022
-        },
-        "json": {
-          "precision": 0,
-          "keepNumbers": false
-        },
-        "svg": {
-          "keepComments": false,
-          "precision": 0
-        },
-        "xml": {
-          "keepWhitespace": false
-        }
-      }
-    },
-    "security": {
-      "enableInlineShortcodes": false,
-      "exec": {
-        "allow": [
-          "^(dart-)?sass(-embedded)?$",
-          "^go$",
-          "^npx$",
-          "^postcss$"
-        ],
-        "osEnv": [
-          "(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG)$"
-        ]
-      },
-      "funcs": {
-        "getenv": [
-          "^HUGO_",
-          "^CI$"
-        ]
-      },
-      "goTemplates": {
-        "AllowActionJSTmpl": false
-      },
-      "http": {
-        "mediaTypes": null,
-        "methods": [
-          "(?i)GET|POST"
-        ],
-        "urls": [
-          ".*"
-        ]
-      }
-    }
-  },
-  "media": {
-    "types": [
-      {
-        "mainType": "application",
-        "subType": "json",
+    "mediaTypes": {
+      "application/json": {
         "delimiter": ".",
-        "type": "application/json",
-        "string": "application/json",
         "suffixes": [
           "json"
         ]
       },
-      {
-        "mainType": "application",
-        "subType": "manifest",
+      "application/manifest+json": {
         "delimiter": ".",
-        "type": "application/manifest+json",
-        "string": "application/manifest+json",
         "suffixes": [
           "webmanifest"
         ]
       },
-      {
-        "mainType": "application",
-        "subType": "octet-stream",
-        "delimiter": ".",
-        "type": "application/octet-stream",
-        "string": "application/octet-stream",
-        "suffixes": [
-          ""
-        ]
+      "application/octet-stream": {
+        "delimiter": "."
       },
-      {
-        "mainType": "application",
-        "subType": "pdf",
+      "application/pdf": {
         "delimiter": ".",
-        "type": "application/pdf",
-        "string": "application/pdf",
         "suffixes": [
           "pdf"
         ]
       },
-      {
-        "mainType": "application",
-        "subType": "rss",
+      "application/rss+xml": {
         "delimiter": ".",
-        "type": "application/rss+xml",
-        "string": "application/rss+xml",
         "suffixes": [
           "xml",
           "rss"
         ]
       },
-      {
-        "mainType": "application",
-        "subType": "toml",
+      "application/toml": {
         "delimiter": ".",
-        "type": "application/toml",
-        "string": "application/toml",
         "suffixes": [
           "toml"
         ]
       },
-      {
-        "mainType": "application",
-        "subType": "wasm",
+      "application/wasm": {
         "delimiter": ".",
-        "type": "application/wasm",
-        "string": "application/wasm",
         "suffixes": [
           "wasm"
         ]
       },
-      {
-        "mainType": "application",
-        "subType": "xml",
+      "application/xml": {
         "delimiter": ".",
-        "type": "application/xml",
-        "string": "application/xml",
         "suffixes": [
           "xml"
         ]
       },
-      {
-        "mainType": "application",
-        "subType": "yaml",
+      "application/yaml": {
         "delimiter": ".",
-        "type": "application/yaml",
-        "string": "application/yaml",
         "suffixes": [
           "yaml",
           "yml"
         ]
       },
-      {
-        "mainType": "font",
-        "subType": "otf",
+      "font/otf": {
         "delimiter": ".",
-        "type": "font/otf",
-        "string": "font/otf",
         "suffixes": [
           "otf"
         ]
       },
-      {
-        "mainType": "font",
-        "subType": "ttf",
+      "font/ttf": {
         "delimiter": ".",
-        "type": "font/ttf",
-        "string": "font/ttf",
         "suffixes": [
           "ttf"
         ]
       },
-      {
-        "mainType": "image",
-        "subType": "bmp",
+      "image/bmp": {
         "delimiter": ".",
-        "type": "image/bmp",
-        "string": "image/bmp",
         "suffixes": [
           "bmp"
         ]
       },
-      {
-        "mainType": "image",
-        "subType": "gif",
+      "image/gif": {
         "delimiter": ".",
-        "type": "image/gif",
-        "string": "image/gif",
         "suffixes": [
           "gif"
         ]
       },
-      {
-        "mainType": "image",
-        "subType": "jpeg",
+      "image/jpeg": {
         "delimiter": ".",
-        "type": "image/jpeg",
-        "string": "image/jpeg",
         "suffixes": [
           "jpg",
           "jpeg",
           "jfif"
         ]
       },
-      {
-        "mainType": "image",
-        "subType": "png",
+      "image/png": {
         "delimiter": ".",
-        "type": "image/png",
-        "string": "image/png",
         "suffixes": [
           "png"
         ]
       },
-      {
-        "mainType": "image",
-        "subType": "svg",
+      "image/svg+xml": {
         "delimiter": ".",
-        "type": "image/svg+xml",
-        "string": "image/svg+xml",
         "suffixes": [
           "svg"
         ]
       },
-      {
-        "mainType": "image",
-        "subType": "tiff",
+      "image/tiff": {
         "delimiter": ".",
-        "type": "image/tiff",
-        "string": "image/tiff",
         "suffixes": [
           "tif",
           "tiff"
         ]
       },
-      {
-        "mainType": "image",
-        "subType": "webp",
+      "image/webp": {
         "delimiter": ".",
-        "type": "image/webp",
-        "string": "image/webp",
         "suffixes": [
           "webp"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "calendar",
+      "text/calendar": {
         "delimiter": ".",
-        "type": "text/calendar",
-        "string": "text/calendar",
         "suffixes": [
           "ics"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "css",
+      "text/css": {
         "delimiter": ".",
-        "type": "text/css",
-        "string": "text/css",
         "suffixes": [
           "css"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "csv",
+      "text/csv": {
         "delimiter": ".",
-        "type": "text/csv",
-        "string": "text/csv",
         "suffixes": [
           "csv"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "html",
+      "text/html": {
         "delimiter": ".",
-        "type": "text/html",
-        "string": "text/html",
         "suffixes": [
           "html"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "javascript",
+      "text/javascript": {
         "delimiter": ".",
-        "type": "text/javascript",
-        "string": "text/javascript",
         "suffixes": [
           "js",
           "jsm",
           "mjs"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "jsx",
+      "text/jsx": {
         "delimiter": ".",
-        "type": "text/jsx",
-        "string": "text/jsx",
         "suffixes": [
           "jsx"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "markdown",
+      "text/markdown": {
         "delimiter": ".",
-        "type": "text/markdown",
-        "string": "text/markdown",
         "suffixes": [
           "md",
           "markdown"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "plain",
+      "text/plain": {
         "delimiter": ".",
-        "type": "text/plain",
-        "string": "text/plain",
         "suffixes": [
           "txt"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "tsx",
+      "text/tsx": {
         "delimiter": ".",
-        "type": "text/tsx",
-        "string": "text/tsx",
         "suffixes": [
           "tsx"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "typescript",
+      "text/typescript": {
         "delimiter": ".",
-        "type": "text/typescript",
-        "string": "text/typescript",
         "suffixes": [
           "ts"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "x-sass",
+      "text/x-sass": {
         "delimiter": ".",
-        "type": "text/x-sass",
-        "string": "text/x-sass",
         "suffixes": [
           "sass"
         ]
       },
-      {
-        "mainType": "text",
-        "subType": "x-scss",
+      "text/x-scss": {
         "delimiter": ".",
-        "type": "text/x-scss",
-        "string": "text/x-scss",
         "suffixes": [
           "scss"
         ]
       },
-      {
-        "mainType": "video",
-        "subType": "3gpp",
+      "video/3gpp": {
         "delimiter": ".",
-        "type": "video/3gpp",
-        "string": "video/3gpp",
         "suffixes": [
           "3gpp",
           "3gp"
         ]
       },
-      {
-        "mainType": "video",
-        "subType": "mp4",
+      "video/mp4": {
         "delimiter": ".",
-        "type": "video/mp4",
-        "string": "video/mp4",
         "suffixes": [
           "mp4"
         ]
       },
-      {
-        "mainType": "video",
-        "subType": "mpeg",
+      "video/mpeg": {
         "delimiter": ".",
-        "type": "video/mpeg",
-        "string": "video/mpeg",
         "suffixes": [
           "mpg",
           "mpeg"
         ]
       },
-      {
-        "mainType": "video",
-        "subType": "ogg",
+      "video/ogg": {
         "delimiter": ".",
-        "type": "video/ogg",
-        "string": "video/ogg",
         "suffixes": [
           "ogv"
         ]
       },
-      {
-        "mainType": "video",
-        "subType": "webm",
+      "video/webm": {
         "delimiter": ".",
-        "type": "video/webm",
-        "string": "video/webm",
         "suffixes": [
           "webm"
         ]
       },
-      {
-        "mainType": "video",
-        "subType": "x-msvideo",
+      "video/x-msvideo": {
         "delimiter": ".",
-        "type": "video/x-msvideo",
-        "string": "video/x-msvideo",
         "suffixes": [
           "avi"
         ]
       }
-    ]
-  },
-  "output": {
-    "formats": [
-      {
-        "mediaType": "text/html",
-        "name": "html",
-        "path": "",
-        "baseName": "index",
-        "rel": "canonical",
-        "protocol": "",
-        "isPlainText": false,
-        "isHTML": true,
-        "noUgly": false,
-        "notAlternative": false,
-        "permalinkable": true,
-        "weight": 10
-      },
-      {
+    },
+    "imaging": {
+      "bgColor": "#ffffff",
+      "hint": "photo",
+      "quality": 75,
+      "resampleFilter": "box"
+    },
+    "outputFormats": {
+      "amp": {
         "mediaType": "text/html",
         "name": "amp",
         "path": "amp",
         "permalinkable": true,
         "weight": 0
       },
-      {
+      "calendar": {
         "mediaType": "text/calendar",
         "name": "calendar",
         "path": "",
         "permalinkable": false,
         "weight": 0
       },
-      {
+      "css": {
         "mediaType": "text/css",
         "name": "css",
         "path": "",
         "permalinkable": false,
         "weight": 0
       },
-      {
+      "csv": {
         "mediaType": "text/csv",
         "name": "csv",
         "path": "",
         "permalinkable": false,
         "weight": 0
       },
-      {
+      "html": {
+        "mediaType": "text/html",
+        "name": "html",
+        "path": "",
+        "baseName": "index",
+        "rel": "canonical",
+        "protocol": "",
+        "isPlainText": false,
+        "isHTML": true,
+        "noUgly": false,
+        "notAlternative": false,
+        "permalinkable": true,
+        "weight": 10
+      },
+      "json": {
         "mediaType": "application/json",
         "name": "json",
         "path": "",
         "permalinkable": false,
         "weight": 0
       },
-      {
+      "markdown": {
         "mediaType": "text/markdown",
         "name": "markdown",
         "path": "",
         "permalinkable": false,
         "weight": 0
       },
-      {
+      "robots": {
         "mediaType": "text/plain",
         "name": "robots",
         "path": "",
         "permalinkable": false,
         "weight": 0
       },
-      {
+      "rss": {
         "mediaType": "application/rss+xml",
         "name": "rss",
         "path": "",
         "permalinkable": false,
         "weight": 0
       },
-      {
+      "sitemap": {
         "mediaType": "application/xml",
         "name": "sitemap",
         "path": "",
         "permalinkable": false,
         "weight": 0
       },
-      {
+      "webappmanifest": {
         "mediaType": "application/manifest+json",
         "name": "webappmanifest",
         "path": "",
         "permalinkable": false,
         "weight": 0
       }
-    ],
+    },
+    "outputs": {
+      "home": [
+        "html",
+        "rss"
+      ],
+      "page": [
+        "html"
+      ],
+      "rss": [
+        "rss"
+      ],
+      "section": [
+        "html",
+        "rss"
+      ],
+      "taxonomy": [
+        "html",
+        "rss"
+      ],
+      "term": [
+        "html",
+        "rss"
+      ]
+    },
+    "cascade": [],
+    "menus": {},
+    "deployment": {
+      "targets": null,
+      "matchers": null,
+      "order": null,
+      "target": "",
+      "confirm": false,
+      "dryRun": false,
+      "force": false,
+      "invalidateCDN": true,
+      "maxDeletes": 256,
+      "workers": 10
+    },
+    "module": {
+      "mounts": [
+        {
+          "source": "content",
+          "target": "content",
+          "lang": "",
+          "includeFiles": null,
+          "excludeFiles": null
+        },
+        {
+          "source": "data",
+          "target": "data",
+          "lang": "",
+          "includeFiles": null,
+          "excludeFiles": null
+        },
+        {
+          "source": "layouts",
+          "target": "layouts",
+          "lang": "",
+          "includeFiles": null,
+          "excludeFiles": null
+        },
+        {
+          "source": "i18n",
+          "target": "i18n",
+          "lang": "",
+          "includeFiles": null,
+          "excludeFiles": null
+        },
+        {
+          "source": "archetypes",
+          "target": "archetypes",
+          "lang": "",
+          "includeFiles": null,
+          "excludeFiles": null
+        },
+        {
+          "source": "assets",
+          "target": "assets",
+          "lang": "",
+          "includeFiles": null,
+          "excludeFiles": null
+        },
+        {
+          "source": "static",
+          "target": "static",
+          "lang": "",
+          "includeFiles": null,
+          "excludeFiles": null
+        }
+      ],
+      "imports": null,
+      "params": null,
+      "hugoVersion": {
+        "min": "",
+        "max": "",
+        "extended": false
+      },
+      "noVendor": "",
+      "vendorClosest": false,
+      "replacements": null,
+      "proxy": "direct",
+      "noProxy": "none",
+      "private": "*.*",
+      "workspace": "off"
+    },
+    "frontmatter": {
+      "date": [
+        "date",
+        "publishdate",
+        "pubdate",
+        "published",
+        "lastmod",
+        "modified"
+      ],
+      "lastmod": [
+        ":git",
+        "lastmod",
+        "modified",
+        "date",
+        "publishdate",
+        "pubdate",
+        "published"
+      ],
+      "publishDate": [
+        "publishdate",
+        "pubdate",
+        "published",
+        "date"
+      ],
+      "expiryDate": [
+        "expirydate",
+        "unpublishdate"
+      ]
+    },
+    "minify": {
+      "minifyOutput": false,
+      "disableHTML": false,
+      "disableCSS": false,
+      "disableJS": false,
+      "disableJSON": false,
+      "disableSVG": false,
+      "disableXML": false,
+      "tdewolff": {
+        "html": {
+          "keepComments": false,
+          "keepConditionalComments": true,
+          "keepDefaultAttrVals": true,
+          "keepDocumentTags": true,
+          "keepEndTags": true,
+          "keepQuotes": false,
+          "keepWhitespace": false
+        },
+        "css": {
+          "keepCSS2": true,
+          "precision": 0
+        },
+        "js": {
+          "precision": 0,
+          "keepVarNames": false,
+          "version": 2022
+        },
+        "json": {
+          "precision": 0,
+          "keepNumbers": false
+        },
+        "svg": {
+          "keepComments": false,
+          "precision": 0
+        },
+        "xml": {
+          "keepWhitespace": false
+        }
+      }
+    },
+    "permalinks": {
+      "page": {},
+      "section": {},
+      "taxonomy": {},
+      "term": {}
+    },
+    "taxonomies": {
+      "category": "categories",
+      "tag": "tags"
+    },
+    "sitemap": {
+      "changeFreq": "",
+      "priority": -1,
+      "filename": "sitemap.xml"
+    },
+    "related": {
+      "threshold": 80,
+      "includeNewer": false,
+      "toLower": false,
+      "indices": [
+        {
+          "name": "keywords",
+          "type": "basic",
+          "applyFilter": false,
+          "pattern": "",
+          "weight": 100,
+          "cardinalityThreshold": 0,
+          "toLower": false
+        },
+        {
+          "name": "date",
+          "type": "basic",
+          "applyFilter": false,
+          "pattern": "",
+          "weight": 10,
+          "cardinalityThreshold": 0,
+          "toLower": false
+        },
+        {
+          "name": "tags",
+          "type": "",
+          "applyFilter": false,
+          "pattern": "",
+          "weight": 80,
+          "cardinalityThreshold": 0,
+          "toLower": false
+        }
+      ]
+    },
+    "server": {
+      "headers": null,
+      "redirects": [
+        {
+          "from": "**",
+          "to": "/404.html",
+          "status": 404,
+          "force": false
+        }
+      ]
+    },
+    "privacy": {
+      "disqus": {
+        "disable": false
+      },
+      "googleAnalytics": {
+        "disable": false,
+        "useSessionStorage": false,
+        "respectDoNotTrack": false,
+        "anonymizeIP": false
+      },
+      "instagram": {
+        "disable": false,
+        "simple": false
+      },
+      "twitter": {
+        "disable": false,
+        "enableDNT": false,
+        "simple": false
+      },
+      "vimeo": {
+        "disable": false,
+        "enableDNT": false,
+        "simple": false
+      },
+      "youTube": {
+        "disable": false,
+        "privacyEnhanced": false
+      }
+    },
+    "security": {
+      "exec": {
+        "allow": [
+          "^((dart-)?sass(-embedded)?|go|npx|postcss)$"
+        ],
+        "osEnv": [
+          "(?i)^(PATH|PATHEXT|APPDATA|HOME|TMP|TEMP|TERM)$"
+        ]
+      },
+      "funcs": {
+        "getenv": [
+          "^(HUGO_|REPOSITORY_URL|^BRANCH$)"
+        ]
+      },
+      "http": {
+        "urls": [
+          ".*"
+        ],
+        "methods": [
+          "(?i)GET|POST"
+        ],
+        "mediaTypes": null
+      },
+      "enableInlineShortcodes": false,
+      "goTemplates": {
+        "allowActionJSTmpl": false
+      }
+    },
+    "services": {
+      "disqus": {
+        "shortname": ""
+      },
+      "googleAnalytics": {
+        "id": ""
+      },
+      "instagram": {
+        "disableInlineCSS": false,
+        "accessToken": ""
+      },
+      "twitter": {
+        "disableInlineCSS": false
+      },
+      "rss": {
+        "limit": -1
+      }
+    },
+    "params": {},
+    "languages": {
+      "en": {
+        "languageName": "",
+        "languageCode": "",
+        "title": "",
+        "languageDirection": "",
+        "weight": 0,
+        "disabled": false
+      }
+    },
+    "uglyURLs": false
+  },
+  "config_helpers": {
+    "mergeStrategy": {
+      "build": {
+        "_merge": "none"
+      },
+      "caches": {
+        "_merge": "none"
+      },
+      "cascade": {
+        "_merge": "none"
+      },
+      "deployment": {
+        "_merge": "none"
+      },
+      "frontmatter": {
+        "_merge": "none"
+      },
+      "imaging": {
+        "_merge": "none"
+      },
+      "languages": {
+        "_merge": "none",
+        "en": {
+          "_merge": "none",
+          "menus": {
+            "_merge": "shallow"
+          },
+          "params": {
+            "_merge": "deep"
+          }
+        }
+      },
+      "markup": {
+        "_merge": "none"
+      },
+      "mediatypes": {
+        "_merge": "shallow"
+      },
+      "menus": {
+        "_merge": "shallow"
+      },
+      "minify": {
+        "_merge": "none"
+      },
+      "module": {
+        "_merge": "none"
+      },
+      "outputformats": {
+        "_merge": "shallow"
+      },
+      "outputs": {
+        "_merge": "none"
+      },
+      "params": {
+        "_merge": "deep"
+      },
+      "permalinks": {
+        "_merge": "none"
+      },
+      "privacy": {
+        "_merge": "none"
+      },
+      "related": {
+        "_merge": "none"
+      },
+      "security": {
+        "_merge": "none"
+      },
+      "server": {
+        "_merge": "none"
+      },
+      "services": {
+        "_merge": "none"
+      },
+      "sitemap": {
+        "_merge": "none"
+      },
+      "taxonomies": {
+        "_merge": "none"
+      }
+    }
+  },
+  "output": {
     "layouts": [
       {
         "Example": "Single page in \"posts\" section",
           "Examples": []
         },
         "Apply": {
-          "Description": "Apply takes a map, array, or slice c and returns a new slice with the function fname applied over it.",
+          "Description": "Apply takes an array or slice c and returns a new slice with the function fname applied over it.",
           "Args": [
             "ctx",
             "c",
         "Delimit": {
           "Description": "Delimit takes a given list l and returns a string delimited by sep.\nIf last is passed to the function, it will be used as the final delimiter.",
           "Args": [
+            "ctx",
             "l",
             "sep",
             "last"
         "Sort": {
           "Description": "Sort returns a sorted copy of the list l.",
           "Args": [
+            "ctx",
             "l",
             "args"
           ],
         "Where": {
           "Description": "Where returns a filtered subset of collection c.",
           "Args": [
+            "ctx",
             "c",
             "key",
             "args"
index 2035c058b55d321171899f3fe4c1dcff760b6595..f78bbd08f2b5344375da4633037ebd9e08ed88b7 100644 (file)
@@ -1,68 +1,78 @@
 {{ define "main" }}
-<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="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">
-                <p class="b">What's on this Page</p>
-                <ul>
-                    <li><a href="#last-updated">Last 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="#dependencies">Project dependencies (Hugo Modules)</a></li>
-                </ul>
-            </aside>
-        </div>
-        <div class="w-100">
-            {{ $byLastMod :=  .Site.RegularPages.ByLastmod  }}
-            {{ $recent := ($byLastMod | last 30).Reverse }}
-            {{ $leastRecent := $byLastMod | first 10 }}
-            <h2 id="last-updated">Last Updated</h2>
-            {{ partial "maintenance-pages-table.html" $recent }}
-            <h2 id="least-recently-updated">Least Recently Updated</h2>
-            {{ partial "maintenance-pages-table.html" $leastRecent }}
+      <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">
+          <p class="b">What's on this Page</p>
+          <ul>
+            <li><a href="#last-updated">Last 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="#dependencies">Project dependencies (Hugo Modules)</a>
+            </li>
+          </ul>
+        </aside>
+      </div>
+      <div class="w-100">
+        {{ $byLastMod :=  .Site.RegularPages.ByLastmod }}
+        {{ $recent := ($byLastMod | last 30).Reverse }}
+        {{ $leastRecent := $byLastMod | first 10 }}
+        <h2 id="last-updated">Last Updated</h2>
+        {{ partial "maintenance-pages-table.html" $recent }}
+        <h2 id="least-recently-updated">Least Recently Updated</h2>
+        {{ partial "maintenance-pages-table.html" $leastRecent }}
 
-            {{/* Don't think this is possible with where directly. Should investigate. */}}
-            {{ .Scratch.Set "todos" slice }}
-            {{ range .Site.RegularPages }}
-                 {{ if .HasShortcode "todo" }}
-                 {{ $.Scratch.Add "todos" . }}
-                 {{ end }}
-            {{ end }}
-            <h2 id="todos">Pages marked with TODO</h2>
-            {{ partial "maintenance-pages-table.html" (.Scratch.Get "todos") }}
+        {{/* Don't think this is possible with where directly. Should investigate. */}}
+        {{ .Scratch.Set "todos" slice }}
+        {{ range .Site.RegularPages }}
+          {{ if .HasShortcode "todo" }}
+            {{ $.Scratch.Add "todos" . }}
+          {{ end }}
+        {{ end }}
+        <h2 id="todos">Pages marked with TODO</h2>
+        {{ partial "maintenance-pages-table.html" (.Scratch.Get "todos") }}
 
-            <h2 id="dependencies">Dependencies</h2>
-            <table class="collapse ba br2 b--black-10 pv2 ph3">
-              <thead>
-                <tr>
-                  <th class="pv2 ph3 tl f6 fw6 ttu">#</th>
-                  <th class="pv2 ph3 tl f6 fw6 ttu">Owner</th>
-                  <th class="pv2 ph3 tl f6 fw6 ttu">Path</th>
-                  <th class="pv2 ph3 tl f6 fw6 ttu">Version</th>
-                  <th class="pv2 ph3 tl f6 fw6 ttu">Time</th>
-                  <th class="pv2 ph3 tl f6 fw6 ttu">Vendor</th>
-                </tr>
-              </thead>
-              <tbody>
-                {{ range $index, $element := hugo.Deps }}
-                <tr class="striped--light-gray">
-                  <th class="pv2 ph3">{{ add $index 1 }}</th>
-                  <td class="pv2 ph3">{{ with $element.Owner }}{{.Path }}{{ end }}</td>
-                  <td class="pv2 ph3">
-                    {{ $element.Path }}
-                    {{ with $element.Replace}}
-                    => {{ .Path }}
-                    {{ end }}
-                  </td>
-                  <td class="pv2 ph3">{{ $element.Version }}</td>
-                  <td class="pv2 ph3">{{ with $element.Time }}{{ . }}{{ end }}</td>
-                  <td class="pv2 ph3">{{ $element.Vendor }}</td>
-                </tr>
-                {{ end }}
-              </tbody>
-            </table>
 
-        </div>
+        <h2 id="dependencies">Dependencies</h2>
+        <table class="collapse ba br2 b--black-10 pv2 ph3">
+          <thead>
+            <tr>
+              <th class="pv2 ph3 tl f6 fw6 ttu">#</th>
+              <th class="pv2 ph3 tl f6 fw6 ttu">Owner</th>
+              <th class="pv2 ph3 tl f6 fw6 ttu">Path</th>
+              <th class="pv2 ph3 tl f6 fw6 ttu">Version</th>
+              <th class="pv2 ph3 tl f6 fw6 ttu">Time</th>
+              <th class="pv2 ph3 tl f6 fw6 ttu">Vendor</th>
+            </tr>
+          </thead>
+          <tbody>
+            {{ range $index, $element := hugo.Deps }}
+              <tr class="striped--light-gray">
+                <th class="pv2 ph3">{{ add $index 1 }}</th>
+                <td class="pv2 ph3">
+                  {{ with $element.Owner }}{{ .Path }}{{ end }}
+                </td>
+                <td class="pv2 ph3">
+                  {{ $element.Path }}
+                  {{ with $element.Replace }}
+                    =>
+                    {{ .Path }}
+                  {{ end }}
+                </td>
+                <td class="pv2 ph3">{{ $element.Version }}</td>
+                <td class="pv2 ph3">
+                  {{ with $element.Time }}{{ . }}{{ end }}
+                </td>
+                <td class="pv2 ph3">{{ $element.Vendor }}</td>
+              </tr>
+            {{ end }}
+          </tbody>
+        </table>
+      </div>
     </div>
-</div>
-{{ end }}
\ No newline at end of file
+  </div>
+{{ end }}
index 3b151669fdfef28dc9419c358b48e666017dee31..6e0e3d73eb136b23fc0700e513477173a4a7e8c4 100644 (file)
@@ -1,17 +1,18 @@
 {{- /*
-Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
+  Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
 
-@param {string} [config] The section of site.Data.docs.config to render.
-@param {bool} [copy=true] If true, display a copy to clipboard button.
-@param {string} [file] The file name to display above the rendered code.
-@param {bool} [fm=false] If true, render the code as front matter.
-@param {bool} [skipHeader=false] If false, omit top level key(s) when rendering a section of site.Data.docs.config.
+  @param {string} [config] The section of site.Data.docs.config to render.
+  @param {bool} [copy=true] If true, display a copy to clipboard button.
+  @param {string} [file] The file name to display above the rendered code.
+  @param {bool} [fm=false] If true, render the code as front matter.
+  @param {bool} [skipHeader=false] If false, omit top level key(s) when rendering a section of site.Data.docs.config.
 
-@returns {template.HTML}
+  @returns {template.HTML}
 */}}
 
 {{- /* Initialize. */}}
 {{- $config := "" }}
+{{- $dataKey := "" }}
 {{- $copy := true }}
 {{- $file := "" }}
 {{- $fm := false }}
@@ -19,20 +20,21 @@ Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
 
 {{- /* Get parameters. */}}
 {{- $config = .Get "config" }}
+{{- $dataKey = .Get "dataKey" }}
 {{- $file = .Get "file" }}
 {{- if in (slice "false" false 0) (.Get "copy") }}
   {{- $copy = false }}
-{{- else if in (slice "true" true 1) (.Get "copy")}}
+{{- else if in (slice "true" true 1) (.Get "copy") }}
   {{- $copy = true }}
 {{- end }}
 {{- if in (slice "false" false 0) (.Get "fm") }}
   {{- $fm = false }}
-{{- else if in (slice "true" true 1) (.Get "fm")}}
+{{- else if in (slice "true" true 1) (.Get "fm") }}
   {{- $fm = true }}
 {{- end }}
 {{- if in (slice "false" false 0) (.Get "skipHeader") }}
   {{- $skipHeader = false }}
-{{- else if in (slice "true" true 1) (.Get "skipHeader")}}
+{{- else if in (slice "true" true 1) (.Get "skipHeader") }}
   {{- $skipHeader = true }}
 {{- end }}
 
@@ -43,14 +45,18 @@ Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
 
 {{- /* Render. */}}
 {{- $code := "" }}
-{{- with $config }}
+{{- if $config }}
   {{- $file = $file | default "hugo" }}
-  {{- $sections := (split . ".") }}
+  {{- $sections := (split $config ".") }}
   {{- $configSection := index $.Site.Data.docs.config $sections }}
   {{- $code = dict $sections $configSection }}
   {{- if $skipHeader }}
     {{- $code = $configSection }}
   {{- end }}
+{{- else if $dataKey }}
+  {{- $file = $file | default $dataKey }}
+  {{- $sections := (split $dataKey ".") }}
+  {{- $code = index $.Site.Data.docs $sections }}
 {{- else }}
   {{- $code = $.Inner }}
 {{- end }}
@@ -62,7 +68,9 @@ Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
       </div>
     {{- end }}
     {{- 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>
       &nbsp;
@@ -70,7 +78,9 @@ Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
   </div>
   <div class="tab-content">
     {{- 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 . }}
         {{- if and $fm (in (slice "toml" "yaml") .) }}
           {{- $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 }}
       </div>
       {{- 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 */}}
       {{- end }}
     {{- end }}
index 4e2814f5a9f8f3a01ea32af3dba0da341daed452..12054f89dad3c437b37b2570f92f9ee35a16af4b 100644 (file)
@@ -3,20 +3,31 @@
 {{ $list := (index (index .Site.Data.docs $package) $listname) }}
 {{ $fields := after 2 .Params }}
 
+
 <table class="table table-bordered">
-       <tr>
-               {{ range $fields }}
-               <th>{{ . }}</th>
-               {{ end }}
-       </tr>
-       {{ range $list }}
-       <tr>
-               {{ range $k, $v := . }}
-               {{ $.Scratch.Set $k $v }}
-               {{ end }}
-               {{ range $fields }}
-                       <td>{{ $.Scratch.Get . }}</td>
-               {{ end }}
-       </tr>
-       {{ end }}
+  <tr>
+    {{ range $fields }}
+      {{ $s := . }}
+      {{ if eq $s "_key" }}
+        {{ $s = "Type" }}
+      {{ end }}
+      <th>{{ $s }}</th>
+    {{ end }}
+  </tr>
+  {{ range $k1, $v1 := $list }}
+    <tr>
+      {{ range $k2, $v2 := . }}
+        {{ $.Scratch.Set $k2 $v2 }}
+      {{ end }}
+      {{ range $fields }}
+        {{ $s := "" }}
+        {{ if eq . "_key" }}
+          {{ $s = $k1 }}
+        {{ else }}
+          {{ $s = $.Scratch.Get . }}
+        {{ end }}
+        <td>{{ $s }}</td>
+      {{ end }}
+    </tr>
+  {{ end }}
 </table>
index 1e159412056ada2f0d7419fa96ea8033c66922bc..b138ff81e35e82e4373307223e5532100bda7f72 100644 (file)
 // is of limited interest for the general Hugo user.
 package docshelper
 
+import "fmt"
+
 type (
        DocProviderFunc = func() DocProvider
-       DocProvider     map[string]map[string]any
+       DocProvider     map[string]any
 )
 
 var docProviderFuncs []DocProviderFunc
@@ -32,20 +34,14 @@ func GetDocProvider() DocProvider {
        for _, fn := range docProviderFuncs {
                p := fn()
                for k, v := range p {
-                       if prev, found := provider[k]; !found {
-                               provider[k] = v
-                       } else {
-                               merge(prev, v)
+                       if _, found := provider[k]; found {
+                               // We use to merge config, but not anymore.
+                               // These constructs will eventually go away, so just make it simple.
+                               panic(fmt.Sprintf("Duplicate doc provider key: %q", k))
                        }
+                       provider[k] = v
                }
        }
 
        return provider
 }
-
-// Shallow merge
-func merge(dst, src map[string]any) {
-       for k, v := range src {
-               dst[k] = v
-       }
-}
index 0793669a76b07c622e519481c6b2fcda45df65b0..0350a78a234b9777d80720027e1d6c526ffe82cf 100644 (file)
@@ -16,12 +16,10 @@ package markup_config
 import (
        "github.com/gohugoio/hugo/common/maps"
        "github.com/gohugoio/hugo/config"
-       "github.com/gohugoio/hugo/docshelper"
        "github.com/gohugoio/hugo/markup/asciidocext/asciidocext_config"
        "github.com/gohugoio/hugo/markup/goldmark/goldmark_config"
        "github.com/gohugoio/hugo/markup/highlight"
        "github.com/gohugoio/hugo/markup/tableofcontents"
-       "github.com/gohugoio/hugo/parser"
        "github.com/mitchellh/mapstructure"
 )
 
@@ -108,10 +106,3 @@ var Default = Config{
        Goldmark:    goldmark_config.Default,
        AsciidocExt: asciidocext_config.Default,
 }
-
-func init() {
-       docsProvider := func() docshelper.DocProvider {
-               return docshelper.DocProvider{"config": map[string]any{"markup": parser.LowerCaseCamelJSONMarshaller{Value: Default}}}
-       }
-       docshelper.AddDocProviderFunc(docsProvider)
-}
diff --git a/media/docshelper.go b/media/docshelper.go
deleted file mode 100644 (file)
index d37c08e..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-package media
-
-import (
-       "github.com/gohugoio/hugo/docshelper"
-)
-
-// This is is just some helpers used to create some JSON used in the Hugo docs.
-func init() {
-       docsProvider := func() docshelper.DocProvider {
-               return docshelper.DocProvider{"media": map[string]any{"types": DefaultTypes}}
-       }
-       docshelper.AddDocProviderFunc(docsProvider)
-}
index 58271362d9ae42e08fba2fccf1424ae0266982fd..8ebcaa5c9b705f27db2ea3b6983503dba29574fb 100644 (file)
@@ -15,8 +15,6 @@ package minifiers
 
 import (
        "github.com/gohugoio/hugo/common/maps"
-       "github.com/gohugoio/hugo/docshelper"
-       "github.com/gohugoio/hugo/parser"
        "github.com/spf13/cast"
 
        "github.com/mitchellh/mapstructure"
@@ -113,10 +111,3 @@ func DecodeConfig(v any) (conf MinifyConfig, err error) {
 
        return
 }
-
-func init() {
-       docsProvider := func() docshelper.DocProvider {
-               return docshelper.DocProvider{"config": map[string]any{"minify": parser.LowerCaseCamelJSONMarshaller{Value: defaultConfig}}}
-       }
-       docshelper.AddDocProviderFunc(docsProvider)
-}
index 1275c59795b2322b59773998d544ef0e96aace8a..0436a10be4dbb99c3cabfde8581ab2777ad0536c 100644 (file)
@@ -14,7 +14,6 @@ func init() {
        docsProvider := func() docshelper.DocProvider {
                return docshelper.DocProvider{
                        "output": map[string]any{
-                               "formats": DefaultFormats,
                                "layouts": createLayoutExamples(),
                        },
                }