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 90cd0558 for ; Mon, 15 Apr 2019 03:14:18 -0500 (EST) Received: from mail.sgregoratto.me (localhost [127.0.0.1]) by mail.sgregoratto.me (Postfix) with ESMTP id 7FCFA3EB45 for ; Mon, 15 Apr 2019 18:14:15 +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:content-disposition:content-type:content-type :mime-version:message-id:subject:subject:to:from:from:date:date; s=dkim; t=1555316054; x=1557908055; bh=byIJTxQPKWDBIgmPplpXM3Bp Z6wH14jIfaRuxdE27XM=; b=DtO8Gqp2/PXaB2FfNMoaaGtNq7K1MFM22ph8/K3R NALJ0/h92g6yhGPi+FMLZRQXGw+pkAuSu/VRyyP4ycTldAJ+VPYRB23zbJazSuyz jh22oeGVLg7j7/yBbIP96JhB+qckbFK6DRN0IwqjmuwpzphlJhKuCPMlsIeXsZiT Gfc= 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 S8Qa6DFAXnxU for ; Mon, 15 Apr 2019 18:14:14 +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 D46FC3E82E for ; Mon, 15 Apr 2019 18:14:14 +1000 (AEST) Date: Mon, 15 Apr 2019 18:14:14 +1000 From: Stephen Gregoratto To: tech@mandoc.bsd.lv Subject: [PATCH mandoc] Add lang attribute to Message-ID: <20190415081414.duabfe6bua65lypb@BlackBox> Mail-Followup-To: tech@mandoc.bsd.lv X-Mailinglist: mandoc-tech Reply-To: tech@mandoc.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: NeoMutt/20180716 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" " 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 -- To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv