From abe797c958d47119f2edaf8d43de06b22408e2a0 Mon Sep 17 00:00:00 2001 From: Ryan Watters Date: Sun, 30 Apr 2017 15:25:54 -0500 Subject: [PATCH] Clean up code block (First round) Also create the first draft of NumFmt function. --- content/content-management/authors.md | 3 +- content/content-management/front-matter.md | 13 +- content/functions/NumFmt.md | 41 +++++ content/functions/numFormat.md | 22 --- content/templates/introduction.md | 47 +++--- content/templates/lists.md | 179 ++++++++++++--------- 6 files changed, 177 insertions(+), 128 deletions(-) create mode 100644 content/functions/NumFmt.md delete mode 100644 content/functions/numFormat.md diff --git a/content/content-management/authors.md b/content/content-management/authors.md index d3f538bab..29fa0f36c 100644 --- a/content/content-management/authors.md +++ b/content/content-management/authors.md @@ -15,9 +15,10 @@ weight: 55 #rem draft: true aliases: [/content/archetypes/] toc: true +comments: Before this page is published, need to also update both site- and page-level variables documentation. --- - + Larger sites often have multiple content authors. Hugo provides standardized author profiles to organize relationships between content and content creators for sites operating under a distributed authorship model. diff --git a/content/content-management/front-matter.md b/content/content-management/front-matter.md index 0d336068d..812926e80 100644 --- a/content/content-management/front-matter.md +++ b/content/content-management/front-matter.md @@ -108,7 +108,7 @@ There are a few predefined variables that Hugo is aware of. See [Page Variables] : the meta keywords for the content. `layout` -: the layout Hugo should select from the [lookup order][] when rendering the content. +: the layout Hugo should select from the [lookup order][lookup] when rendering the content. `lastmod` : the datetime at which the content was last modified. @@ -164,7 +164,7 @@ Field names are always normalized to lowercase; e.g., `camelCase: true` is avail ## Ordering Content Through Front Matter -You can assign content-specific `weight` in the front matter of your content. These values are especially useful for [ordering][ordering] in list views. You can use `weight` for ordering of content and the convention of [`_weight`][taxweight] for ordering content within a taxonomy. See [Ordering and Grouping Hugo Lists][] to see how `weight` can be used to organize your content in list views. +You can assign content-specific `weight` in the front matter of your content. These values are especially useful for [ordering][ordering] in list views. You can use `weight` for ordering of content and the convention of [`_weight`][taxweight] for ordering content within a taxonomy. See [Ordering and Grouping Hugo Lists][lists] to see how `weight` can be used to organize your content in list views. ## Overriding Global Blackfriday Configuration @@ -172,9 +172,9 @@ It's possible to set some options for Markdown rendering in a content's front ma ## Front Matter Format Specs -* [TOML Spec][TOML Spec] -* [YAML Spec][YAML Spec] -* [JSON Spec][JSON Spec] +* [TOML Spec][toml] +* [YAML Spec][yaml] +* [JSON Spec][json] [variables]: /variables/ [aliases]: /content-management/urls/#aliases/ @@ -184,7 +184,8 @@ It's possible to set some options for Markdown rendering in a content's front ma [content type]: /content-management/types/ [contentorg]: /content-management/organization/ [json]: /documents/ecma-404-json-spec.pdf "Specification for JSON, JavaScript Object Notation" -[lookup]: /content-management/l +[lists]: /templates/lists/#ordering-content +[lookup]: /templates/lookup-order/ [ordering]: /templates/lists/ "Hugo provides multiple ways to sort and order your content in list templates" [pagevars]: /variables/page/ [section]: /content-management/sections/ diff --git a/content/functions/NumFmt.md b/content/functions/NumFmt.md new file mode 100644 index 000000000..bc7860726 --- /dev/null +++ b/content/functions/NumFmt.md @@ -0,0 +1,41 @@ +--- +title: numfmt +linktitle: NumFmt +description: Formats a number with a given precision using the requested `decimal`, `grouping`, and `negative` characters. +godocref: +workson: [] +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +tags: [] +toc: false +ns: "lang" +signature: ["NumFmt "] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +draft: true +aliases: [] +comments: +--- + +`NumFmt` formats a number with a given precision using the requested `decimal`, +`grouping`, and `negative` characters. + +Numbers greater than or equal to 5 are rounded up. For example, if precision is set to `0`, `1.5` becomes `2`, and `1.4` becomes `1`. + +``` +{{ lang.NumFmt "," "." "-" 2 12345.6789 }} → 12.345,68 +{{ lang.NumFmt "." "" "-" 6 -12345.6789 }} → -12345.678900 +{{ lang.NumFmt "." "," "-" 0 -12345.6789 }} → -12,346 +{{ -98765.4321 | lang.NumFmt "." "," "-" 2 }} → -98,765.43 +``` + + + + + + + diff --git a/content/functions/numFormat.md b/content/functions/numFormat.md deleted file mode 100644 index 7eadf9c8c..000000000 --- a/content/functions/numFormat.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: numformat -linktitle: numFormat -description: -godocref: -workson: [] -date: 2017-02-01 -publishdate: 2017-02-01 -lastmod: 2017-02-01 -categories: [functions] -tags: [] -toc: false -ns: -signature: [] -workson: [] -hugoversion: -relatedfuncs: [] -deprecated: false -draft: true -aliases: [] ---- - diff --git a/content/templates/introduction.md b/content/templates/introduction.md index 74e20785b..5ebd4faba 100644 --- a/content/templates/introduction.md +++ b/content/templates/introduction.md @@ -285,7 +285,7 @@ The following shows how to define a variable independent of the context. {{% code file="tags-range-with-page-variable.html" %}} ```html {{ $title := .Site.Title }} -
    +
      {{ range .Params.tags }}
    • {{ . }} @@ -306,7 +306,7 @@ Notice how once we have entered the loop (i.e. `range`), the value of `{{ . }}` {{% code file="range-through-tags-w-global.html" %}} ```hbs -
        +
          {{ range .Params.tags }}
        • {{ . }} @@ -383,15 +383,15 @@ notoc: true --- ``` -Here is the corresponding code inside the `toc.html` [partial template][partials]: +Here is an example of corresponding code that could be used inside a `toc.html` [partial template][partials]: {{% code file="layouts/partials/toc.html" download="toc.html" %}} ```html {{ if not .Params.notoc }} -