shite

rc static blog generator
git clone git://git.2f30.org/shite
Log | Files | Refs | README

commit cd50d92b3ebd3f45064de2cfa756d0d0b8bf9e8e
parent e2793909eae507d7a8af449aa4cf430652fc6168
Author: dsp <dsp@2f30.org>
Date:   Tue, 13 Dec 2022 07:43:14 +0000

Adding the capability of gemtext links to make it to the HTML side

Diffstat:
MREADME | 7+++++--
Mshite | 6++++--
2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/README b/README @@ -33,8 +33,11 @@ based on post titles and tags. The files it would create in the current directory are ids, tags, titles, id_content, id_title, tag_id, title_content -content files should be plain text as they are just appended -between hardcoded headers and footers. +content files can be either plain text or gemtext +as they are just appended between hardcoded headers and footers. +In the case of gemtext certain elements are mapped to HTML. + - links (in gemtext lines formatted as => url://something some title + are made into HTML anchors. Depending on the setting the HTML_BASE and/or GEMINI_BASE variables in the mkshite script it generates under publish/ diff --git a/shite b/shite @@ -98,7 +98,7 @@ fn mkgenpages { HTMLHeader $"title > $out HTMLMenu >> $out echo '<pre>' >> $out - cat $content >> $out + cat $content | sed 's/^=> ([a-zA-Z0-9\-:\/\.@?=~]+) (.*)$/<a href="\1">\2<\/a>/' >> $out echo '</pre>' >> $out HTMLFooter >> $out } @@ -207,7 +207,7 @@ fn mkpost { echo '<h1>'^$"title^'</h1>' >> $out echo '<div type=''post''>' >> $out echo '<pre>' >> $out - cat $content >> $out + cat $content | sed 's/^=> ([a-zA-Z0-9\-:\/\.@?=~]+) (.*)$/<a href="\1">\2<\/a>/' >> $out echo '</pre>' >> $out echo '</div>' >> $out HTMLFooter >> $out @@ -227,6 +227,8 @@ fn mkpost { fn mkallposts { if (! test -d publish/html) mkdir -p publish/html/post + if (! test -d publish/gmi) + mkdir -p publish/gmi/post postcontent=`' '{cat id_content} for (p in $postcontent) {