diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2019-08-13 13:00:13 -0700 |
---|---|---|
committer | Alicia Cozine <879121+acozine@users.noreply.github.com> | 2019-08-13 15:00:13 -0500 |
commit | d9b3af523b0eb7be3bf71cd1d9ff9e22d3596f6c (patch) | |
tree | 8b7f0d8788cee5b180c16dceabd7302f302589d6 /docs/templates | |
parent | 60f84836031f51af1b0807476e13a0a6313b7082 (diff) | |
download | ansible-d9b3af523b0eb7be3bf71cd1d9ff9e22d3596f6c.tar.gz |
Galaxy meta docs table (#60171)
* Use an rst table instead of a raw html table
* Rst is easier to read so we want to use it wherever possible
* Fix the jinja2 filters which create links so that they do not include
extraneous whitespace in the URL
* Normalize description data before sending them to the templates
Diffstat (limited to 'docs/templates')
-rw-r--r-- | docs/templates/collections_galaxy_meta.rst.j2 | 70 | ||||
-rw-r--r-- | docs/templates/plugin.rst.j2 | 18 |
2 files changed, 43 insertions, 45 deletions
diff --git a/docs/templates/collections_galaxy_meta.rst.j2 b/docs/templates/collections_galaxy_meta.rst.j2 index 87c530e076..cb3568b32a 100644 --- a/docs/templates/collections_galaxy_meta.rst.j2 +++ b/docs/templates/collections_galaxy_meta.rst.j2 @@ -16,38 +16,44 @@ Structure The ``galaxy.yml`` file must contain the following keys in valid YAML: -.. raw:: html - - <table border=0 cellpadding=0 class="documentation-table"> - {# Header of the documentation -#} - <tr> - <th>Key</th> - <th width="100%">Comments</th> - </tr> - {% for entry in options %} - <tr> - {# key name with required or type label #} - <td> - <b>@{ entry.key }@</b> - <div style="font-size: small"> - <span style="color: purple">@{ entry.type | documented_type }@</span> - {% if entry.get('required', False) %} / <span style="color: red">required</span>{% endif %} - </div> - </td> - {# Comments #} - <td> - {% if entry.description is string %} - <div>@{ entry.description | replace('\n', '\n ') | html_ify }@</div> - {% else %} - {% for desc in entry.description %} - <div>@{ desc | replace('\n', '\n ') | html_ify }@</div> - {% endfor %} - {% endif %} - </td> - </tr> - {% endfor %} - </table> - <br/> + +.. rst-class:: documentation-table + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Key + - Comment + +{%- for entry in options %} + + + * - .. rst-class:: value-name + + @{ entry.key }@ |br| + + .. rst-class:: value-type + + @{ entry.type | documented_type }@ |_| + + {% if entry.get('required', False) -%} + .. rst-class:: value-separator + + / |_| + + .. rst-class:: value-required + + required + {%- endif %} + + + - {% for desc in entry.description -%} + @{ desc | trim | rst_ify }@ + + {% endfor -%} +{%- endfor %} + Examples ======== diff --git a/docs/templates/plugin.rst.j2 b/docs/templates/plugin.rst.j2 index 65acbb2e22..2edbad34d0 100644 --- a/docs/templates/plugin.rst.j2 +++ b/docs/templates/plugin.rst.j2 @@ -50,13 +50,9 @@ Synopsis -------- {% if description -%} -{% if description is string -%} -- @{ description | rst_ify }@ -{% else %} -{% for desc in description %} +{% for desc in description %} - @{ desc | rst_ify }@ -{% endfor %} -{% endif %} +{% endfor %} {% endif %} @@ -183,13 +179,9 @@ Parameters {% endif %} {# description #} <td> - {% if value.description is string %} - <div>@{ value.description | replace('\n', '\n ') | html_ify }@</div> - {% else %} - {% for desc in value.description %} - <div>@{ desc | replace('\n', '\n ') | html_ify }@</div> - {% endfor %} - {% endif %} + {% for desc in value.description %} + <div>@{ desc | replace('\n', '\n ') | html_ify }@</div> + {% endfor %} {% if 'aliases' in value and value.aliases %} <div style="font-size: small; color: darkgreen"><br/>aliases: @{ value.aliases|join(', ') }@</div> {% endif %} |