From: Anna Vyalkova <cyber@sysrq.in>
To: tech@mandoc.bsd.lv
Subject: [PATCH 1/2] HTML: Add "lang" attributes
Date: Sun, 17 Jul 2022 12:37:12 +0500 [thread overview]
Message-ID: <20220717073713.18314-1-cyber@sysrq.in> (raw)
Set global man.cgi language to English.
Set results and manpage language to unknown.
Allows browsers to use the right font and screen readers - the right
voice.
---
Proper localization support can be only done via JS hacks at the moment
and there is no simple solution AFAIK.
How about introducing a new macro for manpage language? Although it
won't be really useful as most localized manpages use legacy man(7).
cgi.c | 12 +++++++-----
man_html.c | 2 +-
mdoc_html.c | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/cgi.c b/cgi.c
index 76baddb6..79f80ffe 100644
--- a/cgi.c
+++ b/cgi.c
@@ -381,7 +381,7 @@ resp_begin_html(int code, const char *msg, const char *file)
resp_begin_http(code, msg);
printf("<!DOCTYPE html>\n"
- "<html>\n"
+ "<html lang=\"en\">\n"
"<head>\n"
" <meta charset=\"UTF-8\"/>\n"
" <meta name=\"viewport\""
@@ -727,11 +727,11 @@ pg_searchres(const struct req *req, struct manpage *r, size_t sz)
puts("</header>");
if (sz > 1) {
- puts("<nav>");
+ puts("<nav lang=\"\">");
puts("<table class=\"results\">");
for (i = 0; i < sz; i++) {
printf(" <tr>\n"
- " <td>"
+ " <td lang=\"en\">"
"<a class=\"Xr\" href=\"/");
if (*scriptname != '\0')
printf("%s/", scriptname);
@@ -907,9 +907,11 @@ resp_format(const struct req *req, const char *file)
int usepath;
if (-1 == (fd = open(file, O_RDONLY))) {
- puts("<p role=\"doc-notice\">\n"
+ puts("<main>\n"
+ "<p role=\"doc-notice\">\n"
" You specified an invalid manual file.\n"
- "</p>");
+ "</p>\n"
+ "</main>");
return;
}
diff --git a/man_html.c b/man_html.c
index f931dcb9..fe5f3ea6 100644
--- a/man_html.c
+++ b/man_html.c
@@ -132,7 +132,7 @@ html_man(void *arg, const struct roff_meta *man)
}
man_root_pre(man, h);
- t = print_otag(h, TAG_MAIN, "c", "manual-text");
+ t = print_otag(h, TAG_MAIN, "c?", "manual-text", "lang", "");
print_man_nodelist(man, n, h);
print_tagq(h, t);
man_root_post(man, h);
diff --git a/mdoc_html.c b/mdoc_html.c
index 7dab43e7..fdf113cf 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -302,7 +302,7 @@ html_mdoc(void *arg, const struct roff_meta *mdoc)
}
mdoc_root_pre(mdoc, h);
- t = print_otag(h, TAG_MAIN, "c", "manual-text");
+ t = print_otag(h, TAG_MAIN, "c?", "manual-text", "lang", "");
print_mdoc_nodelist(mdoc, n, h);
print_tagq(h, t);
mdoc_root_post(mdoc, h);
--
2.35.1
--
To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv
next reply other threads:[~2022-07-17 7:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-17 7:37 Anna Vyalkova [this message]
2022-07-17 7:37 ` [PATCH 2/2] HTML: mark some tables as used for layout only Anna Vyalkova
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=20220717073713.18314-1-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).