summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2022-07-03 14:28:28 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2022-07-03 14:28:28 +0000
commit6be12ed7b8d988e66e11b1b2d93747c01ed85ad5 (patch)
treec8feed4abc708f356d63d1c67537b4d003c3890e /usr.bin/mandoc
parentca98a7b5dc8f559c0eff6267100accc65bdea386 (diff)
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.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/html.c4
-rw-r--r--usr.bin/mandoc/html.h3
-rw-r--r--usr.bin/mandoc/man_html.c4
-rw-r--r--usr.bin/mandoc/mandoc.css8
-rw-r--r--usr.bin/mandoc/mdoc_html.c4
5 files changed, 12 insertions, 11 deletions
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
index bff21059f53..4b582323cfc 100644
--- a/usr.bin/mandoc/html.c
+++ b/usr.bin/mandoc/html.c
@@ -1,7 +1,8 @@
-/* $OpenBSD: html.c,v 1.147 2022/06/24 11:15:19 schwarze Exp $ */
+/* $OpenBSD: html.c,v 1.148 2022/07/03 14:28:26 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
@@ -65,6 +66,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},
diff --git a/usr.bin/mandoc/html.h b/usr.bin/mandoc/html.h
index 5ca0a38f280..7e5b02937f1 100644
--- a/usr.bin/mandoc/html.h
+++ b/usr.bin/mandoc/html.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: html.h,v 1.72 2022/06/24 11:15:19 schwarze Exp $ */
+/* $OpenBSD: html.h,v 1.73 2022/07/03 14:28:27 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,
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index 3d57bad66c0..82d09aebcd7 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.132 2020/10/16 17:22:39 schwarze Exp $ */
+/* $OpenBSD: man_html.c,v 1.133 2022/07/03 14:28:27 schwarze Exp $ */
/*
* Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -130,7 +130,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);
diff --git a/usr.bin/mandoc/mandoc.css b/usr.bin/mandoc/mandoc.css
index 2522112295f..c446b51194c 100644
--- a/usr.bin/mandoc/mandoc.css
+++ b/usr.bin/mandoc/mandoc.css
@@ -1,4 +1,4 @@
-/* $OpenBSD: mandoc.css,v 1.36 2022/03/17 18:45:43 schwarze Exp $ */
+/* $OpenBSD: mandoc.css,v 1.37 2022/07/03 14:28:27 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/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index ab0754d44f4..683c17e7542 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_html.c,v 1.219 2022/06/25 12:44:12 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.220 2022/07/03 14:28:27 schwarze Exp $ */
/*
* Copyright (c) 2014-2022 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -300,7 +300,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);