added webblog
This commit is contained in:
parent
6ad3da3f46
commit
598addf2fe
2
blog
2
blog
|
@ -20,7 +20,7 @@ fn header{
|
||||||
fn gettitle{
|
fn gettitle{
|
||||||
echo `{echo $1 | sed 's/\+/ /g'}
|
echo `{echo $1 | sed 's/\+/ /g'}
|
||||||
}
|
}
|
||||||
posts=`{ls -p $webroot/posts}
|
posts=`{ls -pr $webroot/posts}
|
||||||
fullurl=`{read}
|
fullurl=`{read}
|
||||||
echo $fullurl >[1=2]
|
echo $fullurl >[1=2]
|
||||||
url=`{echo $fullurl | sed 's/gemini:\/\/[0-9 a-z .]*//
|
url=`{echo $fullurl | sed 's/gemini:\/\/[0-9 a-z .]*//
|
||||||
|
|
4
gemtohtm
4
gemtohtm
|
@ -1,5 +1,5 @@
|
||||||
$1 == "#" { print "<h1>", $0, "</h1>"; next}
|
$1 == "#" { print "<h1>", $0, "</h1>"; next}
|
||||||
$1 == "##" { print "<h2>", $0, "</h2>"; next}
|
$1 == "##" { print "<h2>", $0, "</h2>"; next}
|
||||||
$1 == "###" { print "<h3>", $0, "</h3>"; next}
|
$1 == "###" { print "<h3>", $0, "</h3>"; next}
|
||||||
$1 == "=>" { print "<a href=\"", $2, "\">" substr($0,index($0,$3)), "</a>"; next}
|
$1 == "=>" { print "<a href=\"", $2, "\">" substr($0,index($0,$3)), "</a> <br>"; next}
|
||||||
{ print }
|
{ print $0, "<br>" }
|
||||||
|
|
1
install
1
install
|
@ -1,3 +1,4 @@
|
||||||
#! /bin/rc
|
#! /bin/rc
|
||||||
mkdir -p /rc/bin/g9srv
|
mkdir -p /rc/bin/g9srv
|
||||||
cp rfs blog /rc/bin/g9srv
|
cp rfs blog /rc/bin/g9srv
|
||||||
|
cp gemtohtm /lib/
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue