commit a2363bb3bcd0882785554eb198db776e9c714396
Author: Josuah Demangeon <mail_AT_josuah.net>
Date: Thu Sep 6 00:02:37 2018 +0200
Static website generation
This is a first proposal of a trivial, ad-hoc static website generatior
for the suckless.org website.
It uses smu for markdown parsing, so some pages may need editing.
A static website can be generated with ./make
The files in _werc are no longer needed.
The files title, */title, domains, head.html, foot.html, links.html
are added for configuration.
diff --git a/.gitignore b/.gitignore
index 2e542064..2d3b5feb 100644
--- a/.gitignore
+++ b/.gitignore
_AT_@ -1,3 +1,4 @@
# these files are ignored by git
*.html
+!/*.html
test
diff --git a/core.suckless.org/_werc/config b/core.suckless.org/_werc/config
deleted file mode 100644
index 6a56a9d4..00000000
--- a/core.suckless.org/_werc/config
+++ /dev/null
_AT_@ -1,3 +0,0 @@
-siteTitle='suckless.org'
-siteSubtitle='core - userspace foundation'
-menuTitle='about'
diff --git a/core.suckless.org/title b/core.suckless.org/title
new file mode 100644
index 00000000..09d500c8
--- /dev/null
+++ b/core.suckless.org/title
_AT_@ -0,0 +1 @@
+core - userspace foundation
diff --git a/domains b/domains
new file mode 100644
index 00000000..950bcbf8
--- /dev/null
+++ b/domains
_AT_@ -0,0 +1,7 @@
+home.suckless.org
+dwm.suckless.org
+st.suckless.org
+core.suckless.org
+surf.suckless.org
+tools.suckless.org
+libs.suckless.org
diff --git a/dwm.suckless.org/_werc/config b/dwm.suckless.org/_werc/config
deleted file mode 100644
index 30aa42f3..00000000
--- a/dwm.suckless.org/_werc/config
+++ /dev/null
_AT_@ -1,3 +0,0 @@
-siteTitle='suckless.org'
-siteSubtitle='dwm - dynamic window manager'
-menuTitle='about'
diff --git a/dwm.suckless.org/title b/dwm.suckless.org/title
new file mode 100644
index 00000000..2f87133a
--- /dev/null
+++ b/dwm.suckless.org/title
_AT_@ -0,0 +1 @@
+dwm - dynamic window manager
diff --git a/ev.suckless.org/_werc/config b/ev.suckless.org/_werc/config
deleted file mode 100644
index 75ecf44c..00000000
--- a/ev.suckless.org/_werc/config
+++ /dev/null
_AT_@ -1,3 +0,0 @@
-siteTitle='suckless.org e.V.'
-siteSubtitle=''
-menuTitle='about'
diff --git a/ev.suckless.org/title b/ev.suckless.org/title
new file mode 100644
index 00000000..b8034237
--- /dev/null
+++ b/ev.suckless.org/title
_AT_@ -0,0 +1 @@
+e.V.
diff --git a/foot.html b/foot.html
new file mode 100644
index 00000000..c53226be
--- /dev/null
+++ b/foot.html
_AT_@ -0,0 +1,5 @@
+<div id="footer">
+<span class="right">
+© 2006-2018 suckless.org community | <a href="//ev.suckless.org/impressum">Impressum</a> | <a href="//ev.suckless.org">e.V.</a>
+</span>
+</div>
diff --git a/head.html b/head.html
new file mode 100644
index 00000000..20ad1231
--- /dev/null
+++ b/head.html
_AT_@ -0,0 +1,14 @@
+<!doctype html>
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="/static/css/banner-styles.css?v=1533593143.0" />
+<link rel="stylesheet" type="text/css" href="/static/css/iconochive.css?v=1533593143.0" />
+<title>%t | suckless.org software that sucks less</title>
+<link rel="stylesheet" type="text/css" href="//suckless.org/pub/style.css">
+<meta charset="utf-8">
+</head>
+<body>
+<div id="header">
+ <a href="//suckless.org/"><img src="//suckless.org/logo.svg"/></a>
+ <a id="headerLink" href="//suckless.org/">suckless.org</a> <span id="headerSubtitle">%s</span>
+</div>
diff --git a/home.suckless.org b/home.suckless.org
new file mode 120000
index 00000000..4888f31f
--- /dev/null
+++ b/home.suckless.org
_AT_@ -0,0 +1 @@
+suckless.org
\ No newline at end of file
diff --git a/libs.suckless.org/_werc/config b/libs.suckless.org/_werc/config
deleted file mode 100644
index 9feb742a..00000000
--- a/libs.suckless.org/_werc/config
+++ /dev/null
_AT_@ -1,2 +0,0 @@
-siteTitle='suckless.org'
-siteSubtitle='libraries'
diff --git a/libs.suckless.org/title b/libs.suckless.org/title
new file mode 100644
index 00000000..1aa3ee1c
--- /dev/null
+++ b/libs.suckless.org/title
_AT_@ -0,0 +1 @@
+libraries
diff --git a/links.html b/links.html
new file mode 100644
index 00000000..c1e41271
--- /dev/null
+++ b/links.html
_AT_@ -0,0 +1,4 @@
+<span class="right">
+ <a href="//dl.suckless.org">download</a>
+ <a href="//git.suckless.org">source</a>
+</span>
diff --git a/make b/make
new file mode 100755
index 00000000..3b2f03b3
--- /dev/null
+++ b/make
_AT_@ -0,0 +1,72 @@
+#!/bin/sh -e
+
+# Generate a static website out of:
+# - ./**.md - the markdown files. Must be "*/index.md"
+# - ./title - the title of the website
+# - ./domains - file with one domain per line (corresponding to ./<domain>/)
+# - ./*/title - one file per subdirectory with the subtitle
+# - ./head.html - content added at the top,
+# - ./foot.html - content added at the bottom,
+# - ./links.html - content added at the right side of the navigation bar,
+
+#1 current page
+#2 directory to list
+nav() {
+ ls "$2" | while read dir
+ do
+ test -d "$2/$dir" || continue
+ test -z "${1##$2/$dir/*?}" && match=' class="thisPage"' || match=
+ printf '<li><a%s href="%s">' "$match" "$2/$dir"
+ printf %s "$dir" | tr _- ' '
+ printf '/</a>'
+ if test "$match"
+ then
+ printf '<ul>
'
+ nav "$1" "$2/$dir"
+ printf '</ul>
'
+ fi
+ printf '</li>
'
+ done
+}
+
+find * -name '*.md' | while IFS='' read -r page
+do
+ this_domain="${page%%/*}"
+ printf 'Generating %s
' "$page" 1>&2
+ exec >${page%.md}.html
+
+ # header
+ title=$(sed 's,^#* *,,; q' "$page")
+ awk -v title="$title" -v subtitle="$(cat "$this_domain/title")" \
+ '{ gsub("%t", title); gsub("%s", subtitle); print; }' head.html
+
+ # navigation bar
+ printf '<div id="menu">
'
+ while IFS='' read -r domain
+ do
+ printf '<a href="%s"' "//${page%.md}.html"
+ test "$this_domain" = "$domain" && printf ' class="thisSite"'
+ printf '">%s</a>
' "${domain%%.*}"
+ done <domains
+ cat links.html
+ printf '</div>
'
+
+ printf '<div id="content">
'
+
+ # left navigation panel
+ printf '<div id="nav">
<ul><li><a'
+ test "${page%/*}" = "$this_domain" && printf ' class="thisPage"'
+ printf ' href="/">about</a></li>'
+ nav "$page" "$this_domain"
+ printf '</ul></div>
'
+
+ # main
+ printf '<div id="main">
'
+ smu "$page"
+ printf '</div>
'
+
+ printf '</div>
' # end of id="content"
+
+ # footer
+ cat foot.html
+done
diff --git a/st.suckless.org/_werc/config b/st.suckless.org/_werc/config
deleted file mode 100644
index 6a7b1303..00000000
--- a/st.suckless.org/_werc/config
+++ /dev/null
_AT_@ -1,3 +0,0 @@
-siteTitle='suckless.org'
-siteSubtitle='st - simple terminal'
-menuTitle='about'
diff --git a/st.suckless.org/title b/st.suckless.org/title
new file mode 100644
index 00000000..57eaac90
--- /dev/null
+++ b/st.suckless.org/title
_AT_@ -0,0 +1 @@
+st - simple terminal
diff --git a/suckless.org/_werc/config b/suckless.org/_werc/config
deleted file mode 100644
index 8ea3ff72..00000000
--- a/suckless.org/_werc/config
+++ /dev/null
_AT_@ -1,5 +0,0 @@
-siteTitle='suckless.org'
-siteSubtitle='software that sucks less'
-menuTitle='news'
-
-conf_perm_redirect '
http://suckless.org/conference/?$'
http://suckless.org/conferences/
diff --git a/suckless.org/title b/suckless.org/title
new file mode 100644
index 00000000..9f663486
--- /dev/null
+++ b/suckless.org/title
_AT_@ -0,0 +1 @@
+software that sucks less
diff --git a/surf.suckless.org/_werc/config b/surf.suckless.org/_werc/config
deleted file mode 100644
index 4972d876..00000000
--- a/surf.suckless.org/_werc/config
+++ /dev/null
_AT_@ -1,3 +0,0 @@
-siteTitle='suckless.org'
-siteSubtitle='surf'
-menuTitle='about'
diff --git a/surf.suckless.org/title b/surf.suckless.org/title
new file mode 100644
index 00000000..5551a818
--- /dev/null
+++ b/surf.suckless.org/title
_AT_@ -0,0 +1 @@
+surf
diff --git a/tools.suckless.org/_werc/config b/tools.suckless.org/_werc/config
deleted file mode 100644
index b26b3a59..00000000
--- a/tools.suckless.org/_werc/config
+++ /dev/null
_AT_@ -1,6 +0,0 @@
-siteTitle='suckless.org'
-siteSubtitle='tools'
-
-conf_perm_redirect '
http://tools.suckless.org/sbase/?$'
http://core.suckless.org/sbase
-conf_perm_redirect '
http://tools.suckless.org/sinit/?$'
http://core.suckless.org/sinit
-conf_perm_redirect '
http://tools.suckless.org/ubase/?$'
http://core.suckless.org/ubase
diff --git a/tools.suckless.org/title b/tools.suckless.org/title
new file mode 100644
index 00000000..ef1aab0d
--- /dev/null
+++ b/tools.suckless.org/title
_AT_@ -0,0 +1 @@
+tools
Received on Thu Sep 06 2018 - 00:13:45 CEST