From 71c0826f3c33f2289b7327de9968aadd04ea0b3e Mon Sep 17 00:00:00 2001 From: Arnaud Ligny Date: Wed, 26 Dec 2018 23:19:45 +0100 Subject: [PATCH 01/32] Update transform.Unmarshal.md Fix some typos. --- content/en/functions/transform.Unmarshal.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/content/en/functions/transform.Unmarshal.md b/content/en/functions/transform.Unmarshal.md index 7197a6eb1..571117090 100644 --- a/content/en/functions/transform.Unmarshal.md +++ b/content/en/functions/transform.Unmarshal.md @@ -7,13 +7,12 @@ menu: docs: parent: "functions" keywords: [] -signature: ["RESOURCE or STRING | transform.Unmarshal [OPTIONS]" ] +signature: ["RESOURCE or STRING | transform.Unmarshal [OPTIONS]"] hugoversion: "0.53" aliases: [] --- - -The function accept either a `Resource` created in [Hugo Pipes](/hugo-pipes/) or via [Page Bundles](content-management/page-bundles/), or simply a string. The two examples below will produce the same map: +The function accept either a `Resource` created in [Hugo Pipes](/hugo-pipes/) or via [Page Bundles](/content-management/page-bundles/), or simply a string. The two examples below will produce the same map: ```go-html-template {{ $greetings := "hello = \"Hello Hugo\"" | transform.Unmarshal }}` @@ -36,15 +35,13 @@ The above prints `Hello Hugo`. Unmarshal with CSV as input has some options you can set: delimiter -: The delimiter used, default is `,` +: The delimiter used, default is `,`. comment -: The comment character ued in the CSV. If set, lines beginning with the comment character without preceding whitespace are ignored.: - +: The comment character used in the CSV. If set, lines beginning with the comment character without preceding whitespace are ignored.: Example: ```go-html-template {{ $csv := "a;b;c" | transform.Unmarshal (dict "delimiter" ";") }} ``` - From d7aff095401b478488eaae53e31b302ddebabffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 27 Dec 2018 10:11:50 +0100 Subject: [PATCH 02/32] Regenerate docs.json --- data/docs.json | 109 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 2 deletions(-) diff --git a/data/docs.json b/data/docs.json index 04eb91f97..5b1388fea 100644 --- a/data/docs.json +++ b/data/docs.json @@ -1324,6 +1324,16 @@ "xml" ] }, + { + "type": "application/toml", + "string": "application/toml", + "mainType": "application", + "subType": "toml", + "delimiter": ".", + "suffixes": [ + "toml" + ] + }, { "type": "application/xml", "string": "application/xml", @@ -1334,6 +1344,17 @@ "xml" ] }, + { + "type": "application/yaml", + "string": "application/yaml", + "mainType": "application", + "subType": "yaml", + "delimiter": ".", + "suffixes": [ + "yaml", + "yml" + ] + }, { "type": "image/svg+xml", "string": "image/svg+xml", @@ -2271,6 +2292,21 @@ ], "Examples": [] }, + "Complement": { + "Description": "Complement gives the elements in the last element of seqs that are not in\nany of the others.\nAll elements of seqs must be slices or arrays of comparable types.\n\nThe reasoning behind this rather clumsy API is so we can do this in the templates:\n {{ $c := .Pages | complement $last4 }}", + "Args": [ + "seqs" + ], + "Aliases": [ + "complement" + ], + "Examples": [ + [ + "{{ slice \"a\" \"b\" \"c\" \"d\" \"e\" \"f\" | complement (slice \"b\" \"c\") (slice \"d\" \"e\") }}", + "[a f]" + ] + ] + }, "Delimit": { "Description": "Delimit takes a given sequence and returns a delimited HTML string.\nIf last is passed to the function, it will be used as the final delimiter.", "Args": [ @@ -2496,6 +2532,22 @@ ], "Examples": [] }, + "SymDiff": { + "Description": "SymDiff returns the symmetric difference of s1 and s2.\nArguments must be either a slice or an array of comparable types.", + "Args": [ + "s2", + "s1" + ], + "Aliases": [ + "symdiff" + ], + "Examples": [ + [ + "{{ slice 1 2 3 | symdiff (slice 3 4) }}", + "[1 2 4]" + ] + ] + }, "Union": { "Description": "Union returns the union of the given sets, l1 and l2. l1 and\nl2 must be of the same type and may be either arrays or slices.\nIf l1 and l2 aren't of the same type then l1 will be returned.\nIf either l1 or l2 is nil then the non-nil list will be returned.", "Args": [ @@ -2650,7 +2702,7 @@ ] }, "Jsonify": { - "Description": "Jsonify encodes a given object to JSON, returning pretty printed output.", + "Description": "Jsonify encodes a given object to JSON.", "Args": [ "v" ], @@ -2660,7 +2712,7 @@ "Examples": [ [ "{{ (slice \"A\" \"B\" \"C\") | jsonify }}", - "[\n \"A\",\n \"B\",\n \"C\"\n]" + "[\"A\",\"B\",\"C\"]" ] ] } @@ -2729,6 +2781,20 @@ ] } }, + "hugo": { + "Generator": { + "Description": "", + "Args": null, + "Aliases": null, + "Examples": null + }, + "Version": { + "Description": "", + "Args": null, + "Aliases": null, + "Examples": null + } + }, "images": { "Config": { "Description": "Config returns the image.Config for the specified path relative to the\nworking directory.", @@ -3325,6 +3391,26 @@ ] } }, + "site": { + "Hugo": { + "Description": "", + "Args": null, + "Aliases": null, + "Examples": null + }, + "IsServer": { + "Description": "", + "Args": null, + "Aliases": null, + "Examples": null + }, + "Language": { + "Description": "", + "Args": null, + "Aliases": null, + "Examples": null + } + }, "strings": { "Chomp": { "Description": "Chomp returns a copy of s with all trailing newline characters removed.", @@ -3889,6 +3975,25 @@ "{\n \"title\": \"Hello World\"\n}\n" ] ] + }, + "Unmarshal": { + "Description": "Unmarshal unmarshals the data given, which can be either a string\nor a Resource. Supported formats are JSON, TOML, YAML, and CSV.\nYou can optionally provide an options map as the first argument.", + "Args": [ + "args" + ], + "Aliases": [ + "unmarshal" + ], + "Examples": [ + [ + "{{ \"hello = \\\"Hello World\\\"\" | transform.Unmarshal }}", + "map[hello:Hello World]" + ], + [ + "{{ \"hello = \\\"Hello World\\\"\" | resources.FromString \"data/greetings.toml\" | transform.Unmarshal }}", + "map[hello:Hello World]" + ] + ] } }, "urls": { From d63790ef3c3fa424ad129d84abe1ceed5c2e7819 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Mon, 31 Dec 2018 06:55:12 -0400 Subject: [PATCH 03/32] Do not mark UndocumentedFeature issues as stale --- .github/stale.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/stale.yml b/.github/stale.yml index f10747618..389205294 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -6,6 +6,7 @@ daysUntilClose: 30 exemptLabels: - Keep - Security + - UndocumentedFeature # Label to use when marking an issue as stale staleLabel: Stale # Comment to post when marking an issue as stale. Set to `false` to disable From 2dbfc0a4926f7a65a2f162b19af74eb4da1dc873 Mon Sep 17 00:00:00 2001 From: Danny Guo Date: Sun, 30 Dec 2018 22:27:26 -0500 Subject: [PATCH 04/32] Fix a typo in taxonomies --- content/en/content-management/taxonomies.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/content-management/taxonomies.md b/content/en/content-management/taxonomies.md index c06b2385b..7957bf29d 100644 --- a/content/en/content-management/taxonomies.md +++ b/content/en/content-management/taxonomies.md @@ -86,7 +86,7 @@ Moonrise Kingdom <- Value Hugo natively supports taxonomies. -Without adding a single line to your [site config][config] file, Hugo will automatically create taxonomies for `tags` and `categories`. That would be same as manually [configuring your taxonomies](#configuring-taxonomies) as below: +Without adding a single line to your [site config][config] file, Hugo will automatically create taxonomies for `tags` and `categories`. That would be the same as manually [configuring your taxonomies](#configuring-taxonomies) as below: {{< code-toggle copy="false" >}} [taxonomies] From 4a11f3f17c9b3917411b2ba6a9cb735ee1bf5b07 Mon Sep 17 00:00:00 2001 From: Jono Hey Date: Mon, 31 Dec 2018 09:42:06 +0000 Subject: [PATCH 05/32] Fix typo Changed `you` to `your` --- content/en/content-management/cross-references.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/content-management/cross-references.md b/content/en/content-management/cross-references.md index 59733555b..145c2d338 100644 --- a/content/en/content-management/cross-references.md +++ b/content/en/content-management/cross-references.md @@ -35,7 +35,7 @@ The single parameter to `ref` is a string with a content `documentname` (e.g., ` **Paths without a leading `/` will first be tried resolved relative to the current page.** -You will get an error if you document could not be uniquely resolved. The error behaviour can be configured, see below. +You will get an error if your document could not be uniquely resolved. The error behaviour can be configured, see below. ### Link to another language version From 40d88d98f754da846d67471676db5a22b577b01f Mon Sep 17 00:00:00 2001 From: Alex Hogen Date: Tue, 1 Jan 2019 23:28:53 -0800 Subject: [PATCH 06/32] Fix ToC example to use binary true/false The example code seemed to require that `toc` be set to the *string* `"false"` instead of the boolean keyword `false`. However, the text said the `toc` variable should be set to boolean `true`/`false` keywords, not strings. I'm not very familiar with GoLang so I could be completely wrong. I just know that the following Hugo page preamble did not work with the original code, but does work with the proposed fix. ``` +++ toc = false +++ ``` --- content/en/content-management/toc.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/content-management/toc.md b/content/en/content-management/toc.md index a500bcf66..56f51049d 100644 --- a/content/en/content-management/toc.md +++ b/content/en/content-management/toc.md @@ -74,7 +74,7 @@ The following is an example of a very basic [single page template][]: The following is a [partial template][partials] that adds slightly more logic for page-level control over your table of contents. It assumes you are using a `toc` field in your content's [front matter][] that, unless specifically set to `false`, will add a TOC to any page with a `.WordCount` (see [Page Variables][pagevars]) greater than 400. This example also demonstrates how to use [conditionals][] in your templating: {{< code file="layouts/partials/toc.html" download="toc.html" >}} -{{ if and (gt .WordCount 400 ) (ne .Params.toc "false") }} +{{ if and (gt .WordCount 400 ) (.Params.toc) }}