diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2019-03-01 10:57:17 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2019-03-01 10:57:17 +0000 |
commit | d3f52b2d9dc5815b73119982013465a10140e182 (patch) | |
tree | 7e7fd84dc23986618089c3c295a5e1f89df55a97 /man_html.c | |
parent | 122f08c3f3756fc23b3e070a0322f7250bddbfbf (diff) | |
download | mandoc-d3f52b2d9dc5815b73119982013465a10140e182.tar.gz mandoc-d3f52b2d9dc5815b73119982013465a10140e182.tar.zst mandoc-d3f52b2d9dc5815b73119982013465a10140e182.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 'man_html.c')
-rw-r--r-- | man_html.c | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.171 2019/02/28 16:36:13 schwarze Exp $ */ +/* $Id: man_html.c,v 1.172 2019/03/01 10:57:18 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org> @@ -310,18 +310,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; |