in the DPUB-ARIA doc-toc role.
Patch from Anna Vyalkova <cyber at sysrq dot in> slightly tweaked by me.
This is hopefully the start of a collaboration to improve accessibility
of Unix manual pages using the WAI-ARIA, HTML-ARIA, and DPUB-ARIA standards.
Progress appears to be possible without changing *anything* with respect to
the way manual pages are written. Instead, it seems sufficient to properly
translate semantic cues already implied by existing mdoc(7) markup into the
appropriate HTML elements and ARIA attributes. Overall, the total length
of HTML output is likely to increase slightly, but not much.
-/* $Id: html.c,v 1.275 2021/09/09 14:47:24 schwarze Exp $ */
+/* $Id: html.c,v 1.276 2022/06/24 11:15:53 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) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017-2021 Ingo Schwarze <schwarze@openbsd.org>
{"body", HTML_NLALL},
{"div", HTML_NLAROUND},
{"section", HTML_NLALL},
{"body", HTML_NLALL},
{"div", HTML_NLAROUND},
{"section", HTML_NLALL},
{"table", HTML_NLALL | HTML_INDENT},
{"tr", HTML_NLALL | HTML_INDENT},
{"td", HTML_NLAROUND},
{"table", HTML_NLALL | HTML_INDENT},
{"tr", HTML_NLALL | HTML_INDENT},
{"td", HTML_NLAROUND},
case 'i':
attr = "id";
break;
case 'i':
attr = "id";
break;
+ case 'r':
+ attr = "role";
+ break;
case '?':
attr = arg1;
arg1 = va_arg(ap, char *);
case '?':
attr = arg1;
arg1 = va_arg(ap, char *);
-/* $Id: html.h,v 1.109 2021/09/09 14:47:24 schwarze Exp $ */
+/* $Id: html.h,v 1.110 2022/06/24 11:15:53 schwarze Exp $ */
/*
* Copyright (c) 2017, 2018, 2019, 2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
/*
* Copyright (c) 2017, 2018, 2019, 2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
TAG_BODY,
TAG_DIV,
TAG_SECTION,
TAG_BODY,
TAG_DIV,
TAG_SECTION,
TAG_TABLE,
TAG_TR,
TAG_TD,
TAG_TABLE,
TAG_TR,
TAG_TD,
-.\" $Id: mandoc_html.3,v 1.23 2020/04/24 13:13:06 schwarze Exp $
+.\" $Id: mandoc_html.3,v 1.24 2022/06/24 11:15:53 schwarze Exp $
.\"
.\" Copyright (c) 2014, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\"
.\" Copyright (c) 2014, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: April 24 2020 $
+.Dd $Mdocdate: June 24 2022 $
.Dt MANDOC_HTML 3
.Os
.Sh NAME
.Dt MANDOC_HTML 3
.Os
.Sh NAME
Print an
.Cm id
attribute.
Print an
.Cm id
attribute.
+.It Cm r
+Print an ARIA
+.Cm role
+attribute.
.It Cm \&?
Print an arbitrary attribute.
This format letter requires two
.It Cm \&?
Print an arbitrary attribute.
This format letter requires two
-/* $Id: mdoc_html.c,v 1.342 2021/03/30 19:26:20 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.343 2022/06/24 11:15:53 schwarze Exp $ */
/*
* Copyright (c) 2014-2021 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
/*
* Copyright (c) 2014-2021 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
mdoc_sh_pre(MDOC_ARGS)
{
struct roff_node *sn, *subn;
mdoc_sh_pre(MDOC_ARGS)
{
struct roff_node *sn, *subn;
- struct tag *t, *tsec, *tsub;
+ struct tag *t, *tnav, *tsec, *tsub;
break;
if (sc < 2)
break;
break;
if (sc < 2)
break;
+ tnav = print_otag(h, TAG_NAV, "r", "doc-toc");
t = print_otag(h, TAG_H1, "c", "Sh");
print_text(h, "TABLE OF CONTENTS");
print_tagq(h, t);
t = print_otag(h, TAG_H1, "c", "Sh");
print_text(h, "TABLE OF CONTENTS");
print_tagq(h, t);
print_otag(h, TAG_SECTION, "c", "Sh");
break;
case ROFFT_HEAD:
print_otag(h, TAG_SECTION, "c", "Sh");
break;
case ROFFT_HEAD: