From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6888 invoked from network); 9 Aug 2022 12:36:25 -0000 Received: from bsd.lv (HELO mandoc.bsd.lv) (66.111.2.12) by inbox.vuxu.org with ESMTPUTF8; 9 Aug 2022 12:36:25 -0000 Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id 49cf74a8 for ; Tue, 9 Aug 2022 07:36:23 -0500 (EST) Received: from scc-mailout-kit-01.scc.kit.edu (scc-mailout-kit-01.scc.kit.edu [129.13.231.81]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id e3db4718 for ; Tue, 9 Aug 2022 07:36:21 -0500 (EST) Received: from hekate.asta.kit.edu ([2a00:1398:5:f401::77]) by scc-mailout-kit-01.scc.kit.edu with esmtps (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (envelope-from ) id 1oLOT6-002OBt-Mo; Tue, 09 Aug 2022 14:36:21 +0200 Received: from login-1.asta.kit.edu ([2a00:1398:5:f400::72]) by hekate.asta.kit.edu with esmtp (Exim 4.94.2) (envelope-from ) id 1oLOT5-007Dva-Hf; Tue, 09 Aug 2022 14:36:19 +0200 Received: from schwarze by login-1.asta.kit.edu with local (Exim 4.92) (envelope-from ) id 1oLOT5-0007bU-GQ; Tue, 09 Aug 2022 14:36:19 +0200 Date: Tue, 9 Aug 2022 14:36:19 +0200 From: Ingo Schwarze To: Eldred Habert Cc: tech@mandoc.bsd.lv Subject: Re: Inconsistent HTML anchor names Message-ID: References: X-Mailinglist: mandoc-tech Reply-To: tech@mandoc.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Salut Eldred, Eldred Habert wrote on Mon, Aug 08, 2022 at 02:24:35PM +0000: > We at RGBDS[https://rgbds.gbdev.io] use Mandoc for our manual pages, > as well as the online documentation. Nice. :-) Thanks for telling me. I took this as a reason to finally create the sub-page https://mandoc.bsd.lv/css.html and list RGBDS there. I'm sure neither Debian nor Arch will run on the Game Boy, so RGBDS now has a unique position on that page. ;-) It's also nice to see you using the mdoc(7) language for your manual pages. You might also consider using "mandoc -T lint" on your manual pages, it produces a lot of output. Even if you don't care about STYLE messages, at least running "mandoc -T lint -W warning" would make sense, for example: $ mandoc -T lint -W warning rgbgfx.1 mandoc: rgbgfx.1:168:2: WARNING: skipping empty macro: Sy mandoc: rgbgfx.1:573:2: WARNING: sections out of conventional order: Sh SEE ALSO mandoc: rgbgfx.1:575:2: WARNING: unusual Xr order: rgbasm(1) after rgbds(7) mandoc: rgbgfx.1:577:2: WARNING: unusual Xr order: rgbfix after rgblink All four of these are legitimate warnings, and getting rid of them would improve the manual page. > I happened to notice that the "At-files" anchor under > "REVERSE MODE"[https://rgbds.gbdev.io/docs/master/rgbgfx.1#REVERSE_MODE] > does not work, as it points to #At_files instead of #At-files. Heh, what a subtle bug. The hyphen in the sentence .Do Sx At-files Dc may help with this . "At-files" may help with this. is breakable (i.e. if the word "At-files" begins shortly before the end of an output line, an output line break may be inserted between "At-" and "files"). To distinguish breakable from non-breakable hyphens, the roff(7) pre-parser (roff.c) replaces breakable hyphens with a dedicated C0 contol character, ASCII_HYPH = U+001E. Of course, RFC 3986 does not allow that in URI fragments, so it got wrongly turned into an underscore. The commit appended below (made both to OpenBSD and to the portable mandoc at bsd.lv) fixes the bug. Please check that it works for you, too, and tell me in case you notice any regressions. > While we do some post-processing > [https://github.com/gbdev/rgbds-www/blob/master/maintainer/man_to_html.sh], I'm not convinced i understood all of that, but here are some remarks anyway: * The idea to link from flags in the SYNOPSIS to the descriptions of the flags is interesting. I might consider doing that in mandoc. :) Not today, though. * Using ".Fl Fl foo" for GNU-style long options is discouraged because it is semantically wrong. Using ".Fl \-foo" is better. https://mandoc.bsd.lv/mdoc/style/options.html * You may no longer need to shift headings; mandoc-current already translates .Sh to

and .Ss

. That change was motivated by accessibility considerations very similar to your comment "level 1 is reserved for the page's title". > none of it should affect this, as far as I'm aware, therefore I think > it is a Mandoc bug. Sorry if I'm wrong on that. You are correct. Thank you for reporting the bug! Yours, Ingo Log Message: ----------- prevent breakable hyphens in segment identifiers from being turned into underscores; bug reported by Habert Modified Files: -------------- mandoc: html.c Revision Data ------------- Index: html.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/html.c,v retrieving revision 1.278 retrieving revision 1.279 diff -Lhtml.c -Lhtml.c -u -p -r1.278 -r1.279 --- html.c +++ html.c @@ -403,10 +403,13 @@ html_make_id(const struct roff_node *n, * In addition, reserve '~' for ordinal suffixes. */ - for (cp = buf; *cp != '\0'; cp++) - if (isalnum((unsigned char)*cp) == 0 && + for (cp = buf; *cp != '\0'; cp++) { + if (*cp == ASCII_HYPH) + *cp = '-'; + else if (isalnum((unsigned char)*cp) == 0 && strchr("!$&'()*+,-./:;=?@_", *cp) == NULL) *cp = '_'; + } if (unique == 0) return buf; -- To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv