More anchors + new features: :hide-header:, :nested: complete, :post-process: #147
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This adds the following features:
:hide-header:
option: omits the title and description from the output.:nested: complete
option: produces a fuller listing with title, description, usage, short summary and then full nested details. Feel free to change the name to whatever you want if you choose to keep it. =):post-process: path.to.module:func_name
option: invokes the specified function in the specified module on the list of generated nodes for each command. The function should get the command used and the list of nodes that were generated.This also adds quite a few new anchors for cross-referencing - namely one for each
.. program::
directive, and for options and environment variables, an anchor is added per option name. For example, for a command groupgrp
, commandcmd
, an option that has the flags-f
and--flag
and an environment variableenv
that provides a default for it, the following anchors will be created:grp-cmd-f
grp-cmd-flag
grp-cmd-f-env
grp-cmd-flag-env
This has a caveat which I haven't dealt with, which is collisions.
Having an option with the flag names
-f
and--f
would cause the same anchor to be created twice. Similarly a command calledcmd
with the flag--some-flag
and a command calledcmd-some
with the flag--flag
would both create the anchorcmd-some-flag
. It may be a good idea to change the format so it's injective.This actually applies to existing anchors as well, e.g. group
grp
+ commandsome-cmd
+ optionopt
would yield the same option anchor as groupgrp-some
+ commandcmd
+ optionopt
, if I'm not mistaken.A decision not to support this would be valid, of course, but it's something that begs consideration at the least.
Tasks
reno
)tox
)Further details
This is the same PR as #100, fixed to work with the modern code.
I wanted to get this open already so I used what I have now - I'll look at
reno
later for the release notes.This can also use some more tests.