#303: `html_context values given on the command line via -A`

should not override other values given in conf.py.
This commit is contained in:
Georg Brandl 2009-12-31 09:47:56 +01:00
parent 93cca3d4ac
commit 096725922a
5 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,9 @@
Release 0.6.4 (in development)
==============================
* #303: ``html_context`` values given on the command line via ``-A``
should not override other values given in conf.py.
* Fix a bug preventing incremental rebuilds for the ``dirhtml``
builder.

View File

@ -96,7 +96,6 @@ def main(argv):
error = sys.stderr
warnfile = None
confoverrides = {}
htmlcontext = {}
tags = []
doctreedir = path.join(outdir, '.doctrees')
for opt, val in opts:
@ -142,7 +141,7 @@ def main(argv):
val = int(val)
except ValueError:
pass
htmlcontext[key] = val
confoverrides['html_context.%s' % key] = val
elif opt == '-N':
nocolor()
elif opt == '-E':
@ -158,7 +157,6 @@ def main(argv):
warnfile = val
elif opt == '-P':
use_pdb = True
confoverrides['html_context'] = htmlcontext
if warning and warnfile:
warnfp = open(warnfile, 'w')

View File

@ -1,5 +1,8 @@
{% extends "!layout.html" %}
{% block extrahead %}
{# html_context variable from conf.py #}
<meta name="hc" content="{{ hckey }}" />
{# html_context variable from confoverrides (as if given on cmdline) #}
<meta name="hc_co" content="{{ hckey_co }}" />
{{ super() }}
{% endblock %}

View File

@ -35,7 +35,7 @@ html_theme_options = {'testopt': 'testoverride'}
html_style = 'default.css'
html_static_path = ['_static']
html_last_updated_fmt = '%b %d, %Y'
html_context = {'hckey': 'hcval'}
html_context = {'hckey': 'hcval', 'hckey_co': 'wrong_hcval_co'}
htmlhelp_basename = 'SphinxTestsdoc'

View File

@ -108,6 +108,7 @@ HTML_XPATH = {
},
'contents.html': {
".//meta[@name='hc'][@content='hcval']": '',
".//meta[@name='hc_co'][@content='hcval_co']": '',
".//meta[@name='testopt'][@content='testoverride']": '',
#".//td[@class='label']": r'\[Ref1\]', # docutils 0.5 only
".//td[@class='label']": '',
@ -179,6 +180,7 @@ def check_xpath(etree, fname, path, check):
[node.text for node in nodes]))
@gen_with_app(buildername='html', warning=html_warnfile, cleanenv=True,
confoverrides={'html_context.hckey_co': 'hcval_co'},
tags=['testtag'])
def test_html(app):
app.builder.build_all()