summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-08-21 13:14:07 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-08-21 13:14:07 +0000
commitcc7b6e7f2654427ef03598fdd28143e66c09e279 (patch)
tree7228078471175a54ce348952360ad8ecef0e4035
parent270a33558b8c086b899f49f34e1d47da4792b7b8 (diff)
downloadmandoc-cc7b6e7f2654427ef03598fdd28143e66c09e279.tar.gz
Fixed next-line scoping of `.HP nnn' (has both next-line and on-line in head).
-rw-r--r--libman.h3
-rw-r--r--man_macro.c18
2 files changed, 15 insertions, 6 deletions
diff --git a/libman.h b/libman.h
index 2b954dab..d8b305a4 100644
--- a/libman.h
+++ b/libman.h
@@ -71,7 +71,8 @@ struct man_macro {
int (*fp)(MACRO_PROT_ARGS);
int flags;
#define MAN_SCOPED (1 << 0)
-#define MAN_EXPLICIT (1 << 1)
+#define MAN_EXPLICIT (1 << 1) /* See blk_imp(). */
+#define MAN_FSCOPED (1 << 2) /* See blk_imp(). */
};
extern const struct man_macro *const man_macros;
diff --git a/man_macro.c b/man_macro.c
index c09b0070..1607777f 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -40,7 +40,7 @@ const struct man_macro __man_macros[MAN_MAX] = {
{ in_line_eoln, 0 }, /* TH */
{ blk_imp, MAN_SCOPED }, /* SH */
{ blk_imp, MAN_SCOPED }, /* SS */
- { blk_imp, MAN_SCOPED }, /* TP */
+ { blk_imp, MAN_SCOPED | MAN_FSCOPED }, /* TP */
{ blk_imp, 0 }, /* LP */
{ blk_imp, 0 }, /* PP */
{ blk_imp, 0 }, /* P */
@@ -271,10 +271,18 @@ blk_imp(MACRO_PROT_ARGS)
/* Close out head and open body (unless MAN_SCOPE). */
- if (n == m->last && MAN_SCOPED & man_macros[tok].flags) {
- m->flags |= MAN_BLINE;
- return(1);
- } else if ( ! rew_scope(MAN_HEAD, m, tok))
+ if (MAN_SCOPED & man_macros[tok].flags) {
+ /* If we're forcing scope (`TP'), keep it open. */
+ if (MAN_FSCOPED & man_macros[tok].flags) {
+ m->flags |= MAN_BLINE;
+ return(1);
+ } else if (n == m->last) {
+ m->flags |= MAN_BLINE;
+ return(1);
+ }
+ }
+
+ if ( ! rew_scope(MAN_HEAD, m, tok))
return(0);
return(man_body_alloc(m, line, ppos, tok));