Merge pull request #1164 from jpmens/modformatter

module_formatter now also uses Jinja2 trim_blocks
pull/1165/merge
Michael DeHaan 12 years ago
commit 349af83c91

@ -221,6 +221,7 @@ def main():
env = Environment(loader=FileSystemLoader(args.template_dir), env = Environment(loader=FileSystemLoader(args.template_dir),
variable_start_string="@{", variable_start_string="@{",
variable_end_string="}@", variable_end_string="}@",
trim_blocks=True,
) )
env.globals['xline'] = rst_xline env.globals['xline'] = rst_xline

@ -4,56 +4,58 @@
@{ module }@ \- @{ short_description }@ @{ module }@ \- @{ short_description }@
." ------ DESCRIPTION ." ------ DESCRIPTION
.SH DESCRIPTION .SH DESCRIPTION
{% for desc in description -%} {% for desc in description %}
.PP .PP
@{ desc | jpfunc }@ @{ desc | jpfunc }@
{% endfor %} {% endfor %}
." ------ OPTIONS ." ------ OPTIONS
." ."
." ."
{% if options -%} {% if options %}
.SH OPTIONS .SH OPTIONS
{% for (k,v) in options.iteritems() %} {% for (k,v) in options.iteritems() %}
.IP @{ k }@ .IP @{ k }@
{% for desc in v.description -%}@{ desc | jpfunc }@{% endfor -%} {% for desc in v.description %}@{ desc | jpfunc }@{% endfor %}
{% if v.get('choices') %} {% if v.get('choices') %}
.IR Choices : .IR Choices :
{% for choice in v.get('choices',[]) -%}@{ choice }@{% if not loop.last %},{%else%}.{%endif-%}{% endfor -%}{% endif %} {% for choice in v.get('choices',[]) %}@{ choice }@{% if not loop.last %},{%else%}.{%endif%}{% endfor %}{% endif %}
{% if v.get('required') %}(required){% endif -%} {% if v.get('required') %}(required){% endif %}
{% if v.get('default') %} (default: @{ v.get('default') }@){% endif -%} {% if v.get('default') %} (default: @{ v.get('default') }@){% endif %}
{#---------------------------------------------- #} {#---------------------------------------------- #}
{% if v.get('version_added') -%} {% if v.get('version_added') %}
(Added in Ansible version @{ v.get('version_added') }@.) (Added in Ansible version @{ v.get('version_added') }@.)
{% endif -%} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
." ."
." ."
." ------ NOTES ." ------ NOTES
{% if notes -%} {% if notes %}
.SH NOTES .SH NOTES
{% for note in notes -%} {% for note in notes %}
.PP .PP
@{ note | jpfunc }@ @{ note | jpfunc }@
{% endfor -%} {% endfor %}
{% endif -%} {% endif %}
." ."
." ."
." ------ EXAMPLES ." ------ EXAMPLES
{% if examples is defined -%} {% if examples is defined %}
.SH EXAMPLES .SH EXAMPLES
{% for e in examples -%} {% for e in examples %}
.PP .PP
.nf .nf
@{ e['code'] }@ @{ e['code'] }@
.fi .fi
{% endfor -%} {% endfor %}
{% endif -%} {% endif %}
." ------- AUTHOR ." ------- AUTHOR
{% if author is defined -%} {% if author is defined %}
.SH AUTHOR .SH AUTHOR
@{ author }@ @{ author }@
{% endif -%} {% endif %}
.SH SEE ALSO .SH SEE ALSO
.IR ansible (1), .IR ansible (1),
.I http://ansible.github.com/modules.html#@{docuri}@ .I http://ansible.github.com/modules.html#@{docuri}@

@ -23,7 +23,7 @@
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
module: facter module: facter
short_description: Runs the discovery program facter on the remote system short_description: Runs the discovery program I(facter) on the remote system
description: description:
- Runs the discovery program I(facter) on the remote system, returning JSON - Runs the discovery program I(facter) on the remote system, returning JSON
data that can be useful for inventory purposes. data that can be useful for inventory purposes.

Loading…
Cancel
Save