Skip to content

Commit

Permalink
nixos/man: prevent duplication of options
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jtojnar committed Apr 3, 2022
1 parent 05a6c12 commit 84d6565
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions nixos/doc/manual/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ with pkgs;
let
lib = pkgs.lib;

docbook_xsl_ns = pkgs.docbook-xsl-ns.override {
withManOptDedupPatch = true;
};

# We need to strip references to /nix/store/* from options,
# including any `extraSources` if some modules came from elsewhere,
# or else the build will fail.
Expand Down
6 changes: 5 additions & 1 deletion pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, substituteAll, fetchurl, fetchpatch, findXMLCatalogs, writeScriptBin, ruby, bash }:
{ lib, stdenv, substituteAll, fetchurl, fetchpatch, findXMLCatalogs, writeScriptBin, ruby, bash, withManOptDedupPatch ? false }:

let

Expand Down Expand Up @@ -36,6 +36,10 @@ let
src = ./catalog-legacy-uris.patch;
inherit legacySuffix suffix version;
})
] ++ lib.optionals withManOptDedupPatch [
# Fixes https://github.com/NixOS/nixpkgs/issues/166304
# https://github.com/docbook/xslt10-stylesheets/pull/241
./fix-man-options-duplication.patch
];

propagatedBuildInputs = [ findXMLCatalogs ];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/manpages/lists.xsl
+++ b/manpages/lists.xsl
@@ -110,7 +110,7 @@
<xsl:text>.RE&#10;</xsl:text>
</xsl:template>

-<xsl:template match="d:varlistentry/d:term"/>
+<xsl:template match="d:varlistentry/d:term" priority="1"/>
<xsl:template match="d:glossentry/d:glossterm"/>

<xsl:template match="d:variablelist[ancestor::d:listitem or ancestor::d:step or ancestor::d:glossdef]|

0 comments on commit 84d6565

Please sign in to comment.