From 9302231342ad5db3de3ed09890bb7ec746a92519 Mon Sep 17 00:00:00 2001 From: Ian Lee Date: Sat, 7 Feb 2015 00:00:08 -0800 Subject: [PATCH 1/5] Added insertion of todo_include_todos config option. Set to True when we enable 'ext_todo' during the quickstart process. --- sphinx/apidoc.py | 1 + sphinx/quickstart.py | 6 ++++++ tests/test_quickstart.py | 8 ++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py index a2862fcc5..807b03fca 100644 --- a/sphinx/apidoc.py +++ b/sphinx/apidoc.py @@ -363,6 +363,7 @@ Note: By default this script will not overwrite already created files.""") epub = True, ext_autodoc = True, ext_viewcode = True, + ext_todo = True, makefile = True, batchfile = True, mastertocmaxdepth = opts.maxdepth, diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index 3d3d3eb9f..662a9f280 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -53,6 +53,7 @@ DEFAULT_VALUE = { 'epub': False, 'ext_autodoc': False, 'ext_doctest': False, + 'ext_todo': False, 'makefile': True, 'batchfile': True, } @@ -167,6 +168,9 @@ pygments_style = 'sphinx' # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = %(ext_todo)s + # -- Options for HTML output ---------------------------------------------- @@ -1284,6 +1288,8 @@ def generate(d, overwrite=True, silent=False): d['extensions'] = '\n' + indent + extensions + ',\n' else: d['extensions'] = extensions + print(d['extensions']) + d['ext_todo'] = text_type(d['ext_todo']) d['copyright'] = time.strftime('%Y') + ', ' + d['author'] d['author_texescaped'] = text_type(d['author']).\ translate(texescape.tex_escape_map) diff --git a/tests/test_quickstart.py b/tests/test_quickstart.py index 8cc9e4e54..013700417 100644 --- a/tests/test_quickstart.py +++ b/tests/test_quickstart.py @@ -150,6 +150,7 @@ def test_quickstart_defaults(tempdir): assert ns['copyright'] == '%s, Georg Brandl' % time.strftime('%Y') assert ns['version'] == '0.1' assert ns['release'] == '0.1' + assert ns['todo_include_todos'] is False assert ns['html_static_path'] == ['_static'] assert ns['latex_documents'] == [ ('index', 'SphinxTest.tex', 'Sphinx Test Documentation', @@ -178,7 +179,7 @@ def test_quickstart_all_answers(tempdir): 'autodoc': 'y', 'doctest': 'yes', 'intersphinx': 'no', - 'todo': 'n', + 'todo': 'y', 'coverage': 'no', 'pngmath': 'N', 'mathjax': 'no', @@ -198,7 +199,9 @@ def test_quickstart_all_answers(tempdir): assert conffile.isfile() ns = {} execfile_(conffile, ns) - assert ns['extensions'] == ['sphinx.ext.autodoc', 'sphinx.ext.doctest'] + assert ns['extensions'] == [ + 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo' + ] assert ns['templates_path'] == ['.templates'] assert ns['source_suffix'] == '.txt' assert ns['master_doc'] == 'contents' @@ -207,6 +210,7 @@ def test_quickstart_all_answers(tempdir): time.strftime('%Y') assert ns['version'] == '2.0' assert ns['release'] == '2.0.1' + assert ns['todo_include_todos'] is True assert ns['html_static_path'] == ['.static'] assert ns['latex_documents'] == [ ('contents', 'STASI.tex', u'STASI™ Documentation', From 926762ebc53589e844d62072efb7af9498bf2801 Mon Sep 17 00:00:00 2001 From: Ian Lee Date: Sat, 7 Feb 2015 00:02:33 -0800 Subject: [PATCH 2/5] Add nose and mock to test reqs, needed by "make test". --- test-reqs.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test-reqs.txt b/test-reqs.txt index 454fc2235..05d860cda 100644 --- a/test-reqs.txt +++ b/test-reqs.txt @@ -1,3 +1,5 @@ +nose +mock six>=1.4 Jinja2>=2.3 Pygments>=2.0 From d2bee41b7cbe4b78b3d17fde70ea2ce8be65303b Mon Sep 17 00:00:00 2001 From: Ian Lee Date: Sat, 7 Feb 2015 00:02:52 -0800 Subject: [PATCH 3/5] Add name to AUTHORS file --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 44050d48a..eba3edc4b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -31,6 +31,7 @@ Other contributors, listed alphabetically, are: * Blaise Laflamme -- pyramid theme * Thomas Lamb -- linkcheck builder * Łukasz Langa -- partial support for autodoc +* Ian Lee -- quickstart improvements * Robert Lehmann -- gettext builder (GSOC project) * Dan MacKinlay -- metadata fixes * Martin Mahner -- nature theme From fbc87d364484ed7b9b856409d4acf1ef813aee35 Mon Sep 17 00:00:00 2001 From: Ian Lee Date: Sat, 7 Feb 2015 00:05:15 -0800 Subject: [PATCH 4/5] Update changelog --- CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index 1e00780b4..41aa6fba5 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,8 @@ Features added * The ``language`` config value is now available in the HTML templates. * The ``env-updated`` event can now return a value, which is interpreted as an iterable of additional docnames that need to be rewritten. +* Add ``todo_include_todos`` config option to quickstart conf file, handled as + described in documentation. Bugs fixed ---------- From 9f7aa45994f0d4a0974227423dd6b8c759d6c409 Mon Sep 17 00:00:00 2001 From: Ian Lee Date: Sat, 7 Feb 2015 00:31:17 -0800 Subject: [PATCH 5/5] Remove unnecessary lines per PR feedback --- sphinx/quickstart.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index 662a9f280..4b1bc2f7f 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -1288,8 +1288,6 @@ def generate(d, overwrite=True, silent=False): d['extensions'] = '\n' + indent + extensions + ',\n' else: d['extensions'] = extensions - print(d['extensions']) - d['ext_todo'] = text_type(d['ext_todo']) d['copyright'] = time.strftime('%Y') + ', ' + d['author'] d['author_texescaped'] = text_type(d['author']).\ translate(texescape.tex_escape_map)