...
1{/*
2This is the action template.
3It determines how the formatting actions are rendered.
4*/}
5
6{{define "section"}}
7 <h{{len .Number}} id="TOC_{{.FormattedNumber}}">{{.FormattedNumber}} {{.Title}}</h{{len .Number}}>
8 {{range .Elem}}{{elem $.Template .}}{{end}}
9{{end}}
10
11{{define "list"}}
12 <ul>
13 {{range .Bullet}}
14 <li>{{style .}}</li>
15 {{end}}
16 </ul>
17{{end}}
18
19{{define "text"}}
20 {{if .Pre}}
21 <div class="code"><pre>{{range .Lines}}{{.}}{{end}}</pre></div>
22 {{else}}
23 <p>
24 {{range $i, $l := .Lines}}{{if $i}}{{template "newline"}}
25 {{end}}{{style $l}}{{end}}
26 </p>
27 {{end}}
28{{end}}
29
30{{define "code"}}
31 <div class="code{{if playable .}} playground{{end}}" {{if .Edit}}contenteditable="true" spellcheck="false"{{end}}>{{.Text}}</div>
32{{end}}
33
34{{define "image"}}
35<div class="image">
36 <img src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}}>
37</div>
38{{end}}
39
40{{define "video"}}
41<div class="video">
42 <video {{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} controls>
43 <source src="{{.URL}}" type="{{.SourceType}}">
44 </video>
45</div>
46{{end}}
47
48{{define "background"}}
49<div class="background">
50 <img src="{{.URL}}">
51</div>
52{{end}}
53
54{{define "iframe"}}
55<iframe src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}}></iframe>
56{{end}}
57
58{{define "link"}}<p class="link"><a href="{{.URL}}" target="_blank">{{style .Label}}</a></p>{{end}}
59
60{{define "html"}}{{.HTML}}{{end}}
61
62{{define "caption"}}<figcaption>{{style .Text}}</figcaption>{{end}}
View as plain text