diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2022-07-03 14:29:44 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2022-07-03 14:29:44 +0000 |
commit | a77bef18f1857a07c9bb3dee9c7baf792fcfe588 (patch) | |
tree | 3faa0dd7eb6463108e7e733fb70d042d1c6e0214 | |
parent | 2cf172046664124e8c0589ee7e420c1008ee368e (diff) | |
download | mandoc-a77bef18f1857a07c9bb3dee9c7baf792fcfe588.tar.gz mandoc-a77bef18f1857a07c9bb3dee9c7baf792fcfe588.tar.zst mandoc-a77bef18f1857a07c9bb3dee9c7baf792fcfe588.zip |
Instead of the custom <div class="manual-text">, use the standard
HTML <main> element. The benefit is that it has the ARIA landmark
role "main" by default. To ease the transition for people using
their own CSS file instead of mandoc.css, retain the custom class
for now.
I had this idea in a discussion with Anna Vyalkova <cyber at sysrq dot in>.
Patch from Anna, slightly tweaked by me.
-rw-r--r-- | html.c | 4 | ||||
-rw-r--r-- | html.h | 3 | ||||
-rw-r--r-- | man_html.c | 4 | ||||
-rw-r--r-- | mandoc.css | 8 | ||||
-rw-r--r-- | mdoc_html.c | 4 |
5 files changed, 12 insertions, 11 deletions
@@ -1,7 +1,8 @@ -/* $Id: html.c,v 1.276 2022/06/24 11:15:53 schwarze Exp $ */ +/* $Id: html.c,v 1.277 2022/07/03 14:29:44 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011-2015, 2017-2021 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2022 Anna Vyalkova <cyber@sysrq.in> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -67,6 +68,7 @@ static const struct htmldata htmltags[TAG_MAX] = { {"style", HTML_NLALL | HTML_INDENT}, {"title", HTML_NLAROUND}, {"body", HTML_NLALL}, + {"main", HTML_NLALL}, {"div", HTML_NLAROUND}, {"section", HTML_NLALL}, {"nav", HTML_NLALL}, @@ -1,4 +1,4 @@ -/* $Id: html.h,v 1.110 2022/06/24 11:15:53 schwarze Exp $ */ +/* $Id: html.h,v 1.111 2022/07/03 14:29:44 schwarze Exp $ */ /* * Copyright (c) 2017, 2018, 2019, 2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> @@ -27,6 +27,7 @@ enum htmltag { TAG_STYLE, TAG_TITLE, TAG_BODY, + TAG_MAIN, TAG_DIV, TAG_SECTION, TAG_NAV, @@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.179 2020/10/16 17:22:43 schwarze Exp $ */ +/* $Id: man_html.c,v 1.180 2022/07/03 14:29:45 schwarze Exp $ */ /* * Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> @@ -132,7 +132,7 @@ html_man(void *arg, const struct roff_meta *man) } man_root_pre(man, h); - t = print_otag(h, TAG_DIV, "c", "manual-text"); + t = print_otag(h, TAG_MAIN, "c", "manual-text"); print_man_nodelist(man, n, h); print_tagq(h, t); man_root_post(man, h); @@ -1,4 +1,4 @@ -/* $Id: mandoc.css,v 1.49 2022/03/17 18:45:49 schwarze Exp $ */ +/* $Id: mandoc.css,v 1.50 2022/07/03 14:29:45 schwarze Exp $ */ /* * Standard style sheet for mandoc(1) -Thtml and man.cgi(8). * @@ -69,8 +69,7 @@ td.foot-os { text-align: right; } /* Sections and paragraphs. */ -.manual-text { - margin-left: 3.8em; } +main { margin-left: 3.8em; } .Nd { } section.Sh { } h1.Sh { margin-top: 1.2em; @@ -338,8 +337,7 @@ h1.Sh::before, h2.Ss::before, .St::before, .Sx::before, .Sy::before, /* Overrides to avoid excessive margins on small devices. */ @media (max-width: 37.5em) { -.manual-text { - margin-left: 0.5em; } +main { margin-left: 0.5em; } h1.Sh, h2.Ss { margin-left: 0em; } .Bd-indent { margin-left: 2em; } .Bl-hang > dd { diff --git a/mdoc_html.c b/mdoc_html.c index 63c98aab..9a32fe4e 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.344 2022/06/25 12:44:25 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.345 2022/07/03 14:29:45 schwarze Exp $ */ /* * Copyright (c) 2014-2022 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> @@ -302,7 +302,7 @@ html_mdoc(void *arg, const struct roff_meta *mdoc) } mdoc_root_pre(mdoc, h); - t = print_otag(h, TAG_DIV, "c", "manual-text"); + t = print_otag(h, TAG_MAIN, "c", "manual-text"); print_mdoc_nodelist(mdoc, n, h); print_tagq(h, t); mdoc_root_post(mdoc, h); |