From: Kristaps Dzonsons <kristaps@bsd.lv>
To: "tech@mdocml.bsd.lv" <tech@mdocml.bsd.lv>
Cc: Jason McIntyre <jmc@kerhand.co.uk>
Subject: [PATCH] Bd -literal/-unfilled and old groff.
Date: Tue, 27 Jul 2010 01:53:21 +0200 [thread overview]
Message-ID: <4C4E1FF1.5020304@bsd.lv> (raw)
[-- 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;
next reply other threads:[~2010-07-26 23:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-26 23:53 Kristaps Dzonsons [this message]
[not found] ` <20100727065352.GA7946@bramka.kerhand.co.uk>
2010-07-27 8:39 ` 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=4C4E1FF1.5020304@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).