Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/make-options-doc: link manpages #208762

Merged
merged 3 commits into from
Jan 9, 2023

Conversation

ncfavier
Copy link
Member

@ncfavier ncfavier commented Jan 2, 2023

See discussion in #207268 (comment), see commits.

In the future we could consider generating the mapping dynamically as a .nix file, e.g. extracting the full list of systemd manpages from pkgs.systemd.man.

If this is merged, nixos-search will temporarily have double links in nixos options because it extracts them from options.json (where the links have already been inserted) and re-applies the old link-unix-man-references.lua filter in the Docbook → HTML conversion. Most browsers should handle this fine.

Move the manpage-to-URL mapping to `doc/manpage-urls.json` so that we can
reuse that file elsewhere, and generate the `link-manpages.lua` filter from
that file.

Also modify the Pandoc filter so that it doesn't wrap manpages that are
already inside a link.

Keeping a Lua filter is essential for speed: a Python filter would
increase the runtime `md-to-db.sh` from ~20s to ~30s (but Python is not
to blame; marshalling Pandoc types to and from JSON is a costly operation).
Parsing in Lua seems tedious, so I went with the Nix way.
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: systemd 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` labels Jan 2, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Jan 2, 2023
@Mic92
Copy link
Member

Mic92 commented Jan 2, 2023

Cool stuff!

Copy link
Member

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff LGTM.

Add links to manpages without a link using the mapping defined in
`doc/manpage-urls.json`, as is already done for the nixpkgs and NixOS
manuals.
@ncfavier ncfavier force-pushed the link-manpages-options-doc branch from b4226d2 to 4fb500d Compare January 3, 2023 13:03
@ncfavier ncfavier merged commit bff4bb5 into NixOS:master Jan 9, 2023
@ncfavier ncfavier deleted the link-manpages-options-doc branch January 9, 2023 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: systemd 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants