Hi,

On Tue Dec 23 2014 at 9:08:24 Theron Luhn <[email protected]> wrote:

> I have some documentation that needs to be generated twice:  Once for
> internal use, and another time for public release that excludes some
> information.
>
> It seems that ifconfig is the way to achieve this.  My question is in two
> parts:
>
> 1)  Even with the example code, I can't get ifconfig to work.  In
> index.rst:
>
>>
>
>> .. ifconfig:: audience == 'internal'
>>   This is private!
>
>
> In conf.py
>
> def setup(app):
>>     print 'Setup'
>>     app.add_config_value('audience', 'internal', True)
>
>
> But that renders as a scary box with the following text:
>
> System Message: ERROR/3 (<redacted>/index.rst, line 8)
>> Exception occured in ifconfig expression: NameError: name ‘audience’ is
>> not defined
>
>
> What am I doing wrong?  I see "Setup" echoed in the console when I build,
> so I know that the add_config_value() is getting triggered.
>

For now, explicit config value is also needed.
In conf.py::

   audience = 'internal'


> 2) How can I expose the config value so that I can choose the audience at
> build-time? (i.e., with an argument passed to sphinx-build.)
>

you can pass an argument from command-line as::

   make html SPHINXOPTS="-D audience=internal"


However, I think the behavior you pointed out might be unintentional.
Then I fixed it: https://github.com/sphinx-doc/sphinx/issues/1686
The fix will be released on Sphinx-1.2.4 and 3.0.

Regards,
--
Takayuki SHIMIZUKAWA
http://about.me/shimizukawa

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to