diff options
Diffstat (limited to 'templates/page.html')
| -rw-r--r-- | templates/page.html | 112 | 
1 files changed, 112 insertions, 0 deletions
| diff --git a/templates/page.html b/templates/page.html new file mode 100644 index 0000000..0f89e2d --- /dev/null +++ b/templates/page.html @@ -0,0 +1,112 @@ +<!doctype html> +<html> +	<head> +		<meta charset="utf-8" /> +		<meta name="viewport" content="width=device-width, initial-scale=1" /> +		<title>{{with .Doc.Title}}{{.}}{{else}} {{end}}</title> +		<link rel="stylesheet" href="/static/style.css" /> +		<style>main p,main summary,h1,h2,h3,h4,h5,h6{white-space: pre-wrap;}</style> +		<script async src="/static/script.js"></script> +		{{if .Highlight}}<link rel="stylesheet" href="/static/highlight/style.css" />{{end}} +	</head> +	<body> +		<header> +			{{if .Browser -}} +			<form id="browser" action="/" method="post"> +				<input type="text" name="url" placeholder="cnp://example.com/" value="{{if ne .URL "cnp:///"}}{{.URL}}{{end}}" /> +				<input type="submit" value="Go" /> +			</form> +			{{- end}} + +			{{with .Doc.Title}}<h1>{{.}}</h1>{{end -}} + +			{{with .Doc.Links -}} +			<nav> +				<details open> +					<summary><b>Links</b></summary> +						<ul> +							{{- range .}} +							<li><a href="{{tourl .URL}}"{{with .Description}} title="{{.}}"{{end}}>{{with .Name}}{{.}}{{else}}{{.URL}}{{end}}</a></li> +							{{- end}} +						</ul> +				</details> +			</nav> +			{{- end -}} + +			{{with .Site -}} +			<nav> +				<details> +					<summary><b>Sitemap</b></summary> +					{{- block "site" . -}} +					<ul> +					{{- range . -}} +						<li> +							<a href="{{tourl .Path}}">{{.Name}}</a> +							{{- template "site" .Children -}} +						</li> +					{{- end -}} +					</ul> +					{{- end -}} +			</details> +		</nav> +			{{- end -}} + +			{{if .Toc.Children -}} +			<nav> +				<details> +					<summary><b>Table of Contents</b></summary> +					<ul> +						{{- range .Toc.Children -}} +						{{- block "toc" . -}} +						{{- inc .Title -}} +						<li> +							<a href="#/{{anchor}}">{{.Title}}</a> +							{{- with .Children -}} +							<ul> +								{{- range . -}} +									{{- template "toc" . -}} +								{{- end -}} +							</ul> +							{{- end -}} +						</li> +						{{- dec -}} +						{{- end -}} +						{{- end -}} +					</ul> +				</details> +			</nav> +			{{- end}} +		</header> + +		<main> +			{{- with .Doc.Content}} +			{{- range .Children}} +			{{- template "content.html" .}} +			{{- end}}{{end}} +		</main> + +		<footer> +			<p>This is a <a href="https://contnet.org/">ContNet</a> <code>text/cnm</code> page retrieved over CNP from <a {{href .URL}}>{{.URL}}</a> +				- +				<a href="?req&resp">See request/response</a> +				- +				<a href="?raw">Raw CNM document</a> +			</p> +			<details> +				<summary>CNP request header (<a href="?req">try</a>)</summary> +				<pre><code class="lang-{{lang "text/cnp"}}">{{.Req}}</code></pre> +			</details> +			<details> +				<summary>CNP response header (<a href="?hdr">try</a>)</summary> +				<pre><code class="lang-{{lang "text/cnp"}}">{{.Resp}}</code></pre> +			</details> +			<details> +				<summary>Try with <a href="https://en.wikipedia.org/wiki/Netcat">Netcat</a></summary> +				<pre><code class="lang-{{lang "application/x-sh"}}">{{.Netcat}}</code></pre> +			</details> +		</footer> + +		{{if .Highlight}}<script src="/static/highlight/highlight.pack.js"></script> +		<script src="/static/hlraw.js"></script>{{end}} +	</body> +</html> |