* mandoc: Improve accessibility of -T html -O toc output by using the
@ 2022-06-24 11:16 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2022-06-24 11:16 UTC (permalink / raw)
To: source
Log Message:
-----------
Improve accessibility of -T html -O toc output by using the <nav> element
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.
Modified Files:
--------------
mandoc:
html.c
html.h
mandoc_html.3
mdoc_html.c
Revision Data
-------------
Index: mandoc_html.3
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc_html.3,v
retrieving revision 1.23
retrieving revision 1.24
diff -Lmandoc_html.3 -Lmandoc_html.3 -u -p -r1.23 -r1.24
--- mandoc_html.3
+++ mandoc_html.3
@@ -221,6 +221,10 @@ option.
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
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_html.c,v
retrieving revision 1.342
retrieving revision 1.343
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.342 -r1.343
--- mdoc_html.c
+++ mdoc_html.c
@@ -515,7 +515,7 @@ static int
mdoc_sh_pre(MDOC_ARGS)
{
struct roff_node *sn, *subn;
- struct tag *t, *tsec, *tsub;
+ struct tag *t, *tnav, *tsec, *tsub;
char *id;
int sc;
@@ -536,6 +536,7 @@ mdoc_sh_pre(MDOC_ARGS)
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);
@@ -567,7 +568,7 @@ mdoc_sh_pre(MDOC_ARGS)
}
print_tagq(h, tsec);
}
- print_tagq(h, t);
+ print_tagq(h, tnav);
print_otag(h, TAG_SECTION, "c", "Sh");
break;
case ROFFT_HEAD:
Index: html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/html.c,v
retrieving revision 1.275
retrieving revision 1.276
diff -Lhtml.c -Lhtml.c -u -p -r1.275 -r1.276
--- html.c
+++ html.c
@@ -69,6 +69,7 @@ static const struct htmldata htmltags[TA
{"body", HTML_NLALL},
{"div", HTML_NLAROUND},
{"section", HTML_NLALL},
+ {"nav", HTML_NLALL},
{"table", HTML_NLALL | HTML_INDENT},
{"tr", HTML_NLALL | HTML_INDENT},
{"td", HTML_NLAROUND},
@@ -707,6 +708,9 @@ print_otag(struct html *h, enum htmltag
break;
case 'i':
attr = "id";
+ break;
+ case 'r':
+ attr = "role";
break;
case '?':
attr = arg1;
Index: html.h
===================================================================
RCS file: /home/cvs/mandoc/mandoc/html.h,v
retrieving revision 1.109
retrieving revision 1.110
diff -Lhtml.h -Lhtml.h -u -p -r1.109 -r1.110
--- html.h
+++ html.h
@@ -29,6 +29,7 @@ enum htmltag {
TAG_BODY,
TAG_DIV,
TAG_SECTION,
+ TAG_NAV,
TAG_TABLE,
TAG_TR,
TAG_TD,
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-24 11:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-24 11:16 mandoc: Improve accessibility of -T html -O toc output by using the schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).