* Inconsistent HTML anchor names @ 2022-08-08 14:24 Eldred Habert 2022-08-09 12:36 ` Ingo Schwarze 0 siblings, 1 reply; 3+ messages in thread From: Eldred Habert @ 2022-08-08 14:24 UTC (permalink / raw) To: tech [-- Attachment #1: Type: text/plain, Size: 579 bytes --] Hello, We at RGBDS[https://rgbds.gbdev.io] use Mandoc for our manual pages, as well as the online documentation. 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. While we do some post-processing[https://github.com/gbdev/rgbds-www/blob/master/maintainer/man_to_html.sh], 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. Thank you for your continued efforts! ~ Eldred [-- Attachment #2: Type: text/html, Size: 1904 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Inconsistent HTML anchor names 2022-08-08 14:24 Inconsistent HTML anchor names Eldred Habert @ 2022-08-09 12:36 ` Ingo Schwarze 2022-09-20 19:52 ` Eldred HABERT 0 siblings, 1 reply; 3+ messages in thread From: Ingo Schwarze @ 2022-08-09 12:36 UTC (permalink / raw) To: Eldred Habert; +Cc: tech 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 <h2> and .Ss <h3>. 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 <Eldred dot fr> 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Inconsistent HTML anchor names 2022-08-09 12:36 ` Ingo Schwarze @ 2022-09-20 19:52 ` Eldred HABERT 0 siblings, 0 replies; 3+ messages in thread From: Eldred HABERT @ 2022-09-20 19:52 UTC (permalink / raw) To: tech [-- Attachment #1: Type: text/plain, Size: 3257 bytes --] On 8/9/22 2:36 PM, Ingo Schwarze wrote: > Salut Eldred, Well, I hope you will forgive my lack of response for a month and a half. I've been busy elsewhere, and this email got buried under many others. Apologies. > It's also nice to see you using the mdoc(7) language for your manual > pages. Blame bentley for that. I think he originally wrote the man pages, and I think they provide good defaults that are more convenient than directly messing with groff formatting, so I use it for all my (admittedly few) man 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: It does make sense, and I do run this from time to time. The warnings haven't been fixed mainly because they seemed harmless/false positives, but this seems like a good occasion to discuss them, if you want. > mandoc: rgbgfx.1:168:2: WARNING: skipping empty macro: Sy I'm not really sure what this is pointing out. > 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 My understanding is that the Xr order is supposed to be by section, then alphabetical, right? The rationale for our ordering is that it is the order in which we expect the users to read the manual pages; this made more sense back when we served the renders online directly; now that we have a separate navbar, it might be okay to reorder the footers. > 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. I haven't found any thus far, but my testing isn't thorough. We haven't really set up any kind of anchor checker, sadly. >> 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: > > * 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 Again, blame bentley. I didn't realise this page existed until I went through two fairly small links lost in the middle of others. Good resources, despite not being very easy to find. I'll fix this. (I'm also noticing the '\-', and I /really/ hope we didn't mess up and use a breakable hyphen in places we shouldn't have...) > * You may no longer need to shift headings; mandoc-current already > translates .Sh to <h2> and .Ss <h3>. That change was motivated > by accessibility considerations very similar to your comment > "level 1 is reserved for the page's title". Great! That said, I'm reluctant to use a non-release version of Mandoc in our documentation generator, as I don't have much time to dedicate to maintaining it; so I think I'll patiently wait for the next release. Late but yours nonetheless, ~ Eldred [-- Attachment #2: Type: text/html, Size: 4933 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-20 19:53 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-08-08 14:24 Inconsistent HTML anchor names Eldred Habert 2022-08-09 12:36 ` Ingo Schwarze 2022-09-20 19:52 ` Eldred HABERT
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).