aboutsummaryrefslogtreecommitdiff
path: root/mkweb
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2021-04-10 14:37:56 +0000
committerrodri <rgl@antares-labs.eu>2021-04-10 14:37:56 +0000
commit4d4867ed7731c7aa70855e0b62913f442d35628c (patch)
tree1939f5af1777aa9d23ef35b3553e319072206c8a /mkweb
downloadmkweb-4d4867ed7731c7aa70855e0b62913f442d35628c.tar.gz
mkweb-4d4867ed7731c7aa70855e0b62913f442d35628c.tar.bz2
mkweb-4d4867ed7731c7aa70855e0b62913f442d35628c.zip
finally released to the world.
Diffstat (limited to 'mkweb')
-rwxr-xr-xmkweb48
1 files changed, 48 insertions, 0 deletions
diff --git a/mkweb b/mkweb
new file mode 100755
index 0000000..d29cc05
--- /dev/null
+++ b/mkweb
@@ -0,0 +1,48 @@
+#!/bin/rc
+rfork en
+filter='^(bin|lib|pic|tpl)'
+sections=`{walk -d | grep -v $filter}
+
+fn entitle {
+ basename $1 | sed 's/-/ /g' | bin/capitalize
+}
+
+fn usage {
+ echo usage: $0 [ -m ] [ -s section ] >[1=2]
+ exit usage
+}
+
+fn buildsection {
+ if(test -f $1/index.md)
+ >$1/index.html {
+ if(! ~ $1 .){
+ title=`{entitle $1}
+ <tpl/head sed 's/(<title>[^<]*)/\1 - '^$"title^'/'
+ }
+ if not cat tpl/head
+ cat tpl/menu \
+ <{bin/md2html.awk $1/index.md}\
+ tpl/feet
+ }
+}
+
+if(! ~ $#* 0)
+ switch($1){
+ case -m
+ >sitemap.txt {
+ site=http://rgl.antares-labs.eu
+ echo $site/index.html
+ for(d in $sections)
+ echo $site/$d/index.html
+ }
+ case -s
+ if(~ $#2 0)
+ usage
+ buildsection $2
+ case -*
+ usage
+ }
+if not
+ for(d in $sections .){
+ buildsection $d
+ }