diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2012-11-18 19:34:19 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2012-11-18 19:34:19 +0000 |
commit | c9b2badc3fad9570abf31abebb3eadc4b3852605 (patch) | |
tree | 5da04ad607656975a62bd954487ddd01f7dbd2a1 /mdoc_man.c | |
parent | 762994f099cdad6847f40d7daba29e5fe7d35e0e (diff) | |
download | mandoc-c9b2badc3fad9570abf31abebb3eadc4b3852605.tar.gz |
Make the generated man(7) code more portable by using .PD
instead of .sp -1v, which for example Solaris nroff handles poorly.
Problem report and patch by millert@,
with the print_word chunk tweaked by me.
Diffstat (limited to 'mdoc_man.c')
-rw-r--r-- | mdoc_man.c | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -253,6 +253,7 @@ static int outflags; #define MMAN_Bk (1 << 7) /* word keep mode */ #define MMAN_An_split (1 << 8) /* author mode is "split" */ #define MMAN_An_nosplit (1 << 9) /* author mode is "nosplit" */ +#define MMAN_PD (1 << 10) /* inter-paragraph spacing disabled */ #define BL_STACK_MAX 32 @@ -304,8 +305,15 @@ print_word(const char *s) * If we need a newline, print it now and start afresh. */ if (MMAN_PP & outflags) { - if ( ! (MMAN_sp & outflags)) - printf("\n.sp -1v"); + if (MMAN_sp & outflags) { + if (MMAN_PD & outflags) { + printf("\n.PD"); + outflags &= ~MMAN_PD; + } + } else if ( ! (MMAN_PD & outflags)) { + printf("\n.PD 0"); + outflags |= MMAN_PD; + } printf("\n.PP\n"); } else if (MMAN_sp & outflags) printf("\n.sp\n"); @@ -379,10 +387,16 @@ print_block(const char *s, int newflags) { outflags &= ~MMAN_PP; - if (MMAN_sp & outflags) + if (MMAN_sp & outflags) { outflags &= ~(MMAN_sp | MMAN_br); - else - print_line(".sp -1v", 0); + if (MMAN_PD & outflags) { + print_line(".PD", 0); + outflags &= ~MMAN_PD; + } + } else if (! (MMAN_PD & outflags)) { + print_line(".PD 0", 0); + outflags |= MMAN_PD; + } outflags |= MMAN_nl; print_word(s); outflags |= newflags; |