[OpenStack-docs] Conditionals and RST/Sphinx

Anne Gentle annegentle at justwriteclick.com
Wed Feb 18 04:39:53 UTC 2015


Hi all!
Late night for me, but as promised I've been researching how to do
conditional output and at what level for the End User Guide and Admin User
Guide migration to RST/Sphinx.

There are currently phrase-level conditionals for audience in the source.
[1] On further investigation in the Sphinx toolchain, I don't think that's
possible with the way Sphinx makes HTML output.

There are also section-level conditional indicators for audience. [2] I
believe this is possible to do with a solution I've coded up at [3]. It
contains a new Sphinx extension for scoping and also requires use of a meta
indicator for a section file in RST.

I investigated the two common Sphinx ways to do conditionals: the ifconfig
extension and the only directive. The ifconfig extension won't work as
expected for toctree directives. [4] The only directive is meant for
notes/admonitions or paragraph chunks, not for entire files.

So, please take a look at the review and see if you think we can use it for
our use cases. I believe we can extend it further for more meta tags to get
more conditional output.
Thanks,
Anne

1.
https://github.com/openstack/openstack-manuals/blob/ea4f68a88cb56deb216949d781ef905d72c1ab31/doc/common/ch_using_openstack_overview.xml#L7
2.
https://github.com/openstack/openstack-manuals/blob/1326c18819c4a717f88f0347355753c15eb08c92/doc/common/section_cli_openrc.xml#L29
3. https://review.openstack.org/156877
4. https://github.com/sphinx-doc/sphinx/issues/1717

-- 
Anne Gentle
annegentle at justwriteclick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-docs/attachments/20150217/72db41f8/attachment-0001.html>


More information about the OpenStack-docs mailing list