From: Stephen Gregoratto <dev@sgregoratto.me>
To: tech@mandoc.bsd.lv
Subject: Re: [PATCH mandoc] Add lang attribute to <html>
Date: Wed, 24 Apr 2019 00:20:16 +1000 [thread overview]
Message-ID: <20190423142016.sx5s4yuocc3dwbqp@BlackBox> (raw)
In-Reply-To: <20190415081414.duabfe6bua65lypb@BlackBox>
On 2019-04-15 18:14, Stephen Gregoratto wrote:
> This patch sets the lang attribute to "en" for all HTML output.
> This is required for CSS hyphenation, which is supported by all modern
> browsers[1].
>
> Given your comments about non-english manpages[2], I decided that "en"
> is a good default. The alternative would be for mandoc to determine the
> input language and map it to an ISO 639-1 language code.
>
> I've tested adding "hyphens: auto" to mandoc.css on my man.cgi(8) server
> and found good results with Firefox and Chromium.
> I didn't add it to the stylesheet in this patch, but if you think this
> could be added in the future I recommend reading this comprehensive
> walkthrough[3] on CSS hyphenation and its fine-grained settings.
>
> [1] https://caniuse.com/#feat=css-hyphens
> [2] https://lists.gnu.org/archive/html/groff/2018-12/msg00181.html
> [3] http://clagnut.com/blog/2395
>
> Index: cgi.c
> ===================================================================
> RCS file: /cvs/mandoc/cgi.c,v
> retrieving revision 1.166
> diff -u -p -r1.166 cgi.c
> --- cgi.c 6 Mar 2019 12:32:41 -0000 1.166
> +++ cgi.c 15 Apr 2019 07:36:49 -0000
> @@ -368,7 +368,7 @@ resp_begin_html(int code, const char *ms
> 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\""
> Index: html.c
> ===================================================================
> RCS file: /cvs/mandoc/html.c,v
> retrieving revision 1.254
> diff -u -p -r1.254 html.c
> --- html.c 3 Mar 2019 13:02:11 -0000 1.254
> +++ html.c 15 Apr 2019 07:36:49 -0000
> @@ -647,6 +647,9 @@ print_otag(struct html *h, enum htmltag
> case 'i':
> attr = "id";
> break;
> + case 'l':
> + attr = "lang";
> + break;
> case '?':
> attr = arg1;
> arg1 = va_arg(ap, char *);
> Index: mdoc_html.c
> ===================================================================
> RCS file: /cvs/mandoc/mdoc_html.c,v
> retrieving revision 1.328
> diff -u -p -r1.328 mdoc_html.c
> --- mdoc_html.c 1 Mar 2019 10:57:18 -0000 1.328
> +++ mdoc_html.c 15 Apr 2019 07:36:49 -0000
> @@ -293,7 +293,7 @@ html_mdoc(void *arg, const struct roff_m
>
> if ((h->oflags & HTML_FRAGMENT) == 0) {
> print_gen_decls(h);
> - print_otag(h, TAG_HTML, "");
> + print_otag(h, TAG_HTML, "l", "en");
> if (n != NULL && n->type == ROFFT_COMMENT)
> print_gen_comment(h, n);
> t = print_otag(h, TAG_HEAD, "");
> --
> Stephen Gregoratto
> PGP: 3FC6 3D0E 2801 C348 1C44 2D34 A80C 0F8E 8BAB EC8B
Not sure if this one got through so ping I guess.
--
Stephen Gregoratto
PGP: 3FC6 3D0E 2801 C348 1C44 2D34 A80C 0F8E 8BAB EC8B
--
To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv
next prev parent reply other threads:[~2019-04-23 14:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-15 8:14 Stephen Gregoratto
2019-04-23 14:20 ` Stephen Gregoratto [this message]
2019-04-23 20:40 ` 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=20190423142016.sx5s4yuocc3dwbqp@BlackBox \
--to=dev@sgregoratto.me \
--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).