diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2024-02-12 10:57:23 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2024-02-12 10:57:23 +0100 |
commit | ad5b2fb8cd4915de9c6d97c362839de02d4970a6 (patch) | |
tree | 5e293bd1e18debe523cd76982596649c5a916afb /tools | |
parent | 2a1f17a8f7e32e1a485df450c5ad231312fedc16 (diff) | |
download | liberty-ad5b2fb8cd4915de9c6d97c362839de02d4970a6.tar.gz liberty-ad5b2fb8cd4915de9c6d97c362839de02d4970a6.tar.xz liberty-ad5b2fb8cd4915de9c6d97c362839de02d4970a6.zip |
asciiman: mildly improve compatibility
git manual pages render a little bit more sensibly now.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/asciiman.awk | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/asciiman.awk b/tools/asciiman.awk index 92b910d..7483aa4 100644 --- a/tools/asciiman.awk +++ b/tools/asciiman.awk @@ -1,6 +1,6 @@ # asciiman.awk: simplified AsciiDoc to manual page converter # -# Copyright (c) 2022 - 2023, Přemysl Eric Janouch <p@janouch.name> +# Copyright (c) 2022 - 2024, Přemysl Eric Janouch <p@janouch.name> # SPDX-License-Identifier: 0BSD # # This is not intended to produce great output, merely useful output. @@ -149,6 +149,11 @@ function format(line, v) { } else if (match(line, /^[*][^*]+[*]/) && substr(line, RSTART + RLENGTH) !~ /^[[:alnum:]]/) { v = v "\\fB" substr(line, RSTART + 1, RLENGTH - 2) "\\fP" + } else if (match(line, /^`[^`]+`/) && + substr(line, RSTART + RLENGTH) !~ /^[[:alnum:]]/) { + # Manual pages are usually already rendered in monospace; + # follow others, and render this in boldface. + v = v "\\fB" substr(line, RSTART + 1, RLENGTH - 2) "\\fP" } else { v = v substr(line, 1, 1) line = substr(line, 2) @@ -226,6 +231,13 @@ function process(firstline, posattrs, namedattrs) { return 0 } + if (firstline ~ /^--$/) { + flushspace() + + # For now, recognize, but do not process open block delimiters. + InOpenBlock = !InOpenBlock + return 1 + } if (firstline ~ /^(-{4,}|[.]{4,})$/) { flushspace() |