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

Used, fixed and extended the module.rst.j2 template #253

Merged
merged 6 commits into from
Nov 22, 2020

Conversation

andy-maier
Copy link
Member

The commits are intentionally kept separate:

  • Commit to introduce the module.rst.j2 template unchanged from z/OS MF collection
  • 3 commits that fix and extend the template. these are intended to be rolled back into the master source for the template file.
  • Commit that builds the docs using the updated template.

@andy-maier andy-maier self-assigned this Nov 21, 2020
@andy-maier andy-maier added this to the 1.0.0 milestone Nov 21, 2020
@coveralls
Copy link

coveralls commented Nov 21, 2020

Coverage Status

Coverage remained the same at 20.457% when pulling 0c31af7 on andy/sphinx-template into 5c1b6b7 on master.

@andy-maier andy-maier force-pushed the andy/sphinx-template branch 2 times, most recently from 7cf6462 to 4596ede Compare November 22, 2020 17:59
Details:

* For consistency with other IBM Z ansible collections, added
  the module.rst.j2 template file from the z/OS MF Ansible collections
  project (https://github.com/IBM/ibm_zos_zosmf), and changed the
  invocation of ansible-doc-extractor to use it.

  Note that the file as copied fails on a default value that is
  a list, and the fixes an extensions are in subsequent commits.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
…tions

Details:

* The module.rst.j2 template attempted to concatenate an option default
  value directly with a string in line 60:

  {% set default = ", default: " + spec.default if spec.default else "" %}

  If the default value is a list object, the resulting AnsibleSequence
  object cannot be directly concatenated with the literal string.

  This change fixes that by adding a 'string' filter to the default.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details:

* So far, the module.rst.j2 template always sorted options by name.
  The default template used by the ansible-doc-extractor maintains
  the source order of options. For projects that want to present
  the options in a certain logical order, it is useful to be able
  to easily switch those behaviors.

  This change makes the ordering easily controllable by adding
  a variable 'sorted' to the 'option_generation' macro that
  when true produces order by name, and when false keeps the
  source order.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details:

* So far, the module.rst.j2 template always produced an item
  'returned:' for each option, even when the option does not specify
  a 'returned' property. In that case, there was no value shown.

  This change omits the 'returned:' item in the output when an
  option does not specify the 'returned' property.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Details:

* The module.rst.j2 template uses the 'tojson' filter added in Jinja2 2.9.
  Increased the minimum version of Jinja2 from 2.8 to 2.9.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants