summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh17
1 files changed, 15 insertions, 2 deletions
diff --git a/build.sh b/build.sh
index 03be6f8..ab0559e 100755
--- a/build.sh
+++ b/build.sh
@@ -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