Skip to content

Commit a4f5f36

Browse files
Merge pull request #14692 from NixOS/backport-14690-to-2.31-maintenance
[Backport 2.31-maintenance] Support mdbook 0.5
2 parents 315010c + 24096ec commit a4f5f36

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

doc/manual/anchors.jq

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ def map_contents_recursively(transformer):
2424
def process_command:
2525
.[0] as $context |
2626
.[1] as $body |
27-
$body + {
28-
sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
29-
};
27+
# mdbook 0.5.x uses 'items' instead of 'sections'
28+
if $body.items then
29+
$body + {
30+
items: $body.items | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
31+
}
32+
else
33+
$body + {
34+
sections: $body.sections | map(map_contents_recursively(if $context.renderer == "html" then transform_anchors_html else transform_anchors_strip end)),
35+
}
36+
end;
3037

3138
process_command

doc/manual/book.toml.in

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,3 @@ renderers = ["html"]
2323
command = "jq --from-file ./anchors.jq"
2424

2525
[output.markdown]
26-
27-
[output.linkcheck]
28-
# no Internet during the build (in the sandbox)
29-
follow-web-links = false
30-
31-
# mdbook-linkcheck does not understand [foo]{#bar} style links, resulting in
32-
# excessive "Potential incomplete link" warnings. No other kind of warning was
33-
# produced at the time of writing.
34-
warning-policy = "ignore"

doc/manual/package.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
ninja,
77
lowdown-unsandboxed,
88
mdbook,
9-
mdbook-linkcheck,
109
jq,
1110
python3,
1211
rsync,
@@ -51,7 +50,6 @@ mkMesonDerivation (finalAttrs: {
5150
ninja
5251
(lib.getBin lowdown-unsandboxed)
5352
mdbook
54-
mdbook-linkcheck
5553
jq
5654
python3
5755
rsync

doc/manual/substitute.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def recursive_replace(data: dict[str, t.Any], book_root: Path, search_path: Path
4141
return data | dict(
4242
sections = [recursive_replace(section, book_root, search_path) for section in sections],
4343
)
44+
case {'items': items}:
45+
return data | dict(
46+
items = [recursive_replace(item, book_root, search_path) for item in items],
47+
)
4448
case {'Chapter': chapter}:
4549
path_to_chapter = Path(chapter['path'])
4650
chapter_content = chapter['content']

packaging/dependencies.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ scope: {
5454
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [ pkgs.buildPackages.bmake ];
5555
postInstall =
5656
lib.replaceStrings [ "lowdown.so.1" "lowdown.1.dylib" ] [ "lowdown.so.2" "lowdown.2.dylib" ]
57-
prevAttrs.postInstall;
57+
(prevAttrs.postInstall or "");
5858
});
5959

6060
# TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.

0 commit comments

Comments
 (0)