tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* .IP without line args is not an ERROR
@ 2010-10-27 10:22 Ingo Schwarze
  2010-10-27 12:43 ` Joerg Sonnenberger
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Schwarze @ 2010-10-27 10:22 UTC (permalink / raw)
  To: tech

OK to commit this to bsd.lv, too?

----- Forwarded message from Ingo Schwarze <schwarze@cvs.openbsd.org> -----

From: Ingo Schwarze <schwarze@cvs.openbsd.org>
Date: Wed, 27 Oct 2010 04:17:45 -0600 (MDT)
To: source-changes@cvs.openbsd.org

CVSROOT:	/cvs
Module name:	src
Changes by:	schwarze@cvs.openbsd.org	2010/10/27 04:17:45

Modified files:
	usr.bin/mandoc : man_validate.c 

Log message:
The man(7) macros .HP .IP .RS .TP accept *optional* arguments,
so do not throw an ERROR when there are none.
Formatting is already correct:
With no arguments, use default widths and no tag.
Problem reported by naddy@, thanks.

----- End forwarded message -----

Index: man_validate.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/man_validate.c,v
retrieving revision 1.30
diff -u -p -r1.30 man_validate.c
--- man_validate.c	15 Oct 2010 20:45:03 -0000	1.30
+++ man_validate.c	27 Oct 2010 10:04:00 -0000
@@ -310,9 +310,7 @@ check_par(CHKARGS)
 				break;
 			return(man_nmsg(m, n, MANDOCERR_ARGSLOST));
 		default:
-			if (n->nchild)
-				break;
-			return(man_nmsg(m, n, MANDOCERR_NOARGS));
+			break;
 		}
 
 	return(1);
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

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

* Re: .IP without line args is not an ERROR
  2010-10-27 10:22 .IP without line args is not an ERROR Ingo Schwarze
@ 2010-10-27 12:43 ` Joerg Sonnenberger
  2010-10-27 20:46   ` Ingo Schwarze
  0 siblings, 1 reply; 5+ messages in thread
From: Joerg Sonnenberger @ 2010-10-27 12:43 UTC (permalink / raw)
  To: tech

On Wed, Oct 27, 2010 at 12:22:24PM +0200, Ingo Schwarze wrote:
> OK to commit this to bsd.lv, too?

Are you sure that the handling is correct? E.g. the "restore previous"
behavior for missing arguments?

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

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

* Re: .IP without line args is not an ERROR
  2010-10-27 12:43 ` Joerg Sonnenberger
@ 2010-10-27 20:46   ` Ingo Schwarze
  2010-10-27 20:49     ` Joerg Sonnenberger
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Schwarze @ 2010-10-27 20:46 UTC (permalink / raw)
  To: tech

Hi Joerg,

Joerg Sonnenberger wrote on Wed, Oct 27, 2010 at 02:43:37PM +0200:
> On Wed, Oct 27, 2010 at 12:22:24PM +0200, Ingo Schwarze wrote:

>> OK to commit this to bsd.lv, too?

> Are you sure that the handling is correct?

You mean, in man_term.c, (pre|post)_?P()?

I have not systematically tested all the cases, but i have read the
code, and it looks sane.  Besides, there are comments indicating
that Kristaps had this in mind when writing the code (e.g. in the
definition of struct mtermp).  I see no indication that anything
might be broken in that respect.  Those cases i looked at, work.

Besides, that would be a wholly seperate issue.  We are talking about
removing a non-fatal error in the parser.  The resulting AST has
always been rendered in some way.  Whether that rendering has issues
has nothing to do with the validity of the input.

> E.g. the "restore previous" behavior for missing arguments?

Actually, in that respect, man(7) is different than mdoc(7).
In mdoc, blocks can nest, but in man, if i understand correctly,
each block terminates the previous block, at least among the *P
blocks discussed here.  Thus, the values in mtermp need no
resetting at all, and those in termp just get reset to mt->offset
and to the maximum right margin, no matter what the arguments
of the block were.

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

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

* Re: .IP without line args is not an ERROR
  2010-10-27 20:46   ` Ingo Schwarze
@ 2010-10-27 20:49     ` Joerg Sonnenberger
  2010-10-27 20:58       ` Ingo Schwarze
  0 siblings, 1 reply; 5+ messages in thread
From: Joerg Sonnenberger @ 2010-10-27 20:49 UTC (permalink / raw)
  To: tech

On Wed, Oct 27, 2010 at 10:46:11PM +0200, Ingo Schwarze wrote:
> > E.g. the "restore previous" behavior for missing arguments?
> 
> Actually, in that respect, man(7) is different than mdoc(7).
> In mdoc, blocks can nest, but in man, if i understand correctly,
> each block terminates the previous block, at least among the *P
> blocks discussed here.  Thus, the values in mtermp need no
> resetting at all, and those in termp just get reset to mt->offset
> and to the maximum right margin, no matter what the arguments
> of the block were.

If the macros are used without argument, they use the value specified by
the last instance.

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

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

* Re: .IP without line args is not an ERROR
  2010-10-27 20:49     ` Joerg Sonnenberger
@ 2010-10-27 20:58       ` Ingo Schwarze
  0 siblings, 0 replies; 5+ messages in thread
From: Ingo Schwarze @ 2010-10-27 20:58 UTC (permalink / raw)
  To: tech

Hi Joerg,

Joerg Sonnenberger wrote on Wed, Oct 27, 2010 at 10:49:02PM +0200:

>>> E.g. the "restore previous" behavior for missing arguments?

> If the macros are used without argument, they use the value
> specified by the last instance.

Ah, now i see what you mean.  Yes, that's indeed what Kristaps
has coded.  In terminal_man, we have the initialization

  mt->lmargin = INDENT
  mt->offset = INDENT

.HP, .IP, and .TP change mt->lmargin whenever you give an argument,
.RS changes mt->offset, and all of them use the mt values without ever
resetting them.  So yes, values specified once get reused.

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

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

end of thread, other threads:[~2010-10-27 20:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-27 10:22 .IP without line args is not an ERROR Ingo Schwarze
2010-10-27 12:43 ` Joerg Sonnenberger
2010-10-27 20:46   ` Ingo Schwarze
2010-10-27 20:49     ` Joerg Sonnenberger
2010-10-27 20:58       ` Ingo Schwarze

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).