My first attempt to do this was to just use a conditional <refsection/>
in order to not create exact references in the manpage but create the
reference in the HTML manual, as suggested by @edolstra on IRC.
Later I went on to use <olink/> to reference sections of the manual, but
in order to do that, we need to overhaul how we generate the manual and
manpages.
So, that's where we are now:
There is a new derivation called "manual-olinkdb", which is the olinkdb
for the HTML manual, which in turn creates the olinkdb.xml file and the
manual.db. The former contains the targetdoc references and the latter
the specific targetptr elements.
The reason why I included the olinkdb.xml verbatim is that first of all
the DTD is dependent on the Docbook XSL sources and the references
within the olinkdb.xml entities are relative to the current directory.
So using a store path for that would end up searching for the manual.db
directly in /nix/store/manual.db.
Unfortunately, the <olinks/> that end up in the output file are
relative, so for example if you're clicking on one of these within the
PDF, the URL is searched in the current directory.
However, the sections from the olink's text are still valid, so we could
use an alternative URL for that in the future.
The manual doesn't contain any links, so even referencing the relative
URL shouldn't do any harm.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @edolstra
It's not by any means exhaustive, but we're still going to change the
implementation, so let's just use this as a starting point.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
- Enforce that an option declaration has a "defaultText" if and only if the
type of the option derives from "package", "packageSet" or "nixpkgsConfig"
and if a "default" attribute is defined.
- Enforce that the value of the "example" attribute is wrapped with "literalExample"
if the type of the option derives from "package", "packageSet" or "nixpkgsConfig".
- Warn if a "defaultText" is defined in an option declaration if the type of
the option does not derive from "package", "packageSet" or "nixpkgsConfig".
- Warn if no "type" is defined in an option declaration.
First of all this fixes an evaluation error I introduced in ae466ba,
which wasn't triggered by any of my own tests against the change because
there are usually no NixOS options that are declared outside of the
<nixpkgs> tree. I renamed the attribute name from "fn" to "fileName"
first and later to "fullPath" but forgot one still occuring "filename".
Thanks to @vcunat for noticing this.
Another thing that he pointed out was that the "stripPrefix" function
can be factored away entirely, because it's very similar to
"removePrefix" in <nixpkgs/lib>.
Unfortunately we can't use "removePrefix" as is, because we need to
account for the final shlash.
So instead of removing it twice and/or retaining "stripPrefix", let's
append a shlash on every "prefixesToStrip" and we can use "removePrefix"
as is.
Tested with:
taalo-build nixos/release.nix -A tests.installer.simple.x86_64-linux
And:
w3m -dump "$(
nix-build nixos/release.nix -A manual.x86_64-linux
)/share/doc/nixos/options.html"
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @vcunat
Let's use a simple (unflipped) fold and break out the actual core
stripPrefix function from stripAnyPrefixes (I personally love
point-less^H^H^H^Hfree style but if I'd be anal I'd even go further and
factor away the "fn:").
Also, let's use path as a better name for "fn" (filename), because
that's what it is and also cannot be confused with "fn" meaning
"function".
We now toString all of the prefixes, so there shouldn't be any need to
implicily toString the extraSources anymore.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Regression introduced by e6cd147ae7.
This broke all of the installer tests, because they needed to rebuild
the manual within the test machine, while it only has a closure of the
already pre-built system in place.
The problem here was just that the order of the arguments got mixed up
in stripAnyPrefixes, so it was actually trying to strip the path off the
prefix, not the other way around.
So in the end no prefix was stripped at all, so we ended up having full
store paths in the manual, which in turn caused the build within the VM
to fail, because the prefixes differed.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>