summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/hugio/writers.go8
-rw-r--r--docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/baseof.html8
-rw-r--r--docs/content/en/content-management/diagrams.md217
-rw-r--r--docs/layouts/_default/_markup/render-codeblock-goat.html18
-rw-r--r--docs/layouts/_default/_markup/render-codeblock-mermaid.html4
-rw-r--r--go.mod5
-rw-r--r--go.sum8
-rw-r--r--helpers/content.go12
-rw-r--r--hugolib/content_render_hooks_test.go4
-rw-r--r--hugolib/integrationtest_builder.go4
-rw-r--r--hugolib/language_content_dir_test.go2
-rw-r--r--hugolib/page.go64
-rw-r--r--hugolib/page__new.go5
-rw-r--r--hugolib/page__per_output.go173
-rw-r--r--hugolib/page_test.go5
-rw-r--r--hugolib/pagebundler_test.go4
-rw-r--r--hugolib/site.go16
-rw-r--r--hugolib/site_sections.go10
-rw-r--r--markup/converter/converter.go10
-rw-r--r--markup/converter/hooks/hooks.go100
-rw-r--r--markup/goldmark/codeblocks/integration_test.go115
-rw-r--r--markup/goldmark/codeblocks/render.go159
-rw-r--r--markup/goldmark/codeblocks/transform.go53
-rw-r--r--markup/goldmark/convert.go146
-rw-r--r--markup/goldmark/convert_test.go25
-rw-r--r--markup/goldmark/integration_test.go141
-rw-r--r--markup/goldmark/internal/render/context.go81
-rw-r--r--markup/goldmark/render_hooks.go143
-rw-r--r--markup/goldmark/toc_test.go9
-rw-r--r--markup/highlight/config.go99
-rw-r--r--markup/highlight/highlight.go178
-rw-r--r--markup/internal/attributes/attributes.go219
-rw-r--r--markup/markup.go13
-rw-r--r--markup/org/convert.go3
-rw-r--r--output/layout.go18
-rw-r--r--resources/page/site.go5
-rw-r--r--tpl/cast/init_test.go43
-rw-r--r--tpl/collections/init_test.go43
-rw-r--r--tpl/compare/init.go4
-rw-r--r--tpl/compare/init_test.go42
-rw-r--r--tpl/crypto/init_test.go42
-rw-r--r--tpl/data/init_test.go47
-rw-r--r--tpl/debug/init_test.go44
-rw-r--r--tpl/diagrams/diagrams.go73
-rw-r--r--tpl/diagrams/init.go (renamed from tpl/os/init_test.go)34
-rw-r--r--tpl/encoding/init_test.go42
-rw-r--r--tpl/fmt/init_test.go44
-rw-r--r--tpl/hugo/init_test.go49
-rw-r--r--tpl/images/init_test.go42
-rw-r--r--tpl/inflect/init_test.go43
-rw-r--r--tpl/lang/init_test.go48
-rw-r--r--tpl/math/init_test.go42
-rw-r--r--tpl/os/os.go21
-rw-r--r--tpl/os/os_test.go73
-rw-r--r--tpl/partials/init_test.go46
-rw-r--r--tpl/path/init_test.go43
-rw-r--r--tpl/reflect/init_test.go43
-rw-r--r--tpl/safe/init_test.go43
-rw-r--r--tpl/site/init_test.go49
-rw-r--r--tpl/strings/init_test.go45
-rw-r--r--tpl/templates/init_test.go42
-rw-r--r--tpl/time/init_test.go48
-rw-r--r--tpl/tplimpl/embedded/templates/_default/_markup/render-codeblock-goat.html1
-rw-r--r--tpl/tplimpl/template.go24
-rw-r--r--tpl/tplimpl/template_funcs.go1
-rw-r--r--tpl/tplimpl/template_funcs_test.go245
-rw-r--r--tpl/tplimpl/template_info_test.go58
-rw-r--r--tpl/transform/init_test.go42
-rw-r--r--tpl/transform/remarshal_test.go15
-rw-r--r--tpl/transform/transform.go41
-rw-r--r--tpl/transform/transform_test.go111
-rw-r--r--tpl/transform/unmarshal_test.go61
-rw-r--r--tpl/urls/init_test.go45
73 files changed, 1882 insertions, 1981 deletions
diff --git a/common/hugio/writers.go b/common/hugio/writers.go
index 82c4dca52..d8be83a40 100644
--- a/common/hugio/writers.go
+++ b/common/hugio/writers.go
@@ -18,6 +18,14 @@ import (
"io/ioutil"
)
+// As implemented by strings.Builder.
+type FlexiWriter interface {
+ io.Writer
+ io.ByteWriter
+ WriteString(s string) (int, error)
+ WriteRune(r rune) (int, error)
+}
+
type multiWriteCloser struct {
io.Writer
closers []io.WriteCloser
diff --git a/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/baseof.html b/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/baseof.html
index 47019072c..e2886a0b8 100644
--- a/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/baseof.html
+++ b/docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/baseof.html
@@ -66,6 +66,14 @@
{{ block "footer" . }}{{ partialCached "site-footer.html" . }}{{ end }}
+ {{ if .Page.Store.Get "hasMermaid" }}
+ <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
+ <script>
+ mermaid.initialize({ startOnLoad: true });
+ </script>
+{{ end }}
+
+
</body>
</html>
diff --git a/docs/content/en/content-management/diagrams.md b/docs/content/en/content-management/diagrams.md
new file mode 100644
index 000000000..4e3f6164b
--- /dev/null
+++ b/docs/content/en/content-management/diagrams.md
@@ -0,0 +1,217 @@
+---
+title: Diagrams
+date: 2022-02-20
+categories: [content management]
+keywords: [diagrams,drawing]
+menu:
+ docs:
+ parent: "content-management"
+ weight: 22
+weight: 22
+toc: true
+---
+
+
+## Mermaid Diagrams
+
+```mermaid
+sequenceDiagram
+ participant Alice
+ participant Bob
+ Alice->>John: Hello John, how are you?
+ loop Healthcheck
+ John->>John: Fight against hypochondria
+ end
+ Note right of John: Rational thoughts <br/>prevail!
+ John-->>Alice: Great!
+ John->>Bob: How about you?
+ Bob-->>John: Jolly good!
+```
+
+
+
+## Goat Ascii Diagram Examples
+
+### Graphics
+
+```goat
+ .
+ 0 3 P * Eye / ^ /
+ *-------* +y \ +) \ / Reflection
+ 1 /| 2 /| ^ \ \ \ v
+ *-------* | | v0 \ v3 --------*--------
+ | |4 | |7 | *----\-----*
+ | *-----|-* +-----> +x / v X \ .-.<-------- o
+ |/ |/ / / o \ | / | Refraction / \
+ *-------* v / \ +-' / \
+ 5 6 +z v1 *------------------* v2 | o-----o
+ v
+
+```
+
+### Complex
+
+```goat
++-------------------+ ^ .---.
+| A Box |__.--.__ __.--> | .-. | |
+| | '--' v | * |<--- | |
++-------------------+ '-' | |
+ Round *---(-. |
+ .-----------------. .-------. .----------. .-------. | | |
+ | Mixed Rounded | | | / Diagonals \ | | | | | |
+ | & Square Corners | '--. .--' / \ |---+---| '-)-' .--------.
+ '--+------------+-' .--. | '-------+--------' | | | | / Search /
+ | | | | '---. | '-------' | '-+------'
+ |<---------->| | | | v Interior | ^
+ ' <---' '----' .-----------. ---. .--- v |
+ .------------------. Diag line | .-------. +---. \ / . |
+ | if (a > b) +---. .--->| | | | | Curved line \ / / \ |
+ | obj->fcn() | \ / | '-------' |<--' + / \ |
+ '------------------' '--' '--+--------' .--. .--. | .-. +Done?+-'
+ .---+-----. | ^ |\ | | /| .--+ | | \ /
+ | | | Join \|/ | | Curved | \| |/ | | \ | \ /
+ | | +----> o --o-- '-' Vertical '--' '--' '-- '--' + .---.
+ <--+---+-----' | /|\ | | 3 |
+ v not:line 'quotes' .-' '---'
+ .-. .---+--------. / A || B *bold* | ^
+ | | | Not a dot | <---+---<-- A dash--is not a line v |
+ '-' '---------+--' / Nor/is this. ---
+
+```
+
+### Process
+
+```goat
+ .
+ .---------. / \
+ | START | / \ .-+-------+-. ___________
+ '----+----' .-------. A / \ B | |COMPLEX| | / \ .-.
+ | | END |<-----+CHOICE +----->| | | +--->+ PREPARATION +--->| X |
+ v '-------' \ / | |PROCESS| | \___________/ '-'
+ .---------. \ / '-+---+---+-'
+ / INPUT / \ /
+ '-----+---' '
+ | ^
+ v |
+ .-----------. .-----+-----. .-.
+ | PROCESS +---------------->| PROCESS |<------+ X |
+ '-----------' '-----------' '-'
+```
+
+### File tree
+
+Created from https://arthursonzogni.com/Diagon/#Tree
+
+```goat { width=300 color="orange" }
+───Linux─┬─Android
+ ├─Debian─┬─Ubuntu─┬─Lubuntu
+ │ │ ├─Kubuntu
+ │ │ ├─Xubuntu
+ │ │ └─Xubuntu
+ │ └─Mint
+ ├─Centos
+ └─Fedora
+```
+
+
+### Sequence Diagram
+
+https://arthursonzogni.com/Diagon/#Sequence
+
+```goat { class="w-40" }
+┌─────┐ ┌───┐
+│Alice│ │Bob│
+└──┬──┘ └─┬─┘
+ │ │
+ │ Hello Bob! │
+ │───────────>│
+ │ │
+ │Hello Alice!│
+ │<───────────│
+┌──┴──┐ ┌─┴─┐
+│Alice│ │Bob│
+└─────┘ └───┘
+
+```
+
+
+### Flowchart
+
+https://arthursonzogni.com/Diagon/#Flowchart
+
+```goat
+ _________________
+ ╱ ╲ ┌─────┐
+ ╱ DO YOU UNDERSTAND ╲____________________________________________________│GOOD!│
+ ╲ FLOW CHARTS? ╱yes └──┬──┘
+ ╲_________________╱ │
+ │no │
+ _________▽_________ ______________________ │
+ ╱ ╲ ╱ ╲ ┌────┐ │
+╱ OKAY, YOU SEE THE ╲________________╱ ... AND YOU CAN SEE ╲___│GOOD│ │
+╲ LINE LABELED 'YES'? ╱yes ╲ THE ONES LABELED 'NO'? ╱yes└──┬─┘ │
+ ╲___________________╱ ╲______________________╱ │ │
+ │no │no │ │
+ ________▽_________ _________▽__________ │ │
+ ╱ ╲ ┌───────────┐ ╱ ╲ │ │
+ ╱ BUT YOU SEE THE ╲___│WAIT, WHAT?│ ╱ BUT YOU JUST ╲___ │ │
+ ╲ ONES LABELED 'NO'? ╱yes└───────────┘ ╲ FOLLOWED THEM TWICE? ╱yes│ │ │
+ ╲__________________╱ ╲____________________╱ │ │ │
+ │no │no │ │ │
+ ┌───▽───┐ │ │ │ │
+ │LISTEN.│ └───────┬───────┘ │ │
+ └───┬───┘ ┌──────▽─────┐ │ │
+ ┌─────▽────┐ │(THAT WASN'T│ │ │
+ │I HATE YOU│ │A QUESTION) │ │ │
+ └──────────┘ └──────┬─────┘ │ │
+ ┌────▽───┐ │ │
+ │SCREW IT│ │ │
+ └────┬───┘ │ │
+ └─────┬─────┘ │
+ │ │
+ └─────┬─────┘
+ ┌───────▽──────┐
+ │LET'S GO DRING│
+ └───────┬──────┘
+ ┌─────────▽─────────┐
+ │HEY, I SHOULD TRY │
+ │INSTALLING FREEBSD!│
+ └───────────────────┘
+
+```
+
+
+### Table
+
+https://arthursonzogni.com/Diagon/#Table
+
+```goat { class="w-80 dark-blue" }
+┌────────────────────────────────────────────────┐
+│ │
+├────────────────────────────────────────────────┤
+│SYNTAX = { PRODUCTION } . │
+├────────────────────────────────────────────────┤
+│PRODUCTION = IDENTIFIER "=" EXPRESSION "." . │
+├────────────────────────────────────────────────┤
+│EXPRESSION = TERM { "|" TERM } . │
+├────────────────────────────────────────────────┤
+│TERM = FACTOR { FACTOR } . │
+├────────────────────────────────────────────────┤
+│FACTOR = IDENTIFIER │
+├────────────────────────────────────────────────┤
+│ | LITERAL │
+├────────────────────────────────────────────────┤
+│ | "[" EXPRESSION "]" │
+├────────────────────────────────────────────────┤
+│ | "(" EXPRESSION ")" │
+├────────────────────────────────────────────────┤
+│ | "{" EXPRESSION "}" . │
+├────────────────────────────────────────────────┤
+│IDENTIFIER = letter { letter } . │
+├────────────────────────────────────────────────┤
+│LITERAL = """" character { character } """" .│
+└────────────────────────────────────────────────┘
+```
+
+
+
diff --git a/docs/layouts/_default/_markup/render-codeblock-goat.html b/docs/layouts/_default/_markup/render-codeblock-goat.html
new file mode 100644
index 000000000..b1e57e94a
--- /dev/null
+++ b/docs/layouts/_default/_markup/render-codeblock-goat.html
@@ -0,0 +1,18 @@