diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-08-18 08:48:30 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-08-18 08:48:30 +0000 |
commit | 5884f21bb5d782888f0d5979a8a2c7e28c0ee25b (patch) | |
tree | 76866423e3cddb6f384c206fde13c17ff193a7f4 /man_macro.c | |
parent | 64d0475dc9d0f3783750a27bce64dd1c78e4fa01 (diff) | |
download | mandoc-5884f21bb5d782888f0d5979a8a2c7e28c0ee25b.tar.gz mandoc-5884f21bb5d782888f0d5979a8a2c7e28c0ee25b.tar.zst mandoc-5884f21bb5d782888f0d5979a8a2c7e28c0ee25b.zip |
Small updates to man.7 (next-line break-exclusions, numerical width example).
Fully tested and correct scope-rewinding of block macros.
Diffstat (limited to 'man_macro.c')
-rw-r--r-- | man_macro.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/man_macro.c b/man_macro.c index c43f3f6b..bf230387 100644 --- a/man_macro.c +++ b/man_macro.c @@ -1,4 +1,4 @@ -/* $Id: man_macro.c,v 1.19 2009/08/13 11:45:29 kristaps Exp $ */ +/* $Id: man_macro.c,v 1.20 2009/08/18 08:48:30 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -107,24 +107,39 @@ rew_dohalt(int tok, enum man_type type, const struct man_node *n) switch (tok) { case (MAN_SH): - /* Break at root. */ + /* Rewind to ourselves. */ if (type == n->type && tok == n->tok) return(REW_REWIND); break; case (MAN_SS): - /* Break at section. */ + /* Rewind to ourselves. */ if (type == n->type && tok == n->tok) return(REW_REWIND); - if (MAN_BODY == n->type && MAN_SH == n->tok) + /* Rewind to a section, if a block. */ + if (MAN_BLOCK == type && MAN_SH == n->parent->tok && + MAN_BODY == n->parent->type) + return(REW_REWIND); + /* Don't go beyond a section. */ + if (MAN_SH == n->tok) return(REW_HALT); break; default: - /* Break at subsection. */ + /* Rewind to ourselves. */ if (type == n->type && tok == n->tok) return(REW_REWIND); - if (MAN_BODY == n->type && MAN_SS == n->tok) + /* Rewind to a subsection, if a block. */ + if (MAN_BLOCK == type && MAN_SS == n->parent->tok && + MAN_BODY == n->parent->type) + return(REW_REWIND); + /* Don't go beyond a subsection. */ + if (MAN_SS == n->tok) return(REW_HALT); - if (MAN_BODY == n->type && MAN_SH == n->tok) + /* Rewind to a section, if a block. */ + if (MAN_BLOCK == type && MAN_SH == n->parent->tok && + MAN_BODY == n->parent->type) + return(REW_REWIND); + /* Don't go beyond a section. */ + if (MAN_SH == n->tok) return(REW_HALT); break; } |