From c5a5250a1b2897c8726cbf0d3be28d2db936bb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 2 Apr 2018 15:02:13 +0200 Subject: [PATCH] Use the new go-html-template Chroma lexer --- content/about/new-in-032/index.md | 10 +++++----- content/content-management/image-processing/index.md | 4 ++-- content/content-management/page-bundles.md | 2 +- content/content-management/syntax-highlighting.md | 2 +- content/functions/where.md | 2 +- content/news/0.27-relnotes-ready.md | 2 +- content/news/0.27-relnotes.md | 2 +- content/templates/output-formats.md | 6 +++--- layouts/shortcodes/code.html | 3 +++ 9 files changed, 18 insertions(+), 15 deletions(-) diff --git a/content/about/new-in-032/index.md b/content/about/new-in-032/index.md index 41bd58937..b8ca6430e 100644 --- a/content/about/new-in-032/index.md +++ b/content/about/new-in-032/index.md @@ -61,7 +61,7 @@ Note that changes to any resource inside the `content` folder will trigger a rel #### List all Resources -```html +```go-html-template {{ range .Resources }}
  • {{ .ResourceType | title }}
  • {{ end }} @@ -73,7 +73,7 @@ For an absolute URL, use `.Permalink`. #### List All Resources by Type -```html +```go-html-template {{ with .Resources.ByType "image" }} {{ end }} @@ -83,7 +83,7 @@ Type here is `page` for pages, else the main type in the MIME type, so `image`, #### Get a Specific Resource -```html +```go-html-template {{ $logo := .Resources.GetByPrefix "logo" }} {{ with $logo }} {{ end }} @@ -91,7 +91,7 @@ Type here is `page` for pages, else the main type in the MIME type, so `image`, #### Include Page Resource Content -```html +```go-html-template {{ with .Resources.ByType "page" }} {{ range . }}

    {{ .Title }}

    @@ -146,7 +146,7 @@ This is the shortcode used in the examples above: And it is used like this: -```html +```go-html-template {{}} ``` diff --git a/content/content-management/image-processing/index.md b/content/content-management/image-processing/index.md index 1f84ba04d..ecc85bb51 100644 --- a/content/content-management/image-processing/index.md +++ b/content/content-management/image-processing/index.md @@ -23,7 +23,7 @@ The `image` is a [Page Resource]({{< relref "content-management/page-resources" To get all images in a [Page Bundle]({{< relref "content-management/organization#page-bundles" >}}): -```html +```go-html-template {{ with .Resources.ByType "image" }} {{ end }} @@ -131,7 +131,7 @@ This is the shortcode used in the examples above: And it is used like this: -```html +```go-html-template {{}} ``` diff --git a/content/content-management/page-bundles.md b/content/content-management/page-bundles.md index 09aeae8ea..34620a5e2 100644 --- a/content/content-management/page-bundles.md +++ b/content/content-management/page-bundles.md @@ -93,7 +93,7 @@ anywhere: But you can get it by `.Site.GetPage`. Here is an example: -```html +```go-html-template {{ $headless := .Site.GetPage "page" "some-headless-bundle" }} {{ $reusablePages := $headless.Resources.Match "author*" }}

    Authors

    diff --git a/content/content-management/syntax-highlighting.md b/content/content-management/syntax-highlighting.md index a2aa62bb2..e7eb011c8 100644 --- a/content/content-management/syntax-highlighting.md +++ b/content/content-management/syntax-highlighting.md @@ -147,7 +147,7 @@ See [Highlight](/functions/highlight/). It is also possible to add syntax highlighting with GitHub flavored code fences. To enable this, set the `pygmentsCodeFences` to `true` in Hugo's [configuration file](/getting-started/configuration/); ```` -```html +```go-html-template

    {{ .Title }}

    diff --git a/content/functions/where.md b/content/functions/where.md index 3aa03296b..e989ba352 100644 --- a/content/functions/where.md +++ b/content/functions/where.md @@ -140,7 +140,7 @@ This is especially important for themes, but to list the most relevant pages on This will, by default, list pages from the _section with the most pages_. -```html +```go-html-template {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} ``` diff --git a/content/news/0.27-relnotes-ready.md b/content/news/0.27-relnotes-ready.md index 3dd02d455..9251c3768 100644 --- a/content/news/0.27-relnotes-ready.md +++ b/content/news/0.27-relnotes-ready.md @@ -9,7 +9,7 @@ categories: ["Releases"] Hugo `0.27`comes with fast and flexible **Related Content** ([3b4f17bb](https://github.com/gohugoio/hugo/commit/3b4f17bbc9ff789faa581ac278ad109d1ac5b816) [@bep](https://github.com/bep) [#98](https://github.com/gohugoio/hugo/issues/98)). To add this to your site, put something like this in your single page template: -```html +```go-html-template {{ $related := .Site.RegularPages.Related . | first 5 }} {{ with $related }}

    See Also

    diff --git a/content/news/0.27-relnotes.md b/content/news/0.27-relnotes.md index a4ead0816..92fc3a7b0 100644 --- a/content/news/0.27-relnotes.md +++ b/content/news/0.27-relnotes.md @@ -11,7 +11,7 @@ images: Hugo `0.27`comes with fast and flexible **Related Content** ([3b4f17bb](https://github.com/gohugoio/hugo/commit/3b4f17bbc9ff789faa581ac278ad109d1ac5b816) [@bep](https://github.com/bep) [#98](https://github.com/gohugoio/hugo/issues/98)). To add this to your site, put something like this in your single page template: -```html +```go-html-template {{ $related := .Site.RegularPages.Related . | first 5 }} {{ with $related }}

    See Also

    diff --git a/content/templates/output-formats.md b/content/templates/output-formats.md index f51c0eb9b..31956713e 100644 --- a/content/templates/output-formats.md +++ b/content/templates/output-formats.md @@ -184,7 +184,7 @@ outputs: Each `Page` has both an `.OutputFormats` (all formats, including the current) and an `.AlternativeOutputFormats` variable, the latter of which is useful for creating a `link rel` list in your site's ``: -```html +```go-html-template {{ range .AlternativeOutputFormats -}} {{ end -}} @@ -194,7 +194,7 @@ Note that `.Permalink` and `.RelPermalink` on `Page` will return the first outpu This is how you link to a given output format: -```html +```go-html-template {{ with .OutputFormats.Get "json" -}} {{ .Name }} {{- end }} @@ -202,7 +202,7 @@ This is how you link to a given output format: From content files, you can use the [`ref` or `relref` shortcodes](/content-management/shortcodes/#ref-and-relref): -```html +```go-html-template [Neat]({{}}) [Who]({{}}) ``` diff --git a/layouts/shortcodes/code.html b/layouts/shortcodes/code.html index 83220c47d..2ee20b1eb 100644 --- a/layouts/shortcodes/code.html +++ b/layouts/shortcodes/code.html @@ -5,6 +5,9 @@ {{ $.Scratch.Set "codeLang" (index . 0 | strings.TrimPrefix ".") }} {{ end }} {{ with .Get "codeLang" }}{{ $.Scratch.Set "codeLang" . }}{{ end }} +{{ if eq (.Scratch.Get "codeLang") "html"}} +{{ $.Scratch.Set "codeLang" "go-html-template" }} +{{ end }}
    {{- with $file -}}
    {{.}}