Wei-Wei Guo napisaĆ(a):
Hi Wei-Wei,
>>> After having a try, I found that sphinx/config.py still needed to be
>>> modified. Can I
>>> use something like 'add.config_values' in setup(app)? (I tried, but
>>> failed.)
>> Show us your code. It should work if done properly.
> Here is the code of setup(app):
>
> def setup(app):
> app.add_builder(ConTeXtBuilder)
> app.add_config_value('context_documents', [], False)
'context_documents' variable is now available in ConTextBuilder
through 'self.config.context_documents'
An example using a handler for 'builder-inited' core event:
--------------------------------------------------------
from sphinx.builders import Builder
class ConTeXtBuilder(Builder):
"""'myvar' is available through: self.config.myvar"""
def __init__(self):
pass
def init(app):
print app.config.myvar
def setup(app):
app.add_config_value('myvar', 'myval', False)
app.connect('builder-inited', init)
app.add_builder(ConTeXtBuilder)
-------------------------------------------------------
Now, when I add it to conf.py as an extension and run
'make html'
it prints this line among standard output:
$ make html|grep myval
myval
$
I can also overwrite the value in conf.py. I add this to conf.py:
myvar = 'otherval'
and now do:
$ make html|grep "otherval"
otherval
$
HTH,
--
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---