summaryrefslogtreecommitdiffstats
path: root/templates/content.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/content.html')
-rw-r--r--templates/content.html97
1 files changed, 97 insertions, 0 deletions
diff --git a/templates/content.html b/templates/content.html
new file mode 100644
index 0000000..73f18c7
--- /dev/null
+++ b/templates/content.html
@@ -0,0 +1,97 @@
+{{- if eq .Name "section" "content" -}}
+{{- if .Title}}
+<section class="cnm-section"><details open>
+ {{- inc .Title -}}
+ <summary>
+ {{- with .Title -}}
+ {{- if $l := lanchor -}}
+ <h{{depth}}>{{.}}<a class="sec-link" id="/{{$l}}" href="#/{{$l}}">ΒΆ</a>
+ {{- if $s := sanchor}}{{if ne $s $l}}<a id="#{{$s}}"></a>{{end}}{{end -}}
+ </h{{depth}}>
+ {{- end -}}
+ {{- end -}}
+ </summary>
+ {{- range .Children -}}
+ {{- template "content.html" . -}}
+ {{- end -}}
+ {{- dec -}}
+</details></section>
+{{else -}}
+{{- range .Children -}}
+ {{- template "content.html" . -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{- if eq .Name "list" -}}
+{{if .Ordered}}<ol{{else}}<ul{{end}} class="cnm-list">
+ {{- range .Children -}}
+ {{- if eq .Name "list" -}}
+ {{- template "content.html" . -}}
+ {{- else -}}
+ <li>{{- template "content.html" . -}}</li>
+ {{- end -}}
+ {{- end -}}
+{{- if .Ordered}}</ol>{{else}}</ul>{{end -}}
+{{- end -}}
+
+{{- if eq .Name "table" -}}
+<table class="cnm-table">
+ {{- range .Rows -}}
+ {{- template "content.html" . -}}
+ {{- end -}}
+</table>
+{{- end -}}
+
+{{- if eq .Name "header" -}}
+<tr class="cnm-header">
+ {{- range .Children -}}
+ <th>{{template "content.html" .}}</th>
+ {{- end -}}
+</tr>
+{{- end -}}
+
+{{- if eq .Name "row" -}}
+<tr class="cnm-row">
+ {{- range .Children -}}
+ <td>{{template "content.html" .}}</td>
+ {{- end -}}
+</tr>
+{{- end -}}
+
+{{- if eq .Name "embed" -}}
+<figure class="cnm-embed">
+ {{- if eq .Type "image/png" "image/jpeg" "image/webp" "image/*" -}}
+ <a href="{{tourl .URL}}"><img src="{{tourl .URL}}" alt="{{with .Description}}{{.}}{{else}}embedded {{.Type}}{{end}}" {{with .Description}}title="{{.}}" {{end}}/></a>
+ {{- end -}}
+ {{- if eq .Type "video/mp4" "video/webm" "video/*" -}}
+ <video src="{{tourl .URL}}" controls{{with .Description}} title="{{.}}"{{end}}>
+ Video content: <a href="{{tourl .URL}}">{{.URL}}</a>
+ </video>
+ {{- end -}}
+ {{- if not (eq .Type "image/png" "image/jpeg" "image/webp" "image/*" "video/mp4" "video/webm" "video/*") -}}
+ <p>
+ Embedded <code>{{.Type}}</code> content: <a href="{{tourl .URL}}"{{with .Description}} title="{{.}}"{{end}}>{{.URL}}</a>
+ </p>
+ {{- end -}}
+ {{- with .Description}}<figcaption>{{.}}</figcaption>{{end -}}
+</figure>
+{{- end -}}
+
+{{- if eq .Name "text" -}}
+ {{- if eq .Format "" "plain"}}{{range .Contents.Paragraphs -}}
+<p class="cnm-text">{{.}}</p>
+ {{- end}}{{end -}}
+ {{- if eq .Format "fmt" -}}
+ {{- range .Contents.Paragraphs -}}
+ {{- cnmfmt . -}}
+ {{- end -}}
+ {{- end -}}
+ {{- if not (eq .Format "" "plain" "fmt") -}}
+<pre class="cnm-text cnm-text-pre">{{.Contents.Text}}</pre>
+ {{- end -}}
+{{- end -}}
+
+{{- if eq .Name "raw" -}}
+<pre class="cnm-raw"><code class="cnm-raw-{{lang .Syntax}}">{{.Contents}}</code></pre>
+{{- end -}}