commit 26c413e4f8164f92c27e01cb79d66eed8bfd23cb
parent 0f261c6309a35d3e0f70473afab41adb52055c49
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Sat, 12 Apr 2025 11:57:47 +0200
fix: introduce linebreaks after each paragraph
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/scripts/run.sh b/scripts/run.sh
@@ -22,9 +22,10 @@ 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. removes all HTML tags
-# 4. creates paragraphs line-wise
-# 5. removes empty paragraphs
+# 3. introduce line-breaks for each existing paragraph
+# 4. removes all HTML tags
+# 5. creates paragraphs line-wise
+# 6. removes empty paragraphs
printf "Clean up HTML...\n"
start_lines=($(grep -n "<\!--start-->" "$page_file" | sed -e 's/:.*//g'))
stop_lines=($(grep -n "<\!--end-->" "$page_file" | sed -e 's/:.*//g'))
@@ -33,6 +34,7 @@ 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>/" \
@@ -40,7 +42,6 @@ for i in $(seq 0 1 $((${#start_lines[@]} - 1))); do
-i "$page_file"
done
done
-
# re-apply <!--start--> / <!--end--> comments
sed -E \
-e "${start_lines[0]}s/^/<\!--start\-\->/g" \