summaryrefslogtreecommitdiff
path: root/hacking
diff options
context:
space:
mode:
authorJan-Piet Mens <jpmens@gmail.com>2012-10-24 19:42:52 +0200
committerJan-Piet Mens <jpmens@gmail.com>2012-10-24 19:42:52 +0200
commitafa467e975617c9c343b2a993b794c5c47ff98d9 (patch)
tree8160ffd49503a67981ae4a744377e1010be9c53c /hacking
parentf1f44843c318b836450e243d7a65ad5f0afb7896 (diff)
downloadansible-afa467e975617c9c343b2a993b794c5c47ff98d9.tar.gz
DOCUMENTATION: LaTeX template is back
ongoing work for the Booklet
Diffstat (limited to 'hacking')
-rwxr-xr-xhacking/module_formatter.py4
-rw-r--r--hacking/templates/latex.j276
2 files changed, 78 insertions, 2 deletions
diff --git a/hacking/module_formatter.py b/hacking/module_formatter.py
index 8653d994a8..7e8894830c 100755
--- a/hacking/module_formatter.py
+++ b/hacking/module_formatter.py
@@ -259,8 +259,8 @@ def main():
env.filters['jpfunc'] = latex_ify
template = env.get_template('latex.j2')
outputname = "%s.tex"
- includecmt = "% generated code\n"
- includefmt = "\\input %s\n"
+ includecmt = ""
+ includefmt = "%s\n"
if options.type == 'html':
env.filters['jpfunc'] = html_ify
template = env.get_template('html.j2')
diff --git a/hacking/templates/latex.j2 b/hacking/templates/latex.j2
new file mode 100644
index 0000000000..d02ffa8677
--- /dev/null
+++ b/hacking/templates/latex.j2
@@ -0,0 +1,76 @@
+{# -------------------------------------------------------------------
+ template for module_formatter.py for LaTeX output (Ansible Booklet)
+ by Jan-Piet Mens.
+ Note: nodes & code examples are omitted on purpose.
+ -------------------------------------------------------------------- #}
+%--- @{ 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 %}
+\begin{xlist}{abcdefghijklmno}
+ {% for (opt,v) in options.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 %}
+\end{xlist}
+{% endif %}
+
+{# ---------------------------------------
+{% if 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 %}