Merge from master

This commit is contained in:
Jakob Lykke Andersen
2015-02-08 23:48:31 +01:00
8 changed files with 37 additions and 21 deletions

View File

@@ -1,4 +1,5 @@
language: python
sudo: false
python:
- "2.6"
- "2.7"

View File

@@ -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

View File

@@ -15,6 +15,8 @@ Features added
as an iterable of additional docnames that need to be rewritten.
* #772: Support for scoped and unscoped enums in C++. Enumerators in unscoped
enums are injected into the parent scope in addition to the enum scope.
* Add ``todo_include_todos`` config option to quickstart conf file, handled as
described in documentation.
Bugs fixed
----------

View File

@@ -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,

View File

@@ -24,6 +24,7 @@ import re
import sys
import pydoc
import optparse
import codecs
from jinja2 import FileSystemLoader, TemplateNotFound
from jinja2.sandbox import SandboxedEnvironment
@@ -137,9 +138,7 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
new_files.append(fn)
f = open(fn, 'w')
try:
with open(fn, 'w') as f:
doc = get_documenter(obj, parent)
if template_name is not None:
@@ -201,8 +200,6 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
rendered = template.render(**ns)
f.write(rendered)
finally:
f.close()
# descend recursively to new files
if new_files:
@@ -221,12 +218,14 @@ def find_autosummary_in_files(filenames):
"""
documented = []
for filename in filenames:
f = open(filename, 'r')
lines = f.read().splitlines()
documented.extend(find_autosummary_in_lines(lines, filename=filename))
f.close()
with codecs.open(filename, 'r', encoding='utf-8',
errors='ignore') as f:
lines = f.read().splitlines()
documented.extend(find_autosummary_in_lines(lines,
filename=filename))
return documented
def find_autosummary_in_docstring(name, module=None, filename=None):
"""Find out what items are documented in the given object's docstring.
@@ -245,6 +244,7 @@ def find_autosummary_in_docstring(name, module=None, filename=None):
"statement and it might call sys.exit()." % name)
return []
def find_autosummary_in_lines(lines, module=None, filename=None):
"""Find out what items appear in autosummary:: directives in the
given lines.

View File

@@ -53,6 +53,7 @@ DEFAULT_VALUE = {
'epub': False,
'ext_autodoc': False,
'ext_doctest': False,
'ext_todo': False,
'makefile': True,
'batchfile': True,
}
@@ -116,6 +117,7 @@ master_doc = '%(master_str)s'
# General information about the project.
project = u'%(project_str)s'
copyright = u'%(copyright_str)s'
author = u'%(author_str)s'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -167,6 +169,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 ----------------------------------------------
@@ -286,7 +291,7 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('%(master_str)s', '%(project_fn)s.tex', u'%(project_doc_texescaped_str)s',
(master_doc, '%(project_fn)s.tex', u'%(project_doc_texescaped_str)s',
u'%(author_texescaped_str)s', 'manual'),
]
@@ -316,8 +321,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('%(master_str)s', '%(project_manpage)s', u'%(project_doc_str)s',
[u'%(author_str)s'], 1)
(master_doc, '%(project_manpage)s', u'%(project_doc_str)s',
[author], 1)
]
# If true, show URL addresses after external links.
@@ -330,8 +335,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('%(master_str)s', '%(project_fn)s', u'%(project_doc_str)s',
u'%(author_str)s', '%(project_fn)s', 'One line description of project.',
(master_doc, '%(project_fn)s', u'%(project_doc_str)s',
author, '%(project_fn)s', 'One line description of project.',
'Miscellaneous'),
]
@@ -353,13 +358,13 @@ EPUB_CONFIG = u'''
# -- Options for Epub output ----------------------------------------------
# Bibliographic Dublin Core info.
epub_title = u'%(project_str)s'
epub_author = u'%(author_str)s'
epub_publisher = u'%(author_str)s'
epub_copyright = u'%(copyright_str)s'
epub_title = project
epub_author = author
epub_publisher = author
epub_copyright = copyright
# The basename for the epub file. It defaults to the project name.
#epub_basename = u'%(project_str)s'
#epub_basename = project
# The HTML theme for the epub output. Since the default themes are not optimized
# for small screen space, using the same theme for HTML and epub output is

View File

@@ -1,3 +1,5 @@
nose
mock
six>=1.4
Jinja2>=2.3
Pygments>=2.0

View File

@@ -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',