diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2013-05-19 21:40:19 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2013-05-19 21:40:19 +0000 |
commit | bffb353f5aa0b007f5d26ac002592a8729f538a6 (patch) | |
tree | 27a0ce26b82c84e74dd434169cdb3b7148c372e2 /usr.bin/mandoc/mdoc_man.c | |
parent | 34c372a3097ff834e96ec1755a592aff3963fe29 (diff) |
Support .Bl -offset in -mdoc -Tman.
Issue found when Thomas Klausner <wiz at NetBSD dot org> made me
look at the manuals of his http://www.nih.at/libzip library.
Diffstat (limited to 'usr.bin/mandoc/mdoc_man.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_man.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c index eb2b0da45db..0b172127d9e 100644 --- a/usr.bin/mandoc/mdoc_man.c +++ b/usr.bin/mandoc/mdoc_man.c @@ -1,6 +1,6 @@ -/* $Id: mdoc_man.c,v 1.47 2013/05/19 21:05:29 schwarze Exp $ */ +/* $Id: mdoc_man.c,v 1.48 2013/05/19 21:40:18 schwarze Exp $ */ /* - * Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -906,6 +906,16 @@ pre_bl(DECL_ARGS) { size_t icol; + /* + * print_offs() will increase the -offset to account for + * a possible enclosing .It, but any enclosed .It blocks + * just nest and do not add up their indentation. + */ + if (n->norm->Bl.offs) { + print_offs(n->norm->Bl.offs); + Bl_stack[Bl_stack_len++] = 0; + } + switch (n->norm->Bl.type) { case (LIST_enum): n->norm->Bl.count = 0; @@ -938,8 +948,16 @@ post_bl(DECL_ARGS) default: break; } - outflags |= MMAN_PP | MMAN_nl; - outflags &= ~(MMAN_sp | MMAN_br); + + if (n->norm->Bl.offs) { + print_line(".RE", MMAN_nl); + assert(Bl_stack_len); + Bl_stack_len--; + assert(0 == Bl_stack[Bl_stack_len]); + } else { + outflags |= MMAN_PP | MMAN_nl; + outflags &= ~(MMAN_sp | MMAN_br); + } /* Maybe we are inside an enclosing list? */ if (NULL != n->parent->next) |