From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.sgregoratto.me (mail.sgregoratto.me [149.28.166.45]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id 4fbd6fe3 for ; Tue, 23 Apr 2019 09:20:21 -0500 (EST) Received: from mail.sgregoratto.me (localhost [127.0.0.1]) by mail.sgregoratto.me (Postfix) with ESMTP id E61903E8BB for ; Wed, 24 Apr 2019 00:20:17 +1000 (AEST) Authentication-Results: mail.sgregoratto.me (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=sgregoratto.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sgregoratto.me; h=user-agent:in-reply-to:content-disposition:content-type :content-type:mime-version:references:message-id:subject:subject :to:from:from:date:date; s=dkim; t=1556029217; x=1558621218; bh= ztAT+ArYcr483u8wYEhhIvhZK1FsH/lQZKPH8bI1b+g=; b=K9gW5NalmcnWUC0O Np3a9r5LGeiSvjcYcDF8e4KESjcO4Gm8r6JGPfQ0Jhdi/ARH/3kadBfitCP8fuAw OQdwKm0GxgYlTpqWdC8DwTp+8fFTPRyGun+WqaGXOU8o04f3UrX1qLFznvnb2AZ6 8C+n0iC5Fb4JII8VwMrLfxdlSb8= X-Virus-Scanned: Debian amavisd-new at mail.sgregoratto.me Received: from mail.sgregoratto.me ([127.0.0.1]) by mail.sgregoratto.me (mail.sgregoratto.me [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id VRae_PW3EKQR for ; Wed, 24 Apr 2019 00:20:17 +1000 (AEST) Received: from localhost (172.44.179.58.sta.dodo.net.au [58.179.44.172]) by mail.sgregoratto.me (Postfix) with ESMTPSA id 182083E83C for ; Wed, 24 Apr 2019 00:20:17 +1000 (AEST) Date: Wed, 24 Apr 2019 00:20:16 +1000 From: Stephen Gregoratto To: tech@mandoc.bsd.lv Subject: Re: [PATCH mandoc] Add lang attribute to Message-ID: <20190423142016.sx5s4yuocc3dwbqp@BlackBox> Mail-Followup-To: tech@mandoc.bsd.lv References: <20190415081414.duabfe6bua65lypb@BlackBox> X-Mailinglist: mandoc-tech Reply-To: tech@mandoc.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190415081414.duabfe6bua65lypb@BlackBox> User-Agent: NeoMutt/20180716 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("\n" > - "\n" > + "\n" > "\n" > " \n" > " 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