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

(PUP-12058) Add task to generate man (as markdown) reference #9464

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

joshcooper
Copy link
Contributor

@joshcooper joshcooper commented Aug 28, 2024

bundle exec rake references:man

This task generates an overview page that lists all of the puppet commands.

Next, we run the gen_manpages rake task that generates roff formatted man pages
in the man directory. Then we convert roff to markdown using pandoc. We
unfortunately can't generate markdown directly as legacy apps are hardcoded to
generate ronn, such as when running puppet agent --help.

The task requires the pandoc-ruby gem, so add it to the documentation bundler
group. Since the group is optional, check to see if the gem is present before
loading it, similar to how we handle ronn.

The task also requires the pandoc executable.

Only this commit needs to be reviewed:

76a4570

Depends on #9463

@joshcooper joshcooper added the maintenance Maintenance chores are excluded from changelogs label Aug 29, 2024
    bundle exec rake references:function

This task uses puppet strings to generate references/function.md.

The task requires the puppet-strings gems, so add it to the documentation
bundler group. Since the group is optional, check to see if the gem is present
before trying to load it, similar to how we handle ronn.

If there are both 3.x and 4.x functions with the same name, we ignore the 3.x
version and document the 4.x version.

This code is adapted from puppet-docs. The old code had a bug as it used to
replace /####\s/ with '###\s' resulting in a literal '\s' in the header for
some functions.

If `puppet-strings` gem is installed, then the man page generation will include
strings as a new application type. Since we don't actually ship strings
in puppet, hide it from man page generation.
    bundle exec rake references:man

This task generates an overview page that lists all of the puppet commands.

Next, we run the gen_manpages rake task that generates roff formatted man pages
in the man directory. Then we convert roff to markdown using pandoc. We
unfortunately can't generate markdown directly as legacy apps are hardcoded to
generate ronn, such as when running `puppet agent --help`.

The task requires the pandoc-ruby gem, so add it to the documentation bundler
group. Since the group is optional, check to see if the gem is present before
loading it, similar to how we handle ronn.

The task also requires the pandoc executable.
@joshcooper joshcooper force-pushed the references_man_12058 branch from b2115bb to 76a4570 Compare August 30, 2024 00:47
@joshcooper joshcooper marked this pull request as ready for review August 30, 2024 16:20
@joshcooper joshcooper requested a review from a team as a code owner August 30, 2024 16:20
# https://github.com/puppetlabs/puppet-docs/blob/1a13be3fc6981baa8a96ff832ab090abc986830e/lib/puppet_references/puppet/man.rb#L119-L128
files = Pathname.glob(File.join(__dir__, '../man/man8/*.8'))
files.each do |f|
next if File.basename(f) == "puppet.8"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure we should skip this now that it's rendered correctly

@cthorn42 cthorn42 merged commit 76a4570 into puppetlabs:main Sep 3, 2024
9 checks passed
@joshcooper joshcooper deleted the references_man_12058 branch October 10, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance chores are excluded from changelogs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants