1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix py3 docs build (#33345)

* Open file in binary mode to support py3 writes using bytes

* Update sort filter to use an attribute, so that py3 can sort dictionaries
This commit is contained in:
Matt Martz 2017-11-28 12:05:19 -06:00 committed by GitHub
parent 449a0f33e1
commit 84b8f674a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -62,7 +62,7 @@ def main(args):
output_name = os.path.join(output_dir, template_file.replace('.j2', '')) output_name = os.path.join(output_dir, template_file.replace('.j2', ''))
temp_vars = {'config_options': config_options} temp_vars = {'config_options': config_options}
with open(output_name, 'w') as f: with open(output_name, 'wb') as f:
f.write(template.render(temp_vars).encode('utf-8')) f.write(template.render(temp_vars).encode('utf-8'))
return 0 return 0

View file

@ -77,7 +77,7 @@ Actions
{% if actions[action]['options'] %} {% if actions[action]['options'] %}
{% for option in actions[action]['options']|sort %} {% for option in actions[action]['options']|sort(attribute='options') %}
.. option:: {% for switch in option['options'] if switch in actions[action]['option_names'] %}{{switch}} {% if option['arg'] %} <{{option['arg']}}>{% endif %}{% if not loop.last %}, {% endif %}{% endfor %} .. option:: {% for switch in option['options'] if switch in actions[action]['option_names'] %}{{switch}} {% if option['arg'] %} <{{option['arg']}}>{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}
{{ (option['desc']) }} {{ (option['desc']) }}

View file

@ -65,11 +65,11 @@ you can use the command line utility mentioned above (`ansible-config`) to brows
{% if config['version_added'] %} {% if config['version_added'] %}
:Version Added: {{config['version_added']}} :Version Added: {{config['version_added']}}
{% endif %} {% endif %}
{% for ini_map in config['ini']|sort %} {% for ini_map in config['ini']|sort(attribute='section') %}
:Ini Section: {{ini_map['section']}} :Ini Section: {{ini_map['section']}}
:Ini Key: {{ini_map['key']}} :Ini Key: {{ini_map['key']}}
{% endfor %} {% endfor %}
{% for env_var_map in config['env']|sort %} {% for env_var_map in config['env']|sort(attribute='name') %}
:Environment: :envvar:`{{env_var_map['name']}}` :Environment: :envvar:`{{env_var_map['name']}}`
{% endfor %} {% endfor %}
{% if config['deprecated'] %} {% if config['deprecated'] %}