diff options
author | aszlig <aszlig@nix.build> | 2018-09-02 05:05:34 +0200 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2018-09-02 08:10:37 +0200 |
commit | f865d0feabfafbb30a9e0659e19a30cb0dc24481 (patch) | |
tree | 055ebffbbe00dc1b0169e16f22391d4cbd28ff57 /nixos/doc/manual/default.nix | |
parent | 953b77f07be3c1fdef3552ee98c5d26accdde4c1 (diff) | |
download | nixpkgs-f865d0feabfafbb30a9e0659e19a30cb0dc24481.tar nixpkgs-f865d0feabfafbb30a9e0659e19a30cb0dc24481.tar.gz nixpkgs-f865d0feabfafbb30a9e0659e19a30cb0dc24481.tar.bz2 nixpkgs-f865d0feabfafbb30a9e0659e19a30cb0dc24481.tar.lz nixpkgs-f865d0feabfafbb30a9e0659e19a30cb0dc24481.tar.xz nixpkgs-f865d0feabfafbb30a9e0659e19a30cb0dc24481.tar.zst nixpkgs-f865d0feabfafbb30a9e0659e19a30cb0dc24481.zip |
nixos: Split paras by \n\n in option descriptions
What annoyed me for a long time was the fact, that in order to break into a new paragraph, you need to insert </para><para> in the description attribute of an option. Now we will automatically create <para/> elements for every block that is separated by two consecutive newlines. I first tried to do this within options-to-docbook.xsl, but it turns out[1] that this isn't directly possible with XSLT 1.0, so I added another XSLT file that postprocesses the option descriptions that are now enclosed in <nixos:option-description/> by options-to-docbook.xsl. The splitting itself is a bit more involved, because we can't simply split on every \n\n because we'd also split text nodes of elements, for example: <screen><![CDATA[ one line another one ]]></screen> This would create one <para/> element for "one line" and another for "another line", which we obviously don't want because <screen/> is used to display verbatim contents of what a user is seeing on the screen. So what we do instead is splitting *only* the top-level text nodes within the outermost <para/> and leave all elements as-is. If there are more than one <para/> elements at the top-level, we simply don't process it at all, because the description then already contains </para><para>. https://www.mhonarc.org/archive/html/xsl-list/2012-09/msg00319.html Signed-off-by: aszlig <aszlig@nix.build> Cc: @edolstra, @domenkozar
Diffstat (limited to 'nixos/doc/manual/default.nix')
-rw-r--r-- | nixos/doc/manual/default.nix | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index be28c2c17af..aaa6e0da545 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -90,7 +90,9 @@ let fi ${buildPackages.libxslt.bin}/bin/xsltproc \ --stringparam revision '${revision}' \ - -o $out ${./options-to-docbook.xsl} $optionsXML + -o intermediate.xml ${./options-to-docbook.xsl} $optionsXML + ${buildPackages.libxslt.bin}/bin/xsltproc \ + -o "$out" ${./postprocess-option-descriptions.xsl} intermediate.xml ''; sources = lib.sourceFilesBySuffices ./. [".xml"]; |