diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-03-15 11:29:53 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-03-15 11:29:53 +0000 |
commit | 4765dc18ce4546a42d3aa2ce149a3c3fb4d79b00 (patch) | |
tree | 29466681c88eea5ed0346c222603343534c49d77 /man_html.c | |
parent | 7820a26ea52032d0330456ae02d4044b357144de (diff) | |
download | mandoc-4765dc18ce4546a42d3aa2ce149a3c3fb4d79b00.tar.gz mandoc-4765dc18ce4546a42d3aa2ce149a3c3fb4d79b00.tar.zst mandoc-4765dc18ce4546a42d3aa2ce149a3c3fb4d79b00.zip |
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.c | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.133 2017/02/05 18:15:39 schwarze Exp $ */ +/* $Id: man_html.c,v 1.134 2017/03/15 11:29:53 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -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); |