Docs: fix rendering clan source code url
This commit is contained in:
22
lib/docs.nix
22
lib/docs.nix
@@ -1,21 +1,25 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
rec {
|
||||
prefix = "https://git.clan.lol/clan/clan-core/src/branch/main/";
|
||||
# Strip store paths from option declarations to make docs more stable
|
||||
# This prevents documentation from rebuilding when store paths change
|
||||
# but the actual content remains the same
|
||||
stripStorePathsFromDeclarations = opt:
|
||||
opt // {
|
||||
declarations = map (decl:
|
||||
stripStorePathsFromDeclarations =
|
||||
opt:
|
||||
opt
|
||||
// {
|
||||
declarations = map (
|
||||
decl:
|
||||
if lib.isString decl && lib.hasPrefix "/nix/store/" decl then
|
||||
let
|
||||
parts = lib.splitString "/" decl;
|
||||
in
|
||||
if builtins.length parts > 4 then
|
||||
"/" + lib.concatStringsSep "/" (lib.drop 4 parts)
|
||||
else
|
||||
decl
|
||||
if builtins.length parts > 4 then
|
||||
(prefix + "/" + lib.concatStringsSep "/" (lib.drop 4 parts))
|
||||
else
|
||||
decl
|
||||
else
|
||||
decl
|
||||
) opt.declarations;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user