summaryrefslogtreecommitdiff
path: root/htdocs
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2019-01-20 12:35:37 +0100
committerDimitri Sokolyuk <demon@dim13.org>2019-01-20 12:35:37 +0100
commitf12d854fcf5e46fe526a92a316b2c6ec118fcea3 (patch)
tree284d40c6eb60a5163fee6fc4bb2007937a539a1b /htdocs
parent312ecbfa56c625903f1b1d56408326145b2fce2d (diff)
Replace fcgi with plain http server
Diffstat (limited to 'htdocs')
-rw-r--r--htdocs/.gitignore1
-rw-r--r--htdocs/static/style.css47
-rw-r--r--htdocs/template/article.tmpl15
-rw-r--r--htdocs/template/doc.tmpl77
-rw-r--r--htdocs/template/home.tmpl10
-rw-r--r--htdocs/template/index.tmpl24
-rw-r--r--htdocs/template/root.tmpl80
7 files changed, 254 insertions, 0 deletions
diff --git a/htdocs/.gitignore b/htdocs/.gitignore
new file mode 100644
index 0000000..d95f3ad
--- /dev/null
+++ b/htdocs/.gitignore
@@ -0,0 +1 @@
+content
diff --git a/htdocs/static/style.css b/htdocs/static/style.css
new file mode 100644
index 0000000..2e3117f
--- /dev/null
+++ b/htdocs/static/style.css
@@ -0,0 +1,47 @@
+body {
+ color: #222;
+ font-family: 'Abel', sans-serif;
+}
+h1, h2, h3, h4, h5, h6, header, footer, .navbar-brand {
+ font-family: 'Raleway', sans-serif;
+}
+h1, h2, .navbar-brand {
+ text-shadow: 1px 1px #CCC;
+}
+pre, code, kbd {
+ font-family: 'Space Mono', monospace;
+}
+a {
+ color: #F50;
+}
+a:hover {
+ color: #05A;
+}
+pre {
+ line-height: 120%;
+ overflow: auto;
+ border: thin solid #CDE;
+ padding: 1ex 2ex;
+}
+article, section {
+ margin-top: 3em;
+ margin-bottom: 2em;
+}
+article header {
+ margin-bottom: 1em;
+}
+article footer {
+ margin-top: 1em;
+}
+time, address {
+ color: #999;
+ font-size: small;
+}
+figcaption {
+ font-style: italic;
+ margin-bottom: 2ex;
+}
+img {
+ margin-right: 1ex;
+ margin-bottom: 1ex;
+}
diff --git a/htdocs/template/article.tmpl b/htdocs/template/article.tmpl
new file mode 100644
index 0000000..e461ce2
--- /dev/null
+++ b/htdocs/template/article.tmpl
@@ -0,0 +1,15 @@
+{{/* This file is combined with the root.tmpl to display a single article. */}}
+
+{{define "title"}}{{.Doc.Title}}{{end}}
+
+{{define "content"}}
+ {{with .Doc}}
+ {{template "doc" .}}
+ {{with .Related}}
+ <h5>Related articles</h5>
+ <ul>
+ {{range .}}<li><a href="{{.Path}}">{{.Title}}</a></li>{{end}}
+ </ul>
+ {{end}}
+ {{end}}
+{{end}}
diff --git a/htdocs/template/doc.tmpl b/htdocs/template/doc.tmpl
new file mode 100644
index 0000000..b50790d
--- /dev/null
+++ b/htdocs/template/doc.tmpl
@@ -0,0 +1,77 @@
+{{/* This doc template is given to the present tool to format articles. */}}
+
+{{define "root"}}
+ {{with .Subtitle}}<h3>{{.}}</h3>{{end}}
+ {{if .Doc | sectioned}}
+ {{range .Sections}}
+ {{elem $.Template .}}
+ {{end}}
+ {{else}}
+ {{with index .Sections 0}}
+ {{range .Elem}}
+ {{elem $.Template .}}
+ {{end}}
+ {{end}}
+ {{end}}
+{{end}}
+
+{{define "TOC"}}
+ <ul>
+ {{range .}}
+ <li><a href="#TOC_{{.FormattedNumber}}">{{.Title}}</a></li>
+ {{with .Sections}}{{template "TOC" .}}{{end}}
+ {{end}}
+ </ul>
+{{end}}
+
+{{define "newline"}}
+{{/* newline */}}
+{{end}}
+
+{{define "section"}}
+ <h4 id="TOC_{{.FormattedNumber}}">{{.Title}}</h4>
+ {{range .Elem}}{{elem $.Template .}}{{end}}
+{{end}}
+
+{{define "list"}}
+ <ul>
+ {{range .Bullet}}
+ <li>{{style .}}</li>
+ {{end}}
+ </ul>
+{{end}}
+
+{{define "text"}}
+ {{if .Pre}}
+ <pre>{{range .Lines}}{{.}}{{end}}</pre>
+ {{else}}
+ <p>
+ {{range $i, $l := .Lines}}{{if $i}}{{template "newline"}}
+ {{end}}{{style $l}}{{end}}
+ </p>
+ {{end}}
+{{end}}
+
+{{define "code"}}
+ <div class="code">{{.Text}}</div>
+{{end}}
+
+{{define "image"}}
+ <img src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} alt="image">
+{{end}}
+
+{{define "caption"}}
+ <figcaption>{{style .Text}}</figcaption>
+{{end}}
+
+{{define "iframe"}}
+<div class="iframe">
+ <iframe src="{{.URL}}"{{with .Height}} height="{{.}}"{{end}}{{with .Width}} width="{{.}}"{{end}} frameborder="0" allowfullscreen mozallowfullscreen webkitallowfullscreen></iframe>
+</div>
+{{end}}
+
+{{define "link"}}
+ <p class="link"><a href="{{.URL}}" target="_blank" rel="noopener">{{style .Label}}</a></p>
+{{end}}
+
+{{define "html"}}{{.HTML}}{{end}}
diff --git a/htdocs/template/home.tmpl b/htdocs/template/home.tmpl
new file mode 100644
index 0000000..2c622b5
--- /dev/null
+++ b/htdocs/template/home.tmpl
@@ -0,0 +1,10 @@
+{{/* This file is combined with the root.tmpl to display the blog home page. */}}
+
+{{define "title"}}dim13{{end}}
+
+{{define "content"}}
+ {{range .Data}}
+ {{template "doc" .}}
+ {{end}}
+ <p>See the <a href="{{.BasePath}}/index">index</a> for more articles.</p>
+{{end}}
diff --git a/htdocs/template/index.tmpl b/htdocs/template/index.tmpl
new file mode 100644
index 0000000..1803dd5
--- /dev/null
+++ b/htdocs/template/index.tmpl
@@ -0,0 +1,24 @@
+{{/* This file is combined with the root.tmpl to display the blog index. */}}
+
+{{define "title"}}Article index{{end}}
+
+{{define "content"}}
+ <section>
+ <h2>{{template "title"}}</h2>
+ <ul class="list-group">
+ {{range .Data}}
+ <li class="list-group-item">
+ <div class="d-flex justify-content-between">
+ <a href="{{.Path}}">{{.Title}}</a>
+ {{with .Tags}}
+ <span>
+ {{range .}}<span class="badge badge-default">{{.}}</span> {{end}}
+ </span>
+ {{end}}
+ </div>
+ <div>{{template "time" .Time}}</div>
+ </li>
+ {{end}}
+ </ul>
+ </section>
+{{end}}
diff --git a/htdocs/template/root.tmpl b/htdocs/template/root.tmpl
new file mode 100644
index 0000000..164cf31
--- /dev/null
+++ b/htdocs/template/root.tmpl
@@ -0,0 +1,80 @@
+{{/* This template is combined with other templates to render blog pages. */}}
+
+{{define "root" -}}
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title>{{template "title" .}}</title>
+
+ <meta charset="utf-8">
+ <meta name="google-site-verification" content="3cwuN4OwVfNZEGTw5Q9UotI2AJCTzr8F7QB8uhtfAWo">
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Abel|Raleway|Space+Mono">
+ <link rel="stylesheet" href="/static/style.css">
+ <link rel="alternate" type="application/atom+xml" title="Atom Feed" href="/feed.atom">
+
+ <!-- Global site tag (gtag.js) - Google Analytics -->
+ <script async src="https://www.googletagmanager.com/gtag/js?id=UA-22272807-1"></script>
+ <script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+ gtag('config', 'UA-22272807-1');
+ </script>
+</head>
+<body>
+ <nav class="navbar navbar-expand-sm">
+ <div class="container-fluid">
+ <a class="navbar-brand" href="{{.BasePath}}/">dim13·blog</a>
+ <ul class="navbar-nav">
+ <li class="nav-item"><a class="nav-link" href="{{.BasePath}}/Who-am-I">Who am I</a></li>
+ <li class="nav-item"><a class="nav-link" href="//github.com/dim13">GitHub</a></li>
+ <li class="nav-item"><a class="nav-link" href="//git.dim13.org">Local Git</a></li>
+ <li class="nav-item"><a class="nav-link" href="//ftp.dim13.org">Public FTP</a></li>
+ <li class="nav-item"><a class="nav-link" href="{{.BasePath}}/index">Blog Index</a></li>
+ </ul>
+ </div>
+ </nav>
+
+ <div class="container">
+ {{template "content" .}}
+ </div>
+
+ {{with .Doc}}
+ <nav class="navbar navbar-expand-sm">
+ <div class="container-fluid">
+ <ul class="navbar-nav">
+ {{with .Older}}
+ <li class="nav-item"><a class="nav-link" href="{{.Path}}">&larr; {{.Title}}</a></li>
+ {{end}}
+ </ul>
+ <ul class="navbar-nav">
+ {{with .Newer}}
+ <li class="nav-item"><a class="nav-link" href="{{.Path}}">{{.Title}} &rarr;</a></li>
+ {{end}}
+ </ul>
+ </div>
+ </nav>
+ {{end}}
+</body>
+</html>
+{{end}}
+
+{{define "doc"}}
+ <article>
+ <header>
+ <h2><a href="{{.Path}}">{{.Title}}</a></h2>
+ {{template "time" .Time}}
+ </header>
+ {{.HTML}}
+ <footer>
+ {{with .Authors}}<address>By {{authors .}}</address>{{end}}
+ </footer>
+ </article>
+{{end}}
+
+{{define "time" -}}
+<time datetime="{{.Format "2006-01-02T15:04:05Z07:00"}}">{{.Format "2 January 2006"}}</time>
+{{- end}}