docs icon indicating copy to clipboard operation
docs copied to clipboard

Include reST label for default variables

Open ypid opened this issue 9 years ago • 3 comments

Currently the header of default/main.yml files looks something like this:


---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker

# debops.cryptsetup default variables [[[
# =======================================

# .. contents:: Sections
#    :local:
#
# .. include:: includes/all.rst

However one might want to refer to the default variables section from other parts of the documentation. I thought that the unique section name debops.cryptsetup default variables could be used directly from other parts using the ref role but I just tried it with v1.4.6 and it seems that it is not possible. As documented for the ref role, sections should be referred to by label. I therefore would propose to add such a label by default which could look like this:


---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker

# .. _cryptsetup__ref_default_variables:
#
# debops.cryptsetup default variables [[[
# =======================================

# .. contents:: Sections
#    :local:
#
# .. include:: includes/all.rst

This allows to refer to the section like this:

Now, after having peeked at the :ref:`cryptsetup__ref_default_variables` you can

Fortunately, that header update can easily by automated by yaml4rst and debops-optimize :)

ypid avatar Oct 23 '16 16:10 ypid

This makes the header kinda big... But I suppose that if there's no other way and the header doesn't work (any idea why?), then we could go with this solution.

drybjed avatar Oct 23 '16 17:10 drybjed

I am not sure why it does not work. I thought that I had used something like this before but when I tried it was always kind of unreliable so a label would be best.

ypid avatar Oct 23 '16 18:10 ypid

Ok, lets leave this issue open for now. I used the proposed label in https://github.com/debops/ansible-cryptsetup/pull/18 but until the need in other places arises we do not need to make this the default just yet.

ypid avatar Oct 24 '16 09:10 ypid