summaryrefslogtreecommitdiffstats
path: root/man_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-03-15 11:29:53 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-03-15 11:29:53 +0000
commit28bf3097cb23e1f811b5273cd04e16d309f04607 (patch)
tree38ecfdeb14b8bad014fc814155f7a1dd2f311e86 /man_html.c
parent7f62257df910dabf75acbc931ba339de0abde743 (diff)
downloadmandoc-28bf3097cb23e1f811b5273cd04e16d309f04607.tar.gz
Minimal support for deep linking into man(7) pages.
As the man(7) language does not provide semantic markup, only .SH, .SS, and .UR become anchors for now.
Diffstat (limited to 'man_html.c')
-rw-r--r--man_html.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/man_html.c b/man_html.c
index 7db71e2a..cc3fc761 100644
--- a/man_html.c
+++ b/man_html.c
@@ -435,8 +435,14 @@ man_br_pre(MAN_ARGS)
static int
man_SH_pre(MAN_ARGS)
{
- if (n->type == ROFFT_HEAD)
- print_otag(h, TAG_H1, "c", "Sh");
+ char *id;
+
+ if (n->type == ROFFT_HEAD) {
+ id = html_make_id(n);
+ print_otag(h, TAG_H1, "cTi", "Sh", id);
+ print_otag(h, TAG_A, "chR", "selflink", id);
+ free(id);
+ }
return 1;
}
@@ -498,8 +504,14 @@ man_SM_pre(MAN_ARGS)
static int
man_SS_pre(MAN_ARGS)
{
- if (n->type == ROFFT_HEAD)
- print_otag(h, TAG_H2, "c", "Ss");
+ char *id;
+
+ if (n->type == ROFFT_HEAD) {
+ id = html_make_id(n);
+ print_otag(h, TAG_H2, "cTi", "Ss", id);
+ print_otag(h, TAG_A, "chR", "selflink", id);
+ free(id);
+ }
return 1;
}
@@ -656,7 +668,7 @@ man_UR_pre(MAN_ARGS)
assert(n->type == ROFFT_HEAD);
if (n->child != NULL) {
assert(n->child->type == ROFFT_TEXT);
- print_otag(h, TAG_A, "ch", "Lk", n->child->string);
+ print_otag(h, TAG_A, "cTh", "Lk", n->child->string);
}
assert(n->next->type == ROFFT_BODY);