tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Leading space in roff = leading newline.
@ 2011-01-11  1:10 Kristaps Dzonsons
  2011-01-11  1:12 ` Kristaps Dzonsons
  0 siblings, 1 reply; 2+ messages in thread
From: Kristaps Dzonsons @ 2011-01-11  1:10 UTC (permalink / raw)
  To: tech, Jason McIntyre

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

Hi,

I came across a real gem in gm.1.  Apparently leading a line with a 
space causes a leading newline, as in

++++
The \fBGraphicsMagick\fP utilities recognize the following image formats:


\fBName\fP   \fBMode\fP \fBDescription\fP
  o  8BIM      *rw- Photoshop resource format
  o  8BIMTEXT  *rw- Photoshop resource format
  o  8BIMWTEXT *rw- Photoshop resource format
  o  APP1      *rw- Photoshop resource format
  o  ART       *r-- PF1: 1st Publisher
----

and so on.  It works with mdoc(7) and man(7).

Anybody against the following patch?

Thanks,

Kristaps


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

Index: libman.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/libman.h,v
retrieving revision 1.44
diff -r1.44 libman.h
36a37
> #define	MAN_NEWLINE	(1 << 6) /* first macro/text in a line */
Index: man.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.7,v
retrieving revision 1.94
diff -r1.94 man.7
61a62,64
> .Pp
> If the first character of a line is whitespace, that line is printed
> verbatim, including the end-of-line.
Index: man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.c,v
retrieving revision 1.96
diff -r1.96 man.c
47c47
< static	struct man_node	*man_node_alloc(int, int, 
---
> static	struct man_node	*man_node_alloc(struct man *, int, int, 
131a132,133
> 	m->flags |= MAN_NEWLINE;
> 
232c234,235
< man_node_alloc(int line, int pos, enum man_type type, enum mant tok)
---
> man_node_alloc(struct man *m, int line, int pos, 
> 		enum man_type type, enum mant tok)
240a244,247
> 
> 	if (MAN_NEWLINE & m->flags)
> 		p->flags |= MAN_LINE;
> 	m->flags &= ~MAN_NEWLINE;
250c257
< 	p = man_node_alloc(line, pos, MAN_ELEM, tok);
---
> 	p = man_node_alloc(m, line, pos, MAN_ELEM, tok);
263c270
< 	p = man_node_alloc(line, pos, MAN_HEAD, tok);
---
> 	p = man_node_alloc(m, line, pos, MAN_HEAD, tok);
276c283
< 	p = man_node_alloc(line, pos, MAN_BODY, tok);
---
> 	p = man_node_alloc(m, line, pos, MAN_BODY, tok);
289c296
< 	p = man_node_alloc(line, pos, MAN_BLOCK, tok);
---
> 	p = man_node_alloc(m, line, pos, MAN_BLOCK, tok);
302c309
< 	n = man_node_alloc(0, 0, MAN_TBL, MAN_MAX);
---
> 	n = man_node_alloc(m, 0, 0, MAN_TBL, MAN_MAX);
320c327
< 	n = man_node_alloc(line, pos, MAN_TEXT, MAN_MAX);
---
> 	n = man_node_alloc(m, line, pos, MAN_TEXT, MAN_MAX);
Index: man.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.h,v
retrieving revision 1.50
diff -r1.50 man.h
99a100
> #define	MAN_LINE	(1 << 3) /* first macro/text on line */
Index: man_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_html.c,v
retrieving revision 1.62
diff -r1.62 man_html.c
199a200,207
> 		if ('\0' == *n->string) {
> 			print_otag(h, TAG_P, 0, NULL);
> 			return;
> 		}
> 
> 		if (' ' == *n->string && MAN_LINE & n->flags)
> 			print_otag(h, TAG_BR, 0, NULL);
> 
200a209
> 
Index: man_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v
retrieving revision 1.95
diff -r1.95 man_term.c
862c862
< 		if (0 == *n->string) {
---
> 		if ('\0' == *n->string) {
865c865,868
< 		}
---
> 		} 
> 
> 		if (' ' == *n->string && MAN_LINE & n->flags)
> 			term_newln(p);
880a884
> 
Index: mdoc.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.7,v
retrieving revision 1.174
diff -r1.174 mdoc.7
57a58,60
> .Pp
> If the first character of a line is whitespace, that line is printed
> verbatim, including the end-of-line.
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.142
diff -r1.142 mdoc_html.c
422a423,424
> 		if (' ' == *n->string && MDOC_LINE & n->flags)
> 			print_otag(h, TAG_BR, 0, NULL);
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.208
diff -r1.208 mdoc_term.c
317a318,319
> 		if (' ' == *n->string && MDOC_LINE & n->flags)
> 			term_newln(p);

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

end of thread, other threads:[~2011-01-11  1:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-11  1:10 Leading space in roff = leading newline Kristaps Dzonsons
2011-01-11  1:12 ` 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).