## 1. What is SprigX?
SprigX is a suite of extensions to the sprig library (Go docs).
They provide functions that offer more enriched use cases and domain-specific data.
Tip

If you are reading this README on the Go Module Directory documentation (https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx) or the directory landing page (https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx), it may not render correctly. Anchor-links (links within this document to other sections of this document) will likely also not work.

Be sure to view it at properly via the in-repo AsciiDoc rendering or by downloading and viewing the HTML version in a browser locally and/or rendering a PDF version.

## 2. How do I Render These Docs?
This documentation is written in AsciiDoc (with AsciiDoctor extensions).
To re-render all docs (including [PDF](#rndr_pdf)):
``` rouge git clone https://git.r00t2.io/r00t2/go_goutils.git cd go_goutils .githooks/pre-commit/01-docgen ```
### 2.1. HTML
HTML output is re-rendered and included in git on each commit automatically (via github:gabyx/Githooks) but can be re-rendered on-demand locally via:
``` rouge git clone https://git.r00t2.io/r00t2/go_goutils.git cd go_goutils export orig_dir="$(pwd)" cd tplx/sprigx asciidoctor -a ROOTDIR="${orig_dir}/" -o README.html README.adoc ```
### 2.2. PDF
This documentation can be rendered to PDF via asciidoctor-pdf. It is not included in git automatically because binary files that change on each commit is not a good idea for git, especially for a repo that gets cloned as part of a library inclusion in a module/package dependency system (like `gomod`).
To render as PDF:
``` rouge git clone https://git.r00t2.io/r00t2/go_goutils.git cd go_goutils export orig_dir="$(pwd)" cd tplx/sprigx asciidoctor-pdf -a ROOTDIR="${orig_dir}/" -o README.pdf README.adoc ```
## 3. How do I Use SprigX?
The same way you would `sprig`!
Like this.
``` rouge package main import ( htmlTplLib "html/template" txtTplLib "text/template" "r00t2.io/goutils/tplx/sprigx" ) var ( txtTpl *txtTplLib.Template = txtTplLib. New(""). Funcs( sprigx.TxtFuncMap(), ) htmlTpl *htmlTplLib.Template = htmlTplLib. New(""). Funcs( sprigx.HtmlFuncMap(), ) ) ```
They can even be combined/used together,
like this.
``` rouge package main import ( "text/template" "github.com/Masterminds/sprig/v3" "r00t2.io/goutils/tplx/sprigx" ) var txtTpl *template.Template = template. New(""). Funcs( sprigx.TxtFuncMap(), ). Funcs( sprig.TxtFuncMap(), ) // Or: /* var txtTpl *template.Template = template. New(""). Funcs( sprig.TxtFuncMap(), ). Funcs( sprigx.TxtFuncMap(), ) */ ```
Or, as a convenience, you can simply use the [`sprigx.CombinedTxtFuncMap`](#lib_cmbtfmap) and/or [`sprigx.CombinedHtmlFuncMap`](#lib_cmbhfmap) functions.
If a `