summaryrefslogtreecommitdiff
path: root/htdocs/template/doc.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs/template/doc.tmpl')
-rw-r--r--htdocs/template/doc.tmpl77
1 files changed, 77 insertions, 0 deletions
diff --git a/htdocs/template/doc.tmpl b/htdocs/template/doc.tmpl
new file mode 100644
index 0000000..b50790d
--- /dev/null
+++ b/htdocs/template/doc.tmpl
@@ -0,0 +1,77 @@
+{{/* This doc template is given to the present tool to format articles. */}}
+
+{{define "root"}}
+ {{with .Subtitle}}<h3>{{.}}</h3>{{end}}
+ {{if .Doc | sectioned}}
+ {{range .Sections}}
+ {{elem $.Template .}}
+ {{end}}
+ {{else}}
+ {{with index .Sections 0}}
+ {{range .Elem}}
+ {{elem $.Template .}}
+ {{end}}
+ {{end}}
+ {{end}}
+{{end}}
+
+{{define "TOC"}}
+ <ul>
+ {{range .}}
+ <li><a href="#TOC_{{.FormattedNumber}}">{{.Title}}</a></li>
+ {{with .Sections}}{{template "TOC" .}}{{end}}
+ {{end}}
+ </ul>
+{{end}}
+
+{{define "newline"}}
+{{/* newline */}}
+{{end}}
+
+{{define "section"}}
+ <h4 id="TOC_{{.FormattedNumber}}">{{.Title}}</h4>
+ {{range .Elem}}{{elem $.Template .}}{{end}}
+{{end}}
+
+{{define "list"}}
+ <ul>
+ {{range .Bullet}}
+ <li>{{style .}}</li>
+ {{end}}
+ </ul>
+{{end}}
+
+{{define "text"}}
+ {{if .Pre}}
+ <pre>{{range .Lines}}{{.}}{{end}}</pre>
+ {{else}}
+ <p>
+ {{range $i, $l := .Lines}}{{if $i}}{{template "newline"}}
+ {{end}}{{style $l}}{{end}}
+ </p>
+ {{end}}
+{{end}}
+
+{{define "code"}}
+ <div class="code">{{.Text}}</div>
+{{end}}
+
+{{define "image"}}
+ <img src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} alt="image">
+{{end}}
+
+{{define "caption"}}
+ <figcaption>{{style .Text}}</figcaption>
+{{end}}
+
+{{define "iframe"}}
+<div class="iframe">
+ <iframe src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} frameborder="0" allowfullscreen mozallowfullscreen webkitallowfullscreen></iframe>
+</div>
+{{end}}
+
+{{define "link"}}
+ <p class="link"><a href="{{.URL}}" target="_blank" rel="noopener">{{style .Label}}</a></p>
+{{end}}
+
+{{define "html"}}{{.HTML}}{{end}}