tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* tbl(7) should allow comma-separated options
@ 2014-11-25  1:33 Anthony J. Bentley
  2014-11-25  5:52 ` Ingo Schwarze
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony J. Bentley @ 2014-11-25  1:33 UTC (permalink / raw)
  To: tech

Hi,

The following table (from nsdejavu(1)) displays incorrectly in mandoc.
Groff displays it correctly.

mandoc doesn't like the comma-separated options. Options after the
first one are currently ignored.

.TS
center,box;
l l.
foo bar
.TE

mandoc: foo.7:2:7: ERROR: bad table syntax

Here's a patch (but is it right?):


Index: tbl_opts.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/tbl_opts.c,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 tbl_opts.c
--- tbl_opts.c	20 Apr 2014 16:44:44 -0000	1.5
+++ tbl_opts.c	25 Nov 2014 01:29:42 -0000
@@ -178,7 +178,7 @@ again:	/*
 	 *
 	 * options	::= option_list [:space:]* [;][\n]
 	 * option_list	::= option option_tail
-	 * option_tail	::= [:space:]+ option_list |
+	 * option_tail	::= [,:space:]+ option_list |
 	 *		::= epsilon
 	 * option	::= [:alpha:]+ args
 	 * args		::= [:space:]* [(] [:alpha:]+ [)]
@@ -209,7 +209,7 @@ again:	/*
 
 	buf[i] = '\0';
 
-	while (isspace((unsigned char)p[*pos]))
+	while (isspace((unsigned char)p[*pos]) || p[*pos] == ',')
 		(*pos)++;
 
 	/*
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

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

* Re: tbl(7) should allow comma-separated options
  2014-11-25  1:33 tbl(7) should allow comma-separated options Anthony J. Bentley
@ 2014-11-25  5:52 ` Ingo Schwarze
  2014-11-25  6:42   ` Anthony J. Bentley
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Schwarze @ 2014-11-25  5:52 UTC (permalink / raw)
  To: Anthony J. Bentley; +Cc: tech

Hi Anthony,

Anthony J. Bentley wrote on Mon, Nov 24, 2014 at 06:33:24PM -0700:

> The following table (from nsdejavu(1)) displays incorrectly in mandoc.

Well, that table doesn't display at all.
Even with your patch, there is still no output.

Even with my latest commit to tbl_layout.c, one piece is still
missing to make that page work.  Inside tables, the mandoc roff
parser should not swallow lines starting with the roff control
character, but pass them through to the tbl parser.

> Groff displays it correctly.
> 
> mandoc doesn't like the comma-separated options.
> Options after the first one are currently ignored.
> 
> .TS
> center,box;
> l l.
> foo bar
> .TE
> 
> mandoc: foo.7:2:7: ERROR: bad table syntax
> 
> Here's a patch (but is it right?):

Yes, that agrees with GNU tbl(1) and fixes your simplified
example.

OK schwarze@.

If you want, you can commit the following manual page update
with it.

Yours,
  Ingo


Index: tbl.7
===================================================================
RCS file: /cvs/src/share/man/man7/tbl.7,v
retrieving revision 1.7
diff -u -p -r1.7 tbl.7
--- tbl.7	14 Oct 2014 02:16:02 -0000	1.7
+++ tbl.7	25 Nov 2014 05:45:34 -0000
@@ -135,6 +135,7 @@ in the case of
 .Ss Options
 The first line of a table consists of space-separated option keys and
 modifiers terminated by a semicolon.
+For GNU compatibility, option keys can also be separated by commas.
 If the first line does not have a terminating semicolon, it is assumed
 that no options are specified and instead a
 .Sx Layout


> Index: tbl_opts.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/mandoc/tbl_opts.c,v
> retrieving revision 1.5
> diff -u -p -u -p -r1.5 tbl_opts.c
> --- tbl_opts.c	20 Apr 2014 16:44:44 -0000	1.5
> +++ tbl_opts.c	25 Nov 2014 01:29:42 -0000
> @@ -178,7 +178,7 @@ again:	/*
>  	 *
>  	 * options	::= option_list [:space:]* [;][\n]
>  	 * option_list	::= option option_tail
> -	 * option_tail	::= [:space:]+ option_list |
> +	 * option_tail	::= [,:space:]+ option_list |
>  	 *		::= epsilon
>  	 * option	::= [:alpha:]+ args
>  	 * args		::= [:space:]* [(] [:alpha:]+ [)]
> @@ -209,7 +209,7 @@ again:	/*
>  
>  	buf[i] = '\0';
>  
> -	while (isspace((unsigned char)p[*pos]))
> +	while (isspace((unsigned char)p[*pos]) || p[*pos] == ',')
>  		(*pos)++;
>  
>  	/*
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

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

* Re: tbl(7) should allow comma-separated options
  2014-11-25  5:52 ` Ingo Schwarze
@ 2014-11-25  6:42   ` Anthony J. Bentley
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony J. Bentley @ 2014-11-25  6:42 UTC (permalink / raw)
  To: Ingo Schwarze; +Cc: tech

Hi Ingo,

Ingo Schwarze writes:
> Anthony J. Bentley wrote on Mon, Nov 24, 2014 at 06:33:24PM -0700:
> 
> > The following table (from nsdejavu(1)) displays incorrectly in mandoc.
> 
> Well, that table doesn't display at all.
> Even with your patch, there is still no output.

Yes, my email draft initially mentioned that the original table was
affected by another issue already in TODO, but that note apparently got
lost. Oh well.

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

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

end of thread, other threads:[~2014-11-25  6:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-25  1:33 tbl(7) should allow comma-separated options Anthony J. Bentley
2014-11-25  5:52 ` Ingo Schwarze
2014-11-25  6:42   ` Anthony J. Bentley

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