diff options
author | 2019-03-01 10:48:58 +0000 | |
---|---|---|
committer | 2019-03-01 10:48:58 +0000 | |
commit | 1a2b7b3c4d50fc376dd60744134889875b5dd88f (patch) | |
tree | e8fc0280f4d20a2270f706ef7b70efee72980877 /usr.bin/mandoc/man_html.c | |
parent | Print usage on extra create, start and stop arguments (diff) | |
download | wireguard-openbsd-1a2b7b3c4d50fc376dd60744134889875b5dd88f.tar.xz wireguard-openbsd-1a2b7b3c4d50fc376dd60744134889875b5dd88f.zip |
Wrap .Sh/.SH sections and .Ss/.SS subsections in HTML <section> elements
as recommended for accessibility by the HTML 5 standard.
Triggered by a similar, but slightly different suggestion
from Laura Morales <lauretas at mail dot com>.
Diffstat (limited to 'usr.bin/mandoc/man_html.c')
-rw-r--r-- | usr.bin/mandoc/man_html.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c index cfdb29175c6..2780072a794 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.124 2019/02/28 16:36:10 schwarze Exp $ */ +/* $OpenBSD: man_html.c,v 1.125 2019/03/01 10:48:58 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org> @@ -308,18 +308,25 @@ man_root_post(const struct roff_meta *man, struct html *h) static int man_SH_pre(MAN_ARGS) { - char *id; - + const char *class; + char *id; + enum htmltag tag; + + if (n->tok == MAN_SH) { + tag = TAG_H1; + class = "Sh"; + } else { + tag = TAG_H2; + class = "Ss"; + } switch (n->type) { case ROFFT_BLOCK: html_close_paragraph(h); + print_otag(h, TAG_SECTION, "c", class); break; case ROFFT_HEAD: id = html_make_id(n, 1); - if (n->tok == MAN_SH) - print_otag(h, TAG_H1, "ci", "Sh", id); - else - print_otag(h, TAG_H2, "ci", "Ss", id); + print_otag(h, tag, "ci", class, id); if (id != NULL) print_otag(h, TAG_A, "chR", "permalink", id); break; |