diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2013-05-19 21:40:24 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2013-05-19 21:40:24 +0000 |
commit | b051d756c59c51ffbd2f7fc24b466aaafd1b5fbc (patch) | |
tree | 263cff8230ba8a13fa370f197827be912bec4c61 /mdoc_man.c | |
parent | 696927db0da847f12657d36e6c8081d708e8c73f (diff) | |
download | mandoc-b051d756c59c51ffbd2f7fc24b466aaafd1b5fbc.tar.gz |
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 'mdoc_man.c')
-rw-r--r-- | mdoc_man.c | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -1,6 +1,6 @@ /* $Id$ */ /* - * 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 @@ -910,6 +910,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; @@ -942,8 +952,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) |