github.com/hairyhenderson/gomplate/v4@v4.0.0-pre-2.0.20240520121557-362f058f0c93/docs-src/content/functions/func_doc.md.tmpl (about)

     1  {{ define "argName" }}{{ if not .required }}[{{ .name }}]{{else}}{{ .name }}{{end}}{{ end }}
     2  
     3  {{- define "usage" }}### Usage
     4  {{- $arguments := index . "arguments" | default coll.Slice }}
     5  {{ if has . "rawUsage" }}{{ .rawUsage | strings.TrimSpace }}{{ else }}
     6  ```
     7  {{ .name }}{{ range $a := $arguments }} {{template "argName" $a }}{{end}}
     8  ```
     9  {{- if (index . "pipeline" | default false) }}
    10  ```
    11  {{ $last := (sub (len $arguments) 1) -}}
    12  {{ (index $arguments $last).name }} | {{ .name }}{{ range $i, $a := $arguments }}{{if not (eq $i $last)}} {{template "argName" $a }}{{end}}{{end}}
    13  ```
    14  {{- end }}{{ end -}}
    15  {{ end -}}
    16  
    17  {{ $data := ds "data" -}}
    18  ---
    19  title: {{ index $data "title" | default (print $data.ns " functions") }}
    20  menu:
    21    main:
    22      parent: functions
    23  ---
    24  
    25  {{ $data.preamble -}}
    26  
    27  {{- define "annotations" -}}
    28  {{ if not (has . "released") }}_(unreleased)_{{ end -}}
    29  {{ if has . "deprecated" }} _(deprecated)_{{ end -}}
    30  {{ if and (has . "experimental") (index . "experimental") }} _(experimental)_{{ end -}}
    31  {{ end -}}
    32  
    33  {{ range $_, $f := $data.funcs }}
    34  ## {{ if has $f "rawName" -}}
    35  {{ $f.rawName }}{{ else }}`{{ $f.name }}`{{ end }}{{ template "annotations" $f }}
    36  {{ if not (has . "released") -}}
    37  **Unreleased:** _This function is in development, and not yet available in released builds of gomplate._
    38  {{ end -}}
    39  {{ if has $f "deprecated" -}}
    40  **Deprecation Notice:** {{ $f.deprecated }}
    41  {{ end -}}
    42  {{ if and (has . "experimental") (index . "experimental") -}}
    43  **Experimental:** This function is [_experimental_][experimental] and may be enabled with the [`--experimental`][experimental] flag.
    44  
    45  [experimental]: ../config/#experimental
    46  {{ end -}}
    47  
    48  {{ if has $f "alias" }}
    49  **Alias:** `{{$f.alias}}`
    50  {{ end }}
    51  
    52  {{- if has $f "description" }}
    53  {{ $f.description }}
    54  {{ end -}}
    55  
    56  {{ if has . "released" -}}
    57  _Added in gomplate [{{ $f.released }}](https://github.com/hairyhenderson/gomplate/releases/tag/{{ $f.released }})_
    58  {{ end -}}
    59  
    60  {{ template "usage" $f }}
    61  
    62  {{ if has $f "arguments" -}}
    63  ### Arguments
    64  
    65  | name | description |
    66  |------|-------------|
    67  {{ range $f.arguments }}| `{{.name}}` | _({{if .required}}required{{else}}optional{{end}})_ {{.description}} |
    68  {{ end }}
    69  {{- end -}}
    70  {{if has $f "examples" }}
    71  ### Examples
    72  
    73  {{ range $f.examples -}}
    74  ```console
    75  {{ . | strings.TrimSpace }}
    76  ```
    77  {{ end }}{{ end -}}
    78  {{ if has $f "rawExamples" }}
    79  ### Examples
    80  
    81  {{ range $f.rawExamples }}{{ . }}{{ end }}{{ end }}{{ end -}}