commit 37b4eb35d276af4ba61ad84ff9dd6911725c9a4d
parent 131ec5da72ed5545014e17782a9c5ca60611b542
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Sat, 12 Apr 2025 12:42:33 +0200
fix: introduce linebreaks beforehand
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/run.sh b/scripts/run.sh
@@ -20,13 +20,14 @@ printf "Fetching feeds and generating html...\n"
perlanet "$config"
# Clean up HTML from tags within the <!--start--> / <!--end--> comments
-# 1. removes anchor text at the end of the post (typically "read more...")
-# 2. removes text within <figcaption></figcaption>
-# 3. introduce line-breaks for each existing paragraph
+# 1. introduce line-breaks for each existing paragraph
+# 2. removes anchor text at the end of the post (typically "read more...")
+# 3. removes text within <figcaption></figcaption>
# 4. removes all HTML tags
# 5. creates paragraphs line-wise
# 6. removes empty paragraphs
printf "Clean up HTML...\n"
+sed -E -e 's/(<\/p>)/\1\n/g' -i "$page_file"
start_lines=($(grep -n "<\!--start-->" "$page_file" | sed -e 's/:.*//g'))
stop_lines=($(grep -n "<\!--end-->" "$page_file" | sed -e 's/:.*//g'))
for i in $(seq 0 1 $((${#start_lines[@]} - 1))); do
@@ -34,7 +35,6 @@ for i in $(seq 0 1 $((${#start_lines[@]} - 1))); do
sed -E \
-e "${line}s/<a\ [^<]+<\/a><\!--end-->/<\!--end-->/g" \
-e "${line}s/<figcaption.*<\/figcaption>//g" \
- -e "${line}s/(<\/p>)/\1\n/g" \
-e "${line}s/<[^<]+>//g" \
-e "${line}s/^/<p>/" \
-e "${line}s/$/<\/p>/" \