1234567891011121314151617181920212223242526272829303132333435363738394041424344 | {{define "code"}}<table class="code"><tr><td class="ln"><pre>{{.LineNums}}</pre></td><td class="src"><pre>{{.Code}}</pre></td></tr></table>{{end}}
{{define "filebar"}}
<div class="filebar">
<div class="fname">{{template "path" .}}</div>
<span class="finfo">
{{- if .File.Lines}}<span>{{.File.Lines}} line{{if ne .File.Lines 1}}s{{end}}</span>{{end}}
<span>{{.File.Size}}</span>
{{- if .File.Lexer}}<span>{{.File.Lexer}}</span>{{end}}
{{- if .File.Modified}}<span>Modified {{.File.Modified}}</span>{{end}}
{{- if .File.Exec}}<span>executable</span>{{end}}
</span>
<span class="factions">
{{- if .File.RawURL}}<a href="{{.File.RawURL}}">raw</a>{{end}}
{{- if eq .File.Kind "markdown"}}
<span class="toggle"><label for="v-rendered">Rendered</label><label for="v-source">Source</label></span>
{{- end}}
</span>
</div>
{{end}}
{{define "body"}}
{{- with .File}}
{{- if .Notice}}<p class="notice">{{.Notice}}</p>{{end}}
{{- end}}
{{- if eq .File.Kind "markdown"}}
<div class="mdpage">
<input type="radio" name="view" id="v-rendered" class="vis" checked>
<input type="radio" name="view" id="v-source" class="vis">
{{template "filebar" .}}
<article class="markdown rendered">{{.File.Rendered}}</article>
<div class="source">{{template "code" .File}}</div>
</div>
{{- else if eq .File.Kind "code"}}
{{template "filebar" .}}
{{template "code" .File}}
{{- else if eq .File.Kind "image"}}
{{template "filebar" .}}
<figure class="image"><img src="{{.File.ImageURL}}" alt="{{.File.Name}}"></figure>
{{- else if eq .File.Kind "large"}}
{{template "filebar" .}}
{{- else}}
{{template "filebar" .}}
<p class="binary">Binary file{{if .File.RawURL}}: <a href="{{.File.RawURL}}" download>download {{.File.Name}}</a>{{end}}.</p>
{{- end}}
{{end}}
|