summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2012-01-04 02:17:43 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2012-01-04 02:17:43 +0000
commit41fa2a7fc200c650a7e08bf87b6751e7702b2eab (patch)
tree29417a8e86a4fa63254cab214eb77c888e2f163e /usr.bin/mandoc
parenta788b08e4a13f160295ff1c5ed5f72c192a31c6d (diff)
Heads of .It macros in -diag lists are not parsed,
even though .It macros in general are parsed. Fixing a bug reported by deraadt@, based on an incomplete fix by kristaps@, and update the test suite to catch this issue.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/mdoc_macro.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/mandoc/mdoc_macro.c b/usr.bin/mandoc/mdoc_macro.c
index b8dd1b21f17..1c96266df20 100644
--- a/usr.bin/mandoc/mdoc_macro.c
+++ b/usr.bin/mandoc/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.72 2011/12/03 23:01:21 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.73 2012/01/04 02:17:42 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -224,7 +224,6 @@ mdoc_macroend(struct mdoc *m)
static enum mdoct
lookup(enum mdoct from, const char *p)
{
- /* FIXME: make -diag lists be un-PARSED. */
if ( ! (MDOC_PARSED & mdoc_macros[from].flags))
return(MDOC_MAX);
@@ -980,7 +979,7 @@ in_line(MACRO_PROT_ARGS)
static int
blk_full(MACRO_PROT_ARGS)
{
- int la, nl;
+ int la, nl, nparsed;
struct mdoc_arg *arg;
struct mdoc_node *head; /* save of head macro */
struct mdoc_node *body; /* save of body macro */
@@ -1035,6 +1034,14 @@ blk_full(MACRO_PROT_ARGS)
head = body = NULL;
/*
+ * Exception: Heads of `It' macros in `-diag' lists are not
+ * parsed, even though `It' macros in general are parsed.
+ */
+ nparsed = MDOC_It == tok &&
+ MDOC_Bl == m->last->parent->tok &&
+ LIST_diag == m->last->parent->norm->Bl.type;
+
+ /*
* The `Nd' macro has all arguments in its body: it's a hybrid
* of block partial-explicit and full-implicit. Stupid.
*/
@@ -1142,7 +1149,8 @@ blk_full(MACRO_PROT_ARGS)
continue;
}
- ntok = ARGS_QWORD == ac ? MDOC_MAX : lookup(tok, p);
+ ntok = nparsed || ARGS_QWORD == ac ?
+ MDOC_MAX : lookup(tok, p);
if (MDOC_MAX == ntok) {
if ( ! dword(m, line, la, p, DELIM_MAX))