From 598addf2fe5994c8c237a853a206004163da99f0 Mon Sep 17 00:00:00 2001 From: Fulton Browne Date: Fri, 28 May 2021 03:51:46 +0000 Subject: added webblog --- blog | 2 +- gemtohtm | 4 ++-- install | 1 + webblog | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100755 webblog diff --git a/blog b/blog index 3f37676..f6aa1c5 100755 --- a/blog +++ b/blog @@ -20,7 +20,7 @@ fn header{ fn gettitle{ echo `{echo $1 | sed 's/\+/ /g'} } -posts=`{ls -p $webroot/posts} +posts=`{ls -pr $webroot/posts} fullurl=`{read} echo $fullurl >[1=2] url=`{echo $fullurl | sed 's/gemini:\/\/[0-9 a-z .]*// diff --git a/gemtohtm b/gemtohtm index 0f0d038..ff85297 100644 --- a/gemtohtm +++ b/gemtohtm @@ -1,5 +1,5 @@ $1 == "#" { print "

", $0, "

"; next} $1 == "##" { print "

", $0, "

"; next} $1 == "###" { print "

", $0, "

"; next} -$1 == "=>" { print "" substr($0,index($0,$3)), ""; next} -{ print } +$1 == "=>" { print "" substr($0,index($0,$3)), "
"; next} +{ print $0, "
" } diff --git a/install b/install index 21e56fd..0e630ee 100755 --- a/install +++ b/install @@ -1,3 +1,4 @@ #! /bin/rc mkdir -p /rc/bin/g9srv cp rfs blog /rc/bin/g9srv +cp gemtohtm /lib/ diff --git a/webblog b/webblog new file mode 100755 index 0000000..ff67fa1 --- /dev/null +++ b/webblog @@ -0,0 +1,35 @@ +#!/bin/rc +webroot = ./ +o=./ +fn gettitle{ + echo `{echo $1 | sed 's/\+/ /g'} +} +while(! ~ $#* 0) { + switch ($1) { + case -w + webroot=$2 + shift + case -o + o=$2 + shift + case * + echo Usage: g9srv/webblog [-w webroot] [-o output dir] + exit usage + } + shift +} + +posts=`{ls -pr $webroot/posts} + +for(i in $posts){ + awk -f /lib/gemtohtm < $webroot'/posts/'$i'' > $o'/'$i.html +} + + +echo '' > $o'/'index.html +echo 'fulton.software blog' >> $o'/'index.html +for(i in $posts){ + name=`{gettitle $i} + echo ''$"name'
' >> $o'/'index.html +} +exit 0 -- cgit 1.4.1-2-gfad0