Compare commits

...

3 Commits

Author SHA1 Message Date
Fulton Browne 94bf6b9d08 fast script 2021-05-28 15:28:18 +00:00
Fulton Browne 598addf2fe added webblog 2021-05-28 03:51:46 +00:00
Fulton Browne 6ad3da3f46 added a gemtext to html converter 2021-05-28 03:10:01 +00:00
5 changed files with 48 additions and 1 deletions

2
blog
View File

@ -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 .]*//

5
gemtohtm Normal file
View File

@ -0,0 +1,5 @@
$1 == "#" { print "<h1>", $0, "</h1>"; next}
$1 == "##" { print "<h2>", $0, "</h2>"; next}
$1 == "###" { print "<h3>", $0, "</h3>"; next}
$1 == "=>" { print "<a href=\"", $2, "\">" substr($0,index($0,$3)), "</a> <br>"; next}
{ print $0, "<br>" }

View File

@ -1,3 +1,5 @@
#! /bin/rc
mkdir -p /rc/bin/g9srv
cp rfs blog /rc/bin/g9srv
cp gemtohtm /lib/
cp webblog /rc/bin/g9srv

3
wb Executable file
View File

@ -0,0 +1,3 @@
#!/bin/rc
g9srv/webblog -o /usr/web/posts -w /usr/glenda/code/gemsite/

37
webblog Executable file
View File

@ -0,0 +1,37 @@
#!/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 '<link rel="stylesheet" href="/style.css">' > $o'/'index.html
echo '<title>fulton.software blog</title>' >> $o'/'index.html
echo '<h1>Fulton''s blog</h1>' >> $o'/'index.html
for(i in $posts){
name=`{gettitle $i}
echo '<a href="'$i'.html">'$"name'</a> <br>' >> $o'/'index.html
}
exit 0