-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/man: prevent duplication of options #166509
Conversation
Thanks for tackling this! I can confirm this resolves the reported issue. Although not quite out of the woods yet. I'm not familiar with docbook really ("what other impact might moving this have?"), so instead of trying to sort that went and diff(oscope)d the manuals (man/html/epub) before and after. And unfortunately this also changes the HTML and epub manuals. The HTML one seems visually fine (although options are now blue instead of the red-ish 'code' styling), but comparing with old manual, there are lots of differences like this: 334c334
< <a class="xref" href="options.html#opt-boot.loader.grub.device"><code class="option">boot.loader.grub.device</code></a> to
---
> <a class="xref" href="options.html#opt-boot.loader.grub.device"><code class="option"><a class="option" href="options.html#opt-boot.loader.grub.device">boot.loader.grub.device</a></code></a> to
341c341
< <a class="xref" href="options.html#opt-boot.loader.systemd-boot.enable"><code class="option">boot.loader.systemd-boot.enable</code></a>
---
> <a class="xref" href="options.html#opt-boot.loader.systemd-boot.enable"><code class="option"><a class="option" href="options.html#opt-boot.loader.systemd-boot.enable">boot.loader.systemd-boot.enable</a></code></a> So it seems we're now generating a nested The epub manual diffoscope appears to be the same sort of change, I haven't looked more closely. For now, just reporting what I found. No answers/solutions yet 😇 . |
Wow I wasn't sure how this was possible (some impurity from somewhere?) until realized: I was comparing the With this detail realized, I agree Before:
After:
Which changes the manual visually and makes each option a link to itself (same page, but with anchor for that option). This actually seems like reasonable or even desirable behavior for me-- it helps easily create links to options if you're browsing and want to share. Anyway, mostly want to make sure we like the new output! 👍 |
Oh, that makes sense, the |
I tried to move the id attribute to a separate link: --- a/nixos/lib/make-options-doc/options-to-docbook.xsl
+++ b/nixos/lib/make-options-doc/options-to-docbook.xsl
@@ -22,11 +22,13 @@
<xsl:for-each select="attrs">
<xsl:variable name="id" select="concat('opt-', str:replace(str:replace(str:replace(str:replace(attr[@name = 'name']/string/@value, '*', '_'), '<', '_'), '>', '_'), ':', '_'))" />
<varlistentry>
- <term xlink:href="#{$id}">
- <xsl:attribute name="xml:id"><xsl:value-of select="$id"/></xsl:attribute>
- <option>
- <xsl:value-of select="attr[@name = 'name']/string/@value" />
- </option>
+ <term>
+ <link xlink:href="#{$id}">
+ <xsl:attribute name="xml:id"><xsl:value-of select="$id"/></xsl:attribute>
+ <option>
+ <xsl:value-of select="attr[@name = 'name']/string/@value" />
+ </option>
+ </link>
</term>
<listitem> But that does not work either:
Forgot that |
libxslt 1.1.35 fixed conflict resolution for templates to match the specification. This uncovered a bug in docbook-xsl (docbook/xslt10-stylesheets#240), which causes option names to be duplicated into the option descriptions. Let’s resolve the conflict by patching the stylesheets. Fixes: NixOS#166304
I applied a patch to the stylesheets that should resolve the issue. Limiting scope to the manual to avoid stdenv rebuild. |
Thanks!! |
Should fix duplicate option names into the manpages generated with nmd. See: - NixOS/nixpkgs#166304 - NixOS/nixpkgs#166509 - nix-community/home-manager#2820
Removes the need to apply `fix-man-options-duplication.patch`. See, e.g., NixOS/nixpkgs#166509.
Description of changes
libxslt 1.1.35 fixed conflict resolution for templates to match the specification. This uncovered a bug in docbook-xsl (docbook/xslt10-stylesheets#240), which causes option names to be duplicated into the option descriptions.
Until it is resolved upstream, let’s fix the conflict by ambiguity by moving the link to a different element.
Fixes: #166304
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes