From: Kristaps Dzonsons <kristaps@bsd.lv>
To: tech@mdocml.bsd.lv, Jason McIntyre <jmc@kerhand.co.uk>
Subject: Leading space in roff = leading newline.
Date: Tue, 11 Jan 2011 02:10:27 +0100 [thread overview]
Message-ID: <4D2BAE03.7050709@bsd.lv> (raw)
[-- 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);
next reply other threads:[~2011-01-11 1:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-11 1:10 Kristaps Dzonsons [this message]
2011-01-11 1:12 ` Kristaps Dzonsons
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D2BAE03.7050709@bsd.lv \
--to=kristaps@bsd.lv \
--cc=jmc@kerhand.co.uk \
--cc=tech@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).