diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2012-11-19 02:08:33 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2012-11-19 02:08:33 +0000 |
commit | 8bcb19ad96666e4a14040ca305268fb59995fd25 (patch) | |
tree | 486b74a4f9b1e766d123185fa8c1ca50301ff48b /mdoc_man.c | |
parent | c9b2badc3fad9570abf31abebb3eadc4b3852605 (diff) | |
download | mandoc-8bcb19ad96666e4a14040ca305268fb59995fd25.tar.gz |
Three portability improvements by millert@:
* Use "\\ " not "\\~" as the non-breaking space as historic nroff
doesn't support the latter.
* The '-' before the flags needs to be quoted to prevent nroff
from putting a line break between the '-' and the flag character.
* Disable hyphenation and, for nroff, disable justification which is
consistent with how mdoc behaves (and produces more readable manuals).
(OpenBSD rev. 1.39, 1.40 and 1.41)
Diffstat (limited to 'mdoc_man.c')
-rw-r--r-- | mdoc_man.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -334,11 +334,9 @@ print_word(const char *s) */ if (MMAN_spc_force & outflags || '\0' == s[0] || NULL == strchr(".,:;)]?!", s[0]) || '\0' != s[1]) { - if (MMAN_Bk & outflags) { + if (MMAN_Bk & outflags) putchar('\\'); - putchar('~'); - } else - putchar(' '); + putchar(' '); if (TPremain) TPremain--; } @@ -358,7 +356,7 @@ print_word(const char *s) for ( ; *s; s++) { switch (*s) { case (ASCII_NBRSP): - printf("\\~"); + printf("\\ "); break; case (ASCII_HYPH): putchar('-'); @@ -535,10 +533,13 @@ man_mdoc(void *arg, const struct mdoc *mdoc) meta = mdoc_meta(mdoc); n = mdoc_node(mdoc); - printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"", + printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n", meta->title, meta->msec, meta->date, meta->os, meta->vol); + /* Disable hyphenation and if nroff, disable justification. */ + printf(".nh\n.if n .ad l"); + outflags = MMAN_nl | MMAN_Sm; if (0 == fontqueue.size) { fontqueue.size = 8; @@ -1053,7 +1054,7 @@ pre_fl(DECL_ARGS) { font_push('B'); - print_word("-"); + print_word("\\-"); outflags &= ~MMAN_spc; return(1); } @@ -1531,7 +1532,7 @@ pre_ux(DECL_ARGS) if (NULL == n->child) return(0); outflags &= ~MMAN_spc; - print_word("\\~"); + print_word("\\ "); outflags &= ~MMAN_spc; return(1); } |