Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate docs site to new theme #1729

Merged
merged 1 commit into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ report.xml
*.cid
*.iid
*.out
.netlify
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ gen-changelog:
docker run -it -v $(shell pwd):/app --workdir /app -e CHANGELOG_GITHUB_TOKEN hairyhenderson/github_changelog_generator \
github_changelog_generator --no-filter-by-milestone --exclude-labels duplicate,question,invalid,wontfix,admin

docs/themes/hugo-material-docs:
git clone https://github.com/digitalcraftsman/hugo-material-docs.git $@
docs/themes/hugo-theme-relearn:
git clone --depth=1 https://github.com/McShelby/hugo-theme-relearn.git $@

gen-docs: docs/themes/hugo-material-docs
gen-docs: docs/themes/hugo-theme-relearn
cd docs/; hugo

docs/content/functions/%.md: docs-src/content/functions/%.yml docs-src/content/functions/func_doc.md.tmpl
Expand Down
4 changes: 2 additions & 2 deletions docs-src/content/functions/func_doc.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
{{- define "usage" }}### Usage
{{- $arguments := index . "arguments" | default coll.Slice }}
{{ if has . "rawUsage" }}{{ .rawUsage | strings.TrimSpace }}{{ else }}
```go
```
{{ .name }}{{ range $a := $arguments }} {{template "argName" $a }}{{end}}
```
{{- if (index . "pipeline" | default false) }}
```go
```
{{ $last := (sub (len $arguments) 1) -}}
{{ (index $arguments $last).name }} | {{ .name }}{{ range $i, $a := $arguments }}{{if not (eq $i $last)}} {{template "argName" $a }}{{end}}{{end}}
```
Expand Down
11 changes: 8 additions & 3 deletions docs-src/content/functions/sockaddr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ preamble: |

To demonstrate how this can be used, here's an example that lists all of the IPv4 addresses available on the system:

```console
$ gomplate -i '{{ range (sockaddr.GetAllInterfaces | sockaddr.Include "type" "ipv4") -}}
_in.tmpl:_
```
{{ range (sockaddr.GetAllInterfaces | sockaddr.Include "type" "ipv4") -}}
{{ . | sockaddr.Attr "address" }}
{{end}}'
{{end}}
```

```console
$ gomplate -f in.tmpl
127.0.0.1
10.0.0.8
132.79.79.79
Expand Down
6 changes: 6 additions & 0 deletions docs/archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

65 changes: 40 additions & 25 deletions docs/config.toml
Original file line number Diff line number Diff line change
@@ -1,36 +1,51 @@
baseURL = "/"
languageCode = "en-us"
title = "gomplate documentation"
theme = "hugo-material-docs"
theme = "hugo-theme-relearn"
googleAnalytics = "UA-82637990-3"

[params]
alwaysopen = false
editURL = "https://github.com/hairyhenderson/gomplate/edit/main/docs/content/"
author = "hairyhenderson"
description = "gomplate documentation"
copyright = "Released under the MIT license"
provider = "GitHub"
repo_url = "https://github.com/hairyhenderson/gomplate"
logo = "images/gomplate-icon.svg"
favicon = "favicon.ico"
custom_css = [
"stylesheets/search.css",
"stylesheets/custom-palettes.css",
]
custom_js = [
"https://code.jquery.com/jquery-3.3.1.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.4.4/fuse.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js",
"js/search.js",
"js/faro.js"
]
showVisitedLinks = false
disableSearch = false
disableSearchHiddenPages = false
disableSeoHiddenPages = false
disableTagHiddenPages = false
disableAssetsBusting = false
disableGeneratorVersion = false
disableInlineCopyToClipBoard = true
disableShortcutsTitle = false
disableLandingPageButton = false
disableLanguageSwitchingButton = false
disableBreadcrumb = false
disableToc = false
disableMathJax = true
disableMermaid = true
disableSwagger = true
disableNextPrev = false
ordersectionsby = "weight"
themeVariantAuto = ["gomplate-light", "gomplate-dark"]
themeVariant = ["auto", "gomplate-light", "gomplate-dark"]
titleSeparator = "-"
collapsibleMenu = true
additionalContentLanguage = [ "en" ]
disableExplicitIndexURLs = true
externalLinkTarget = "_blank"

[params.palette]
primary = "spalding-gray"
accent = "spalding-blue"

[social]
twitter = "hairyhenderson"
github = "hairyhenderson"
[markup]
[markup.highlight]
guessSyntax = false
noClasses = false

[outputs]
home = ["HTML", "RSS", "JSON"]
home = [ "HTML", "RSS", "SEARCH", "SEARCHPAGE"]

[privacy]
[privacy.googleAnalytics]
disable = false
anonymizeIP = true
respectDoNotTrack = true
useSessionStorage = false
72 changes: 72 additions & 0 deletions docs/content/functions/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: Functions
---

Almost all of gomplate's utility is provided as _functions._ These are key
words that perform some action.

For example, the [`base64.Encode`][] function will encode some input string as
a base-64 string:

```
The word is {{ base64.Encode "swordfish" }}
```
renders as:
```
The word is c3dvcmRmaXNo
```

## Built-ins

Go's [`text/template`][] language provides a number of built-in functions,
operators, and actions that can be used in templates.

### Built-in functions

Here is a list of the built-in functions, but see [the documentation](https://golang.org/pkg/text/template/#hdr-Functions)
for full details:

- `and`, `or`, `not`: Returns boolean AND/OR/NOT of the argument(s).
- `call`: Returns the result of calling a function argument.
- `html`, `js`, `urlquery`: Safely escapes input for inclusion in HTML, JavaScript, and URL query strings.
- `index`: Returns the referenced element of an array/slice, string, or map. See also [Arrays](#arrays) and [Maps](#maps).
- `len`: Returns the length of the argument.
- `print`, `printf`, `println`: Aliases for Go's [`fmt.Print`](https://golang.org/pkg/fmt/#Print),
[`fmt.Printf`](https://golang.org/pkg/fmt/#Printf), and [`fmt.Println`](https://golang.org/pkg/fmt/#Println)
functions. See the [format documentation](https://golang.org/pkg/fmt/#hdr-Printing)
for details on `printf`'s format syntax.

### Operators

And the following comparison operators are also supported:

- `eq`: Equal (`==`)
- `ne`: Not-equal (`!=`)
- `lt`: Less than (`<`)
- `le`: Less than or equal to (`<=`)
- `gt`: Greater than (`>`)
- `ge`: Greater than or equal to (`>=`)

### Actions

There are also a few _actions_, which are used for control flow and other purposes. See [the documentation](https://golang.org/pkg/text/template/#hdr-Actions) for details on these:

- `if`/`else`/`else if`: Conditional control flow.
- `with`/`else`: Conditional execution with assignment.
- `range`: Looping control flow. See discussion in the [Arrays](#arrays) and [Maps](#maps) sections.
- `break`: The innermost `range` loop is ended early, stopping the current iteration and bypassing all remaining iterations.
- `continue`: The current iteration of the innermost `range` loop is stopped, and the loop starts the next iteration.
- `template`: Include the output of a named template. See the [Nested templates](#nested-templates) section for more details, and the [`tmpl`](../functions/tmpl) namespace for more flexible versions of `template`.
- `define`: Define a named nested template. See the [Nested templates](#nested-templates) section for more details.
- `block`: Shorthand for `define` followed immediately by `template`.

## gomplate functions

gomplate provides over 200 functions not found in the standard library. These
are grouped into namespaces, and documented on the following pages:

{{% children depth="3" description="false" %}}

[`text/template`]: https://golang.org/pkg/text/template/
[`base64.Encode`]: ../functions/base64#base64-encode
[data sources]: ../datasources/
8 changes: 4 additions & 4 deletions docs/content/installing.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ On macOS, you can also install gomplate using [MacPorts](https://www.macports.or
$ sudo port install gomplate
```

## [![Chocolatey](https://img.shields.io/chocolatey/v/gomplate.svg)](https://chocolatey.org/packages/gomplate) Windows with Chocolatey
## Windows with Chocolatey

The simplest method for installing gomplate on Windows is to use [`choco`](https://community.chocolatey.org/packages/gomplate):

Expand Down Expand Up @@ -59,12 +59,11 @@ Of course, there are some drawbacks - any files to be used for [datasources][]
must be mounted and any environment variables to be used must be passed through:

```console
$ echo 'My voice is my {{.Env.THING}}. {{(datasource "vault").value}}' \
| docker run -i -e THING=passport -v /home/me/.vault-token:/root/.vault-token hairyhenderson/gomplate -d vault=vault:///secret/sneakers -f -
$ echo 'My voice is my {{.Env.THING}}. {{(datasource "vault").value}}' | docker run -i -e THING=passport -v /home/me/.vault-token:/root/.vault-token hairyhenderson/gomplate -d vault=vault:///secret/sneakers -f -
My voice is my passport. Verify me.
```

It can be pretty awkward to always type `docker run hairyhenderson/gomplate:stable`,
It can be awkward to always type `docker run hairyhenderson/gomplate:stable`,
so this can be made simpler with a shell alias:

```console
Expand Down Expand Up @@ -145,6 +144,7 @@ $ sh <(curl https://tea.xyz) +gomplate.ca sh
$ gomplate --version
...
```

[releases]: https://github.com/hairyhenderson/gomplate/releases
[multi-stage builds]: https://docs.docker.com/develop/develop-images/multistage-build/
[hairyhenderson/gomplate]: https://hub.docker.com/r/hairyhenderson/gomplate/tags/
31 changes: 0 additions & 31 deletions docs/content/search.md

This file was deleted.

49 changes: 1 addition & 48 deletions docs/content/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,54 +244,7 @@ Or if you need keys as well:
Almost all of gomplate's utility is provided as _functions._ These are key
words (like `print` in the previous examples) that perform some action.

For example, the [`base64.Encode`][] function will encode some input string as
a base-64 string:

```
The word is {{ base64.Encode "swordfish" }}
```
renders as:
```
The word is c3dvcmRmaXNo
```

Go's [`text/template`][] language provides a number of built-in functions,
operators, and actions that can be used in templates.

Here is a list of the built-in functions, but see [the documentation](https://golang.org/pkg/text/template/#hdr-Functions)
for full details:

- `and`, `or`, `not`: Returns boolean AND/OR/NOT of the argument(s).
- `call`: Returns the result of calling a function argument.
- `html`, `js`, `urlquery`: Safely escapes input for inclusion in HTML, JavaScript, and URL query strings.
- `index`: Returns the referenced element of an array/slice, string, or map. See also [Arrays](#arrays) and [Maps](#maps).
- `len`: Returns the length of the argument.
- `print`, `printf`, `println`: Aliases for Go's [`fmt.Print`](https://golang.org/pkg/fmt/#Print),
[`fmt.Printf`](https://golang.org/pkg/fmt/#Printf), and [`fmt.Println`](https://golang.org/pkg/fmt/#Println)
functions. See the [format documentation](https://golang.org/pkg/fmt/#hdr-Printing)
for details on `printf`'s format syntax.

And the following comparison operators are also supported:

- `eq`: Equal (`==`)
- `ne`: Not-equal (`!=`)
- `lt`: Less than (`<`)
- `le`: Less than or equal to (`<=`)
- `gt`: Greater than (`>`)
- `ge`: Greater than or equal to (`>=`)

There are also a few _actions_, which are used for control flow and other purposes. See [the documentation](https://golang.org/pkg/text/template/#hdr-Actions) for details on these:

- `if`/`else`/`else if`: Conditional control flow.
- `with`/`else`: Conditional execution with assignment.
- `range`: Looping control flow. See discussion in the [Arrays](#arrays) and [Maps](#maps) sections.
- `break`: The innermost `range` loop is ended early, stopping the current iteration and bypassing all remaining iterations.
- `continue`: The current iteration of the innermost `range` loop is stopped, and the loop starts the next iteration.
- `template`: Include the output of a named template. See the [Nested templates](#nested-templates) section for more details, and the [`tmpl`](../functions/tmpl) namespace for more flexible versions of `template`.
- `define`: Define a named nested template. See the [Nested templates](#nested-templates) section for more details.
- `block`: Shorthand for `define` followed immediately by `template`.

See also gomplate's functions, defined to the left.
See the [functions documentation](/functions/) for more information.

## The Context

Expand Down
5 changes: 0 additions & 5 deletions docs/layouts/_default/index.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{ template "_internal/google_analytics.html" . }}
<script>
(function () {
var webSdkScript = document.createElement("script");

webSdkScript.src = "https://unpkg.com/@grafana/faro-web-sdk@^1.0.0/dist/bundle/faro-web-sdk.iife.js";

webSdkScript.onload = () => {
window.GrafanaFaroWebSdk.initializeFaro({
url: "https://faro-collector-prod-us-central-0.grafana.net/collect/d8b5652f5dd57fb1cfec9a1c32970fe0",
Expand Down Expand Up @@ -33,3 +33,4 @@
// Append the Web-SDK script script tag to the HTML page
document.head.appendChild(webSdkScript);
})();
</script>
Loading