mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge with default
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -91,6 +91,8 @@ Features added
|
||||
Thanks to Takeshi Komiya.
|
||||
* #1344: add :confval:`gettext_enables` to enable extracting 'index' to gettext
|
||||
catalog output / applying translation catalog to generated documentation.
|
||||
* PR#299: add various options to sphinx-quickstart. Quiet mode option
|
||||
``--quiet`` will skips wizard mode. Thanks to WAKAYAMA shirou.
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
@@ -1,5 +1,138 @@
|
||||
.. default-role:: any
|
||||
|
||||
.. _invocation:
|
||||
|
||||
Invocation of sphinx-quickstart
|
||||
===============================
|
||||
|
||||
The :program:`sphinx-quickstart` script generates a Sphinx documentation set.
|
||||
It is called like this::
|
||||
|
||||
$ sphinx-quickstart [options] [projectdir]
|
||||
|
||||
where *projectdir* is the Sphinx documentation set directory in which you want
|
||||
to place. If you omit *projectdir*, files are generated into current directory
|
||||
by default.
|
||||
|
||||
The :program:`sphinx-quickstart` script has several options:
|
||||
|
||||
.. program:: sphinx-quickstart
|
||||
|
||||
.. option:: -q, --quiet
|
||||
|
||||
Quiet mode that will skips interactive wizard to specify options.
|
||||
This option requires `-p`, `-a` and `-v` options.
|
||||
|
||||
.. option:: -h, --help, --version
|
||||
|
||||
Display usage summary or Sphinx version.
|
||||
|
||||
|
||||
Structure options
|
||||
-----------------
|
||||
|
||||
.. option:: --sep
|
||||
|
||||
If specified, separate source and build directories.
|
||||
|
||||
.. option:: --dot=DOT
|
||||
|
||||
Inside the root directory, two more directories will be created;
|
||||
"_templates" for custom HTML templates and "_static" for custom stylesheets
|
||||
and other static files. You can enter another prefix (such as ".") to
|
||||
replace the underscore.
|
||||
|
||||
Project basic options
|
||||
---------------------
|
||||
|
||||
.. option:: -p PROJECT, --project=PROJECT
|
||||
|
||||
Project name will be set. (see :confval:`project`).
|
||||
|
||||
.. option:: -a AUTHOR, --author=AUTHOR
|
||||
|
||||
Author names. (see :confval:`copyright`).
|
||||
|
||||
.. option:: -v VERSION
|
||||
|
||||
Version of project. (see :confval:`version`).
|
||||
|
||||
.. option:: -r RELEASE, --release=RELEASE
|
||||
|
||||
Release of project. (see :confval:`release`).
|
||||
|
||||
.. option:: -l LANGUAGE, --language=LANGUAGE
|
||||
|
||||
Document language. (see :confval:`language`).
|
||||
|
||||
.. option:: --suffix=SUFFIX
|
||||
|
||||
Source file suffix. (see :confval:`source_suffix`).
|
||||
|
||||
.. option:: --master=MASTER
|
||||
|
||||
Master document name. (see :confval:`master_doc`).
|
||||
|
||||
.. option:: --epub
|
||||
|
||||
Use epub.
|
||||
|
||||
Extension options
|
||||
-----------------
|
||||
|
||||
.. option:: --ext-autodoc
|
||||
|
||||
Enable `sphinx.ext.autodoc` extension.
|
||||
|
||||
.. option:: --ext-doctest
|
||||
|
||||
Enable `sphinx.ext.doctest` extension.
|
||||
|
||||
.. option:: --ext-intersphinx
|
||||
|
||||
Enable `sphinx.ext.intersphinx` extension.
|
||||
|
||||
.. option:: --ext-todo
|
||||
|
||||
Enable `sphinx.ext.todo` extension.
|
||||
|
||||
.. option:: --ext-coverage
|
||||
|
||||
Enable `sphinx.ext.coverage` extension.
|
||||
|
||||
.. option:: --ext-pngmath
|
||||
|
||||
Enable `sphinx.ext.pngmath` extension.
|
||||
|
||||
.. option:: --ext-mathjax
|
||||
|
||||
Enable `sphinx.ext.mathjax` extension.
|
||||
|
||||
.. option:: --ext-ifconfig
|
||||
|
||||
Enable `sphinx.ext.ifconfig` extension.
|
||||
|
||||
.. option:: --ext-viewcode
|
||||
|
||||
Enable `sphinx.ext.viewcode` extension.
|
||||
|
||||
|
||||
Makefile and Batchfile creation options
|
||||
---------------------------------------
|
||||
|
||||
.. option:: --makefile, --no-makefile
|
||||
|
||||
Create (or not create) makefile.
|
||||
|
||||
.. option:: --batchfile, --no-batchfile
|
||||
|
||||
Create (or not create) batchfile
|
||||
|
||||
|
||||
.. versionadded:: 1.3
|
||||
Add various options for sphinx-quickstart invocation.
|
||||
|
||||
|
||||
Invocation of sphinx-build
|
||||
==========================
|
||||
|
||||
|
@@ -72,9 +72,9 @@ class Config(object):
|
||||
nitpick_ignore = ([], 'html'),
|
||||
numfig = (False, 'env'),
|
||||
numfig_secnum_depth = (1, 'env'),
|
||||
numfig_prefix = ({'figure': l_('Fig.'),
|
||||
'table': l_('Table '),
|
||||
'code-block': l_('List ')},
|
||||
numfig_prefix = ({'figure': l_('Fig. %s'),
|
||||
'table': l_('Table %s'),
|
||||
'code-block': l_('Listing %s')},
|
||||
'env'),
|
||||
|
||||
# HTML options
|
||||
|
@@ -63,11 +63,14 @@ def dedent_lines(lines, dedent):
|
||||
|
||||
|
||||
def container_wrapper(directive, literal_node, caption):
|
||||
caption_node = nodes.caption()
|
||||
directive.state.nested_parse(ViewList([caption], source=''),
|
||||
directive.content_offset, caption_node)
|
||||
|
||||
container_node = nodes.container('', literal_block=True)
|
||||
parsed = nodes.Element()
|
||||
directive.state.nested_parse(ViewList([caption], source=''),
|
||||
directive.content_offset, parsed)
|
||||
caption_node = nodes.caption(parsed[0].rawsource, '',
|
||||
*parsed[0].children)
|
||||
caption_node.source = parsed[0].source
|
||||
caption_node.line = parsed[0].line
|
||||
container_node += caption_node
|
||||
container_node += literal_node
|
||||
return container_node
|
||||
|
@@ -638,8 +638,8 @@ class StandardDomain(Domain):
|
||||
title = contnode.astext()
|
||||
if labelid == title:
|
||||
prefix = env.config.numfig_prefix.get(figtype, '')
|
||||
title = "%s#" % prefix
|
||||
newtitle = prefix + '.'.join(map(str, fignumber))
|
||||
title = prefix.replace('%s', '#')
|
||||
newtitle = prefix % '.'.join(map(str, fignumber))
|
||||
else:
|
||||
newtitle = title.replace('#', '.'.join(map(str, fignumber)))
|
||||
|
||||
|
@@ -76,7 +76,7 @@ default_settings = {
|
||||
# or changed to properly invalidate pickle files.
|
||||
#
|
||||
# NOTE: increase base version by 2 to have distinct numbers for Py2 and 3
|
||||
ENV_VERSION = 44 + (sys.version_info[0] - 2)
|
||||
ENV_VERSION = 46 + (sys.version_info[0] - 2)
|
||||
|
||||
|
||||
dummy_reporter = Reporter('', 4, 4)
|
||||
@@ -310,6 +310,7 @@ class BuildEnvironment:
|
||||
self.longtitles.pop(docname, None)
|
||||
self.tocs.pop(docname, None)
|
||||
self.toc_secnumbers.pop(docname, None)
|
||||
self.toc_fignumbers.pop(docname, None)
|
||||
self.toc_num_entries.pop(docname, None)
|
||||
self.toctree_includes.pop(docname, None)
|
||||
self.indexentries.pop(docname, None)
|
||||
@@ -350,7 +351,7 @@ class BuildEnvironment:
|
||||
self.longtitles[docname] = other.longtitles[docname]
|
||||
self.tocs[docname] = other.tocs[docname]
|
||||
self.toc_num_entries[docname] = other.toc_num_entries[docname]
|
||||
# toc_secnumbers is not assigned during read
|
||||
# toc_secnumbers and toc_fignumbers are not assigned during read
|
||||
if docname in other.toctree_includes:
|
||||
self.toctree_includes[docname] = other.toctree_includes[docname]
|
||||
self.indexentries[docname] = other.indexentries[docname]
|
||||
@@ -1701,7 +1702,7 @@ class BuildEnvironment:
|
||||
rewrite_needed = []
|
||||
|
||||
assigned = set()
|
||||
old_fignumbers = getattr(self, 'toc_fignumbers', {}) # compatible with old envs
|
||||
old_fignumbers = self.toc_fignumbers
|
||||
self.toc_fignumbers = {}
|
||||
fignum_counter = {}
|
||||
|
||||
|
@@ -6,9 +6,9 @@
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Sphinx 1.2.2+/6728a8b81a26+\n"
|
||||
"Project-Id-Version: Sphinx 1.3a0\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2014-08-11 21:54+0900\n"
|
||||
"POT-Creation-Date: 2014-10-06 15:34+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -17,185 +17,201 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 1.3\n"
|
||||
|
||||
#: sphinx/config.py:81
|
||||
#: sphinx/config.py:75
|
||||
#, python-format
|
||||
msgid "Fig. %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/config.py:76
|
||||
#, python-format
|
||||
msgid "Table %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/config.py:77
|
||||
#, python-format
|
||||
msgid "Listing %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/config.py:84
|
||||
#, python-format
|
||||
msgid "%s %s documentation"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/environment.py:1550
|
||||
#: sphinx/environment.py:1825
|
||||
#, python-format
|
||||
msgid "see %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/environment.py:1553
|
||||
#: sphinx/environment.py:1828
|
||||
#, python-format
|
||||
msgid "see also %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/environment.py:1610
|
||||
#: sphinx/environment.py:1884
|
||||
msgid "Symbols"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/roles.py:175
|
||||
#: sphinx/roles.py:193
|
||||
#, python-format
|
||||
msgid "Python Enhancement Proposals; PEP %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/transforms.py:56 sphinx/writers/latex.py:205
|
||||
#: sphinx/writers/manpage.py:68 sphinx/writers/texinfo.py:217
|
||||
#: sphinx/transforms.py:55 sphinx/writers/latex.py:210
|
||||
#: sphinx/writers/manpage.py:67 sphinx/writers/texinfo.py:221
|
||||
#, python-format
|
||||
msgid "%B %d, %Y"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/builders/changes.py:73
|
||||
#: sphinx/builders/changes.py:75
|
||||
msgid "Builtins"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/builders/changes.py:75
|
||||
#: sphinx/builders/changes.py:77
|
||||
msgid "Module level"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/builders/html.py:291
|
||||
#: sphinx/builders/html.py:290
|
||||
#, python-format
|
||||
msgid "%b %d, %Y"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/builders/html.py:310 sphinx/themes/basic/defindex.html:30
|
||||
#: sphinx/builders/html.py:309 sphinx/themes/basic/defindex.html:30
|
||||
msgid "General Index"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/builders/html.py:310
|
||||
#: sphinx/builders/html.py:309
|
||||
msgid "index"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/builders/html.py:370
|
||||
#: sphinx/builders/html.py:369
|
||||
msgid "next"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/builders/html.py:379
|
||||
#: sphinx/builders/html.py:378
|
||||
msgid "previous"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/builders/latex.py:142 sphinx/builders/texinfo.py:197
|
||||
#: sphinx/builders/latex.py:144 sphinx/builders/texinfo.py:198
|
||||
msgid " (in "
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/directives/other.py:138
|
||||
#: sphinx/directives/other.py:139
|
||||
msgid "Section author: "
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/directives/other.py:140
|
||||
#: sphinx/directives/other.py:141
|
||||
msgid "Module author: "
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/directives/other.py:142
|
||||
#: sphinx/directives/other.py:143
|
||||
msgid "Code author: "
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/directives/other.py:144
|
||||
#: sphinx/directives/other.py:145
|
||||
msgid "Author: "
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/__init__.py:244
|
||||
#: sphinx/domains/__init__.py:273
|
||||
#, python-format
|
||||
msgid "%s %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:51 sphinx/domains/cpp.py:984 sphinx/domains/python.py:95
|
||||
#: sphinx/domains/c.py:58 sphinx/domains/cpp.py:1637
|
||||
#: sphinx/domains/python.py:113
|
||||
msgid "Parameters"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:54 sphinx/domains/cpp.py:990
|
||||
#: sphinx/domains/javascript.py:128 sphinx/domains/python.py:107
|
||||
#: sphinx/domains/c.py:61 sphinx/domains/cpp.py:1643
|
||||
#: sphinx/domains/javascript.py:128 sphinx/domains/python.py:125
|
||||
msgid "Returns"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:56 sphinx/domains/javascript.py:130
|
||||
#: sphinx/domains/python.py:109
|
||||
#: sphinx/domains/c.py:63 sphinx/domains/javascript.py:130
|
||||
#: sphinx/domains/python.py:127
|
||||
msgid "Return type"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:146
|
||||
#: sphinx/domains/c.py:177
|
||||
#, python-format
|
||||
msgid "%s (C function)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:148
|
||||
#: sphinx/domains/c.py:179
|
||||
#, python-format
|
||||
msgid "%s (C member)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:150
|
||||
#: sphinx/domains/c.py:181
|
||||
#, python-format
|
||||
msgid "%s (C macro)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:152
|
||||
#: sphinx/domains/c.py:183
|
||||
#, python-format
|
||||
msgid "%s (C type)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:154
|
||||
#: sphinx/domains/c.py:185
|
||||
#, python-format
|
||||
msgid "%s (C variable)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:211 sphinx/domains/cpp.py:1252
|
||||
#: sphinx/domains/javascript.py:164 sphinx/domains/python.py:560
|
||||
#: sphinx/domains/c.py:242 sphinx/domains/cpp.py:1812
|
||||
#: sphinx/domains/javascript.py:164 sphinx/domains/python.py:578
|
||||
msgid "function"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:212 sphinx/domains/cpp.py:1253
|
||||
#: sphinx/domains/c.py:243 sphinx/domains/cpp.py:1813
|
||||
msgid "member"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:213
|
||||
#: sphinx/domains/c.py:244
|
||||
msgid "macro"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:214 sphinx/domains/cpp.py:1254
|
||||
#: sphinx/domains/c.py:245 sphinx/domains/cpp.py:1814
|
||||
msgid "type"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/c.py:215
|
||||
#: sphinx/domains/c.py:246
|
||||
msgid "variable"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/cpp.py:987 sphinx/domains/javascript.py:125
|
||||
#: sphinx/domains/cpp.py:1640 sphinx/domains/javascript.py:125
|
||||
msgid "Throws"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/cpp.py:1083
|
||||
#, python-format
|
||||
msgid "%s (C++ class)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/cpp.py:1106
|
||||
#: sphinx/domains/cpp.py:1705
|
||||
#, python-format
|
||||
msgid "%s (C++ type)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/cpp.py:1126
|
||||
#: sphinx/domains/cpp.py:1717
|
||||
#, python-format
|
||||
msgid "%s (C++ member)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/cpp.py:1182
|
||||
#: sphinx/domains/cpp.py:1728
|
||||
#, python-format
|
||||
msgid "%s (C++ function)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/cpp.py:1251 sphinx/domains/javascript.py:165
|
||||
#: sphinx/domains/python.py:562
|
||||
#: sphinx/domains/cpp.py:1739
|
||||
#, python-format
|
||||
msgid "%s (C++ class)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/cpp.py:1811 sphinx/domains/javascript.py:165
|
||||
#: sphinx/domains/python.py:580
|
||||
msgid "class"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/javascript.py:106 sphinx/domains/python.py:253
|
||||
#: sphinx/domains/javascript.py:106 sphinx/domains/python.py:271
|
||||
#, python-format
|
||||
msgid "%s() (built-in function)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/javascript.py:107 sphinx/domains/python.py:317
|
||||
#: sphinx/domains/javascript.py:107 sphinx/domains/python.py:335
|
||||
#, python-format
|
||||
msgid "%s() (%s method)"
|
||||
msgstr ""
|
||||
@@ -210,7 +226,7 @@ msgstr ""
|
||||
msgid "%s (global variable or constant)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/javascript.py:113 sphinx/domains/python.py:355
|
||||
#: sphinx/domains/javascript.py:113 sphinx/domains/python.py:373
|
||||
#, python-format
|
||||
msgid "%s (%s attribute)"
|
||||
msgstr ""
|
||||
@@ -219,319 +235,319 @@ msgstr ""
|
||||
msgid "Arguments"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/javascript.py:166 sphinx/domains/python.py:561
|
||||
#: sphinx/domains/javascript.py:166 sphinx/domains/python.py:579
|
||||
msgid "data"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/javascript.py:167 sphinx/domains/python.py:567
|
||||
#: sphinx/domains/javascript.py:167 sphinx/domains/python.py:585
|
||||
msgid "attribute"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:100
|
||||
#: sphinx/domains/python.py:118
|
||||
msgid "Variables"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:104
|
||||
#: sphinx/domains/python.py:122
|
||||
msgid "Raises"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:254 sphinx/domains/python.py:311
|
||||
#: sphinx/domains/python.py:323 sphinx/domains/python.py:336
|
||||
#: sphinx/domains/python.py:272 sphinx/domains/python.py:329
|
||||
#: sphinx/domains/python.py:341 sphinx/domains/python.py:354
|
||||
#, python-format
|
||||
msgid "%s() (in module %s)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:257
|
||||
#: sphinx/domains/python.py:275
|
||||
#, python-format
|
||||
msgid "%s (built-in variable)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:258 sphinx/domains/python.py:349
|
||||
#: sphinx/domains/python.py:276 sphinx/domains/python.py:367
|
||||
#, python-format
|
||||
msgid "%s (in module %s)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:274
|
||||
#: sphinx/domains/python.py:292
|
||||
#, python-format
|
||||
msgid "%s (built-in class)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:275
|
||||
#: sphinx/domains/python.py:293
|
||||
#, python-format
|
||||
msgid "%s (class in %s)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:315
|
||||
#: sphinx/domains/python.py:333
|
||||
#, python-format
|
||||
msgid "%s() (%s.%s method)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:327
|
||||
#: sphinx/domains/python.py:345
|
||||
#, python-format
|
||||
msgid "%s() (%s.%s static method)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:330
|
||||
#: sphinx/domains/python.py:348
|
||||
#, python-format
|
||||
msgid "%s() (%s static method)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:340
|
||||
#: sphinx/domains/python.py:358
|
||||
#, python-format
|
||||
msgid "%s() (%s.%s class method)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:343
|
||||
#: sphinx/domains/python.py:361
|
||||
#, python-format
|
||||
msgid "%s() (%s class method)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:353
|
||||
#: sphinx/domains/python.py:371
|
||||
#, python-format
|
||||
msgid "%s (%s.%s attribute)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:434
|
||||
#: sphinx/domains/python.py:452
|
||||
#, python-format
|
||||
msgid "%s (module)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:491
|
||||
#: sphinx/domains/python.py:509
|
||||
msgid "Python Module Index"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:492
|
||||
#: sphinx/domains/python.py:510
|
||||
msgid "modules"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:538
|
||||
#: sphinx/domains/python.py:556
|
||||
msgid "Deprecated"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:563 sphinx/locale/__init__.py:179
|
||||
#: sphinx/domains/python.py:581 sphinx/locale/__init__.py:181
|
||||
msgid "exception"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:564
|
||||
#: sphinx/domains/python.py:582
|
||||
msgid "method"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:565
|
||||
#: sphinx/domains/python.py:583
|
||||
msgid "class method"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:566
|
||||
#: sphinx/domains/python.py:584
|
||||
msgid "static method"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:568 sphinx/locale/__init__.py:175
|
||||
#: sphinx/domains/python.py:586 sphinx/locale/__init__.py:177
|
||||
msgid "module"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/python.py:696
|
||||
#: sphinx/domains/python.py:751
|
||||
msgid " (deprecated)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/rst.py:53
|
||||
#, python-format
|
||||
msgid "%s (directive)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/rst.py:55
|
||||
#, python-format
|
||||
msgid "%s (directive)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/rst.py:57
|
||||
#, python-format
|
||||
msgid "%s (role)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/rst.py:104
|
||||
#: sphinx/domains/rst.py:106
|
||||
msgid "directive"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/rst.py:105
|
||||
#: sphinx/domains/rst.py:107
|
||||
msgid "role"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/std.py:69 sphinx/domains/std.py:85
|
||||
#: sphinx/domains/std.py:72 sphinx/domains/std.py:88
|
||||
#, python-format
|
||||
msgid "environment variable; %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/std.py:180
|
||||
#: sphinx/domains/std.py:184
|
||||
#, python-format
|
||||
msgid "%scommand line option; %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/std.py:457
|
||||
#: sphinx/domains/std.py:442
|
||||
msgid "glossary term"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/std.py:458
|
||||
#: sphinx/domains/std.py:443
|
||||
msgid "grammar token"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/std.py:459
|
||||
#: sphinx/domains/std.py:444
|
||||
msgid "reference label"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/std.py:461
|
||||
#: sphinx/domains/std.py:446
|
||||
msgid "environment variable"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/std.py:462
|
||||
#: sphinx/domains/std.py:447
|
||||
msgid "program option"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/std.py:492 sphinx/themes/basic/genindex-single.html:32
|
||||
#: sphinx/domains/std.py:477 sphinx/themes/basic/genindex-single.html:32
|
||||
#: sphinx/themes/basic/genindex-single.html:57
|
||||
#: sphinx/themes/basic/genindex-split.html:11
|
||||
#: sphinx/themes/basic/genindex-split.html:14
|
||||
#: sphinx/themes/basic/genindex.html:32 sphinx/themes/basic/genindex.html:35
|
||||
#: sphinx/themes/basic/genindex.html:68 sphinx/themes/basic/layout.html:134
|
||||
#: sphinx/writers/latex.py:194 sphinx/writers/texinfo.py:475
|
||||
#: sphinx/writers/latex.py:199 sphinx/writers/texinfo.py:479
|
||||
msgid "Index"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/std.py:493
|
||||
#: sphinx/domains/std.py:478
|
||||
msgid "Module Index"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/domains/std.py:494 sphinx/themes/basic/defindex.html:25
|
||||
#: sphinx/domains/std.py:479 sphinx/themes/basic/defindex.html:25
|
||||
msgid "Search Page"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/autodoc.py:1065
|
||||
#: sphinx/ext/autodoc.py:1127
|
||||
#, python-format
|
||||
msgid " Bases: %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/autodoc.py:1113
|
||||
#: sphinx/ext/autodoc.py:1175
|
||||
#, python-format
|
||||
msgid "alias of :class:`%s`"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/graphviz.py:297 sphinx/ext/graphviz.py:305
|
||||
#: sphinx/ext/graphviz.py:293 sphinx/ext/graphviz.py:301
|
||||
#, python-format
|
||||
msgid "[graph: %s]"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/graphviz.py:299 sphinx/ext/graphviz.py:307
|
||||
#: sphinx/ext/graphviz.py:295 sphinx/ext/graphviz.py:303
|
||||
msgid "[graph]"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/intersphinx.py:244
|
||||
#: sphinx/ext/intersphinx.py:257
|
||||
#, python-format
|
||||
msgid "(in %s v%s)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/linkcode.py:66 sphinx/ext/viewcode.py:70
|
||||
#: sphinx/ext/linkcode.py:69 sphinx/ext/viewcode.py:99
|
||||
msgid "[source]"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/todo.py:42
|
||||
#: sphinx/ext/todo.py:43
|
||||
msgid "Todo"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/todo.py:112
|
||||
#: sphinx/ext/todo.py:113
|
||||
#, python-format
|
||||
msgid "(The <<original entry>> is located in %s, line %d.)"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/todo.py:121
|
||||
#: sphinx/ext/todo.py:122
|
||||
msgid "original entry"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/viewcode.py:117
|
||||
#: sphinx/ext/viewcode.py:158
|
||||
msgid "[docs]"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/viewcode.py:131
|
||||
#: sphinx/ext/viewcode.py:172
|
||||
msgid "Module code"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/viewcode.py:137
|
||||
#: sphinx/ext/viewcode.py:178
|
||||
#, python-format
|
||||
msgid "<h1>Source code for %s</h1>"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/viewcode.py:164
|
||||
#: sphinx/ext/viewcode.py:204
|
||||
msgid "Overview: module code"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/ext/viewcode.py:165
|
||||
#: sphinx/ext/viewcode.py:205
|
||||
msgid "<h1>All modules for which code is available</h1>"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:155
|
||||
#: sphinx/locale/__init__.py:157
|
||||
msgid "Attention"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:156
|
||||
#: sphinx/locale/__init__.py:158
|
||||
msgid "Caution"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:157
|
||||
#: sphinx/locale/__init__.py:159
|
||||
msgid "Danger"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:158
|
||||
#: sphinx/locale/__init__.py:160
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:159
|
||||
#: sphinx/locale/__init__.py:161
|
||||
msgid "Hint"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:160
|
||||
#: sphinx/locale/__init__.py:162
|
||||
msgid "Important"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:161
|
||||
#: sphinx/locale/__init__.py:163
|
||||
msgid "Note"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:162
|
||||
#: sphinx/locale/__init__.py:164
|
||||
msgid "See also"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:163
|
||||
#: sphinx/locale/__init__.py:165
|
||||
msgid "Tip"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:164
|
||||
#: sphinx/locale/__init__.py:166
|
||||
msgid "Warning"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:168
|
||||
#, python-format
|
||||
msgid "New in version %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:169
|
||||
#, python-format
|
||||
msgid "Changed in version %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:170
|
||||
#, python-format
|
||||
msgid "New in version %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:171
|
||||
#, python-format
|
||||
msgid "Changed in version %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:172
|
||||
#, python-format
|
||||
msgid "Deprecated since version %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:176
|
||||
#: sphinx/locale/__init__.py:178
|
||||
msgid "keyword"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:177
|
||||
#: sphinx/locale/__init__.py:179
|
||||
msgid "operator"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:178
|
||||
#: sphinx/locale/__init__.py:180
|
||||
msgid "object"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:180
|
||||
#: sphinx/locale/__init__.py:182
|
||||
msgid "statement"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/locale/__init__.py:181
|
||||
#: sphinx/locale/__init__.py:183
|
||||
msgid "built-in function"
|
||||
msgstr ""
|
||||
|
||||
@@ -540,21 +556,21 @@ msgstr ""
|
||||
msgid "Table Of Contents"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/themes/agogo/layout.html:50 sphinx/themes/basic/layout.html:137
|
||||
#: sphinx/themes/agogo/layout.html:51 sphinx/themes/basic/layout.html:137
|
||||
#: sphinx/themes/basic/search.html:11 sphinx/themes/basic/search.html:23
|
||||
#: sphinx/themes/basic/searchresults.html:10
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/themes/agogo/layout.html:53 sphinx/themes/basic/searchbox.html:15
|
||||
#: sphinx/themes/agogo/layout.html:54 sphinx/themes/basic/searchbox.html:15
|
||||
msgid "Go"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/themes/agogo/layout.html:58 sphinx/themes/basic/searchbox.html:20
|
||||
#: sphinx/themes/agogo/layout.html:59 sphinx/themes/basic/searchbox.html:20
|
||||
msgid "Enter search terms or a module, class or function name."
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/themes/agogo/layout.html:79 sphinx/themes/basic/sourcelink.html:14
|
||||
#: sphinx/themes/agogo/layout.html:84 sphinx/themes/basic/sourcelink.html:15
|
||||
msgid "Show Source"
|
||||
msgstr ""
|
||||
|
||||
@@ -716,7 +732,7 @@ msgstr ""
|
||||
msgid "Quick search"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/themes/basic/sourcelink.html:11
|
||||
#: sphinx/themes/basic/sourcelink.html:12
|
||||
msgid "This Page"
|
||||
msgstr ""
|
||||
|
||||
@@ -748,12 +764,11 @@ msgstr ""
|
||||
msgid "Other changes"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/themes/basic/static/doctools.js:142 sphinx/writers/html.py:542
|
||||
#: sphinx/writers/html.py:548
|
||||
#: sphinx/themes/basic/static/doctools.js:142 sphinx/writers/html.py:600
|
||||
msgid "Permalink to this headline"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/themes/basic/static/doctools.js:148 sphinx/writers/html.py:108
|
||||
#: sphinx/themes/basic/static/doctools.js:148
|
||||
msgid "Permalink to this definition"
|
||||
msgstr ""
|
||||
|
||||
@@ -791,29 +806,34 @@ msgstr ""
|
||||
msgid "Contents"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/writers/latex.py:192
|
||||
#: sphinx/writers/html.py:266
|
||||
#, python-format
|
||||
msgid "Permalink to this %s"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/writers/latex.py:197
|
||||
msgid "Release"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/writers/latex.py:624 sphinx/writers/manpage.py:178
|
||||
#: sphinx/writers/texinfo.py:612
|
||||
#: sphinx/writers/latex.py:638 sphinx/writers/manpage.py:177
|
||||
#: sphinx/writers/texinfo.py:616
|
||||
msgid "Footnotes"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/writers/latex.py:709
|
||||
#: sphinx/writers/latex.py:723
|
||||
msgid "continued from previous page"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/writers/latex.py:715
|
||||
#: sphinx/writers/latex.py:729
|
||||
msgid "Continued on next page"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/writers/manpage.py:224 sphinx/writers/text.py:538
|
||||
#: sphinx/writers/manpage.py:223 sphinx/writers/text.py:541
|
||||
#, python-format
|
||||
msgid "[image: %s]"
|
||||
msgstr ""
|
||||
|
||||
#: sphinx/writers/manpage.py:225 sphinx/writers/text.py:539
|
||||
#: sphinx/writers/manpage.py:224 sphinx/writers/text.py:542
|
||||
msgid "[image]"
|
||||
msgstr ""
|
||||
|
||||
|
@@ -13,6 +13,7 @@ from __future__ import print_function
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
import optparse
|
||||
import time
|
||||
from os import path
|
||||
from io import open
|
||||
@@ -42,6 +43,22 @@ from sphinx.util import texescape
|
||||
# function to get input from terminal -- overridden by the test suite
|
||||
term_input = input
|
||||
|
||||
DEFAULT_VALUE = {
|
||||
'path': '.',
|
||||
'sep': False,
|
||||
'dot': '_',
|
||||
'language': None,
|
||||
'suffix': '.rst',
|
||||
'master': 'index',
|
||||
'epub': False,
|
||||
'ext_autodoc': False,
|
||||
'ext_doctest': False,
|
||||
'makefile': True,
|
||||
'batchfile': True,
|
||||
}
|
||||
|
||||
EXTENSIONS = ('autodoc', 'doctest', 'intersphinx', 'todo', 'coverage',
|
||||
'pngmath', 'mathjax', 'ifconfig', 'viewcode')
|
||||
|
||||
PROMPT_PREFIX = '> '
|
||||
|
||||
@@ -1228,13 +1245,17 @@ pngmath has been deselected.''')
|
||||
do_prompt(d, 'ext_viewcode', 'viewcode: include links to the source '
|
||||
'code of documented Python objects (y/n)', 'n', boolean)
|
||||
|
||||
if 'makefile' not in d:
|
||||
if 'no_makefile' in d:
|
||||
d['makefile'] = False
|
||||
elif 'makefile' not in d:
|
||||
print('''
|
||||
A Makefile and a Windows command file can be generated for you so that you
|
||||
only have to run e.g. `make html' instead of invoking sphinx-build
|
||||
directly.''')
|
||||
do_prompt(d, 'makefile', 'Create Makefile? (y/n)', 'y', boolean)
|
||||
if 'batchfile' not in d:
|
||||
if 'no_batchfile' in d:
|
||||
d['batchfile'] = False
|
||||
elif 'batchfile' not in d:
|
||||
do_prompt(d, 'batchfile', 'Create Windows command file? (y/n)',
|
||||
'y', boolean)
|
||||
print()
|
||||
@@ -1257,8 +1278,7 @@ def generate(d, overwrite=True, silent=False):
|
||||
d['project_underline'] = column_width(d['project']) * '='
|
||||
extensions = (',\n' + indent).join(
|
||||
repr('sphinx.ext.' + name)
|
||||
for name in ('autodoc', 'doctest', 'intersphinx', 'todo', 'coverage',
|
||||
'pngmath', 'mathjax', 'ifconfig', 'viewcode')
|
||||
for name in EXTENSIONS
|
||||
if d.get('ext_' + name))
|
||||
if extensions:
|
||||
d['extensions'] = '\n' + indent + extensions + ',\n'
|
||||
@@ -1316,13 +1336,13 @@ def generate(d, overwrite=True, silent=False):
|
||||
masterfile = path.join(srcdir, d['master'] + d['suffix'])
|
||||
write_file(masterfile, MASTER_FILE % d)
|
||||
|
||||
if d['makefile']:
|
||||
if d['makefile'] is True:
|
||||
d['rsrcdir'] = d['sep'] and 'source' or '.'
|
||||
d['rbuilddir'] = d['sep'] and 'build' or d['dot'] + 'build'
|
||||
# use binary mode, to avoid writing \r\n on Windows
|
||||
write_file(path.join(d['path'], 'Makefile'), MAKEFILE % d, u'\n')
|
||||
|
||||
if d['batchfile']:
|
||||
if d['batchfile'] is True:
|
||||
d['rsrcdir'] = d['sep'] and 'source' or '.'
|
||||
d['rbuilddir'] = d['sep'] and 'build' or d['dot'] + 'build'
|
||||
write_file(path.join(d['path'], 'make.bat'), BATCHFILE % d, u'\r\n')
|
||||
@@ -1344,24 +1364,141 @@ where "builder" is one of the supported builders, e.g. html, latex or linkcheck.
|
||||
''')
|
||||
|
||||
|
||||
def usage(argv, msg=None):
|
||||
if msg:
|
||||
print(msg, file=sys.stderr)
|
||||
print(file=sys.stderr)
|
||||
|
||||
USAGE = """\
|
||||
Sphinx v%s
|
||||
Usage: %%prog [options] [projectdir]
|
||||
""" % __version__
|
||||
|
||||
EPILOG = """\
|
||||
For more information, visit <http://sphinx-doc.org/>.
|
||||
"""
|
||||
|
||||
|
||||
class MyFormatter(optparse.IndentedHelpFormatter):
|
||||
def format_usage(self, usage):
|
||||
return usage
|
||||
|
||||
def format_help(self, formatter):
|
||||
result = []
|
||||
if self.description:
|
||||
result.append(self.format_description(formatter))
|
||||
if self.option_list:
|
||||
result.append(self.format_option_help(formatter))
|
||||
return "\n".join(result)
|
||||
|
||||
|
||||
def main(argv=sys.argv):
|
||||
if not color_terminal():
|
||||
nocolor()
|
||||
|
||||
d = {}
|
||||
if len(argv) > 3:
|
||||
print('Usage: sphinx-quickstart [root]')
|
||||
sys.exit(1)
|
||||
elif len(argv) == 2:
|
||||
d['path'] = argv[1]
|
||||
parser = optparse.OptionParser(USAGE, epilog=EPILOG,
|
||||
version='Sphinx v%s' % __version__,
|
||||
formatter=MyFormatter())
|
||||
parser.add_option('-q', '--quiet', action='store_true', dest='quiet',
|
||||
default=False,
|
||||
help='quiet mode')
|
||||
|
||||
group = parser.add_option_group('Structure options')
|
||||
group.add_option('--sep', action='store_true', dest='sep',
|
||||
help='if specified, separate source and build dirs')
|
||||
group.add_option('--dot', metavar='DOT', dest='dot',
|
||||
help='replacement for dot in _templates etc.')
|
||||
|
||||
group = parser.add_option_group('Project basic options')
|
||||
group.add_option('-p', '--project', metavar='PROJECT', dest='project',
|
||||
help='project name')
|
||||
group.add_option('-a', '--author', metavar='AUTHOR', dest='author',
|
||||
help='author names')
|
||||
group.add_option('-v', metavar='VERSION', dest='version',
|
||||
help='version of project')
|
||||
group.add_option('-r', '--release', metavar='RELEASE', dest='release',
|
||||
help='release of project')
|
||||
group.add_option('-l', '--language', metavar='LANGUAGE', dest='language',
|
||||
help='document language')
|
||||
group.add_option('--suffix', metavar='SUFFIX', dest='suffix',
|
||||
help='source file suffix')
|
||||
group.add_option('--master', metavar='MASTER', dest='master',
|
||||
help='master document name')
|
||||
group.add_option('--epub', action='store_true', dest='epub',
|
||||
default=False,
|
||||
help='use epub')
|
||||
|
||||
group = parser.add_option_group('Extension options')
|
||||
for ext in EXTENSIONS:
|
||||
group.add_option('--ext-' + ext, action='store_true',
|
||||
dest='ext_' + ext, default=False,
|
||||
help='enable %s extension' % ext)
|
||||
|
||||
group = parser.add_option_group('Makefile and Batchfile creation')
|
||||
group.add_option('--makefile', action='store_true', dest='makefile',
|
||||
default=False,
|
||||
help='create makefile')
|
||||
group.add_option('--no-makefile', action='store_true', dest='no_makefile',
|
||||
default=False,
|
||||
help='not create makefile')
|
||||
group.add_option('--batchfile', action='store_true', dest='batchfile',
|
||||
default=False,
|
||||
help='create batchfile')
|
||||
group.add_option('--no-batchfile', action='store_true', dest='no_batchfile',
|
||||
default=False,
|
||||
help='not create batchfile')
|
||||
|
||||
# parse options
|
||||
try:
|
||||
ask_user(d)
|
||||
opts, args = parser.parse_args()
|
||||
except SystemExit as err:
|
||||
return err.code
|
||||
|
||||
if len(args) > 0:
|
||||
opts.ensure_value('path', args[0])
|
||||
|
||||
d = vars(opts)
|
||||
for k, v in d.items():
|
||||
# delete None or False value
|
||||
if v is None or v is False:
|
||||
del d[k]
|
||||
|
||||
try:
|
||||
if 'quiet' in d:
|
||||
if 'project' not in d or 'author' not in d or \
|
||||
'version' not in d:
|
||||
print('''"quiet" is specified, but any of "project", \
|
||||
"author" or "version" is not specified.''')
|
||||
return
|
||||
|
||||
if all(['quiet' in d, 'project' in d, 'author' in d,
|
||||
'version' in d]):
|
||||
# quiet mode with all required params satisfied, use default
|
||||
d.setdefault('release', d['version'])
|
||||
d2 = DEFAULT_VALUE.copy()
|
||||
d2.update(dict(("ext_"+ext, False) for ext in EXTENSIONS))
|
||||
d2.update(d)
|
||||
d = d2
|
||||
if 'no_makefile' in d:
|
||||
d['makefile'] = False
|
||||
if 'no_batchfile' in d:
|
||||
d['batchfile'] = False
|
||||
|
||||
if path.exists(d['path']) and (
|
||||
not path.isdir(d['path']) or os.listdir(d['path'])):
|
||||
print()
|
||||
print(bold('Error: specified path is not a directory, or not a'
|
||||
' empty directory.'))
|
||||
print('sphinx-quickstart only generate into a empty directory.'
|
||||
' Please specify a new root path.')
|
||||
return
|
||||
else:
|
||||
ask_user(d)
|
||||
except (KeyboardInterrupt, EOFError):
|
||||
print()
|
||||
print('[Interrupted.]')
|
||||
return
|
||||
generate(d)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
|
@@ -97,7 +97,10 @@ h3:hover > a.headerlink,
|
||||
h4:hover > a.headerlink,
|
||||
h5:hover > a.headerlink,
|
||||
h6:hover > a.headerlink,
|
||||
dt:hover > a.headerlink {
|
||||
dt:hover > a.headerlink,
|
||||
caption:hover > a.headerlink,
|
||||
p.caption:hover > a.headerlink,
|
||||
div.code-block-caption:hover > a.headerlink {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
|
@@ -197,7 +197,10 @@ h3:hover > a.headerlink,
|
||||
h4:hover > a.headerlink,
|
||||
h5:hover > a.headerlink,
|
||||
h6:hover > a.headerlink,
|
||||
dt:hover > a.headerlink {
|
||||
dt:hover > a.headerlink,
|
||||
caption:hover > a.headerlink,
|
||||
p.caption:hover > a.headerlink,
|
||||
div.code-block-caption:hover > a.headerlink {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
|
@@ -250,7 +250,10 @@ h4:hover > a.headerlink,
|
||||
h5:hover > a.headerlink,
|
||||
h6:hover > a.headerlink,
|
||||
dt:hover > a.headerlink,
|
||||
dt:hover > a.headerlink {
|
||||
dt:hover > a.headerlink,
|
||||
caption:hover > a.headerlink,
|
||||
p.caption:hover > a.headerlink,
|
||||
div.code-block-caption:hover > a.headerlink {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
|
@@ -102,12 +102,7 @@ class HTMLTranslator(BaseTranslator):
|
||||
and node['ids'] and node['first']:
|
||||
self.body.append('<!--[%s]-->' % node['ids'][0])
|
||||
def depart_desc_signature(self, node):
|
||||
if node['ids'] and self.permalink_text and self.builder.add_permalinks:
|
||||
self.body.append(u'<a class="headerlink" href="#%s" '
|
||||
% node['ids'][0] +
|
||||
u'title="%s">%s</a>' % (
|
||||
_('Permalink to this definition'),
|
||||
self.permalink_text))
|
||||
self.add_permalink_ref(node, 'definition')
|
||||
self.body.append('</dt>\n')
|
||||
|
||||
def visit_desc_addname(self, node):
|
||||
@@ -259,9 +254,11 @@ class HTMLTranslator(BaseTranslator):
|
||||
def add_fignumber(self, node):
|
||||
def append_fignumber(figtype, figure_id):
|
||||
if figure_id in self.builder.fignumbers.get(figtype, {}):
|
||||
self.body.append(self.starttag(node, 'span', '', CLASS='caption-number'))
|
||||
prefix = self.builder.config.numfig_prefix.get(figtype, '')
|
||||
numbers = self.builder.fignumbers[figtype][figure_id]
|
||||
self.body.append(prefix + '.'.join(map(str, numbers)) + " ")
|
||||
self.body.append(prefix % '.'.join(map(str, numbers)) + ' ')
|
||||
self.body.append('</span>')
|
||||
|
||||
if isinstance(node.parent, nodes.figure):
|
||||
append_fignumber('figure', node.parent['ids'][0])
|
||||
@@ -270,6 +267,12 @@ class HTMLTranslator(BaseTranslator):
|
||||
elif isinstance(node.parent, nodes.container):
|
||||
append_fignumber('code-block', node.parent['ids'][0])
|
||||
|
||||
def add_permalink_ref(self, node, typename):
|
||||
if node['ids'] and self.permalink_text and self.builder.add_permalinks:
|
||||
title = _('Permalink to this %s' % typename)
|
||||
format = u'<a class="headerlink" href="#%s" title="%s">%s</a>'
|
||||
self.body.append(format % (node['ids'][0], title, self.permalink_text))
|
||||
|
||||
# overwritten to avoid emitting empty <ul></ul>
|
||||
def visit_bullet_list(self, node):
|
||||
if len(node) == 1 and node[0].tagname == 'toctree':
|
||||
@@ -281,6 +284,8 @@ class HTMLTranslator(BaseTranslator):
|
||||
BaseTranslator.visit_title(self, node)
|
||||
self.add_secnumber(node)
|
||||
self.add_fignumber(node)
|
||||
if isinstance(node.parent, nodes.table):
|
||||
self.body.append(self.starttag(node, 'span', '', CLASS='caption-text'))
|
||||
|
||||
# overwritten
|
||||
def visit_literal_block(self, node):
|
||||
@@ -313,8 +318,17 @@ class HTMLTranslator(BaseTranslator):
|
||||
else:
|
||||
BaseTranslator.visit_caption(self, node)
|
||||
self.add_fignumber(node)
|
||||
self.body.append(self.starttag(node, 'span', '', CLASS='caption-text'))
|
||||
|
||||
def depart_caption(self, node):
|
||||
self.body.append('</span>')
|
||||
|
||||
# append permalink if available
|
||||
if isinstance(node.parent, nodes.container) and node.parent.get('literal_block'):
|
||||
self.add_permalink_ref(node.parent, 'code')
|
||||
elif isinstance(node.parent, nodes.figure):
|
||||
self.add_permalink_ref(node.parent, 'image')
|
||||
|
||||
if isinstance(node.parent, nodes.container) and node.parent.get('literal_block'):
|
||||
self.body.append('</div>\n')
|
||||
else:
|
||||
@@ -581,20 +595,19 @@ class HTMLTranslator(BaseTranslator):
|
||||
def depart_title(self, node):
|
||||
close_tag = self.context[-1]
|
||||
if (self.permalink_text and self.builder.add_permalinks and
|
||||
node.parent.hasattr('ids') and node.parent['ids']):
|
||||
aname = node.parent['ids'][0]
|
||||
node.parent.hasattr('ids') and node.parent['ids']):
|
||||
# add permalink anchor
|
||||
if close_tag.startswith('</h'):
|
||||
self.body.append(u'<a class="headerlink" href="#%s" ' % aname +
|
||||
u'title="%s">%s</a>' % (
|
||||
_('Permalink to this headline'),
|
||||
self.permalink_text))
|
||||
self.add_permalink_ref(node.parent, 'headline')
|
||||
elif close_tag.startswith('</a></h'):
|
||||
self.body.append(u'</a><a class="headerlink" href="#%s" ' %
|
||||
aname +
|
||||
node.parent['ids'][0] +
|
||||
u'title="%s">%s' % (
|
||||
_('Permalink to this headline'),
|
||||
self.permalink_text))
|
||||
elif isinstance(node.parent, nodes.table):
|
||||
self.body.append('</span>')
|
||||
self.add_permalink_ref(node.parent, 'table')
|
||||
|
||||
BaseTranslator.depart_title(self, node)
|
||||
|
||||
|
@@ -305,8 +305,13 @@ class NslessParser(ET.XMLParser):
|
||||
|
||||
def check_xpath(etree, fname, path, check, be_found=True):
|
||||
nodes = list(etree.findall(path))
|
||||
assert nodes != [], ('did not find any node matching xpath '
|
||||
'%r in file %s' % (path, fname))
|
||||
if check is None:
|
||||
assert nodes == [], ('found any nodes matching xpath '
|
||||
'%r in file %s' % (path, fname))
|
||||
return
|
||||
else:
|
||||
assert nodes != [], ('did not find any node matching xpath '
|
||||
'%r in file %s' % (path, fname))
|
||||
if hasattr(check, '__call__'):
|
||||
check(nodes)
|
||||
elif not check:
|
||||
@@ -463,16 +468,11 @@ def test_numfig_disabled(app, status, warning):
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.2$', True),
|
||||
(".//table/caption", '^should be Table 1$', True),
|
||||
(".//table/caption", '^should be Table 2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", None, True),
|
||||
(".//table/caption/span[@class='caption-number']", None, True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", None, True),
|
||||
(".//li/code/span", '^fig1$', True),
|
||||
(".//li/code/span", '^Figure#$', True),
|
||||
(".//li/code/span", '^table1$', True),
|
||||
@@ -481,50 +481,25 @@ def test_numfig_disabled(app, status, warning):
|
||||
(".//li/code/span", '^Code-#$', True),
|
||||
],
|
||||
'foo.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.1.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.1.2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.1.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.1.4$', True),
|
||||
(".//table/caption", '^should be Table 1.1$', True),
|
||||
(".//table/caption", '^should be Table 1.2$', True),
|
||||
(".//table/caption", '^should be Table 1.3$', True),
|
||||
(".//table/caption", '^should be Table 1.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 1.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 1.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 1.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 1.4$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", None, True),
|
||||
(".//table/caption/span[@class='caption-number']", None, True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", None, True),
|
||||
],
|
||||
'bar.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.2.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.2.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.2.4$', True),
|
||||
(".//table/caption", '^should be Table 2.1$', True),
|
||||
(".//table/caption", '^should be Table 2.3$', True),
|
||||
(".//table/caption", '^should be Table 2.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 2.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 2.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 2.4$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", None, True),
|
||||
(".//table/caption/span[@class='caption-number']", None, True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", None, True),
|
||||
],
|
||||
'baz.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.2.2$', True),
|
||||
(".//table/caption", '^should be Table 2.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 2.2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", None, True),
|
||||
(".//table/caption/span[@class='caption-number']", None, True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", None, True),
|
||||
],
|
||||
}
|
||||
|
||||
@@ -552,68 +527,78 @@ def test_numfig_without_numbered_toctree(app, status, warning):
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.9 should be Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.10 should be Fig.2$', True),
|
||||
(".//table/caption", '^Table 9 should be Table 1$', True),
|
||||
(".//table/caption", '^Table 10 should be Table 2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 9 should be List 1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 10 should be List 2$', True),
|
||||
(".//li/a/em", '^Fig.9$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 9 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 10 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 9 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 10 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 9 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 10 $', True),
|
||||
(".//li/a/em", '^Fig. 9$', True),
|
||||
(".//li/a/em", '^Figure6$', True),
|
||||
(".//li/a/em", '^Table 9$', True),
|
||||
(".//li/a/em", '^Table:6$', True),
|
||||
(".//li/a/em", '^List 9$', True),
|
||||
(".//li/a/em", '^Listing 9$', True),
|
||||
(".//li/a/em", '^Code-6$', True),
|
||||
],
|
||||
'foo.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1 should be Fig.1.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2 should be Fig.1.2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.3 should be Fig.1.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.4 should be Fig.1.4$', True),
|
||||
(".//table/caption", '^Table 1 should be Table 1.1$', True),
|
||||
(".//table/caption", '^Table 2 should be Table 1.2$', True),
|
||||
(".//table/caption", '^Table 3 should be Table 1.3$', True),
|
||||
(".//table/caption", '^Table 4 should be Table 1.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1 should be List 1.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2 should be List 1.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 3 should be List 1.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 4 should be List 1.4$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 1 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 2 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 3 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 4 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 2 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 3 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 4 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 2 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 3 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 4 $', True),
|
||||
],
|
||||
'bar.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.5 should be Fig.2.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.7 should be Fig.2.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.8 should be Fig.2.4$', True),
|
||||
(".//table/caption", '^Table 5 should be Table 2.1$', True),
|
||||
(".//table/caption", '^Table 7 should be Table 2.3$', True),
|
||||
(".//table/caption", '^Table 8 should be Table 2.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 5 should be List 2.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 7 should be List 2.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 8 should be List 2.4$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 5 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 7 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 8 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 5 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 7 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 8 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 5 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 7 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 8 $', True),
|
||||
],
|
||||
'baz.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.6 should be Fig.2.2$', True),
|
||||
(".//table/caption", '^Table 6 should be Table 2.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 6 should be List 2.2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 6 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 6 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 6 $', True),
|
||||
],
|
||||
}
|
||||
|
||||
@@ -637,68 +622,78 @@ def test_numfig_with_numbered_toctree(app, status, warning):
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1 should be Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2 should be Fig.2$', True),
|
||||
(".//table/caption", '^Table 1 should be Table 1$', True),
|
||||
(".//table/caption", '^Table 2 should be Table 2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1 should be List 1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2 should be List 2$', True),
|
||||
(".//li/a/em", '^Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 1 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 2 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 2 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 2 $', True),
|
||||
(".//li/a/em", '^Fig. 1$', True),
|
||||
(".//li/a/em", '^Figure2.2$', True),
|
||||
(".//li/a/em", '^Table 1$', True),
|
||||
(".//li/a/em", '^Table:2.2$', True),
|
||||
(".//li/a/em", '^List 1$', True),
|
||||
(".//li/a/em", '^Listing 1$', True),
|
||||
(".//li/a/em", '^Code-2.2$', True),
|
||||
],
|
||||
'foo.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1.1 should be Fig.1.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1.2 should be Fig.1.2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1.3 should be Fig.1.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1.4 should be Fig.1.4$', True),
|
||||
(".//table/caption", '^Table 1.1 should be Table 1.1$', True),
|
||||
(".//table/caption", '^Table 1.2 should be Table 1.2$', True),
|
||||
(".//table/caption", '^Table 1.3 should be Table 1.3$', True),
|
||||
(".//table/caption", '^Table 1.4 should be Table 1.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.1 should be List 1.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.2 should be List 1.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.3 should be List 1.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.4 should be List 1.4$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 1.1 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 1.2 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 1.3 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 1.4 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 1.1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 1.2 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 1.3 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 1.4 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 1.1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 1.2 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 1.3 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 1.4 $', True),
|
||||
],
|
||||
'bar.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.1 should be Fig.2.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.3 should be Fig.2.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.4 should be Fig.2.4$', True),
|
||||
(".//table/caption", '^Table 2.1 should be Table 2.1$', True),
|
||||
(".//table/caption", '^Table 2.3 should be Table 2.3$', True),
|
||||
(".//table/caption", '^Table 2.4 should be Table 2.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.1 should be List 2.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.3 should be List 2.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.4 should be List 2.4$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 2.1 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 2.3 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 2.4 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 2.1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 2.3 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 2.4 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 2.1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 2.3 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 2.4 $', True),
|
||||
],
|
||||
'baz.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.2 should be Fig.2.2$', True),
|
||||
(".//table/caption", '^Table 2.2 should be Table 2.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.2 should be List 2.2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 2.2 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 2.2 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 2.2 $', True),
|
||||
],
|
||||
}
|
||||
|
||||
@@ -716,22 +711,27 @@ def test_numfig_with_numbered_toctree(app, status, warning):
|
||||
|
||||
|
||||
@gen_with_app(buildername='html', testroot='numfig',
|
||||
confoverrides={'numfig': True, 'numfig_prefix': {'figure': 'Figure:', 'table': 'Tab_', 'code-block': 'Code-'}})
|
||||
confoverrides={'numfig': True,
|
||||
'numfig_prefix': {'figure': 'Figure:%s',
|
||||
'table': 'Tab_%s',
|
||||
'code-block': 'Code-%s'}})
|
||||
def test_numfig_with_prefix(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:1 should be Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:2 should be Fig.2$', True),
|
||||
(".//table/caption", '^Tab_1 should be Table 1$', True),
|
||||
(".//table/caption", '^Tab_2 should be Table 2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-1 should be List 1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-2 should be List 2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Figure:1 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Figure:2 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Tab_1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Tab_2 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Code-1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Code-2 $', True),
|
||||
(".//li/a/em", '^Figure:1$', True),
|
||||
(".//li/a/em", '^Figure2.2$', True),
|
||||
(".//li/a/em", '^Tab_1$', True),
|
||||
@@ -740,50 +740,58 @@ def test_numfig_with_prefix(app, status, warning):
|
||||
(".//li/a/em", '^Code-2.2$', True),
|
||||
],
|
||||
'foo.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:1.1 should be Fig.1.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:1.2 should be Fig.1.2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:1.3 should be Fig.1.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:1.4 should be Fig.1.4$', True),
|
||||
(".//table/caption", '^Tab_1.1 should be Table 1.1$', True),
|
||||
(".//table/caption", '^Tab_1.2 should be Table 1.2$', True),
|
||||
(".//table/caption", '^Tab_1.3 should be Table 1.3$', True),
|
||||
(".//table/caption", '^Tab_1.4 should be Table 1.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-1.1 should be List 1.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-1.2 should be List 1.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-1.3 should be List 1.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-1.4 should be List 1.4$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Figure:1.1 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Figure:1.2 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Figure:1.3 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Figure:1.4 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Tab_1.1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Tab_1.2 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Tab_1.3 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Tab_1.4 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Code-1.1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Code-1.2 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Code-1.3 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Code-1.4 $', True),
|
||||
],
|
||||
'bar.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:2.1 should be Fig.2.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:2.3 should be Fig.2.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:2.4 should be Fig.2.4$', True),
|
||||
(".//table/caption", '^Tab_2.1 should be Table 2.1$', True),
|
||||
(".//table/caption", '^Tab_2.3 should be Table 2.3$', True),
|
||||
(".//table/caption", '^Tab_2.4 should be Table 2.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-2.1 should be List 2.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-2.3 should be List 2.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-2.4 should be List 2.4$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Figure:2.1 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Figure:2.3 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Figure:2.4 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Tab_2.1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Tab_2.3 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Tab_2.4 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Code-2.1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Code-2.3 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Code-2.4 $', True),
|
||||
],
|
||||
'baz.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:2.2 should be Fig.2.2$', True),
|
||||
(".//table/caption", '^Tab_2.2 should be Table 2.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-2.2 should be List 2.2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Figure:2.2 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Tab_2.2 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Code-2.2 $', True),
|
||||
],
|
||||
}
|
||||
|
||||
@@ -807,68 +815,78 @@ def test_numfig_with_secnum_depth(app, status, warning):
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1 should be Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2 should be Fig.2$', True),
|
||||
(".//table/caption", '^Table 1 should be Table 1$', True),
|
||||
(".//table/caption", '^Table 2 should be Table 2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1 should be List 1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2 should be List 2$', True),
|
||||
(".//li/a/em", '^Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 1 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 2 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 2 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 2 $', True),
|
||||
(".//li/a/em", '^Fig. 1$', True),
|
||||
(".//li/a/em", '^Figure2.1.2$', True),
|
||||
(".//li/a/em", '^Table 1$', True),
|
||||
(".//li/a/em", '^Table:2.1.2$', True),
|
||||
(".//li/a/em", '^List 1$', True),
|
||||
(".//li/a/em", '^Listing 1$', True),
|
||||
(".//li/a/em", '^Code-2.1.2$', True),
|
||||
],
|
||||
'foo.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1.1 should be Fig.1.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1.1.1 should be Fig.1.2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1.1.2 should be Fig.1.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1.2.1 should be Fig.1.4$', True),
|
||||
(".//table/caption", '^Table 1.1 should be Table 1.1$', True),
|
||||
(".//table/caption", '^Table 1.1.1 should be Table 1.2$', True),
|
||||
(".//table/caption", '^Table 1.1.2 should be Table 1.3$', True),
|
||||
(".//table/caption", '^Table 1.2.1 should be Table 1.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.1 should be List 1.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.1.1 should be List 1.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.1.2 should be List 1.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.2.1 should be List 1.4$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 1.1 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 1.1.1 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 1.1.2 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 1.2.1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 1.1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 1.1.1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 1.1.2 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 1.2.1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 1.1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 1.1.1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 1.1.2 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 1.2.1 $', True),
|
||||
],
|
||||
'bar.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.1.1 should be Fig.2.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.1.3 should be Fig.2.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.2.1 should be Fig.2.4$', True),
|
||||
(".//table/caption", '^Table 2.1.1 should be Table 2.1$', True),
|
||||
(".//table/caption", '^Table 2.1.3 should be Table 2.3$', True),
|
||||
(".//table/caption", '^Table 2.2.1 should be Table 2.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.1.1 should be List 2.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.1.3 should be List 2.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.2.1 should be List 2.4$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 2.1.1 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 2.1.3 $', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 2.2.1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 2.1.1 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 2.1.3 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 2.2.1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 2.1.1 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 2.1.3 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 2.2.1 $', True),
|
||||
],
|
||||
'baz.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.1.2 should be Fig.2.2$', True),
|
||||
(".//table/caption", '^Table 2.1.2 should be Table 2.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.1.2 should be List 2.2$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
"span[@class='caption-number']", '^Fig. 2.1.2 $', True),
|
||||
(".//table/caption/span[@class='caption-number']",
|
||||
'^Table 2.1.2 $', True),
|
||||
(".//div[@class='code-block-caption']/"
|
||||
"span[@class='caption-number']", '^Listing 2.1.2 $', True),
|
||||
],
|
||||
}
|
||||
|
||||
|
@@ -52,8 +52,11 @@ def test_code_block_dedent(app, status, warning):
|
||||
@with_app('html', testroot='directive-code')
|
||||
def test_code_block_caption_html(app, status, warning):
|
||||
app.builder.build(['caption'])
|
||||
html = (app.outdir / 'caption.html').text()
|
||||
caption = '<div class="code-block-caption">caption <em>test</em> rb</div>'
|
||||
html = (app.outdir / 'caption.html').text(encoding='utf-8')
|
||||
caption = (u'<div class="code-block-caption">'
|
||||
u'<span class="caption-text">caption <em>test</em> rb'
|
||||
u'</span><a class="headerlink" href="#id1" '
|
||||
u'title="Permalink to this code">\xb6</a></div>')
|
||||
assert caption in html
|
||||
|
||||
|
||||
@@ -61,7 +64,7 @@ def test_code_block_caption_html(app, status, warning):
|
||||
def test_code_block_caption_latex(app, status, warning):
|
||||
app.builder.build_all()
|
||||
latex = (app.outdir / 'Python.tex').text()
|
||||
caption = '\\caption{\ncaption \\emph{test} rb\n}'
|
||||
caption = '\\caption{caption \\emph{test} rb}'
|
||||
assert caption in latex
|
||||
|
||||
|
||||
@@ -98,8 +101,11 @@ def test_literal_include_dedent(app, status, warning):
|
||||
@with_app('html', testroot='directive-code')
|
||||
def test_literalinclude_caption_html(app, status, warning):
|
||||
app.builder.build('index')
|
||||
html = (app.outdir / 'caption.html').text()
|
||||
caption = '<div class="code-block-caption">caption <strong>test</strong> py</div>'
|
||||
html = (app.outdir / 'caption.html').text(encoding='utf-8')
|
||||
caption = (u'<div class="code-block-caption">'
|
||||
u'<span class="caption-text">caption <strong>test</strong> py'
|
||||
u'</span><a class="headerlink" href="#id2" '
|
||||
u'title="Permalink to this code">\xb6</a></div>')
|
||||
assert caption in html
|
||||
|
||||
|
||||
@@ -107,5 +113,5 @@ def test_literalinclude_caption_html(app, status, warning):
|
||||
def test_literalinclude_caption_latex(app, status, warning):
|
||||
app.builder.build('index')
|
||||
latex = (app.outdir / 'Python.tex').text()
|
||||
caption = '\\caption{\ncaption \\textbf{test} py\n}'
|
||||
caption = '\\caption{caption \\textbf{test} py}'
|
||||
assert caption in latex
|
||||
|
Reference in New Issue
Block a user