sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit a2363bb3bcd0882785554eb198db776e9c714396
parent af463df202bf60b580c62c3dd047a85b573c5b4e
Author: Josuah Demangeon <mail@josuah.net>
Date:   Thu,  6 Sep 2018 00:02:37 +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.

Diffstat:
M.gitignore | 1+
Dcore.suckless.org/_werc/config | 3---
Acore.suckless.org/title | 1+
Adomains | 7+++++++
Ddwm.suckless.org/_werc/config | 3---
Adwm.suckless.org/title | 1+
Dev.suckless.org/_werc/config | 3---
Aev.suckless.org/title | 1+
Afoot.html | 5+++++
Ahead.html | 14++++++++++++++
Ahome.suckless.org | 2++
Dlibs.suckless.org/_werc/config | 2--
Alibs.suckless.org/title | 1+
Alinks.html | 4++++
Amake | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/_werc/config | 3---
Ast.suckless.org/title | 1+
Dsuckless.org/_werc/config | 5-----
Asuckless.org/title | 1+
Dsurf.suckless.org/_werc/config | 3---
Asurf.suckless.org/title | 1+
Dtools.suckless.org/_werc/config | 6------
Atools.suckless.org/title | 1+
23 files changed, 113 insertions(+), 28 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -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 @@ -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 @@ -0,0 +1 @@ +core - userspace foundation diff --git a/domains b/domains @@ -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 @@ -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 @@ -0,0 +1 @@ +dwm - dynamic window manager diff --git a/ev.suckless.org/_werc/config b/ev.suckless.org/_werc/config @@ -1,3 +0,0 @@ -siteTitle='suckless.org e.V.' -siteSubtitle='' -menuTitle='about' diff --git a/ev.suckless.org/title b/ev.suckless.org/title @@ -0,0 +1 @@ +e.V. diff --git a/foot.html b/foot.html @@ -0,0 +1,5 @@ +<div id="footer"> +<span class="right"> +&copy; 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 @@ -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 @@ -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 @@ -1,2 +0,0 @@ -siteTitle='suckless.org' -siteSubtitle='libraries' diff --git a/libs.suckless.org/title b/libs.suckless.org/title @@ -0,0 +1 @@ +libraries diff --git a/links.html b/links.html @@ -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 @@ -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>\n' + nav "$1" "$2/$dir" + printf '</ul>\n' + fi + printf '</li>\n' + done +} + +find * -name '*.md' | while IFS='' read -r page +do + this_domain="${page%%/*}" + printf 'Generating %s\n' "$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">\n' + while IFS='' read -r domain + do + printf '<a href="%s"' "//${page%.md}.html" + test "$this_domain" = "$domain" && printf ' class="thisSite"' + printf '">%s</a>\n' "${domain%%.*}" + done <domains + cat links.html + printf '</div>\n\n' + + printf '<div id="content">\n\n' + + # left navigation panel + printf '<div id="nav">\n<ul><li><a' + test "${page%/*}" = "$this_domain" && printf ' class="thisPage"' + printf ' href="/">about</a></li>' + nav "$page" "$this_domain" + printf '</ul></div>\n\n' + + # main + printf '<div id="main">\n' + smu "$page" + printf '</div>\n\n' + + printf '</div>\n\n' # end of id="content" + + # footer + cat foot.html +done diff --git a/st.suckless.org/_werc/config b/st.suckless.org/_werc/config @@ -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 @@ -0,0 +1 @@ +st - simple terminal diff --git a/suckless.org/_werc/config b/suckless.org/_werc/config @@ -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 @@ -0,0 +1 @@ +software that sucks less diff --git a/surf.suckless.org/_werc/config b/surf.suckless.org/_werc/config @@ -1,3 +0,0 @@ -siteTitle='suckless.org' -siteSubtitle='surf' -menuTitle='about' diff --git a/surf.suckless.org/title b/surf.suckless.org/title @@ -0,0 +1 @@ +surf diff --git a/tools.suckless.org/_werc/config b/tools.suckless.org/_werc/config @@ -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 @@ -0,0 +1 @@ +tools