docs: rename generated manual to index.xhtml

The `nixos-render-docs` tool outputs XHTML formatted content. In
order to convince browsers like `firefox` to treat the data as XHTML
the extension must be `.xhtml` and not `.html`.

Using the XHTML-formatted content as HTML is mainly an issue with
self-closing `<a />` tags.
This commit is contained in:
Viktor Kronvall 2023-12-07 21:36:39 +09:00
parent 0a71046493
commit 613dbb35db
3 changed files with 18 additions and 8 deletions

View file

@ -1,5 +1,11 @@
{ stdenv, lib, documentation-highlighter, nmd, revision, home-manager-options { stdenv
, nixos-render-docs }: , lib
, documentation-highlighter
, nmd
, revision
, home-manager-options
, nixos-render-docs
}:
let outputPath = "share/doc/home-manager"; let outputPath = "share/doc/home-manager";
in stdenv.mkDerivation { in stdenv.mkDerivation {
name = "home-manager-manual"; name = "home-manager-manual";
@ -46,7 +52,7 @@ in stdenv.mkDerivation {
--toc-depth 1 \ --toc-depth 1 \
--section-toc-depth 1 \ --section-toc-depth 1 \
manual.md \ manual.md \
out/index.html out/index.xhtml
''; '';
installPhase = '' installPhase = ''

View file

@ -1,6 +1,9 @@
{ writeShellScriptBin, makeDesktopItem, symlinkJoin }: { writeShellScriptBin, makeDesktopItem, symlinkJoin }:
{ html, pathName ? "home-manager", projectName ? pathName { html
, name ? "${pathName}-help" }: , pathName ? "home-manager"
, projectName ? pathName
, name ? "${pathName}-help"
}:
let let
helpScript = writeShellScriptBin name '' helpScript = writeShellScriptBin name ''
set -euo pipefail set -euo pipefail
@ -18,7 +21,7 @@ let
echo "$0: unable to start a web browser; please set \$BROWSER" echo "$0: unable to start a web browser; please set \$BROWSER"
exit 1 exit 1
else else
exec "$BROWSER" "${html}/share/doc/${pathName}/index.html" exec "$BROWSER" "${html}/share/doc/${pathName}/index.xhtml"
fi fi
''; '';
@ -30,7 +33,8 @@ let
exec = "${helpScript}/bin/${name}"; exec = "${helpScript}/bin/${name}";
categories = [ "System" ]; categories = [ "System" ];
}; };
in symlinkJoin { in
symlinkJoin {
inherit name; inherit name;
paths = [ helpScript desktopItem ]; paths = [ helpScript desktopItem ];
} }

View file

@ -9,7 +9,7 @@
}; };
nmt.script = '' nmt.script = ''
assertFileExists home-path/share/doc/home-manager/index.html assertFileExists home-path/share/doc/home-manager/index.xhtml
assertFileExists home-path/share/doc/home-manager/options.html assertFileExists home-path/share/doc/home-manager/options.html
assertFileExists home-path/share/doc/home-manager/options.json assertFileExists home-path/share/doc/home-manager/options.json
assertFileExists home-path/share/man/man1/home-manager.1 assertFileExists home-path/share/man/man1/home-manager.1