diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/asciiman.awk | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/asciiman.awk b/tools/asciiman.awk index da32db8..6db5695 100644 --- a/tools/asciiman.awk +++ b/tools/asciiman.awk @@ -32,7 +32,7 @@ function expand(s, attr) { function escape(s) { gsub(/\\/, "\\\\", s) gsub(/-/, "\\-", s) - gsub(/[.]/, "\\.", s) + sub(/^[.']/, "\\\\\\&&", s) return s } @@ -80,9 +80,6 @@ function inline(line) { line = escape(expand(line)) - # Enable double-spacing after the end of a sentence. - gsub(/\\[.][[:space:]]+/, ".\n", s) - # Strip empty URL descriptions, otherwise useful for demarking the end. while (match(line, /[^[:space:]]+\[\]/)) { line = substr(line, 1, RSTART + RLENGTH - 3) \ @@ -118,6 +115,15 @@ function inline(line) { substr(line, RSTART + RLENGTH) } + # Enable double-spacing after the end of a sentence. + gsub(/[.][[:space:]]+/, ".\n", line) + gsub(/[!][[:space:]]+/, "!\n", line) + gsub(/[?][[:space:]]+/, "?\n", line) + + # Quote commands resulting from that, as well as from expand(). + gsub(/\n[.]/, "\n\\\\\\&.", line) + gsub(/\n[']/, "\n\\\\\\&'", line) + sub(/[[:space:]]+[+]$/, "\n.br", line) print line } |