summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules3
-rwxr-xr-xbuild.sh17
m---------modules/gmi2html0
3 files changed, 18 insertions, 2 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..517c99f
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "modules/gmi2html"]
+ path = modules/gmi2html
+ url = git@senders.io:utils/gmi2html
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
diff --git a/modules/gmi2html b/modules/gmi2html
new file mode 160000
+Subproject a6c2523aed55f01ce8390272619cfee0db7cc3a