summaryrefslogtreecommitdiffstats
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/html.c b/html.c
index 9b80efcd..594de3fa 100644
--- a/html.c
+++ b/html.c
@@ -878,6 +878,15 @@ print_gen_comment(struct html *h, struct roff_node *n)
void
print_text(struct html *h, const char *word)
{
+ print_tagged_text(h, word, NULL);
+}
+
+void
+print_tagged_text(struct html *h, const char *word, struct roff_node *n)
+{
+ struct tag *t;
+ char *href;
+
/*
* Always wrap text in a paragraph unless already contained in
* some flow container; never put it directly into a section.
@@ -898,13 +907,20 @@ print_text(struct html *h, const char *word)
}
/*
- * Print the text, optionally surrounded by HTML whitespace,
- * optionally manually switching fonts before and after.
+ * Optionally switch fonts, optionally write a permalink, then
+ * print the text, optionally surrounded by HTML whitespace.
*/
assert(h->metaf == NULL);
print_metaf(h);
print_indent(h);
+
+ if (n != NULL && (href = html_make_id(n, 0)) != NULL) {
+ t = print_otag(h, TAG_A, "chR", "permalink", href);
+ free(href);
+ } else
+ t = NULL;
+
if ( ! print_encode(h, word, NULL, 0)) {
if ( ! (h->flags & HTML_NONOSPACE))
h->flags &= ~HTML_NOSPACE;
@@ -915,7 +931,8 @@ print_text(struct html *h, const char *word)
if (h->metaf != NULL) {
print_tagq(h, h->metaf);
h->metaf = NULL;
- }
+ } else if (t != NULL)
+ print_tagq(h, t);
h->flags &= ~HTML_IGNDELIM;
}