diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rwxr-xr-x | build.sh | 17 | ||||
m--------- | modules/gmi2html | 0 |
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 @@ -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 |