mirror of
https://github.com/NixOS/nix.git
synced 2025-12-03 07:31:00 +01:00
Merge pull request #14693 from NixOS/backport-14690-to-2.32-maintenance
[Backport 2.32-maintenance] Support mdbook 0.5
This commit is contained in:
commit
ba5bede9f5
5 changed files with 15 additions and 15 deletions
|
|
@ -24,8 +24,15 @@ def map_contents_recursively(transformer):
|
||||||
def process_command:
|
def process_command:
|
||||||
.[0] as $context |
|
.[0] as $context |
|
||||||
.[1] as $body |
|
.[1] as $body |
|
||||||
|
# mdbook 0.5.x uses 'items' instead of 'sections'
|
||||||
|
if $body.items then
|
||||||
|
$body + {
|
||||||
|
items: $body.items | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
|
||||||
|
}
|
||||||
|
else
|
||||||
$body + {
|
$body + {
|
||||||
sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
|
sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
|
||||||
};
|
}
|
||||||
|
end;
|
||||||
|
|
||||||
process_command
|
process_command
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,3 @@ renderers = ["html"]
|
||||||
command = "jq --from-file ./anchors.jq"
|
command = "jq --from-file ./anchors.jq"
|
||||||
|
|
||||||
[output.markdown]
|
[output.markdown]
|
||||||
|
|
||||||
[output.linkcheck]
|
|
||||||
# no Internet during the build (in the sandbox)
|
|
||||||
follow-web-links = false
|
|
||||||
|
|
||||||
# mdbook-linkcheck does not understand [foo]{#bar} style links, resulting in
|
|
||||||
# excessive "Potential incomplete link" warnings. No other kind of warning was
|
|
||||||
# produced at the time of writing.
|
|
||||||
warning-policy = "ignore"
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
ninja,
|
ninja,
|
||||||
lowdown-unsandboxed,
|
lowdown-unsandboxed,
|
||||||
mdbook,
|
mdbook,
|
||||||
mdbook-linkcheck,
|
|
||||||
jq,
|
jq,
|
||||||
python3,
|
python3,
|
||||||
rsync,
|
rsync,
|
||||||
|
|
@ -51,7 +50,6 @@ mkMesonDerivation (finalAttrs: {
|
||||||
ninja
|
ninja
|
||||||
(lib.getBin lowdown-unsandboxed)
|
(lib.getBin lowdown-unsandboxed)
|
||||||
mdbook
|
mdbook
|
||||||
mdbook-linkcheck
|
|
||||||
jq
|
jq
|
||||||
python3
|
python3
|
||||||
rsync
|
rsync
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,10 @@ def recursive_replace(data: dict[str, t.Any], book_root: Path, search_path: Path
|
||||||
return data | dict(
|
return data | dict(
|
||||||
sections = [recursive_replace(section, book_root, search_path) for section in sections],
|
sections = [recursive_replace(section, book_root, search_path) for section in sections],
|
||||||
)
|
)
|
||||||
|
case {'items': items}:
|
||||||
|
return data | dict(
|
||||||
|
items = [recursive_replace(item, book_root, search_path) for item in items],
|
||||||
|
)
|
||||||
case {'Chapter': chapter}:
|
case {'Chapter': chapter}:
|
||||||
path_to_chapter = Path(chapter['path'])
|
path_to_chapter = Path(chapter['path'])
|
||||||
chapter_content = chapter['content']
|
chapter_content = chapter['content']
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ scope: {
|
||||||
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ pkgs.buildPackages.bmake ];
|
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ pkgs.buildPackages.bmake ];
|
||||||
postInstall =
|
postInstall =
|
||||||
lib.replaceStrings [ "lowdown.so.1" "lowdown.1.dylib" ] [ "lowdown.so.2" "lowdown.2.dylib" ]
|
lib.replaceStrings [ "lowdown.so.1" "lowdown.1.dylib" ] [ "lowdown.so.2" "lowdown.2.dylib" ]
|
||||||
prevAttrs.postInstall;
|
(prevAttrs.postInstall or "");
|
||||||
});
|
});
|
||||||
|
|
||||||
# TODO: Remove this when https://github.com/NixOS/nixpkgs/pull/442682 is included in a stable release
|
# TODO: Remove this when https://github.com/NixOS/nixpkgs/pull/442682 is included in a stable release
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue