From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Make -T[x]html in -man also be aware of the vertical-space
Date: Sat, 18 Jun 2011 16:34:08 -0400 (EDT) [thread overview]
Message-ID: <201106182034.p5IKY8xn030279@krisdoz.my.domain> (raw)
Log Message:
-----------
Make -T[x]html in -man also be aware of the vertical-space issues in the
last few commits.
Modified Files:
--------------
mdocml:
man_html.c
Revision Data
-------------
Index: man_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_html.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -Lman_html.c -Lman_html.c -u -p -r1.73 -r1.74
--- man_html.c
+++ man_html.c
@@ -53,6 +53,8 @@ struct htmlman {
int (*post)(MAN_ARGS);
};
+static void print_bvspace(struct html *,
+ const struct man_node *);
static void print_man(MAN_ARGS);
static void print_man_head(MAN_ARGS);
static void print_man_nodelist(MAN_ARGS);
@@ -114,6 +116,28 @@ static const struct htmlman mans[MAN_MAX
{ man_ign_pre, NULL }, /* ft */
};
+/*
+ * Printing leading vertical space before a block.
+ * This is used for the paragraph macros.
+ * The rules are pretty simple, since there's very little nesting going
+ * on here. Basically, if we're the first within another block (SS/SH),
+ * then don't emit vertical space. If we are (RS), then do. If not the
+ * first, print it.
+ */
+static void
+print_bvspace(struct html *h, const struct man_node *n)
+{
+
+ if (n->body && n->body->child)
+ if (MAN_TBL == n->body->child->type)
+ return;
+
+ if (MAN_ROOT == n->parent->type || MAN_RS != n->parent->tok)
+ if (NULL == n->prev)
+ return;
+
+ print_otag(h, TAG_P, 0, NULL);
+}
void
html_man(void *arg, const struct man *m)
@@ -513,8 +537,8 @@ man_PP_pre(MAN_ARGS)
if (MAN_HEAD == n->type)
return(0);
- else if (MAN_BODY == n->type && n->prev)
- print_otag(h, TAG_P, 0, NULL);
+ else if (MAN_BLOCK == n->type)
+ print_bvspace(h, n);
return(1);
}
@@ -562,7 +586,7 @@ man_IP_pre(MAN_ARGS)
}
if (MAN_BLOCK == n->type) {
- print_otag(h, TAG_P, 0, NULL);
+ print_bvspace(h, n);
print_otag(h, TAG_TABLE, 0, NULL);
bufinit(h);
bufcat_su(h, "width", &su);
@@ -613,7 +637,7 @@ man_HP_pre(MAN_ARGS)
print_otag(h, TAG_TD, 0, NULL);
return(0);
} else if (MAN_BLOCK == n->type) {
- print_otag(h, TAG_P, 0, NULL);
+ print_bvspace(h, n);
print_otag(h, TAG_TABLE, 0, NULL);
bufcat_su(h, "width", &su);
PAIR_STYLE_INIT(&tag, h);
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2011-06-18 20:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=201106182034.p5IKY8xn030279@krisdoz.my.domain \
--to=kristaps@mdocml.bsd.lv \
--cc=source@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).