From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Clean up handling of `In' for -T[x]html such that it only links
Date: Mon, 4 Apr 2011 11:33:03 -0400 (EDT) [thread overview]
Message-ID: <201104041533.p34FX3wg002056@krisdoz.my.domain> (raw)
Log Message:
-----------
Clean up handling of `In' for -T[x]html such that it only links to the
first argument. groff of course doesn't do links, but it will uglify
subsequent arguments in the list (we warn about >1, anyway).
Modified Files:
--------------
mdocml:
mdoc_html.c
Revision Data
-------------
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.155 -r1.156
--- mdoc_html.c
+++ mdoc_html.c
@@ -1696,38 +1696,55 @@ mdoc_fo_post(MDOC_ARGS)
static int
mdoc_in_pre(MDOC_ARGS)
{
- const struct mdoc_node *nn;
- struct tag *t;
- struct htmlpair tag[2];
- int i;
+ struct tag *t;
+ struct htmlpair tag[2];
+ int i;
synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag[0], "includes");
print_otag(h, TAG_B, 1, tag);
+ /*
+ * The first argument of the `In' gets special treatment as
+ * being a linked value. Subsequent values are printed
+ * afterward. groff does similarly. This also handles the case
+ * of no children.
+ */
+
if (MDOC_SYNPRETTY & n->flags && MDOC_LINE & n->flags)
print_text(h, "#include");
print_text(h, "<");
h->flags |= HTML_NOSPACE;
- for (nn = n->child; nn; nn = nn->next) {
+ if (NULL != (n = n->child)) {
+ assert(MDOC_TEXT == n->type);
+
PAIR_CLASS_INIT(&tag[0], "link-includes");
- i = 1;
bufinit(h);
+
+ i = 1;
+
if (h->base_includes) {
- buffmt_includes(h, nn->string);
- PAIR_HREF_INIT(&tag[i], h->buf);
- i++;
- }
+ buffmt_includes(h, n->string);
+ PAIR_HREF_INIT(&tag[i++], h->buf);
+ }
+
t = print_otag(h, TAG_A, i, tag);
- print_mdoc_node(m, nn, h);
+ print_text(h, n->string);
print_tagq(h, t);
+
+ n = n->next;
}
h->flags |= HTML_NOSPACE;
print_text(h, ">");
+
+ for ( ; n; n = n->next) {
+ assert(MDOC_TEXT == n->type);
+ print_text(h, n->string);
+ }
return(0);
}
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2011-04-04 15:33 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=201104041533.p34FX3wg002056@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).