xonsh/docs/envvars.jinja2
Noorhteen Raja NJ bceaafae4d
Add groups to env vars (#4026)
* feat: add grouped-settings for env variables

fixes #4014

style: fix mypy errors

chore: update testing requirements versions

fix: update xonsh.tools import error

* chore: add news item

* fix: update Var.with_default handling env defaults

* fix: set env var.doc_default=DefaultNotGiven

there is a custom handler for it

* chore: update travis

speedup docs generation

* chore: add command to serve docs during development

* docs: add jinja2 helpers/renderers extension for sphinx

* docs: update envvars document

* docs: fix docs failing

* Update xonsh/environ.py

commit suggestion

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>

* Update xonsh/environ.py

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>

* Update xonsh/environ.py

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>

* Update xonsh/environ.py

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>

* Update xonsh/environ.py

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>

* Update xonsh/environ.py

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>

* refactor: update rst-extension

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2021-01-04 12:21:44 -05:00

50 lines
1.3 KiB
Django/Jinja

{% set ns = namespace(root_index='') %}
{% macro list_table(vars) %}
{% for vardoc in rst.iterator_for_divmod(vars.values()) %}
{% if loop.index0 % 3 == 0 %}* {% else %} {% endif %}- {% if vardoc %}{{ rst.to_ref_string(vardoc.info.title) }}{% endif %}
{% endfor %}
{% endmacro %}
{#titular table#}
{% for cls, envgrp in env_vars.children.items() recursive %}
{% if not loop.depth0 %}
{% set ns.root_index=loop.index %}
{% endif %}
.. list-table:: {{ rst.to_ref_string(cls.get_group_title()) }}
:header-rows: 0
{{ list_table(envgrp.vars)|indent(4) }}
{% if envgrp.children %}{{ loop(envgrp.children.items()) }}{% endif %}
{% endfor %}
{#variables doc#}
{% for cls, envgrp in env_vars.children.items() recursive %}
.. _{{ rst.to_valid_id(cls.get_group_title()) }}:
{{ cls.get_group_title() }}
{{ rst.underline_title(cls.get_group_title(), loop.depth0) }}
{{ cls.get_group_description() }}
{% for key, vardoc in envgrp.vars.items() %}
.. _{{ rst.to_valid_id(vardoc.info.title) }}:
{{ vardoc.info.title }}
{{ rst.underline_title(vardoc.info.title) }}
{{ vardoc.info.docstr }}
**configurable:** {{ vardoc.info.configurable }}
**default:** {{ vardoc.info.default }}
**store_as_str:** {{ vardoc.info.store_as_str }}
-------
{% endfor %}
{% if envgrp.children %}{{ loop(envgrp.children.items()) }}{% endif %}
{% endfor %}