mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Starting to refactor module formatter script.
Rename "jpfunc" to something more explanatory
This commit is contained in:
parent
c44b876c82
commit
10009b0d3f
8 changed files with 24 additions and 24 deletions
|
@ -27,6 +27,6 @@ clean:
|
|||
.PHONEY: docs clean
|
||||
|
||||
modules: $(FORMATTER) ../hacking/templates/rst.j2
|
||||
PYTHONPATH=../lib $(FORMATTER) -t rst --template-dir=../hacking/templates --module-dir=../library -o rst/modules/ --includes-file=rst/modules/_list.rst
|
||||
PYTHONPATH=../lib $(FORMATTER) -t rst --template-dir=../hacking/templates --module-dir=../library -o rst/modules/ --includes-file=rst/modules/_categories.rst
|
||||
|
||||
|
||||
|
|
|
@ -54,8 +54,7 @@ ansible-doc as well as the man command::
|
|||
|
||||
Let's see what's available in the Ansible module library, out of the box:
|
||||
|
||||
|
||||
.. include:: modules/_list.rst
|
||||
.. include:: modules/_categories.rst
|
||||
|
||||
.. _ansible_doc:
|
||||
|
||||
|
|
|
@ -264,25 +264,25 @@ def main():
|
|||
env.globals['xline'] = rst_xline
|
||||
|
||||
if options.type == 'latex':
|
||||
env.filters['jpfunc'] = latex_ify
|
||||
env.filters['convert_symbols_to_format'] = latex_ify
|
||||
template = env.get_template('latex.j2')
|
||||
outputname = "%s.tex"
|
||||
includecmt = ""
|
||||
includefmt = "%s\n"
|
||||
if options.type == 'html':
|
||||
env.filters['jpfunc'] = html_ify
|
||||
env.filters['convert_symbols_to_format'] = html_ify
|
||||
template = env.get_template('html.j2')
|
||||
outputname = "%s.html"
|
||||
includecmt = ""
|
||||
includefmt = ""
|
||||
if options.type == 'man':
|
||||
env.filters['jpfunc'] = man_ify
|
||||
env.filters['convert_symbols_to_format'] = man_ify
|
||||
template = env.get_template('man.j2')
|
||||
outputname = "ansible.%s.3"
|
||||
includecmt = ""
|
||||
includefmt = ""
|
||||
if options.type == 'rst':
|
||||
env.filters['jpfunc'] = rst_ify
|
||||
env.filters['convert_symbols_to_format'] = rst_ify
|
||||
env.filters['html_ify'] = html_ify
|
||||
env.filters['fmt'] = rst_fmt
|
||||
env.filters['xline'] = rst_xline
|
||||
|
@ -291,16 +291,16 @@ def main():
|
|||
includecmt = ".. Generated by module_formatter\n"
|
||||
includefmt = ".. include:: modules/%s.rst\n"
|
||||
if options.type == 'json':
|
||||
env.filters['jpfunc'] = json_ify
|
||||
env.filters['convert_symbols_to_format'] = json_ify
|
||||
outputname = "%s.json"
|
||||
includecmt = ""
|
||||
includefmt = ""
|
||||
if options.type == 'js':
|
||||
env.filters['jpfunc'] = js_ify
|
||||
env.filters['convert_symbols_to_format'] = js_ify
|
||||
template = env.get_template('js.j2')
|
||||
outputname = "%s.js"
|
||||
if options.type == 'markdown':
|
||||
env.filters['jpfunc'] = markdown_ify
|
||||
env.filters['convert_symbols_to_format'] = markdown_ify
|
||||
env.filters['html_ify'] = html_ify
|
||||
template = env.get_template('markdown.j2')
|
||||
outputname = "%s.md"
|
||||
|
@ -320,6 +320,7 @@ def main():
|
|||
category_names.sort()
|
||||
|
||||
for category in category_names:
|
||||
|
||||
module_map = categories[category]
|
||||
|
||||
category = category.replace("_"," ")
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
<h2>@{module}@</h2>
|
||||
|
||||
{% for desc in description -%}
|
||||
@{ desc | jpfunc }@
|
||||
@{ desc | convert_symbols_to_format }@
|
||||
{% endfor %}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
%: -- module header
|
||||
\mods{@{module}@}{@{docuri}@}{
|
||||
{% for desc in description -%}
|
||||
@{ desc | jpfunc }@
|
||||
@{ desc | convert_symbols_to_format }@
|
||||
{% endfor -%}
|
||||
{% if version_added is defined -%}
|
||||
(\I{* new in version @{ version_added }@})
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
{# -------- option description ----------#}
|
||||
{% for desc in v.description %}
|
||||
@{ desc | jpfunc }@
|
||||
@{ desc | convert_symbols_to_format }@
|
||||
{% endfor %}
|
||||
{% if v['choices'] %}
|
||||
\B{Choices}:\,
|
||||
|
@ -51,7 +51,7 @@
|
|||
{% if notes %}
|
||||
|
||||
{% for note in notes %}
|
||||
\I{@{ note | jpfunc }@}
|
||||
\I{@{ note | convert_symbols_to_format }@}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
----------------------------- #}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
.SH DESCRIPTION
|
||||
{% for desc in description %}
|
||||
.PP
|
||||
@{ desc | jpfunc }@
|
||||
@{ desc | convert_symbols_to_format }@
|
||||
{% endfor %}
|
||||
.\" ------ OPTIONS
|
||||
.\"
|
||||
|
@ -17,7 +17,7 @@
|
|||
{% set v = options[k] %}
|
||||
|
||||
.IP @{ k }@
|
||||
{% for desc in v.description %}@{ desc | jpfunc }@{% endfor %}
|
||||
{% for desc in v.description %}@{ desc | convert_symbols_to_format }@{% endfor %}
|
||||
{% if v.get('choices') %}
|
||||
|
||||
.IR Choices :
|
||||
|
@ -37,7 +37,7 @@
|
|||
.SH NOTES
|
||||
{% for note in notes %}
|
||||
.PP
|
||||
@{ note | jpfunc }@
|
||||
@{ note | convert_symbols_to_format }@
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
.\"
|
||||
|
@ -48,7 +48,7 @@
|
|||
{% for e in examples %}
|
||||
.PP
|
||||
{% if e['description'] %}
|
||||
@{ e['description'] | jpfunc }@
|
||||
@{ e['description'] | convert_symbols_to_format }@
|
||||
{% endif %}
|
||||
|
||||
.nf
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## @{ module | jpfunc }@
|
||||
## @{ module | convert_symbols_to_format }@
|
||||
|
||||
{# ------------------------------------------
|
||||
#
|
||||
|
@ -11,7 +11,7 @@ New in version @{ version_added }@.
|
|||
{% endif %}
|
||||
|
||||
{% for desc in description -%}
|
||||
@{ desc | jpfunc }@
|
||||
@{ desc | convert_symbols_to_format }@
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
@ -42,7 +42,7 @@ New in version @{ version_added }@.
|
|||
|
||||
{% for example in examples %}
|
||||
{% if example['description'] %}
|
||||
* @{ example['description'] | jpfunc }@
|
||||
* @{ example['description'] | convert_symbols_to_format }@
|
||||
{% endif %}
|
||||
|
||||
```
|
||||
|
@ -58,7 +58,7 @@ New in version @{ version_added }@.
|
|||
{% if notes %}
|
||||
#### Notes
|
||||
{% for note in notes %}
|
||||
@{ note | jpfunc }@
|
||||
@{ note | convert_symbols_to_format }@
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% for desc in description -%}
|
||||
@{ desc | jpfunc }@
|
||||
@{ desc | convert_symbols_to_format }@
|
||||
{% endfor %}
|
||||
|
||||
{% if options -%}
|
||||
|
|
Loading…
Reference in a new issue