commit dde744b5002b48c248ccfcb7f208616ed94ef1e5
parent 47766b32d7c6edb18c90c0fcef6c3aa54e1dc39f
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Sat, 15 Mar 2025 12:08:13 +0100
clean up HTML more rigorously
Diffstat:
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/run.sh b/run.sh
@@ -2,7 +2,7 @@
# fetch input config file, fall back to "centre"
if [ -z $1 ]; then
- CONFIG="01_pulse.yaml"
+ CONFIG="pulse.yaml"
else
CONFIG="$1"
fi
@@ -25,9 +25,13 @@ printf "Removing images and iframes...\n"
sed -E -e 's/<img[^>]*>//g' -e 's/<iframe[^>]*>//g' \
-e 's/<figure[^>]*>//g' -e 's/<\/figure>//g' -i "$HTML"
-# remove linebreaks and empty paragraphs
+# remove linebreaks and empty paragraphs as well as inline-links ("more...")
printf "Clean up HTML...\n"
-sed -E -e 's/<br[^a-z]*[^>]*>//g' -e 's/<p[^a-z]*[^>]*><\/p>//g' -i "$HTML"
+sed -E \
+ -e 's/<br[^a-z]*[^>]*>//g' \
+ -e 's/<p[^a-z]*[^>]*><\/p>//g' \
+ -e 's/<a\ [^<]+<\/a><\!--end-->/<\!--end-->/g' \
+ -i "$HTML"
# insert link to rss/xml file
printf "Inserting RSS feed file...\n"
@@ -49,19 +53,19 @@ sed -E \
# Insert feeds list
printf "Inserting feeds list...\n"
-FEEDS=""
+FEEDS="<ul>"
for i in `seq 1 1 $NFEEDS`; do
TITLE=`echo "$TITLES" | sed -n "${i},${i}p"`
WEB=`echo "$WEBS" | sed -n "${i},${i}p"`
- FEEDS="${FEEDS}<a href=\"${WEB}\">${TITLE}</a><br>"
+ FEEDS="${FEEDS}<li><a href=\"${WEB}\">${TITLE}</a></li>"
done
-FEEDS=`echo "$FEEDS" | sed -e 's/\//\\\\\//g' -ze 's/\n//g'`
+FEEDS=`echo "${FEEDS}</ul>" | sed -e 's/\//\\\\\//g' -ze 's/\n//g'`
sed -E -e "s/<\!--FEEDS-->/$FEEDS/" -i "$HTML"
# Insert Update time
printf "Inserting update time...\n"
DATE=`date +%c`
-sed -E -e "s/<\!--UPDATED-->/$DATE/" -i "$HTML"
+sed -E -e "s/<\!--UPDATED-->/🗘 ${DATE}/" -i "$HTML"
# Re-download favicons
# ./fetch_favicon.sh "$CONFIG"
diff --git a/template.tt b/template.tt
@@ -50,7 +50,7 @@
This is updated by find-and-replace
WORKAROUND: [% feed.modified %] is hardcoded to UTC
-->
- <p>Last Update:
+ <p>
<!--UPDATED-->
</p>
@@ -72,9 +72,9 @@
</h3>
<div class="article_content">
[% IF entry.summary.body %]
- <p>[% entry.summary.body %]</p>
+ <p><!--start-->[% entry.summary.body %]<!--end--></p>
[% ELSE %]
- [% entry.content.body %]
+ <!--start-->[% entry.content.body %]<!--end-->
[% END %]
</div>