tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Re: mdocml: `-diag' lists aren't parsed, unlike other list types.
       [not found] <201201021548.q02Fm65M026067@krisdoz.my.domain>
@ 2012-01-04  2:29 ` Ingo Schwarze
  2012-01-04 11:58   ` Kristaps Dzonsons
  0 siblings, 1 reply; 2+ messages in thread
From: Ingo Schwarze @ 2012-01-04  2:29 UTC (permalink / raw)
  To: tech

Hi Kristaps,

kristaps@mdocml.bsd.lv wrote on Mon, Jan 02, 2012 at 10:48:06AM -0500:

> `-diag' lists aren't parsed, unlike other list types.
> This fixes a TODO entry raised by deraadt@.

i hate to say so, but this fix is incomplete:
It only fixes the first .It macro in each -diag list.
To fix the subsequent ones as well, the check
has to be moved after the creation of the .It block,
such that we can look for the parent.

While moving the check, we can drop the if-statement
and make the comment more precise.

OK?
  Ingo


CVSROOT:	/cvs
Module name:	src
Changes by:	schwarze@cvs.openbsd.org	2012/01/03 19:17:42

Modified files:
	usr.bin/mandoc : mdoc_macro.c 
	regress/usr.bin/mandoc/mdoc/Bl: diag.in diag.out_ascii 

Log message:
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.


--- /co/mdocml/mdoc_macro.c	Wed Jan  4 03:24:13 2012
+++ ./mdoc_macro.c	Wed Jan  4 03:17:42 2012
@@ -994,16 +990,6 @@
 	enum margverr	  av;
 	char		 *p;
 
-	/*
-	 * Exception: `-diag' lists are not parsed, but lists in general
-	 * are parsed.
-	 */
-	nparsed = 0;
-	if (MDOC_It == tok && NULL != m->last &&
-			MDOC_Bl == m->last->tok &&
-			LIST_diag == m->last->norm->Bl.type)
-		nparsed = 1;
-
 	nl = MDOC_NEWLINE & m->flags;
 
 	/* Close out prior implicit scope. */
@@ -1046,6 +1032,14 @@
 		return(0);
 
 	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
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mdocml: `-diag' lists aren't parsed, unlike other list types.
  2012-01-04  2:29 ` mdocml: `-diag' lists aren't parsed, unlike other list types Ingo Schwarze
@ 2012-01-04 11:58   ` Kristaps Dzonsons
  0 siblings, 0 replies; 2+ messages in thread
From: Kristaps Dzonsons @ 2012-01-04 11:58 UTC (permalink / raw)
  To: tech

On 01/04/12 03:29, Ingo Schwarze wrote:
> Hi Kristaps,
>
> kristaps@mdocml.bsd.lv wrote on Mon, Jan 02, 2012 at 10:48:06AM -0500:
>
>> `-diag' lists aren't parsed, unlike other list types.
>> This fixes a TODO entry raised by deraadt@.
>
> i hate to say so, but this fix is incomplete:
> It only fixes the first .It macro in each -diag list.
> To fix the subsequent ones as well, the check
> has to be moved after the creation of the .It block,
> such that we can look for the parent.
>
> While moving the check, we can drop the if-statement
> and make the comment more precise.

Ingo,

Gah!  Yes, please commit, and thanks for double-checking!

Kristaps

--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-04 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201201021548.q02Fm65M026067@krisdoz.my.domain>
2012-01-04  2:29 ` mdocml: `-diag' lists aren't parsed, unlike other list types Ingo Schwarze
2012-01-04 11:58   ` Kristaps Dzonsons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).