mirror of
https://github.com/golang/go
synced 2024-11-18 15:14:44 -07:00
8453f27cc7
Also added a suite of tests and fixed a minor bug that caused a panic when the .code command specified HL with no text after. Fixes golang/go#17379. Change-Id: I3c246523c3d4010bf76a467ee648475255090e1b Reviewed-on: https://go-review.googlesource.com/30691 Reviewed-by: Rob Pike <r@golang.org>
63 lines
1.5 KiB
Cheetah
63 lines
1.5 KiB
Cheetah
{/*
|
|
This is the action template.
|
|
It determines how the formatting actions are rendered.
|
|
*/}
|
|
|
|
{{define "section"}}
|
|
<h{{len .Number}} id="TOC_{{.FormattedNumber}}">{{.FormattedNumber}} {{.Title}}</h{{len .Number}}>
|
|
{{range .Elem}}{{elem $.Template .}}{{end}}
|
|
{{end}}
|
|
|
|
{{define "list"}}
|
|
<ul>
|
|
{{range .Bullet}}
|
|
<li>{{style .}}</li>
|
|
{{end}}
|
|
</ul>
|
|
{{end}}
|
|
|
|
{{define "text"}}
|
|
{{if .Pre}}
|
|
<div class="code"><pre>{{range .Lines}}{{.}}{{end}}</pre></div>
|
|
{{else}}
|
|
<p>
|
|
{{range $i, $l := .Lines}}{{if $i}}{{template "newline"}}
|
|
{{end}}{{style $l}}{{end}}
|
|
</p>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{define "code"}}
|
|
<div class="code{{if playable .}} playground{{end}}" {{if .Edit}}contenteditable="true" spellcheck="false"{{end}}>{{.Text}}</div>
|
|
{{end}}
|
|
|
|
{{define "image"}}
|
|
<div class="image">
|
|
<img src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}}>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{define "video"}}
|
|
<div class="video">
|
|
<video {{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} controls>
|
|
<source src="{{.URL}}" type="{{.SourceType}}">
|
|
</video>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{define "background"}}
|
|
<div class="background">
|
|
<img src="{{.URL}}">
|
|
</div>
|
|
{{end}}
|
|
|
|
{{define "iframe"}}
|
|
<iframe src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}}></iframe>
|
|
{{end}}
|
|
|
|
{{define "link"}}<p class="link"><a href="{{.URL}}" target="_blank">{{style .Label}}</a></p>{{end}}
|
|
|
|
{{define "html"}}{{.HTML}}{{end}}
|
|
|
|
{{define "caption"}}<figcaption>{{style .Text}}</figcaption>{{end}}
|