summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-04-04 15:33:03 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-04-04 15:33:03 +0000
commitdff60581ee6a3878f319d127c7e83b61c30ac622 (patch)
tree65a60882932419518e94cc8fe8a7b9a796d6e99e /mdoc_html.c
parentb2742286b1f8fde21eb7e583826a71e8839c3948 (diff)
downloadmandoc-dff60581ee6a3878f319d127c7e83b61c30ac622.tar.gz
mandoc-dff60581ee6a3878f319d127c7e83b61c30ac622.tar.zst
mandoc-dff60581ee6a3878f319d127c7e83b61c30ac622.zip
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).
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 9656aced..ed99dea0 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.155 2011/03/22 14:05:45 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.156 2011/04/04 15:33:03 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -1696,39 +1696,56 @@ 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);
}