github.com/spotify/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/blog/template/doc.tmpl (about)

     1  {{/* This doc template is given to the present tool to format articles.  */}}
     2  
     3  {{define "root"}}
     4  
     5    {{with .Subtitle}}<h2>{{.}}</h2>{{end}}
     6    {{if .Doc | sectioned}}
     7      {{range .Sections}}
     8        {{elem $.Template .}}
     9      {{end}}
    10    {{else}}
    11      {{with index .Sections 0}}
    12        {{range .Elem}}
    13          {{elem $.Template .}}
    14        {{end}}
    15      {{end}}
    16    {{end}}
    17  
    18  {{end}}
    19  
    20  {{define "TOC"}}
    21    <ul>
    22    {{range .}}
    23      <li><a href="#TOC_{{.FormattedNumber}}">{{.Title}}</a></li>
    24      {{with .Sections}}{{template "TOC" .}}{{end}}
    25    {{end}}
    26    </ul>
    27  {{end}}
    28  
    29  {{define "newline"}}
    30  {{/* No automatic line break. Paragraphs are free-form. */}}
    31  {{end}}
    32  
    33  {{define "section"}}
    34    <h4 id="TOC_{{.FormattedNumber}}">{{.Title}}</h4>
    35    {{range .Elem}}{{elem $.Template .}}{{end}}
    36  {{end}}
    37  
    38  {{define "list"}}
    39    <ul>
    40    {{range .Bullet}}
    41      <li>{{style .}}</li>
    42    {{end}}
    43    </ul>
    44  {{end}}
    45  
    46  {{define "text"}}
    47    {{if .Pre}}
    48    <div class="code"><pre>{{range .Lines}}{{.}}{{end}}</pre></div>
    49    {{else}}
    50    <p>
    51      {{range $i, $l := .Lines}}{{if $i}}{{template "newline"}}
    52      {{end}}{{style $l}}{{end}}
    53    </p>
    54    {{end}}
    55  {{end}}
    56  
    57  {{define "code"}}
    58    {{if .Play}}
    59  	<div class="playground">{{.Text}}</div>
    60    {{else}}
    61  	<div class="code">{{.Text}}</div>
    62    {{end}}
    63  {{end}}
    64  
    65  {{define "image"}}
    66  <div class="image">
    67    <img src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}}>
    68  </div>
    69  {{end}}
    70  
    71  {{define "iframe"}}
    72  <div class="iframe">
    73    <iframe src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} frameborder="0" allowfullscreen mozallowfullscreen webkitallowfullscreen></iframe>
    74  </div>
    75  {{end}}
    76        
    77  {{define "link"}}<p class="link"><a href="{{.URL}}" target="_blank">{{style .Label}}</a></p>{{end}}
    78  
    79  {{define "html"}}{{.HTML}}{{end}}