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

---
 html.h                             | 26 ++++++++++++++++++++++++++
 mdoc_html.c                        |  5 +++--
 regress/mdoc/Er/tag.out_html       |  2 +-
 regress/mdoc/Rs/paragraph.out_html |  2 +-
 regress/mdoc/Sh/paragraph.out_html |  2 +-
 regress/mdoc/Sh/tag.out_html       |  8 ++++----
 regress/mdoc/Tg/warn.out_html      |  2 +-
 7 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/html.h b/html.h
index 5e2adc06..dc4febf2 100644
--- a/html.h
+++ b/html.h
@@ -74,6 +74,32 @@ enum	htmltag {
 	TAG_MAX
 };
 
+static	const char * const dpubroles[SEC__MAX] = {
+	NULL,			/* SEC_NONE */
+	"doc-abstract",		/* SEC_NAME */
+	"doc-abstract",		/* SEC_LIBRARY */
+	"doc-part",		/* SEC_SYNOPSIS */
+	"doc-part",		/* SEC_DESCRIPTION */
+	"doc-part",		/* SEC_CONTEXT */
+	"doc-part",		/* SEC_IMPLEMENTATION */
+	"doc-part",		/* SEC_RETURN_VALUES */
+	"doc-part",		/* SEC_ENVIRONMENT */
+	"doc-part",		/* SEC_FILES */
+	"doc-part",		/* SEC_EXIT_STATUS */
+	"doc-example",		/* SEC_EXAMPLES */
+	"doc-part",		/* SEC_DIAGNOSTICS */
+	"doc-part",		/* SEC_COMPATIBILITY */
+	"doc-part",		/* SEC_ERRORS */
+	"doc-part",		/* SEC_SEE_ALSO */
+	"doc-part",		/* SEC_STANDARDS */
+	"doc-part",		/* SEC_HISTORY */
+	"doc-aknowledgments",	/* SEC_AUTHORS */
+	"doc-part",		/* SEC_CAVEATS */
+	"doc-part",		/* SEC_BUGS */
+	"doc-part",		/* SEC_SECURITY */
+	"doc-part",		/* SEC_CUSTOM */
+};
+
 struct	tag {
 	struct tag	 *next;
 	int		  refcnt;
diff --git a/mdoc_html.c b/mdoc_html.c
index d85df753..31cfaac2 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -525,7 +525,8 @@ mdoc_sh_pre(MDOC_ARGS)
 		if ((h->oflags & HTML_TOC) == 0 ||
 		    h->flags & HTML_TOCDONE ||
 		    n->sec <= SEC_SYNOPSIS) {
-			print_otag(h, TAG_SECTION, "c", "Sh");
+			print_otag(h, TAG_SECTION, "cr",
+			    "Sh", dpubroles[n->sec]);
 			break;
 		}
 		h->flags |= HTML_TOCDONE;
@@ -570,7 +571,7 @@ mdoc_sh_pre(MDOC_ARGS)
 		}
 		print_tagq(h, t);
 		print_tagq(h, tnav);
-		print_otag(h, TAG_SECTION, "c", "Sh");
+		print_otag(h, TAG_SECTION, "cr", "Sh", dpubroles[n->sec]);
 		break;
 	case ROFFT_HEAD:
 		print_otag_id(h, TAG_H1, "Sh", n);
diff --git a/regress/mdoc/Er/tag.out_html b/regress/mdoc/Er/tag.out_html
index 80daa28b..276bf29b 100644
--- a/regress/mdoc/Er/tag.out_html
+++ b/regress/mdoc/Er/tag.out_html
@@ -4,7 +4,7 @@
 </dl>
 <a class="permalink" href="#two"><code class="Er" id="two">two</code></a>
 </section>
-<section class="Sh">
+<section class="Sh" role="doc-part">
 <h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
 <dl class="Bl-tag">
   <dt id="ENOENT">[<a class="permalink" href="#ENOENT"><code class="Er">ENOENT</code></a>]</dt>
diff --git a/regress/mdoc/Rs/paragraph.out_html b/regress/mdoc/Rs/paragraph.out_html
index bfb0a724..9c197182 100644
--- a/regress/mdoc/Rs/paragraph.out_html
+++ b/regress/mdoc/Rs/paragraph.out_html
@@ -4,7 +4,7 @@
 <p class="Pp">in a paragraph: <cite class="Rs"><span class="RsA">another
     author</span>, <i class="RsB">another book</i>.</cite></p>
 </section>
-<section class="Sh">
+<section class="Sh" role="doc-part">
 <h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
   ALSO</a></h1>
 <p class="Pp">initial reference:</p>
diff --git a/regress/mdoc/Sh/paragraph.out_html b/regress/mdoc/Sh/paragraph.out_html
index 82ede5be..604153cd 100644
--- a/regress/mdoc/Sh/paragraph.out_html
+++ b/regress/mdoc/Sh/paragraph.out_html
@@ -5,5 +5,5 @@
 <p class="Pp">subsection paragraph</p>
 </section>
 </section>
-<section class="Sh">
+<section class="Sh" role="doc-example">
 <h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
diff --git a/regress/mdoc/Sh/tag.out_html b/regress/mdoc/Sh/tag.out_html
index 0dd39398..88f65803 100644
--- a/regress/mdoc/Sh/tag.out_html
+++ b/regress/mdoc/Sh/tag.out_html
@@ -1,11 +1,11 @@
 <p class="Pp">Text in the subsection.</p>
 </section>
 </section>
-<section class="Sh">
+<section class="Sh" role="doc-part">
 <h1 class="Sh" id="DESCRIPTION~2"><a class="permalink" href="#DESCRIPTION~2">DESCRIPTION</a></h1>
 <p class="Pp">Text in duplicate description section.</p>
 </section>
-<section class="Sh">
+<section class="Sh" role="doc-example">
 <h1 class="Sh" id="examples"><a class="permalink" href="#examples">EXAMPLES</a></h1>
 <p class="Pp">Text introducing examples.</p>
 <section class="Ss">
@@ -17,11 +17,11 @@
 <p class="Pp">More example text.</p>
 </section>
 </section>
-<section class="Sh">
+<section class="Sh" role="doc-part">
 <h1 class="Sh" id="WEIRD_SECTION"><a class="permalink" href="#WEIRD_SECTION">	
   WEIRD SECTION	 </a></h1>
 <p class="Pp">Text in weird section.</p>
 </section>
-<section class="Sh">
+<section class="Sh" role="doc-part">
 <h1 class="Sh">&#x00A0;</h1>
 <p class="Pp">Text in section with empty header.</p>
diff --git a/regress/mdoc/Tg/warn.out_html b/regress/mdoc/Tg/warn.out_html
index a7f92574..7c7d7943 100644
--- a/regress/mdoc/Tg/warn.out_html
+++ b/regress/mdoc/Tg/warn.out_html
@@ -6,6 +6,6 @@
 <p class="Pp">subtext</p>
 </section>
 </section>
-<section class="Sh">
+<section class="Sh" role="doc-example">
 <h1 class="Sh" id="examples"><a class="permalink" href="#examples">EXAMPLES</a></h1>
 <p class="Pp">example text</p>
-- 
2.35.1

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


  parent 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 ` [PATCH 1/8] mdoc_html: Accessibility markup for ToC Anna “CyberTailor”
2022-06-21 12:27 ` Anna “CyberTailor” [this message]
2022-06-24 13:58   ` [PATCH 2/8] mdoc_html: Add DPUB-ARIA roles to sections 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-3-cyber@sysrq.in \
    --to=cyber@sysrq.in \
    --cc=tech@mandoc.bsd.lv \
    --subject='Re: [PATCH 2/8] mdoc_html: Add DPUB-ARIA roles to sections' \
    /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

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).