dhall: Use --base-import-url flag for documentation (#128588)
This updates `pkgs.dhallPackages.buildDhallGitHubPackage` to use the newly added `--base-import-url` `dhall-docs` flag. This flag is used by the generated documentation so that paths copied to the clipboard represent complete URLs that can be imported instead of only the relative path to the import.
This commit is contained in:
@@ -43,7 +43,7 @@ lib.makePackageOverridable
|
||||
"rev"
|
||||
]);
|
||||
|
||||
prefix = lib.optionalString (directory != "") "${directory}/";
|
||||
prefix = lib.optionalString (directory != "") "/${directory}";
|
||||
|
||||
in
|
||||
buildDhallPackage
|
||||
@@ -51,9 +51,12 @@ lib.makePackageOverridable
|
||||
|
||||
name = versionedName;
|
||||
|
||||
code = "${src}/${prefix}${file}";
|
||||
code = "${src}${prefix}/${file}";
|
||||
}
|
||||
// lib.optionalAttrs document
|
||||
{ documentationRoot = "${src}/${prefix}"; }
|
||||
{ documentationRoot = "${src}/${prefix}";
|
||||
|
||||
baseImportUrl = "https://raw.githubusercontent.com/${owner}/${repo}/${rev}${prefix}";
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -37,6 +37,12 @@
|
||||
#
|
||||
# If `null`, then no documentation is generated.
|
||||
, documentationRoot ? null
|
||||
|
||||
# Base URL prepended to paths copied to the clipboard
|
||||
#
|
||||
# This is used in conjunction with `documentationRoot`, and is unused if
|
||||
# `documentationRoot` is `null`.
|
||||
, baseImportUrl ? null
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -85,6 +91,12 @@ in
|
||||
${lib.optionalString (documentationRoot != null) ''
|
||||
mkdir -p $out/${dataDhall}
|
||||
|
||||
XDG_DATA_HOME=$out/${data} ${dhall-docs}/bin/dhall-docs --input '${documentationRoot}' --package-name '${name}' --output-link $out/docs
|
||||
XDG_DATA_HOME=$out/${data} ${dhall-docs}/bin/dhall-docs --output-link $out/docs ${lib.cli.toGNUCommandLineShell { } {
|
||||
base-import-url = baseImportUrl;
|
||||
|
||||
input = documentationRoot;
|
||||
|
||||
package-name = name;
|
||||
}}
|
||||
''}
|
||||
''
|
||||
|
||||
Reference in New Issue
Block a user