git3html

git clone https://orangeshoelaces.net/git/git3html.git

dac228f3fbb675ab89f37a9dc4786a1ac1e260f2

Author: Vasilii Kolobkov on 01/15/2019

Committer: Vasilii Kolobkov on 01/15/2019

Shoehorn commit body into a <p>

Stats

git3html | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

Patch

diff --git a/git3html b/git3html
index 710dec7..22175c8 100755
--- a/git3html
+++ b/git3html
@@ -162,7 +162,13 @@ commit() (
 		printf '<p>%s</p>\n' "$subj"
 		body="$(cat)"
 		if [ "${#body}" -gt 0 ]; then
-			printf '<p>%s</p>\n' "$body"
+			printf '<p>'
+			bodylnfmt='%s'
+			echo "$body" | while IFS= read -r bodyln; do
+				printf "$bodylnfmt" "$bodyln"
+				bodylnfmt='<br>\n%s'
+			done
+			printf '</p>\n'
 		fi
 	}