ref: 6c8cdffcbb31b74008f8fa14a26d6ad524850802
parent: aa397fe2ffceabe962d70930ed220952c893feb0
author: kvik <kvik@a-b.xyz>
date: Wed Jul 29 11:46:31 EDT 2020
Make cfg/ configuration system
--- a/bin/md2html
+++ b/bin/md2html
@@ -14,12 +14,17 @@
ENDOFTEMPLATE'
}
-# Template variables
-# TODO: Source these from templates/env or something.
-language = 'en'
+fn cfg {
+ echo -n `''{sed 1q cfg/$1 >[2]/dev/null}
+}
+language = `{cfg language}
+site = `{cfg site}
+
stub = `{echo $md | sed 's@\..*$@@'}
title = `{sed 's@^# @@; 1q' $stub.md}
+if(! ~ $#site 0)
+ title = $site — $title
head = `''{expand templates/head.html}
body = `''{bin/filter-markdown $stub.md}
body = `''{expand templates/body.html}
--- /dev/null
+++ b/cfg/language
@@ -1,0 +1,1 @@
+en
--- /dev/null
+++ b/cfg/site
@@ -1,0 +1,1 @@
+ugh!