diff --git a/CHANGES b/CHANGES index 7ef7b7c10..e01f480fa 100644 --- a/CHANGES +++ b/CHANGES @@ -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. diff --git a/sphinx/cmdline.py b/sphinx/cmdline.py index 898678b72..ae8b076b2 100644 --- a/sphinx/cmdline.py +++ b/sphinx/cmdline.py @@ -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') diff --git a/tests/root/_templates/layout.html b/tests/root/_templates/layout.html index e8920025d..7f290fc1e 100644 --- a/tests/root/_templates/layout.html +++ b/tests/root/_templates/layout.html @@ -1,5 +1,8 @@ {% extends "!layout.html" %} {% block extrahead %} +{# html_context variable from conf.py #} +{# html_context variable from confoverrides (as if given on cmdline) #} + {{ super() }} {% endblock %} diff --git a/tests/root/conf.py b/tests/root/conf.py index fd82be7d7..192a18832 100644 --- a/tests/root/conf.py +++ b/tests/root/conf.py @@ -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' diff --git a/tests/test_build.py b/tests/test_build.py index ea7c3e43d..7b70c6823 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -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()