Skip to content

Conversation

@swagtoy
Copy link
Contributor

@swagtoy swagtoy commented Oct 21, 2025

Exactly what it says on the box.

Probably worth considering using another manpage parser like pandoc or something one day, it looks like we sed many things here. For now let's just grow that list of replacements.

@swagtoy swagtoy changed the title gen-eclass-html.sh: Fix tildes', fix manpages not building without eclass-manpages gen-eclass-html.sh: Fix tildes' Oct 21, 2025
@ulm
Copy link
Member

ulm commented Oct 21, 2025

Can you give an example of an eclass where this is a problem?

@swagtoy
Copy link
Contributor Author

swagtoy commented Oct 21, 2025

@ulm It's in the commit message. Not an eclass afaik

Seen in ebuild(5).

https://devmanual.gentoo.org/eclass-reference/ebuild/index.html

@ulm
Copy link
Member

ulm commented Oct 21, 2025

@ulm It's in the commit message. Not an eclass afaik

Seen in ebuild(5).

https://devmanual.gentoo.org/eclass-reference/ebuild/index.html

I see. However, there are also phrases like 'KEYWORDS = [-ti][x86,ppc,sparc,mips,alpha,arm,hppa,...]' and 'ACCEPT_KEYWORDS will be set to "amd64 tiamd64"' and your fix doesn't catch these.

@swagtoy
Copy link
Contributor Author

swagtoy commented Oct 21, 2025

@ulm It's in the commit message. Not an eclass afaik

Seen in ebuild(5).

https://devmanual.gentoo.org/eclass-reference/ebuild/index.html

I see. However, there are also phrases like 'KEYWORDS = [-ti][x86,ppc,sparc,mips,alpha,arm,hppa,...]' and 'ACCEPT_KEYWORDS will be set to "amd64 tiamd64"' and your fix doesn't catch these.

Can you show one please?

@ulm
Copy link
Member

ulm commented Oct 21, 2025

Search for these strings in https://devmanual.gentoo.org/eclass-reference/ebuild/index.html?

@swagtoy
Copy link
Contributor Author

swagtoy commented Oct 21, 2025

Ah shit... yeah! You're right. ;-/

Do you want to expand the regex for now to cover any corner cases until we later switch to a better man convert?

@ulm
Copy link
Member

ulm commented Oct 21, 2025

This Portage fix broke it: gentoo/portage@3b1e073

Maybe we could use \[ti] instead of \(ti which would make replacing the output easier?
@floppym

@swagtoy
Copy link
Contributor Author

swagtoy commented Oct 21, 2025

\fI\(ti\fR also seems to work if \[ti] wouldn't, at least for the sake of making formatting work

@ulm
Copy link
Member

ulm commented Oct 21, 2025

Maybe we could switch to app-text/mandoc for conversion, AFAICS it renders \(ti correctly. I have to check if there are any showstoppers.

@ulm
Copy link
Member

ulm commented Oct 21, 2025

Maybe we could switch to app-text/mandoc for conversion, AFAICS it renders \(ti correctly. I have to check if there are any showstoppers.

Unfortunately mandoc's style sheet collides with ours (for example, <a class="permalink">). Plus, I'm not convinced that the generated HTML is an improvement. For example, the first @CODE block of elisp-common.eclass is rendered as

<p class="Pp">
  <br/>
</p>
<pre>emacs? ( &gt;=app-editors/emacs-25.3:* )
</pre>
<br/>

which is terrible from a semantic point of view.

@floppym
Copy link
Contributor

floppym commented Oct 21, 2025

This Portage fix broke it: gentoo/portage@3b1e073

Maybe we could use \[ti] instead of \(ti which would make replacing the output easier? @floppym

I'm certainly no groff expert; if the alternate syntax works I have no objection.

@ulm
Copy link
Member

ulm commented Oct 21, 2025

This Portage fix broke it: gentoo/portage@3b1e073
Maybe we could use \[ti] instead of \(ti which would make replacing the output easier? @floppym

I'm certainly no groff expert; if the alternate syntax works I have no objection.

groff_char(7) lists it:

       ~        \[ti]   u007E     tilde

@swagtoy
Copy link
Contributor Author

swagtoy commented Oct 21, 2025

Maybe we could switch to app-text/mandoc for conversion, AFAICS it renders \(ti correctly. I have to check if there are any showstoppers.

Yeah, you have my support for trying to switch to anything other than man2html. In fact i suggested we do this from the start someday instead of trying to hack around man2html

Maybe poke at pandoc?

@swagtoy
Copy link
Contributor Author

swagtoy commented Oct 21, 2025

Maybe we could switch to app-text/mandoc for conversion, AFAICS it renders \(ti correctly. I have to check if there are any showstoppers.

Unfortunately mandoc's style sheet collides with ours (for example, <a class="permalink">). Plus, I'm not convinced that the generated HTML is an improvement. For example, the first @CODE block of elisp-common.eclass is rendered as

<p class="Pp">
  <br/>
</p>
<pre>emacs? ( &gt;=app-editors/emacs-25.3:* )
</pre>
<br/>

which is terrible from a semantic point of view.

You can pass style as an option to the mandoc html renderer (or just override it.

Im not sure what the issue is with what you posted, sorry

@ulm
Copy link
Member

ulm commented Oct 21, 2025

style just specifies the URI for <link rel="stylesheet" />. Also, it is ignored when mandoc is called with -O fragment (which we would do, because we add our own header and footer).

Anyway, I think the plan is:

  • Submit a PR for Portage to replace \(ti with \[ti] in all man pages (technically, we need only ebuild.5 and make.conf.5 but better to replace it everywhere). Do you want to do that, or shall I?
  • Update the sed regex to replace any occurence of [ti] with literal ~.
  • Keep fingers cross and hope that there aren't legitimate strings [ti] anywhere else.

@swagtoy
Copy link
Contributor Author

swagtoy commented Oct 21, 2025

  • Do you want to do that, or shall I?

Ill just woke up, so happy to tackle it in a moment. Ive never messed with manpages directly so i wanna get some hands on experience.

Plus, want to make sure that \[ti] actually converts to ti

@ulm
Copy link
Member

ulm commented Oct 21, 2025

Maybe poke at pandoc?

pandoc is slow. Real time to process all eclass manpages:

  • man2html -r: 0.837 s
  • mandoc -T html -O fragment: 0.684 s
  • pandoc -f man -t html: 40.281 s

As I said above, the plan is to get rid of the conversion for the eclass manpages, so now is not a good time to change the conversion tool. Once we are left with ebuild.5 and make.conf.5 only, we can reconsider.

@swagtoy
Copy link
Contributor Author

swagtoy commented Oct 21, 2025

pandoc is slow.

Tell me something new 😅

Didnt consider the speed though, so we'll try your suggestion

@swagtoy
Copy link
Contributor Author

swagtoy commented Oct 21, 2025

@ulm It worked! Gonna send a patch to portage, apply those and then you can run it here :)

swagtoy added a commit to swagtoy/portage that referenced this pull request Oct 21, 2025
Workaround for an issue caused by 3b1e073. man2html (and possibly
others) seem to have trouble parsing \(ti, so instead switch to
\[ti]. This results in man2html generating it as [ti], which we can
then sed with ~.

See: gentoo/devmanual#378
Signed-off-by: Swagtoy <[email protected]>
Ensures that MANPATH is checked, especially so in cases where manpages reside in /usr/local.

Signed-off-by: Swagtoy <[email protected]>
@swagtoy
Copy link
Contributor Author

swagtoy commented Oct 21, 2025

Attached is another patch. Feel free to cherry pick it if you'd like

Comment on lines +134 to +135
$(man --path 5 ebuild)*
$(man --path 5 make.conf)*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. a) We know that Portage installs its manpages in /usr/share/man/, and b) --path is not portable between the different providers of virtual/man.

Copy link
Contributor Author

@swagtoy swagtoy Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Portage does, but meson does not unless you specify (i think?). Was useful for me to test my patch.

We could also just || echo

Anyway, you can just not cherry pick it.

gentoo-bot pushed a commit to gentoo/portage that referenced this pull request Oct 22, 2025
Workaround for an issue caused by 3b1e073. man2html (and possibly
others) seem to have trouble parsing \(ti, so instead switch to
\[ti]. This results in man2html generating it as [ti], which we can
then sed with ~.

See: gentoo/devmanual#378
Closes: #1480
Signed-off-by: Swagtoy <[email protected]>
Signed-off-by: Mike Gilbert <[email protected]>
@ulm
Copy link
Member

ulm commented Oct 22, 2025

Thank you, I've cherry picked the first commit. Closing.

It may take some time (e.g. we need a new portage release) before the changes will be visible on the site.

@ulm ulm closed this Oct 22, 2025
@swagtoy
Copy link
Contributor Author

swagtoy commented Oct 22, 2025

Awesome. Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants