From 43aa4473be55cfbf22cc7e7a2e331b0291af81e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Mon, 26 Jul 2021 15:10:28 +0200 Subject: [PATCH] Squashed 'cgilite/' changes from 52e7985..4a04dc4 4a04dc4 portability GNU `date` / Busybox `date` 76395d4 Fix: prevent horizontal rule from masking 2nd order heading git-subtree-dir: cgilite git-subtree-split: 4a04dc4e7e882b6b4fd19059e521e261a6703f89 --- file.sh | 3 +-- markdown.awk | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/file.sh b/file.sh index 04a8ef6..6f956df 100755 --- a/file.sh +++ b/file.sh @@ -58,8 +58,7 @@ FILE(){ file_size="$(stat -Lc %s "$file")" file_date="$(stat -Lc %Y "$file")" - http_date="$(date -uRd @$file_date)" - http_date="${http_date%+0000}GMT" + http_date="$(date -ud "@$file_date" +"%a, %d %b %Y %T GMT")" cachedate="$( # Parse the allowable date formats from Section 3.3.1 of # https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html diff --git a/markdown.awk b/markdown.awk index 512be5d..361e600 100755 --- a/markdown.awk +++ b/markdown.awk @@ -274,11 +274,6 @@ function _block( block, LOCAL, st, len, hlvl, htxt, guard, code, indent ) { } else if ( AllowHTML && match( block, /^ ? ? ?(<\/[A-Za-z][A-Za-z0-9-]*[[:space:]]*>|<[A-Za-z][A-Za-z0-9-]*([[:space:]]+[A-Za-z_:][A-Za-z0-9_\.:-]*([[:space:]]*=[[:space:]]*([[:space:]"'=<>`]+|"[^"]*"|'[^']*'))?)*[[:space:]]*\/?>)([[:space:]]*\n)([^\n]|\n[ \t]*[^\n])*(\n[[:space:]]*\n|$)/) ) { len = RLENGTH; st = RSTART; return substr(block, st, len) _block(substr(block, st + len)); - - # Horizontal rule - } else if ( match( block, /(^|\n) ? ? ?((\* *){3,}|(- *){3,}|(_ *){3,})($|\n)/) ) { - len = RLENGTH; st = RSTART; - return _block(substr(block, 1, st - 1)) "
\n" _block(substr(block, st + len)); # Blockquote (leading >) } else if ( match( block, /^> /) ) { @@ -369,6 +364,11 @@ function _block( block, LOCAL, st, len, hlvl, htxt, guard, code, indent ) { return "" inline( htxt ) "\n\n" \ _block( substr( block, len + 1) ); + # Horizontal rule + } else if ( match( block, /(^|\n) ? ? ?((\* *){3,}|(- *){3,}|(_ *){3,})($|\n)/) ) { + len = RLENGTH; st = RSTART; + return _block(substr(block, 1, st - 1)) "
\n" _block(substr(block, st + len)); + # Plain paragraph } else { match( block, /(^|\n)[[:space:]]*(\n|$)/ ) || match( block, /$/ ); -- 2.39.2