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/systemd: document what scriptArgs is for #207268

Merged
merged 2 commits into from
Dec 23, 2022

Conversation

ncfavier
Copy link
Member

Related to #154123, I guess

@ncfavier ncfavier requested review from roberth and pennae December 22, 2022 14:51
@ncfavier ncfavier requested a review from a team as a code owner December 22, 2022 14:51
@github-actions github-actions bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Dec 22, 2022
@ncfavier ncfavier requested a review from jtojnar as a code owner December 22, 2022 14:55
@github-actions github-actions bot added the 8.has: documentation This PR adds or changes documentation label Dec 22, 2022
@ncfavier
Copy link
Member Author

Would be nice to have manpage links working in options.html. I think we could

  • split out the manpage → URL mapping into a JSON file or whatever lua can parse
  • duplicate the link-unix-man-references.lua logic here

@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 Dec 22, 2022
Copy link
Contributor

@pennae pennae left a comment

Choose a reason for hiding this comment

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

looks good. as for linking in options.html, we could move the manpage reference table to a special doc attribute that generates an MD footer with link targets? that way the renderers could remain agnostic and html output can get automatic linking with no extra effort.

["tmpfiles.d(5)"] = "https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html",
["systemd.time(7)"] = "https://www.freedesktop.org/software/systemd/man/systemd.time.html",
["systemd-fstab-generator(8)"] = "https://www.freedesktop.org/software/systemd/man/systemd-fstab-generator.html",
["systemd-networkd-wait-online.service(8)"] = "https://www.freedesktop.org/software/systemd/man/systemd-networkd-wait-online.service.html",
Copy link
Member

Choose a reason for hiding this comment

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

Neat.

Copy link
Member

Choose a reason for hiding this comment

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

Actually it doesn't seem to work? When I render the manual and load the options page, I don't see any replacements. Maybe this operates on the docbook, which is structured?

    def manpage(self, page, section):
        title = f"<refentrytitle>{escape(page)}</refentrytitle>"
        vol = f"<manvolnum>{escape(section)}</manvolnum>"
        return f"<citerefentry>{title}{vol}</citerefentry>"

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see. I thought you implemented that. I should've clicked the link in that comment.

@roberth roberth self-requested a review December 22, 2022 23:03
Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

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

May need a fix

["tmpfiles.d(5)"] = "https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html",
["systemd.time(7)"] = "https://www.freedesktop.org/software/systemd/man/systemd.time.html",
["systemd-fstab-generator(8)"] = "https://www.freedesktop.org/software/systemd/man/systemd-fstab-generator.html",
["systemd-networkd-wait-online.service(8)"] = "https://www.freedesktop.org/software/systemd/man/systemd-networkd-wait-online.service.html",
Copy link
Member

Choose a reason for hiding this comment

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

Actually it doesn't seem to work? When I render the manual and load the options page, I don't see any replacements. Maybe this operates on the docbook, which is structured?

    def manpage(self, page, section):
        title = f"<refentrytitle>{escape(page)}</refentrytitle>"
        vol = f"<manvolnum>{escape(section)}</manvolnum>"
        return f"<citerefentry>{title}{vol}</citerefentry>"

@roberth roberth merged commit 84c1409 into NixOS:master Dec 23, 2022
@ncfavier ncfavier deleted the systemd-scriptArgs branch December 23, 2022 10:06
@ncfavier
Copy link
Member Author

@pennae that would require changing the manpage syntax to something like [systemd.unit(5)], unless i'm misunderstanding? But then other documents would have to append the footer everywhere, which seems burdensome, unless there's an easy way to do that with pandoc?

@pennae
Copy link
Contributor

pennae commented Dec 23, 2022

that would require changing the manpage syntax to something like [systemd.unit(5)], unless i'm misunderstanding?

not necessarily. once we actually render from markdown to html/manpages/… directly each renderer can process the manpage tag as appropriate, the default being "the traditional text representation" and the html renderer overriding that to wrap it in a link.

But then other documents would have to append the footer everywhere

was thinking about only option docs for that suggestion. if the manpage maps are json the option docs build process could load them and set them as a default map for eg documentation.nixos.options.manpageLinks, which would be formatted and appended to the markdown document before rendering. but that's all a long way out anyway :(

@ncfavier
Copy link
Member Author

ncfavier commented Dec 23, 2022

not necessarily

Well, if we want this to work with a footer (I'm assuming you're talking about https://pandoc.org/MANUAL.html#reference-links), the manpage references must have that shape, so we'd need a step that converts {manpage}`foo` to [foo] in Markdown, before we append the footer and render to HTML. But at that point it seems easier to just do the conversion from {manpage}`foo` to <a href=...>foo</a> directly, as a filter in the Markdown → HTML pipeline (as is currently done in the Markdown → DocBook pipeline).

@ncfavier
Copy link
Member Author

ncfavier commented Jan 2, 2023

Would be nice to have manpage links working in options.html.

Done in #208762

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 8.has: documentation This PR adds or changes documentation 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.

3 participants