diff options
author | Steph Enders <steph@senders.io> | 2024-03-11 13:42:36 -0400 |
---|---|---|
committer | Steph Enders <steph@senders.io> | 2024-03-11 13:42:36 -0400 |
commit | 2ee0921e1b9f5f59567e0b29ec19421307e84f54 (patch) | |
tree | b03a534c1a1c896deb7a06e649714353e1dd4a10 /build.sh | |
parent | 99e582d5fa60537fe73c8e6f5bdf0de60871a134 (diff) |
Add support for authoring gemtext posts
Updating the build script to allow for posts to be .gmi files in
addition .html files. I added a submodule to gmi2html so we can
convert these on the fly and they'll write themselves to the build
directory as the desired filename which then get hoisted into the www
folder upon post creation - as normal!
This should help with authoring more simple text posts that don't
require complex markup like music stuff! This did require updating
gmi2html to have more support for quote attribution however. So I
should be mindful in the future of how that renders!
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -175,7 +175,7 @@ function add_to_rss() { local rss_data=$5 local pub_date=$(date -d "${post_date}" -R) sed -E -e "{ - s/[{]TITLE[}]/${post_title}/1; + s/[{]TITLE[}]/${post_title/\//\\/}/1; s,[{]LINK[}],${post_url},g; s/[{]PUBDATE[}]/${pub_date}/1; /CONTENT/ { @@ -201,7 +201,7 @@ echo "Building html" pinned_html=$(mktemp_file "pinned") rss_data=$(mktemp_file "rss_data") echo "Using pinned file: $pinned_html" -for post in posts/*.html; do +for post in posts/*.*; do echo "Processing $post" post_date=$(extract_metadata "post-date" $post) if [ -z "$post_date" ]; then @@ -220,6 +220,19 @@ for post in posts/*.html; do post_file=$(mktemp_file "post") content_file=$(mktemp_file "content") + # Check if gmi or HTML + extension="${post##*.}" + + if [ "${extension}" == "gmi" ]; then + echo "Converting gemtext 2 html" + gmihtml="$BUILD/$(basename ${post%.*}).html" + # todo - make gmi2html post as an article + echo "<article>" > $gmihtml + ./modules/gmi2html/gmi2html.sh <(sed "/^--.*$/d" $post) >> $gmihtml + echo "</article>" >> $gmihtml + post=$gmihtml # set post file to be the temporary HTML file + fi + echo "Copying $post data into $content_file" cp $post $content_file |