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 | 3f6a596c60833741991c23766d8710154bd82dfd (patch) | |
tree | b4b127ac6ac49bda9b7168e2dfb0bde79fbff169 | |
parent | cf1c247205f081780afa35078c938782166eb318 (diff) | |
download | mandoc-3f6a596c60833741991c23766d8710154bd82dfd.tar.gz |
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 | 2 | ||||
-rw-r--r-- | html.h | 1 | ||||
-rw-r--r-- | man_html.c | 2 | ||||
-rw-r--r-- | mandoc.css | 6 | ||||
-rw-r--r-- | mdoc_html.c | 2 |
5 files changed, 7 insertions, 6 deletions
@@ -2,6 +2,7 @@ /* * 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}, @@ -27,6 +27,7 @@ enum htmltag { TAG_STYLE, TAG_TITLE, TAG_BODY, + TAG_MAIN, TAG_DIV, TAG_SECTION, TAG_NAV, @@ -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); @@ -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 a0e29c72..16b72e00 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -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); |