mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
module_formatter in hacking/
This commit is contained in:
7
hacking/templates/html.j2
Normal file
7
hacking/templates/html.j2
Normal file
@@ -0,0 +1,7 @@
|
||||
<!-- @{ module | upper }@ -->
|
||||
|
||||
<h2>@{module}@</h2>
|
||||
|
||||
{% for desc in description -%}
|
||||
@{ desc | jpfunc }@
|
||||
{% endfor %}
|
||||
70
hacking/templates/latex.j2
Normal file
70
hacking/templates/latex.j2
Normal file
@@ -0,0 +1,70 @@
|
||||
%--- @{ module | upper }@ ---- from @{ filename }@ ---
|
||||
|
||||
%: -- module header
|
||||
\mods{@{module}@}{@{docuri}@}{
|
||||
{% for desc in description -%}
|
||||
@{ desc | jpfunc }@
|
||||
{% endfor -%}
|
||||
{% if version_added is defined -%}
|
||||
(\I{* new in version @{ version_added }@})
|
||||
{% endif -%}
|
||||
}
|
||||
|
||||
%: -- module options
|
||||
|
||||
{% if options is defined -%}
|
||||
\begin{xlist}{abcdefghijklmno}
|
||||
{% for o in options -%}
|
||||
{% for opt, v in o.iteritems() -%}
|
||||
|
||||
{% if v['required'] -%}
|
||||
\item[\man\,\C{@{ opt }@}]
|
||||
{% else -%}
|
||||
\item[\opt\,\C{@{ opt }@}]
|
||||
{% endif -%}
|
||||
|
||||
{# -------- option description ----------#}
|
||||
{% for desc in v.description -%}
|
||||
@{ desc | jpfunc }@
|
||||
{% endfor %}
|
||||
{% if v['choices'] -%}
|
||||
\B{Choices}:\,
|
||||
{% for choice in v['choices'] -%}\C{@{ choice }@}{% if not loop.last %},{% else %}.{% endif %}
|
||||
{% endfor -%}
|
||||
{% endif -%}
|
||||
{% if v['default'] -%}
|
||||
(default \C{@{ v['default'] }@})
|
||||
{% endif -%}
|
||||
{% if v['version_added'] is defined -%}
|
||||
(\I{* version @{ v['version_added'] }@})
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{% endfor -%}
|
||||
\end{xlist}
|
||||
{% endif -%}
|
||||
|
||||
{% if notes is defined -%}
|
||||
{# -------- notes ----------#}
|
||||
{% for note in notes -%}
|
||||
\I{@{ note | jpfunc }@}
|
||||
{% endfor %}
|
||||
{% endif -%}
|
||||
|
||||
{#-------------------------------------------
|
||||
|
||||
{% if examples is defined -%}
|
||||
{% for e in examples -%}
|
||||
\begin{extymeta}
|
||||
@{ e['code'] }@
|
||||
\end{extymeta}
|
||||
{% endfor -%}
|
||||
{% endif -%}
|
||||
----------------------------------- #}
|
||||
|
||||
{% if extradata is defined -%}
|
||||
%--- BEGIN-EXTRADATA
|
||||
\begin{extymeta}
|
||||
@{ extradata -}@
|
||||
\end{extymeta}
|
||||
%----- END-EXTRADATA
|
||||
{% endif -%}
|
||||
64
hacking/templates/man.j2
Normal file
64
hacking/templates/man.j2
Normal file
@@ -0,0 +1,64 @@
|
||||
.TH ANSIBLE.@{ module | upper }@ 5 "@{ now_date }@" "@{ ansible_version }@" "ANSIBLE MODULES"
|
||||
." generated from @{ filename }@
|
||||
.SH NAME
|
||||
@{ module }@ \- @{ short_description }@
|
||||
." ------ DESCRIPTION
|
||||
.SH DESCRIPTION
|
||||
{% for desc in description -%}
|
||||
.PP
|
||||
@{ desc | jpfunc }@
|
||||
{% endfor %}
|
||||
." ------ OPTIONS
|
||||
."
|
||||
."
|
||||
{% if options is defined -%}
|
||||
.SH OPTIONS
|
||||
{% for o in options -%}{% for opt, v in o.iteritems() -%}
|
||||
.IP @{opt}@
|
||||
{% for desc in v.description -%}
|
||||
@{ desc | jpfunc }@
|
||||
{% endfor -%}
|
||||
{% if v['required'] %}(required){% endif -%}
|
||||
{% if v['choices'] -%}
|
||||
." .SS Choices
|
||||
.IR Choices :
|
||||
{% for choice in v['choices'] -%}@{ choice }@{% if not loop.last %},{% else %}.{% endif -%}
|
||||
{% endfor -%}
|
||||
{% endif %}
|
||||
{#---------------------------------------------- #}
|
||||
{% if v['version_added'] is defined -%}
|
||||
(Added in Ansible version @{ v['version_added'] }@.)
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
{% endfor -%}
|
||||
{% endif %}
|
||||
."
|
||||
."
|
||||
." ------ NOTES
|
||||
{% if notes is defined -%}
|
||||
.SH NOTES
|
||||
{% for note in notes -%}
|
||||
.PP
|
||||
@{ note | jpfunc }@
|
||||
{% endfor -%}
|
||||
{% endif -%}
|
||||
."
|
||||
."
|
||||
." ------ EXAMPLES
|
||||
{% if examples is defined -%}
|
||||
.SH EXAMPLES
|
||||
{% for e in examples -%}
|
||||
.PP
|
||||
.nf
|
||||
@{ e['code'] }@
|
||||
.fi
|
||||
{% endfor -%}
|
||||
{% endif -%}
|
||||
." ------- AUTHOR
|
||||
{% if author is defined -%}
|
||||
.SH AUTHOR
|
||||
@{ author }@
|
||||
{% endif -%}
|
||||
.SH SEE ALSO
|
||||
.IR ansible (1),
|
||||
.I http://ansible.github.com/modules.html#@{docuri}@
|
||||
33
hacking/templates/rst.j2
Normal file
33
hacking/templates/rst.j2
Normal file
@@ -0,0 +1,33 @@
|
||||
.. _@{ module }@:
|
||||
|
||||
@{ module }@
|
||||
````````
|
||||
|
||||
{# ------------------------------------------
|
||||
#
|
||||
# Please note: this looks like a core dump
|
||||
# but it isn't one.
|
||||
#
|
||||
--------------------------------------------#}
|
||||
|
||||
{% if version_added is defined -%}
|
||||
.. versionadded:: @{ version_added }@
|
||||
{% endif %}
|
||||
|
||||
{% for desc in description -%}
|
||||
@{ desc | jpfunc }@
|
||||
{% endfor %}
|
||||
|
||||
{% if options is defined -%}
|
||||
@{ xline(10, "=") }@ @{xline(10)}@ @{xline(10)}@ @{xline(60)}@
|
||||
@{ "parameter" | fmt('%-10s')}@ @{ "required" | fmt('%-10s')}@ @{ "default" | fmt('%-10s')}@ @{ "comments" | fmt('%-60s')}@
|
||||
@{ xline(10, "=") }@ @{xline(10)}@ @{xline(10)}@ @{xline(60)}@ {% for o in options -%}
|
||||
{% for opt, v in o.iteritems() %}
|
||||
{% if v['required'] %}{% set required = 'yes' %}{% else %}{% set required = ' ' %}{% endif -%}
|
||||
@{opt |fmt("%-10s") }@ @{ required|fmt('%-10s') }@ @{ v['default']|fmt('%-10s') }@ {% for desc in v.description -%}@{ desc | jpfunc }@{% endfor -%}
|
||||
{% endfor -%}
|
||||
{% endfor %}
|
||||
@{ xline(10, "=") }@ @{xline(10)}@ @{xline(10)}@ @{xline(60)}@
|
||||
{% endif %}
|
||||
|
||||
FIXME: examples!
|
||||
Reference in New Issue
Block a user