summaryrefslogtreecommitdiffstats
path: root/man_macro.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-08-18 08:48:30 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-08-18 08:48:30 +0000
commitd80c47aaf68066e0c2f531aea4e33ef2d8fa2a56 (patch)
treec8cb97cc0ed83c43d56e7e98bf7ce7fb9d21afa2 /man_macro.c
parent3c79b46f4899602bf4c94770849210c30a76367d (diff)
downloadmandoc-d80c47aaf68066e0c2f531aea4e33ef2d8fa2a56.tar.gz
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.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/man_macro.c b/man_macro.c
index 3ded243a..969f704f 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -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;
}