tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: "Anna “CyberTailor”" <cyber@sysrq.in>
To: tech@mandoc.bsd.lv
Subject: [PATCH 1/8] mdoc_html: Accessibility markup for ToC
Date: Tue, 21 Jun 2022 17:27:42 +0500	[thread overview]
Message-ID: <20220621122749.11417-2-cyber@sysrq.in> (raw)
In-Reply-To: <20220621122749.11417-1-cyber@sysrq.in>

1. Wrap ToC in the "<nav>" tag
2. Add "doc-toc" DPUB-ARIA role
---
 html.c      | 4 ++++
 html.h      | 1 +
 mdoc_html.c | 4 +++-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/html.c b/html.c
index 65c31b64..4710bab7 100644
--- a/html.c
+++ b/html.c
@@ -110,6 +110,7 @@ static	const struct htmldata htmltags[TAG_MAX] = {
 	{"munderover",	0},
 	{"munder",	0},
 	{"mover",	0},
+	{"nav",		HTML_NLALL},
 };
 
 /* Avoid duplicate HTML id= attributes. */
@@ -708,6 +709,9 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
 		case 'i':
 			attr = "id";
 			break;
+		case 'r':
+			attr = "role";
+			break;
 		case '?':
 			attr = arg1;
 			arg1 = va_arg(ap, char *);
diff --git a/html.h b/html.h
index dda19b8a..5e2adc06 100644
--- a/html.h
+++ b/html.h
@@ -70,6 +70,7 @@ enum	htmltag {
 	TAG_MUNDEROVER,
 	TAG_MUNDER,
 	TAG_MOVER,
+	TAG_NAV,
 	TAG_MAX
 };
 
diff --git a/mdoc_html.c b/mdoc_html.c
index 2dde0531..d85df753 100644
--- a/mdoc_html.c
+++ b/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);
@@ -568,6 +569,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:
-- 
2.35.1

--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv


  reply	other threads:[~2022-06-21 12:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 12:27 [PATCH 0/8] Make generated HTML more accessible Anna “CyberTailor”
2022-06-21 12:27 ` Anna “CyberTailor” [this message]
2022-06-21 12:27 ` [PATCH 2/8] mdoc_html: Add DPUB-ARIA roles to sections Anna “CyberTailor”
2022-06-24 13:58   ` Ingo Schwarze
2022-06-21 12:27 ` [PATCH 3/8] mdoc_html: Add DPUB-ARIA roles to subsections Anna “CyberTailor”
2022-06-21 12:27 ` [PATCH 4/8] man_html: Add DPUB-ARIA roles to (sub)sections Anna “CyberTailor”
2022-06-21 12:27 ` [PATCH 5/8] man.cgi: add ARIA roles and semantics Anna “CyberTailor”
2022-07-04 16:37   ` Ingo Schwarze
2022-06-21 12:27 ` [PATCH 6/8] mdoc_html: Add accessible description to crosslinks Anna “CyberTailor”
2022-06-25 12:58   ` Ingo Schwarze
2022-06-21 12:27 ` [PATCH 7/8] mdoc_html: Tell screen readers to skip the header Anna “CyberTailor”
2022-06-26 15:51   ` Ingo Schwarze
2022-06-28 16:33     ` Anna “CyberTailor”
2022-06-21 12:27 ` [PATCH 8/8] man_html: " Anna “CyberTailor”
2022-06-22 19:15 ` [PATCH 0/8] Make generated HTML more accessible Ingo Schwarze
2022-06-22 19:40   ` Anna “CyberTailor”
2022-06-23 13:34     ` Ingo Schwarze

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=20220621122749.11417-2-cyber@sysrq.in \
    --to=cyber@sysrq.in \
    --cc=tech@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).