source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Improve accessibility of -T html -O toc output by using the
Date: Fri, 24 Jun 2022 06:16:24 -0500 (EST)	[thread overview]
Message-ID: <3365d256f9bc8006@mandoc.bsd.lv> (raw)

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


                 reply	other threads:[~2022-06-24 11:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3365d256f9bc8006@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).