about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFulton Browne <git@fulton.software>2021-05-28 03:51:46 +0000
committerFulton Browne <git@fulton.software>2021-05-28 03:51:46 +0000
commit598addf2fe5994c8c237a853a206004163da99f0 (patch)
treeab9fdbd5c5d6bb8b96916ba7efddb97bbbcfcc2a
parent6ad3da3f46c45620da55bee9dc659f6888181572 (diff)
downloadg9srv-598addf2fe5994c8c237a853a206004163da99f0.tar.gz
added webblog
-rwxr-xr-xblog2
-rw-r--r--gemtohtm4
-rwxr-xr-xinstall1
-rwxr-xr-xwebblog35
4 files changed, 39 insertions, 3 deletions
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 "<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>"; next}
-{ print }
+$1 == "=>" { print "<a href=\"", $2, "\">" substr($0,index($0,$3)), "</a> <br>"; next}
+{ print $0, "<br>" }
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 '<link rel="stylesheet" href="/style.css">'  >  $o'/'index.html
+echo '<title>fulton.software blog</title>'  >>  $o'/'index.html
+for(i in $posts){
+	name=`{gettitle $i}
+	echo '<a href="'$i'.html">'$"name'</a> <br>' >>  $o'/'index.html
+}
+exit 0