tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* [PATCH] Bd -literal/-unfilled and old groff.
@ 2010-07-26 23:53 Kristaps Dzonsons
       [not found] ` <20100727065352.GA7946@bramka.kerhand.co.uk>
  0 siblings, 1 reply; 2+ messages in thread
From: Kristaps Dzonsons @ 2010-07-26 23:53 UTC (permalink / raw)
  To: tech; +Cc: Jason McIntyre

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

In looking for `Sm' violators, I found that `Bd -unfilled' or `Bd 
-literal' are playing ugly with mandoc and sub-macros.

The following at least brings us in line with old groff (less some 
spacing issues here and there).  New groff is completely different.  Sigh.

Ingo, this is mostly for you.  Thoughts?  This at least fixes the main 
violators, like awk.1, but there could be unexpected fallout.  I haven't 
been able to find any, but I didn't look too hard.

Kristaps

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1909 bytes --]

Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.99
diff -u -r1.99 mdoc_html.c
--- mdoc_html.c	23 Jul 2010 00:08:57 -0000	1.99
+++ mdoc_html.c	26 Jul 2010 23:51:15 -0000
@@ -1407,7 +1407,7 @@
 mdoc_bd_pre(MDOC_ARGS)
 {
 	struct htmlpair	 	 tag[2];
-	int		 	 comp;
+	int		 	 comp, last;
 	const struct mdoc_node	*nn;
 	struct roffsu		 su;
 
@@ -1456,15 +1456,14 @@
 	PAIR_STYLE_INIT(&tag[1], h);
 	print_otag(h, TAG_DIV, 2, tag);
 
+	last = 0;
 	for (nn = n->child; nn; nn = nn->next) {
-		h->flags |= HTML_NOSPACE;
-		print_mdoc_node(m, nn, h);
-		if (NULL == nn->next)
-			continue;
-		if (nn->prev && nn->prev->line < nn->line)
-			print_text(h, "\n");
-		else if (NULL == nn->prev)
+		if (last && last < nn->line) {
 			print_text(h, "\n");
+			h->flags |= HTML_NOSPACE;
+		}
+		print_mdoc_node(m, nn, h);
+		last = nn->line;
 	}
 
 	return(0);
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.178
diff -u -r1.178 mdoc_term.c
--- mdoc_term.c	26 Jul 2010 22:35:59 -0000	1.178
+++ mdoc_term.c	26 Jul 2010 23:51:15 -0000
@@ -1621,8 +1621,8 @@
 static int
 termp_bd_pre(DECL_ARGS)
 {
-	size_t			 tabwidth;
-	size_t			 rm, rmax;
+	size_t			 tabwidth, rm, rmax;
+	int			 last;
 	const struct mdoc_node	*nn;
 
 	if (MDOC_BLOCK == n->type) {
@@ -1653,13 +1653,12 @@
 	rmax = p->maxrmargin;
 	p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
 
+	last = 0;
 	for (nn = n->child; nn; nn = nn->next) {
-		p->flags |= TERMP_NOSPACE;
+		if (last && last < nn->line)
+			term_newln(p);
 		print_mdoc_node(p, pair, m, nn);
-		if (NULL == nn->prev ||
-		    nn->prev->line < nn->line ||
-		    NULL == nn->next)
-			term_flushln(p);
+		last = nn->line;
 	}
 
 	p->tabwidth = tabwidth;

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

* Re: [PATCH] Bd -literal/-unfilled and old groff.
       [not found] ` <20100727065352.GA7946@bramka.kerhand.co.uk>
@ 2010-07-27  8:39   ` Kristaps Dzonsons
  0 siblings, 0 replies; 2+ messages in thread
From: Kristaps Dzonsons @ 2010-07-27  8:39 UTC (permalink / raw)
  To: Jason McIntyre; +Cc: tech

>> In looking for `Sm' violators, I found that `Bd -unfilled' or `Bd 
>> -literal' are playing ugly with mandoc and sub-macros.
>>
>> The following at least brings us in line with old groff (less some 
>> spacing issues here and there).  New groff is completely different.  Sigh.
>>
>> Ingo, this is mostly for you.  Thoughts?  This at least fixes the main 
>> violators, like awk.1, but there could be unexpected fallout.  I haven't 
>> been able to find any, but I didn't look too hard.
>>
>> Kristaps
> 
> so, there has always been an issue that if you stick macros which change
> appearance (bold or whatever) in a literal display, you get screwy
> output. i wasn;t aware that it affects -filled/-unfilled types, but
> there you go.
> 
> the awk.1 stuff is probably just wrong. our old groff formatted this
> nicely, but newer ones (understandably) dislike it. i think after
> release i will probably convert this to a list, and remove the issue.
> 
> on a nice side note, your diff fixes our boot_config(8) page, which also
> has some .No within a literal display. it now formats as it should, and
> the same as new groff.

So it does!  I've just committed a cleaned-up version of the patch.

Thanks,

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:[~2010-07-27  8:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-26 23:53 [PATCH] Bd -literal/-unfilled and old groff Kristaps Dzonsons
     [not found] ` <20100727065352.GA7946@bramka.kerhand.co.uk>
2010-07-27  8:39   ` 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).