summaryrefslogtreecommitdiff
path: root/template/doc.tmpl
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-04-06 14:59:25 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-04-06 14:59:25 +0200
commit1ca0e11c15d4b5692b9b95c660689fd245ee66bd (patch)
treeb386cfc06f73a9ce92b9bd977fa204342e13cbc9 /template/doc.tmpl
parent8b0fb5ba05165d5d57e1fd474e40f18f9acf5fb6 (diff)
Add templates
Diffstat (limited to 'template/doc.tmpl')
-rw-r--r--template/doc.tmpl75
1 files changed, 75 insertions, 0 deletions
diff --git a/template/doc.tmpl b/template/doc.tmpl
new file mode 100644
index 0000000..8d1b2c9
--- /dev/null
+++ b/template/doc.tmpl
@@ -0,0 +1,75 @@
+{{/* 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"}}
+{{/* No automatic line break. Paragraphs are free-form. */}}
+{{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"}}
+ <code>{{.Text}}</code>
+{{end}}
+
+{{define "image"}}
+ <img src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} alt="image">
+{{end}}
+
+{{define "caption"}}
+ <p id="figcaption">{{style .Text}}</p>
+{{end}}
+
+{{define "iframe"}}
+ <iframe src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} frameborder="0" allowfullscreen mozallowfullscreen webkitallowfullscreen></iframe>
+{{end}}
+
+{{define "link"}}<p><a href="{{.URL}}" target="_blank">{{style .Label}}</a></p>{{end}}
+
+{{define "html"}}{{.HTML}}{{end}}