diff options
author | 2017-03-15 11:29:50 +0000 | |
---|---|---|
committer | 2017-03-15 11:29:50 +0000 | |
commit | 6ef173c4fd6cf3afea3b1350ebffc5f08324070b (patch) | |
tree | 8d52bb40f8f0ba1ff6cb0b07b8ad4648a4392a48 /usr.bin/mandoc/man_html.c | |
parent | We do not need while loop around uiomove(9) in lcdwrite(). (diff) | |
download | wireguard-openbsd-6ef173c4fd6cf3afea3b1350ebffc5f08324070b.tar.xz wireguard-openbsd-6ef173c4fd6cf3afea3b1350ebffc5f08324070b.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 'usr.bin/mandoc/man_html.c')
-rw-r--r-- | usr.bin/mandoc/man_html.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c index b41e3c056a0..43c78be604c 100644 --- a/usr.bin/mandoc/man_html.c +++ b/usr.bin/mandoc/man_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_html.c,v 1.86 2017/02/05 18:13:28 schwarze Exp $ */ +/* $OpenBSD: man_html.c,v 1.87 2017/03/15 11:29:50 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -433,8 +433,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; } @@ -496,8 +502,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; } @@ -654,7 +666,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); |