blob: 8153cd94e4691db5efae0954c2a2c327420d8697 [file] [log] [blame]
{/*
This is the article template. It defines how articles are formatted.
The "root" template is the base HTML document. The "list", "text", "code",
"image", and "link" templates are used by the various formatting helpers.
*/}
{{define "root"}}
<!DOCTYPE html>
<html>
<head>
<title>{{.Title}}</title>
<link type="text/css" rel="stylesheet" href="/static/article.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<meta charset='utf-8'>
</head>
<body>
<div id="topbar" class="wide">
<div class="container">
<div id="heading">{{.Title}}
{{with .Subtitle}}{{.}}{{end}}
</div>
</div>
</div>
<div id="page" class="wide">
<div class="container">
{{with $toc := .Sections}}
<div id="toc">
{{range .}}{{template "TOC" .}}{{end}}
</div>
{{end}}
{{range .Sections}}
{{.HTML $.Template}}
{{end}}{{/* of Section block */}}
<h2>Authors</h2>
{{range .Authors}}
<div class="author">
{{range .Elem}}{{.HTML $.Template}}{{end}}
</div>
{{end}}
</div>
</div>
<script src='/static/playground.js'></script>
</body>
</html>
{{end}}
{{define "TOC"}}
<ul>
<li><a href="#TOC_{{.FormattedNumber}}">{{.Title}}</a></li>
{{with .Sections}}
<ul>
{{range .}}{{template "TOC" .}}{{end}}
</ul>
{{end}}
</ul>
{{end}}
{{define "section"}}
<h{{len .Number}} id="TOC_{{.FormattedNumber}}">{{.FormattedNumber}} {{.Title}}</h{{len .Number}}>
{{range .Elem}}{{.HTML $.Doc.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}}<br>
{{end}}{{style $l}}{{end}}
</p>
{{end}}
{{end}}
{{define "code"}}
<div class="code{{if .Play}} playground{{end}}" contenteditable="true">{{code .}}</div>
{{end}}
{{define "image"}}<div class="image">{{image .File .Args}}</div>{{end}}
{{define "link"}}<p class="link">{{link .URL .Args}}</p>{{end}}