Fix paragraph

This commit is contained in:
davidovki 2023-03-03 05:08:51 +00:00
parent b1ffc4b5ba
commit 6bc6d5fb6b
1 changed files with 9 additions and 7 deletions

View File

@ -85,14 +85,16 @@ _p () {
empty=true empty=true
while IFS= read -r line; do while IFS= read -r line; do
case "$line" in case "$line" in
"#"*|">"*|"``"*) "#"*|">"*|'``'*|'<'*'>'*)
printf "%s\n" "$line" $empty &&
printf "%s\n" "$line"
;; ;;
"") "")
$empty || $empty || {
printf "</p>\n" printf "</p>\n"
empty=true
empty=true ;; }
;;
*) *)
$empty && $empty &&
printf "<p>%s " "$line" || printf "<p>%s " "$line" ||
@ -250,10 +252,10 @@ _ol () {
# #
md2html () { md2html () {
_p \ _pre_emph \
| _pre_emph \
| _ul \ | _ul \
| _ol \ | _ol \
| _p \
| _emph '__' "<strong>" "</strong>" \ | _emph '__' "<strong>" "</strong>" \
| _emph '_' "<em>" "</em>" \ | _emph '_' "<em>" "</em>" \
| _emph '`' "<code>" "</code>" \ | _emph '`' "<code>" "</code>" \