* [PATCH 1/2] HTML: Add "lang" attributes
@ 2022-07-17 7:37 Anna Vyalkova
2022-07-17 7:37 ` [PATCH 2/2] HTML: mark some tables as used for layout only Anna Vyalkova
0 siblings, 1 reply; 2+ messages in thread
From: Anna Vyalkova @ 2022-07-17 7:37 UTC (permalink / raw)
To: tech
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] HTML: mark some tables as used for layout only
2022-07-17 7:37 [PATCH 1/2] HTML: Add "lang" attributes Anna Vyalkova
@ 2022-07-17 7:37 ` Anna Vyalkova
0 siblings, 0 replies; 2+ messages in thread
From: Anna Vyalkova @ 2022-07-17 7:37 UTC (permalink / raw)
To: tech
---
cgi.c | 3 ++-
man_html.c | 2 +-
mandoc.css | 1 +
mdoc_html.c | 2 +-
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/cgi.c b/cgi.c
index 79f80ffe..c4e46f59 100644
--- a/cgi.c
+++ b/cgi.c
@@ -728,7 +728,8 @@ pg_searchres(const struct req *req, struct manpage *r, size_t sz)
if (sz > 1) {
puts("<nav lang=\"\">");
- puts("<table class=\"results\">");
+ puts("<table class=\"results\" role=\"presentation\">");
+ puts("<caption><strong>Search results</strong></caption>");
for (i = 0; i < sz; i++) {
printf(" <tr>\n"
" <td lang=\"en\">"
diff --git a/man_html.c b/man_html.c
index fe5f3ea6..1b073736 100644
--- a/man_html.c
+++ b/man_html.c
@@ -595,7 +595,7 @@ man_SY_pre(MAN_ARGS)
switch (n->type) {
case ROFFT_BLOCK:
html_close_paragraph(h);
- print_otag(h, TAG_TABLE, "c", "Nm");
+ print_otag(h, TAG_TABLE, "cr", "Nm", "presentation");
print_otag(h, TAG_TR, "");
break;
case ROFFT_HEAD:
diff --git a/mandoc.css b/mandoc.css
index fff17159..0aec155b 100644
--- a/mandoc.css
+++ b/mandoc.css
@@ -20,6 +20,7 @@ h1, h2 { font-size: 110%; }
table { margin-top: 0em;
margin-bottom: 0em;
border-collapse: collapse; }
+caption { text-align: left; }
/* Some browsers set border-color in a browser style for tbody,
* but not for table, resulting in inconsistent border styling. */
tbody { border-color: inherit; }
diff --git a/mdoc_html.c b/mdoc_html.c
index fdf113cf..c72652ce 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -661,7 +661,7 @@ mdoc_nm_pre(MDOC_ARGS)
}
html_close_paragraph(h);
synopsis_pre(h, n);
- print_otag(h, TAG_TABLE, "c", "Nm");
+ print_otag(h, TAG_TABLE, "cr", "Nm", "presentation");
print_otag(h, TAG_TR, "");
return 1;
}
--
2.35.1
--
To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-17 7:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-17 7:37 [PATCH 1/2] HTML: Add "lang" attributes Anna Vyalkova
2022-07-17 7:37 ` [PATCH 2/2] HTML: mark some tables as used for layout only Anna Vyalkova
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).