Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use :envvar: to refer to variables. (was: Updated to Sphinx 1.3 to allow using :any: to reference vars) #140

Merged
merged 2 commits into from
May 23, 2016

Conversation

ypid
Copy link
Member

@ypid ypid commented May 23, 2016

Refer to the Sphinx documentation about :envvar:.
:envvar: can be used in Sphinx to reference variables. Example:

# .. envvar:: ferm__enabled
#
# Some text.
ferm__enabled: True


# .. envvar:: ferm__flush
#
# Some text.
# You might also need to change :envvar:`ferm__enabled`.
# Some text.
ferm__flush: '{{ ferm__enabled | bool }}'

When using this, we might need to adjust sections names. Example:

.. _ferm_input_list:

ferm_input_list
---------------

could be changed to:

.. _ferm_detailed_input_list:

ferm_input_list
---------------

to avoid duplicates. The good thing is that Sphinx as of 1.3.4 warns when referencing a label for which multiple targets exist.

1.3.4 has been chosen because it is the current version in jessie-backports.

Edited: Changed :any: to :envvar:. See comment

ypid added 2 commits May 23, 2016 14:08
Refer to the [Sphinx documentation about `:any:`](http://www.sphinx-doc.org/en/stable/markup/inline.html#role-any)
`:any:` can be used in Sphinx to reference variables. Example:

```YAML
ferm__enabled: True

ferm__flush: '{{ ferm__enabled | bool }}'
```

When using this, we might need to adjust sections names. Example:

```reStructuredText
.. _ferm_input_list:

ferm_input_list
---------------
```

could be changed to:

```reStructuredText
.. _ferm_detailed_input_list:

ferm_input_list
---------------
```

1.3.4 has been chosen because it is the current version in [jessie-backports](https://packages.debian.org/jessie-backports/python-sphinx).
@drybjed drybjed merged commit 7bd61cb into debops:master May 23, 2016
@ypid
Copy link
Member Author

ypid commented May 28, 2016

Actually. I think we should add a proper namespace for sections.

.. _ferm__section_detailed_input_list:

ferm_input_list
---------------

@drybjed
Copy link
Member

drybjed commented May 28, 2016

So far there is only one "target" for each default variable with detailed documentation, so for example with:

Go to :ref:`ferm__rules`

.. _ferm__rules:

ferm__rules
-----------

Everything should be covered. Do you think that there could be more targets?

@ypid
Copy link
Member Author

ypid commented May 28, 2016

Do you think that there could be more targets?

Actually, I do. The reason of this PR was to enable the use of the any role with which you can refer to the envvar definition in the defaults file with

:any:`ferm__rules`

Check the http://docs.debops.org/en/latest/ansible/roles/ansible-apt_install/docs/changelog.html#v0-1-1 in which I made use of this feature.

ypid added a commit to ypid/ansible-preseed that referenced this pull request May 28, 2016
@drybjed
Copy link
Member

drybjed commented May 28, 2016

OK, I presume that works. However, some of the variable names are long already an writing a nice paragraph that looks OK in the file is sometimes hard, I wouldn't want to add section_detailed to each one, maybe something shorter? Let's see...

Go to :ref:`ferm__ref_dependent_rules`

.. ferm__ref_dependent_rules:

ferm__dependent_rules
---------------------

What do you think?

@ypid
Copy link
Member Author

ypid commented May 28, 2016

@drybjed Nice 👍 Lets go with that.

ypid added a commit to ypid/ansible-preseed that referenced this pull request May 28, 2016
ypid added a commit to ypid/ansible-preseed that referenced this pull request May 28, 2016
@drybjed
Copy link
Member

drybjed commented May 28, 2016

OK.

ypid added a commit to ypid/ansible-preseed that referenced this pull request May 28, 2016
ypid added a commit to ypid/ansible-ferm that referenced this pull request May 28, 2016
@ypid ypid changed the title Updated to Sphinx 1.3 to allow using :any: to reference vars. Updated to Sphinx 1.3 to allow using :envvar: to reference vars. Jun 19, 2016
@ypid
Copy link
Member Author

ypid commented Jun 19, 2016

@ganto has read the Sphinx documentation more carefully then I did and uses :envvar: in https://github.com/debops/ansible-slapd/pull/26.

I think :envvar: is the better way to refer to variables. I updated my comment at the top.

@ypid ypid changed the title Updated to Sphinx 1.3 to allow using :envvar: to reference vars. Use :envvar: to refer to variables. (was: Updated to Sphinx 1.3 to allow using :any: to reference vars) Jun 19, 2016
ypid added a commit to ypid/ansible-opsi that referenced this pull request Jun 19, 2016
ypid added a commit to debops-contrib/ansible-x2go_server that referenced this pull request Jun 19, 2016
ypid added a commit to ypid/ansible-packages that referenced this pull request Jun 19, 2016
ypid added a commit to debops-contrib/ansible-fuse that referenced this pull request Jun 19, 2016
ypid added a commit to ypid/ansible-owncloud that referenced this pull request Jun 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants