This commit is contained in:
Jeppe Pihl 2014-10-06 20:31:30 +02:00
commit 29af67f438
9 changed files with 497 additions and 432 deletions

View File

@ -72,9 +72,9 @@ class Config(object):
nitpick_ignore = ([], 'html'), nitpick_ignore = ([], 'html'),
numfig = (False, 'env'), numfig = (False, 'env'),
numfig_secnum_depth = (1, 'env'), numfig_secnum_depth = (1, 'env'),
numfig_prefix = ({'figure': l_('Fig.'), numfig_prefix = ({'figure': l_('Fig. %s'),
'table': l_('Table '), 'table': l_('Table %s'),
'code-block': l_('List ')}, 'code-block': l_('Listing %s')},
'env'), 'env'),
# HTML options # HTML options

View File

@ -76,7 +76,7 @@ default_settings = {
# or changed to properly invalidate pickle files. # or changed to properly invalidate pickle files.
# #
# NOTE: increase base version by 2 to have distinct numbers for Py2 and 3 # 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) dummy_reporter = Reporter('', 4, 4)
@ -310,6 +310,7 @@ class BuildEnvironment:
self.longtitles.pop(docname, None) self.longtitles.pop(docname, None)
self.tocs.pop(docname, None) self.tocs.pop(docname, None)
self.toc_secnumbers.pop(docname, None) self.toc_secnumbers.pop(docname, None)
self.toc_fignumbers.pop(docname, None)
self.toc_num_entries.pop(docname, None) self.toc_num_entries.pop(docname, None)
self.toctree_includes.pop(docname, None) self.toctree_includes.pop(docname, None)
self.indexentries.pop(docname, None) self.indexentries.pop(docname, None)
@ -350,7 +351,7 @@ class BuildEnvironment:
self.longtitles[docname] = other.longtitles[docname] self.longtitles[docname] = other.longtitles[docname]
self.tocs[docname] = other.tocs[docname] self.tocs[docname] = other.tocs[docname]
self.toc_num_entries[docname] = other.toc_num_entries[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: if docname in other.toctree_includes:
self.toctree_includes[docname] = other.toctree_includes[docname] self.toctree_includes[docname] = other.toctree_includes[docname]
self.indexentries[docname] = other.indexentries[docname] self.indexentries[docname] = other.indexentries[docname]
@ -1701,7 +1702,7 @@ class BuildEnvironment:
rewrite_needed = [] rewrite_needed = []
assigned = set() assigned = set()
old_fignumbers = getattr(self, 'toc_fignumbers', {}) # compatible with old envs old_fignumbers = self.toc_fignumbers
self.toc_fignumbers = {} self.toc_fignumbers = {}
fignum_counter = {} fignum_counter = {}

View File

@ -6,9 +6,9 @@
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Sphinx 1.2.2+/6728a8b81a26+\n" "Project-Id-Version: Sphinx 1.3a0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,185 +17,201 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 1.3\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 #, python-format
msgid "%s %s documentation" msgid "%s %s documentation"
msgstr "" msgstr ""
#: sphinx/environment.py:1550 #: sphinx/environment.py:1825
#, python-format #, python-format
msgid "see %s" msgid "see %s"
msgstr "" msgstr ""
#: sphinx/environment.py:1553 #: sphinx/environment.py:1828
#, python-format #, python-format
msgid "see also %s" msgid "see also %s"
msgstr "" msgstr ""
#: sphinx/environment.py:1610 #: sphinx/environment.py:1884
msgid "Symbols" msgid "Symbols"
msgstr "" msgstr ""
#: sphinx/roles.py:175 #: sphinx/roles.py:193
#, python-format #, python-format
msgid "Python Enhancement Proposals; PEP %s" msgid "Python Enhancement Proposals; PEP %s"
msgstr "" msgstr ""
#: sphinx/transforms.py:56 sphinx/writers/latex.py:205 #: sphinx/transforms.py:55 sphinx/writers/latex.py:210
#: sphinx/writers/manpage.py:68 sphinx/writers/texinfo.py:217 #: sphinx/writers/manpage.py:67 sphinx/writers/texinfo.py:221
#, python-format #, python-format
msgid "%B %d, %Y" msgid "%B %d, %Y"
msgstr "" msgstr ""
#: sphinx/builders/changes.py:73 #: sphinx/builders/changes.py:75
msgid "Builtins" msgid "Builtins"
msgstr "" msgstr ""
#: sphinx/builders/changes.py:75 #: sphinx/builders/changes.py:77
msgid "Module level" msgid "Module level"
msgstr "" msgstr ""
#: sphinx/builders/html.py:291 #: sphinx/builders/html.py:290
#, python-format #, python-format
msgid "%b %d, %Y" msgid "%b %d, %Y"
msgstr "" 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" msgid "General Index"
msgstr "" msgstr ""
#: sphinx/builders/html.py:310 #: sphinx/builders/html.py:309
msgid "index" msgid "index"
msgstr "" msgstr ""
#: sphinx/builders/html.py:370 #: sphinx/builders/html.py:369
msgid "next" msgid "next"
msgstr "" msgstr ""
#: sphinx/builders/html.py:379 #: sphinx/builders/html.py:378
msgid "previous" msgid "previous"
msgstr "" msgstr ""
#: sphinx/builders/latex.py:142 sphinx/builders/texinfo.py:197 #: sphinx/builders/latex.py:144 sphinx/builders/texinfo.py:198
msgid " (in " msgid " (in "
msgstr "" msgstr ""
#: sphinx/directives/other.py:138 #: sphinx/directives/other.py:139
msgid "Section author: " msgid "Section author: "
msgstr "" msgstr ""
#: sphinx/directives/other.py:140 #: sphinx/directives/other.py:141
msgid "Module author: " msgid "Module author: "
msgstr "" msgstr ""
#: sphinx/directives/other.py:142 #: sphinx/directives/other.py:143
msgid "Code author: " msgid "Code author: "
msgstr "" msgstr ""
#: sphinx/directives/other.py:144 #: sphinx/directives/other.py:145
msgid "Author: " msgid "Author: "
msgstr "" msgstr ""
#: sphinx/domains/__init__.py:244 #: sphinx/domains/__init__.py:273
#, python-format #, python-format
msgid "%s %s" msgid "%s %s"
msgstr "" 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" msgid "Parameters"
msgstr "" msgstr ""
#: sphinx/domains/c.py:54 sphinx/domains/cpp.py:990 #: sphinx/domains/c.py:61 sphinx/domains/cpp.py:1643
#: sphinx/domains/javascript.py:128 sphinx/domains/python.py:107 #: sphinx/domains/javascript.py:128 sphinx/domains/python.py:125
msgid "Returns" msgid "Returns"
msgstr "" msgstr ""
#: sphinx/domains/c.py:56 sphinx/domains/javascript.py:130 #: sphinx/domains/c.py:63 sphinx/domains/javascript.py:130
#: sphinx/domains/python.py:109 #: sphinx/domains/python.py:127
msgid "Return type" msgid "Return type"
msgstr "" msgstr ""
#: sphinx/domains/c.py:146 #: sphinx/domains/c.py:177
#, python-format #, python-format
msgid "%s (C function)" msgid "%s (C function)"
msgstr "" msgstr ""
#: sphinx/domains/c.py:148 #: sphinx/domains/c.py:179
#, python-format #, python-format
msgid "%s (C member)" msgid "%s (C member)"
msgstr "" msgstr ""
#: sphinx/domains/c.py:150 #: sphinx/domains/c.py:181
#, python-format #, python-format
msgid "%s (C macro)" msgid "%s (C macro)"
msgstr "" msgstr ""
#: sphinx/domains/c.py:152 #: sphinx/domains/c.py:183
#, python-format #, python-format
msgid "%s (C type)" msgid "%s (C type)"
msgstr "" msgstr ""
#: sphinx/domains/c.py:154 #: sphinx/domains/c.py:185
#, python-format #, python-format
msgid "%s (C variable)" msgid "%s (C variable)"
msgstr "" msgstr ""
#: sphinx/domains/c.py:211 sphinx/domains/cpp.py:1252 #: sphinx/domains/c.py:242 sphinx/domains/cpp.py:1812
#: sphinx/domains/javascript.py:164 sphinx/domains/python.py:560 #: sphinx/domains/javascript.py:164 sphinx/domains/python.py:578
msgid "function" msgid "function"
msgstr "" msgstr ""
#: sphinx/domains/c.py:212 sphinx/domains/cpp.py:1253 #: sphinx/domains/c.py:243 sphinx/domains/cpp.py:1813
msgid "member" msgid "member"
msgstr "" msgstr ""
#: sphinx/domains/c.py:213 #: sphinx/domains/c.py:244
msgid "macro" msgid "macro"
msgstr "" msgstr ""
#: sphinx/domains/c.py:214 sphinx/domains/cpp.py:1254 #: sphinx/domains/c.py:245 sphinx/domains/cpp.py:1814
msgid "type" msgid "type"
msgstr "" msgstr ""
#: sphinx/domains/c.py:215 #: sphinx/domains/c.py:246
msgid "variable" msgid "variable"
msgstr "" msgstr ""
#: sphinx/domains/cpp.py:987 sphinx/domains/javascript.py:125 #: sphinx/domains/cpp.py:1640 sphinx/domains/javascript.py:125
msgid "Throws" msgid "Throws"
msgstr "" msgstr ""
#: sphinx/domains/cpp.py:1083 #: sphinx/domains/cpp.py:1705
#, python-format
msgid "%s (C++ class)"
msgstr ""
#: sphinx/domains/cpp.py:1106
#, python-format #, python-format
msgid "%s (C++ type)" msgid "%s (C++ type)"
msgstr "" msgstr ""
#: sphinx/domains/cpp.py:1126 #: sphinx/domains/cpp.py:1717
#, python-format #, python-format
msgid "%s (C++ member)" msgid "%s (C++ member)"
msgstr "" msgstr ""
#: sphinx/domains/cpp.py:1182 #: sphinx/domains/cpp.py:1728
#, python-format #, python-format
msgid "%s (C++ function)" msgid "%s (C++ function)"
msgstr "" msgstr ""
#: sphinx/domains/cpp.py:1251 sphinx/domains/javascript.py:165 #: sphinx/domains/cpp.py:1739
#: sphinx/domains/python.py:562 #, python-format
msgid "%s (C++ class)"
msgstr ""
#: sphinx/domains/cpp.py:1811 sphinx/domains/javascript.py:165
#: sphinx/domains/python.py:580
msgid "class" msgid "class"
msgstr "" msgstr ""
#: sphinx/domains/javascript.py:106 sphinx/domains/python.py:253 #: sphinx/domains/javascript.py:106 sphinx/domains/python.py:271
#, python-format #, python-format
msgid "%s() (built-in function)" msgid "%s() (built-in function)"
msgstr "" msgstr ""
#: sphinx/domains/javascript.py:107 sphinx/domains/python.py:317 #: sphinx/domains/javascript.py:107 sphinx/domains/python.py:335
#, python-format #, python-format
msgid "%s() (%s method)" msgid "%s() (%s method)"
msgstr "" msgstr ""
@ -210,7 +226,7 @@ msgstr ""
msgid "%s (global variable or constant)" msgid "%s (global variable or constant)"
msgstr "" msgstr ""
#: sphinx/domains/javascript.py:113 sphinx/domains/python.py:355 #: sphinx/domains/javascript.py:113 sphinx/domains/python.py:373
#, python-format #, python-format
msgid "%s (%s attribute)" msgid "%s (%s attribute)"
msgstr "" msgstr ""
@ -219,319 +235,319 @@ msgstr ""
msgid "Arguments" msgid "Arguments"
msgstr "" msgstr ""
#: sphinx/domains/javascript.py:166 sphinx/domains/python.py:561 #: sphinx/domains/javascript.py:166 sphinx/domains/python.py:579
msgid "data" msgid "data"
msgstr "" msgstr ""
#: sphinx/domains/javascript.py:167 sphinx/domains/python.py:567 #: sphinx/domains/javascript.py:167 sphinx/domains/python.py:585
msgid "attribute" msgid "attribute"
msgstr "" msgstr ""
#: sphinx/domains/python.py:100 #: sphinx/domains/python.py:118
msgid "Variables" msgid "Variables"
msgstr "" msgstr ""
#: sphinx/domains/python.py:104 #: sphinx/domains/python.py:122
msgid "Raises" msgid "Raises"
msgstr "" msgstr ""
#: sphinx/domains/python.py:254 sphinx/domains/python.py:311 #: sphinx/domains/python.py:272 sphinx/domains/python.py:329
#: sphinx/domains/python.py:323 sphinx/domains/python.py:336 #: sphinx/domains/python.py:341 sphinx/domains/python.py:354
#, python-format #, python-format
msgid "%s() (in module %s)" msgid "%s() (in module %s)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:257 #: sphinx/domains/python.py:275
#, python-format #, python-format
msgid "%s (built-in variable)" msgid "%s (built-in variable)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:258 sphinx/domains/python.py:349 #: sphinx/domains/python.py:276 sphinx/domains/python.py:367
#, python-format #, python-format
msgid "%s (in module %s)" msgid "%s (in module %s)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:274 #: sphinx/domains/python.py:292
#, python-format #, python-format
msgid "%s (built-in class)" msgid "%s (built-in class)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:275 #: sphinx/domains/python.py:293
#, python-format #, python-format
msgid "%s (class in %s)" msgid "%s (class in %s)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:315 #: sphinx/domains/python.py:333
#, python-format #, python-format
msgid "%s() (%s.%s method)" msgid "%s() (%s.%s method)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:327 #: sphinx/domains/python.py:345
#, python-format #, python-format
msgid "%s() (%s.%s static method)" msgid "%s() (%s.%s static method)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:330 #: sphinx/domains/python.py:348
#, python-format #, python-format
msgid "%s() (%s static method)" msgid "%s() (%s static method)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:340 #: sphinx/domains/python.py:358
#, python-format #, python-format
msgid "%s() (%s.%s class method)" msgid "%s() (%s.%s class method)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:343 #: sphinx/domains/python.py:361
#, python-format #, python-format
msgid "%s() (%s class method)" msgid "%s() (%s class method)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:353 #: sphinx/domains/python.py:371
#, python-format #, python-format
msgid "%s (%s.%s attribute)" msgid "%s (%s.%s attribute)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:434 #: sphinx/domains/python.py:452
#, python-format #, python-format
msgid "%s (module)" msgid "%s (module)"
msgstr "" msgstr ""
#: sphinx/domains/python.py:491 #: sphinx/domains/python.py:509
msgid "Python Module Index" msgid "Python Module Index"
msgstr "" msgstr ""
#: sphinx/domains/python.py:492 #: sphinx/domains/python.py:510
msgid "modules" msgid "modules"
msgstr "" msgstr ""
#: sphinx/domains/python.py:538 #: sphinx/domains/python.py:556
msgid "Deprecated" msgid "Deprecated"
msgstr "" msgstr ""
#: sphinx/domains/python.py:563 sphinx/locale/__init__.py:179 #: sphinx/domains/python.py:581 sphinx/locale/__init__.py:181
msgid "exception" msgid "exception"
msgstr "" msgstr ""
#: sphinx/domains/python.py:564 #: sphinx/domains/python.py:582
msgid "method" msgid "method"
msgstr "" msgstr ""
#: sphinx/domains/python.py:565 #: sphinx/domains/python.py:583
msgid "class method" msgid "class method"
msgstr "" msgstr ""
#: sphinx/domains/python.py:566 #: sphinx/domains/python.py:584
msgid "static method" msgid "static method"
msgstr "" msgstr ""
#: sphinx/domains/python.py:568 sphinx/locale/__init__.py:175 #: sphinx/domains/python.py:586 sphinx/locale/__init__.py:177
msgid "module" msgid "module"
msgstr "" msgstr ""
#: sphinx/domains/python.py:696 #: sphinx/domains/python.py:751
msgid " (deprecated)" msgid " (deprecated)"
msgstr "" msgstr ""
#: sphinx/domains/rst.py:53
#, python-format
msgid "%s (directive)"
msgstr ""
#: sphinx/domains/rst.py:55 #: sphinx/domains/rst.py:55
#, python-format #, python-format
msgid "%s (directive)"
msgstr ""
#: sphinx/domains/rst.py:57
#, python-format
msgid "%s (role)" msgid "%s (role)"
msgstr "" msgstr ""
#: sphinx/domains/rst.py:104 #: sphinx/domains/rst.py:106
msgid "directive" msgid "directive"
msgstr "" msgstr ""
#: sphinx/domains/rst.py:105 #: sphinx/domains/rst.py:107
msgid "role" msgid "role"
msgstr "" msgstr ""
#: sphinx/domains/std.py:69 sphinx/domains/std.py:85 #: sphinx/domains/std.py:72 sphinx/domains/std.py:88
#, python-format #, python-format
msgid "environment variable; %s" msgid "environment variable; %s"
msgstr "" msgstr ""
#: sphinx/domains/std.py:180 #: sphinx/domains/std.py:184
#, python-format #, python-format
msgid "%scommand line option; %s" msgid "%scommand line option; %s"
msgstr "" msgstr ""
#: sphinx/domains/std.py:457 #: sphinx/domains/std.py:442
msgid "glossary term" msgid "glossary term"
msgstr "" msgstr ""
#: sphinx/domains/std.py:458 #: sphinx/domains/std.py:443
msgid "grammar token" msgid "grammar token"
msgstr "" msgstr ""
#: sphinx/domains/std.py:459 #: sphinx/domains/std.py:444
msgid "reference label" msgid "reference label"
msgstr "" msgstr ""
#: sphinx/domains/std.py:461 #: sphinx/domains/std.py:446
msgid "environment variable" msgid "environment variable"
msgstr "" msgstr ""
#: sphinx/domains/std.py:462 #: sphinx/domains/std.py:447
msgid "program option" msgid "program option"
msgstr "" 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-single.html:57
#: sphinx/themes/basic/genindex-split.html:11 #: sphinx/themes/basic/genindex-split.html:11
#: sphinx/themes/basic/genindex-split.html:14 #: sphinx/themes/basic/genindex-split.html:14
#: sphinx/themes/basic/genindex.html:32 sphinx/themes/basic/genindex.html:35 #: 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/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" msgid "Index"
msgstr "" msgstr ""
#: sphinx/domains/std.py:493 #: sphinx/domains/std.py:478
msgid "Module Index" msgid "Module Index"
msgstr "" 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" msgid "Search Page"
msgstr "" msgstr ""
#: sphinx/ext/autodoc.py:1065 #: sphinx/ext/autodoc.py:1127
#, python-format #, python-format
msgid " Bases: %s" msgid " Bases: %s"
msgstr "" msgstr ""
#: sphinx/ext/autodoc.py:1113 #: sphinx/ext/autodoc.py:1175
#, python-format #, python-format
msgid "alias of :class:`%s`" msgid "alias of :class:`%s`"
msgstr "" msgstr ""
#: sphinx/ext/graphviz.py:297 sphinx/ext/graphviz.py:305 #: sphinx/ext/graphviz.py:293 sphinx/ext/graphviz.py:301
#, python-format #, python-format
msgid "[graph: %s]" msgid "[graph: %s]"
msgstr "" msgstr ""
#: sphinx/ext/graphviz.py:299 sphinx/ext/graphviz.py:307 #: sphinx/ext/graphviz.py:295 sphinx/ext/graphviz.py:303
msgid "[graph]" msgid "[graph]"
msgstr "" msgstr ""
#: sphinx/ext/intersphinx.py:244 #: sphinx/ext/intersphinx.py:257
#, python-format #, python-format
msgid "(in %s v%s)" msgid "(in %s v%s)"
msgstr "" msgstr ""
#: sphinx/ext/linkcode.py:66 sphinx/ext/viewcode.py:70 #: sphinx/ext/linkcode.py:69 sphinx/ext/viewcode.py:99
msgid "[source]" msgid "[source]"
msgstr "" msgstr ""
#: sphinx/ext/todo.py:42 #: sphinx/ext/todo.py:43
msgid "Todo" msgid "Todo"
msgstr "" msgstr ""
#: sphinx/ext/todo.py:112 #: sphinx/ext/todo.py:113
#, python-format #, python-format
msgid "(The <<original entry>> is located in %s, line %d.)" msgid "(The <<original entry>> is located in %s, line %d.)"
msgstr "" msgstr ""
#: sphinx/ext/todo.py:121 #: sphinx/ext/todo.py:122
msgid "original entry" msgid "original entry"
msgstr "" msgstr ""
#: sphinx/ext/viewcode.py:117 #: sphinx/ext/viewcode.py:158
msgid "[docs]" msgid "[docs]"
msgstr "" msgstr ""
#: sphinx/ext/viewcode.py:131 #: sphinx/ext/viewcode.py:172
msgid "Module code" msgid "Module code"
msgstr "" msgstr ""
#: sphinx/ext/viewcode.py:137 #: sphinx/ext/viewcode.py:178
#, python-format #, python-format
msgid "<h1>Source code for %s</h1>" msgid "<h1>Source code for %s</h1>"
msgstr "" msgstr ""
#: sphinx/ext/viewcode.py:164 #: sphinx/ext/viewcode.py:204
msgid "Overview: module code" msgid "Overview: module code"
msgstr "" msgstr ""
#: sphinx/ext/viewcode.py:165 #: sphinx/ext/viewcode.py:205
msgid "<h1>All modules for which code is available</h1>" msgid "<h1>All modules for which code is available</h1>"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:155 #: sphinx/locale/__init__.py:157
msgid "Attention" msgid "Attention"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:156 #: sphinx/locale/__init__.py:158
msgid "Caution" msgid "Caution"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:157 #: sphinx/locale/__init__.py:159
msgid "Danger" msgid "Danger"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:158 #: sphinx/locale/__init__.py:160
msgid "Error" msgid "Error"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:159 #: sphinx/locale/__init__.py:161
msgid "Hint" msgid "Hint"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:160 #: sphinx/locale/__init__.py:162
msgid "Important" msgid "Important"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:161 #: sphinx/locale/__init__.py:163
msgid "Note" msgid "Note"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:162 #: sphinx/locale/__init__.py:164
msgid "See also" msgid "See also"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:163 #: sphinx/locale/__init__.py:165
msgid "Tip" msgid "Tip"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:164 #: sphinx/locale/__init__.py:166
msgid "Warning" msgid "Warning"
msgstr "" 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 #: sphinx/locale/__init__.py:170
#, python-format #, 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" msgid "Deprecated since version %s"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:176 #: sphinx/locale/__init__.py:178
msgid "keyword" msgid "keyword"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:177 #: sphinx/locale/__init__.py:179
msgid "operator" msgid "operator"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:178 #: sphinx/locale/__init__.py:180
msgid "object" msgid "object"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:180 #: sphinx/locale/__init__.py:182
msgid "statement" msgid "statement"
msgstr "" msgstr ""
#: sphinx/locale/__init__.py:181 #: sphinx/locale/__init__.py:183
msgid "built-in function" msgid "built-in function"
msgstr "" msgstr ""
@ -540,21 +556,21 @@ msgstr ""
msgid "Table Of Contents" msgid "Table Of Contents"
msgstr "" 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/search.html:11 sphinx/themes/basic/search.html:23
#: sphinx/themes/basic/searchresults.html:10 #: sphinx/themes/basic/searchresults.html:10
msgid "Search" msgid "Search"
msgstr "" 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" msgid "Go"
msgstr "" 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." msgid "Enter search terms or a module, class or function name."
msgstr "" 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" msgid "Show Source"
msgstr "" msgstr ""
@ -716,7 +732,7 @@ msgstr ""
msgid "Quick search" msgid "Quick search"
msgstr "" msgstr ""
#: sphinx/themes/basic/sourcelink.html:11 #: sphinx/themes/basic/sourcelink.html:12
msgid "This Page" msgid "This Page"
msgstr "" msgstr ""
@ -748,12 +764,11 @@ msgstr ""
msgid "Other changes" msgid "Other changes"
msgstr "" msgstr ""
#: sphinx/themes/basic/static/doctools.js:142 sphinx/writers/html.py:542 #: sphinx/themes/basic/static/doctools.js:142 sphinx/writers/html.py:600
#: sphinx/writers/html.py:548
msgid "Permalink to this headline" msgid "Permalink to this headline"
msgstr "" 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" msgid "Permalink to this definition"
msgstr "" msgstr ""
@ -791,29 +806,34 @@ msgstr ""
msgid "Contents" msgid "Contents"
msgstr "" 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" msgid "Release"
msgstr "" msgstr ""
#: sphinx/writers/latex.py:624 sphinx/writers/manpage.py:178 #: sphinx/writers/latex.py:638 sphinx/writers/manpage.py:177
#: sphinx/writers/texinfo.py:612 #: sphinx/writers/texinfo.py:616
msgid "Footnotes" msgid "Footnotes"
msgstr "" msgstr ""
#: sphinx/writers/latex.py:709 #: sphinx/writers/latex.py:723
msgid "continued from previous page" msgid "continued from previous page"
msgstr "" msgstr ""
#: sphinx/writers/latex.py:715 #: sphinx/writers/latex.py:729
msgid "Continued on next page" msgid "Continued on next page"
msgstr "" msgstr ""
#: sphinx/writers/manpage.py:224 sphinx/writers/text.py:538 #: sphinx/writers/manpage.py:223 sphinx/writers/text.py:541
#, python-format #, python-format
msgid "[image: %s]" msgid "[image: %s]"
msgstr "" msgstr ""
#: sphinx/writers/manpage.py:225 sphinx/writers/text.py:539 #: sphinx/writers/manpage.py:224 sphinx/writers/text.py:542
msgid "[image]" msgid "[image]"
msgstr "" msgstr ""

View File

@ -97,7 +97,10 @@ h3:hover > a.headerlink,
h4:hover > a.headerlink, h4:hover > a.headerlink,
h5:hover > a.headerlink, h5:hover > a.headerlink,
h6: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; visibility: visible;
} }

View File

@ -197,7 +197,10 @@ h3:hover > a.headerlink,
h4:hover > a.headerlink, h4:hover > a.headerlink,
h5:hover > a.headerlink, h5:hover > a.headerlink,
h6: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; visibility: visible;
} }

View File

@ -250,7 +250,10 @@ h4:hover > a.headerlink,
h5:hover > a.headerlink, h5:hover > a.headerlink,
h6:hover > a.headerlink, h6:hover > a.headerlink,
dt: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; visibility: visible;
} }

View File

@ -102,12 +102,7 @@ class HTMLTranslator(BaseTranslator):
and node['ids'] and node['first']: and node['ids'] and node['first']:
self.body.append('<!--[%s]-->' % node['ids'][0]) self.body.append('<!--[%s]-->' % node['ids'][0])
def depart_desc_signature(self, node): def depart_desc_signature(self, node):
if node['ids'] and self.permalink_text and self.builder.add_permalinks: self.add_permalink_ref(node, 'definition')
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.body.append('</dt>\n') self.body.append('</dt>\n')
def visit_desc_addname(self, node): def visit_desc_addname(self, node):
@ -253,9 +248,11 @@ class HTMLTranslator(BaseTranslator):
def add_fignumber(self, node): def add_fignumber(self, node):
def append_fignumber(figtype, figure_id): def append_fignumber(figtype, figure_id):
if figure_id in self.builder.fignumbers.get(figtype, {}): 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, '') prefix = self.builder.config.numfig_prefix.get(figtype, '')
numbers = self.builder.fignumbers[figtype][figure_id] 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): if isinstance(node.parent, nodes.figure):
append_fignumber('figure', node.parent['ids'][0]) append_fignumber('figure', node.parent['ids'][0])
@ -264,6 +261,12 @@ class HTMLTranslator(BaseTranslator):
elif isinstance(node.parent, nodes.container): elif isinstance(node.parent, nodes.container):
append_fignumber('code-block', node.parent['ids'][0]) 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> # overwritten to avoid emitting empty <ul></ul>
def visit_bullet_list(self, node): def visit_bullet_list(self, node):
if len(node) == 1 and node[0].tagname == 'toctree': if len(node) == 1 and node[0].tagname == 'toctree':
@ -275,6 +278,8 @@ class HTMLTranslator(BaseTranslator):
BaseTranslator.visit_title(self, node) BaseTranslator.visit_title(self, node)
self.add_secnumber(node) self.add_secnumber(node)
self.add_fignumber(node) self.add_fignumber(node)
if isinstance(node.parent, nodes.table):
self.body.append(self.starttag(node, 'span', '', CLASS='caption-text'))
# overwritten # overwritten
def visit_literal_block(self, node): def visit_literal_block(self, node):
@ -307,8 +312,17 @@ class HTMLTranslator(BaseTranslator):
else: else:
BaseTranslator.visit_caption(self, node) BaseTranslator.visit_caption(self, node)
self.add_fignumber(node) self.add_fignumber(node)
self.body.append(self.starttag(node, 'span', '', CLASS='caption-text'))
def depart_caption(self, node): 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'): if isinstance(node.parent, nodes.container) and node.parent.get('literal_block'):
self.body.append('</div>\n') self.body.append('</div>\n')
else: else:
@ -575,20 +589,19 @@ class HTMLTranslator(BaseTranslator):
def depart_title(self, node): def depart_title(self, node):
close_tag = self.context[-1] close_tag = self.context[-1]
if (self.permalink_text and self.builder.add_permalinks and if (self.permalink_text and self.builder.add_permalinks and
node.parent.hasattr('ids') and node.parent['ids']): node.parent.hasattr('ids') and node.parent['ids']):
aname = node.parent['ids'][0]
# add permalink anchor # add permalink anchor
if close_tag.startswith('</h'): if close_tag.startswith('</h'):
self.body.append(u'<a class="headerlink" href="#%s" ' % aname + self.add_permalink_ref(node.parent, 'headline')
u'title="%s">%s</a>' % (
_('Permalink to this headline'),
self.permalink_text))
elif close_tag.startswith('</a></h'): elif close_tag.startswith('</a></h'):
self.body.append(u'</a><a class="headerlink" href="#%s" ' % self.body.append(u'</a><a class="headerlink" href="#%s" ' %
aname + node.parent['ids'][0] +
u'title="%s">%s' % ( u'title="%s">%s' % (
_('Permalink to this headline'), _('Permalink to this headline'),
self.permalink_text)) 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) BaseTranslator.depart_title(self, node)

View File

@ -305,8 +305,13 @@ class NslessParser(ET.XMLParser):
def check_xpath(etree, fname, path, check, be_found=True): def check_xpath(etree, fname, path, check, be_found=True):
nodes = list(etree.findall(path)) nodes = list(etree.findall(path))
assert nodes != [], ('did not find any node matching xpath ' if check is None:
'%r in file %s' % (path, fname)) 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__'): if hasattr(check, '__call__'):
check(nodes) check(nodes)
elif not check: elif not check:
@ -464,62 +469,32 @@ def test_numfig(app, status, warning):
expects = { expects = {
'index.html': [ 'index.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^should be Fig.1$', True), "span[@class='caption-number']", None, True),
(".//div[@class='figure']/p[@class='caption']", (".//table/caption/span[@class='caption-number']", None, True),
'^should be Fig.2$', True), (".//div[@class='code-block-caption']/"
(".//table/caption", '^should be Table 1$', True), "span[@class='caption-number']", None, 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),
], ],
'foo.html': [ 'foo.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^should be Fig.1.1$', True), "span[@class='caption-number']", None, True),
(".//div[@class='figure']/p[@class='caption']", (".//table/caption/span[@class='caption-number']", None, True),
'^should be Fig.1.2$', True), (".//div[@class='code-block-caption']/"
(".//div[@class='figure']/p[@class='caption']", "span[@class='caption-number']", None, True),
'^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),
], ],
'bar.html': [ 'bar.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^should be Fig.2.1$', True), "span[@class='caption-number']", None, True),
(".//div[@class='figure']/p[@class='caption']", (".//table/caption/span[@class='caption-number']", None, True),
'^should be Fig.2.3$', True), (".//div[@class='code-block-caption']/"
(".//div[@class='figure']/p[@class='caption']", "span[@class='caption-number']", None, True),
'^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),
], ],
'baz.html': [ 'baz.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^should be Fig.2.2$', True), "span[@class='caption-number']", None, True),
(".//table/caption", '^should be Table 2.2$', True), (".//table/caption/span[@class='caption-number']", None, True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^should be List 2.2$', True), "span[@class='caption-number']", None, True),
], ],
} }
@ -547,62 +522,72 @@ def test_numfig_without_numbered_toctree(app, status, warning):
expects = { expects = {
'index.html': [ 'index.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.9 should be Fig.1$', True), "span[@class='caption-number']", '^Fig. 9 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.10 should be Fig.2$', True), "span[@class='caption-number']", '^Fig. 10 $', True),
(".//table/caption", '^Table 9 should be Table 1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 10 should be Table 2$', True), '^Table 9 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^List 9 should be List 1$', True), '^Table 10 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^List 10 should be List 2$', True), "span[@class='caption-number']", '^Listing 9 $', True),
(".//div[@class='code-block-caption']/"
"span[@class='caption-number']", '^Listing 10 $', True),
], ],
'foo.html': [ 'foo.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.1 should be Fig.1.1$', True), "span[@class='caption-number']", '^Fig. 1 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.2 should be Fig.1.2$', True), "span[@class='caption-number']", '^Fig. 2 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.3 should be Fig.1.3$', True), "span[@class='caption-number']", '^Fig. 3 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.4 should be Fig.1.4$', True), "span[@class='caption-number']", '^Fig. 4 $', True),
(".//table/caption", '^Table 1 should be Table 1.1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 2 should be Table 1.2$', True), '^Table 1 $', True),
(".//table/caption", '^Table 3 should be Table 1.3$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 4 should be Table 1.4$', True), '^Table 2 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^List 1 should be List 1.1$', True), '^Table 3 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^List 2 should be List 1.2$', True), '^Table 4 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^List 3 should be List 1.3$', True), "span[@class='caption-number']", '^Listing 1 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^List 4 should be List 1.4$', True), "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': [ 'bar.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.5 should be Fig.2.1$', True), "span[@class='caption-number']", '^Fig. 5 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.7 should be Fig.2.3$', True), "span[@class='caption-number']", '^Fig. 7 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.8 should be Fig.2.4$', True), "span[@class='caption-number']", '^Fig. 8 $', True),
(".//table/caption", '^Table 5 should be Table 2.1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 7 should be Table 2.3$', True), '^Table 5 $', True),
(".//table/caption", '^Table 8 should be Table 2.4$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Table 7 $', True),
'^List 5 should be List 2.1$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Table 8 $', True),
'^List 7 should be List 2.3$', True), (".//div[@class='code-block-caption']/"
(".//div[@class='code-block-caption']", "span[@class='caption-number']", '^Listing 5 $', True),
'^List 8 should be List 2.4$', 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': [ 'baz.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.6 should be Fig.2.2$', True), "span[@class='caption-number']", '^Fig. 6 $', True),
(".//table/caption", '^Table 6 should be Table 2.2$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Table 6 $', True),
'^List 6 should be List 2.2$', True), (".//div[@class='code-block-caption']/"
"span[@class='caption-number']", '^Listing 6 $', True),
], ],
} }
@ -626,62 +611,72 @@ def test_numfig_with_numbered_toctree(app, status, warning):
expects = { expects = {
'index.html': [ 'index.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.1 should be Fig.1$', True), "span[@class='caption-number']", '^Fig. 1 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.2 should be Fig.2$', True), "span[@class='caption-number']", '^Fig. 2 $', True),
(".//table/caption", '^Table 1 should be Table 1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 2 should be Table 2$', True), '^Table 1 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^List 1 should be List 1$', True), '^Table 2 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^List 2 should be List 2$', True), "span[@class='caption-number']", '^Listing 1 $', True),
(".//div[@class='code-block-caption']/"
"span[@class='caption-number']", '^Listing 2 $', True),
], ],
'foo.html': [ 'foo.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.1.1 should be Fig.1.1$', True), "span[@class='caption-number']", '^Fig. 1.1 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.1.2 should be Fig.1.2$', True), "span[@class='caption-number']", '^Fig. 1.2 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.1.3 should be Fig.1.3$', True), "span[@class='caption-number']", '^Fig. 1.3 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.1.4 should be Fig.1.4$', True), "span[@class='caption-number']", '^Fig. 1.4 $', True),
(".//table/caption", '^Table 1.1 should be Table 1.1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 1.2 should be Table 1.2$', True), '^Table 1.1 $', True),
(".//table/caption", '^Table 1.3 should be Table 1.3$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 1.4 should be Table 1.4$', True), '^Table 1.2 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^List 1.1 should be List 1.1$', True), '^Table 1.3 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^List 1.2 should be List 1.2$', True), '^Table 1.4 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^List 1.3 should be List 1.3$', True), "span[@class='caption-number']", '^Listing 1.1 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^List 1.4 should be List 1.4$', True), "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': [ 'bar.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.2.1 should be Fig.2.1$', True), "span[@class='caption-number']", '^Fig. 2.1 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.2.3 should be Fig.2.3$', True), "span[@class='caption-number']", '^Fig. 2.3 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.2.4 should be Fig.2.4$', True), "span[@class='caption-number']", '^Fig. 2.4 $', True),
(".//table/caption", '^Table 2.1 should be Table 2.1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 2.3 should be Table 2.3$', True), '^Table 2.1 $', True),
(".//table/caption", '^Table 2.4 should be Table 2.4$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Table 2.3 $', True),
'^List 2.1 should be List 2.1$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Table 2.4 $', True),
'^List 2.3 should be List 2.3$', True), (".//div[@class='code-block-caption']/"
(".//div[@class='code-block-caption']", "span[@class='caption-number']", '^Listing 2.1 $', True),
'^List 2.4 should be List 2.4$', 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': [ 'baz.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.2.2 should be Fig.2.2$', True), "span[@class='caption-number']", '^Fig. 2.2 $', True),
(".//table/caption", '^Table 2.2 should be Table 2.2$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Table 2.2 $', True),
'^List 2.2 should be List 2.2$', True), (".//div[@class='code-block-caption']/"
"span[@class='caption-number']", '^Listing 2.2 $', True),
], ],
} }
@ -699,68 +694,81 @@ def test_numfig_with_numbered_toctree(app, status, warning):
@gen_with_app(buildername='html', testroot='numfig', @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): def test_numfig_with_prefix(app, status, warning):
app.builder.build_all() app.builder.build_all()
expects = { expects = {
'index.html': [ 'index.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Figure:1 should be Fig.1$', True), "span[@class='caption-number']", '^Figure:1 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Figure:2 should be Fig.2$', True), "span[@class='caption-number']", '^Figure:2 $', True),
(".//table/caption", '^Tab_1 should be Table 1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Tab_2 should be Table 2$', True), '^Tab_1 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^Code-1 should be List 1$', True), '^Tab_2 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^Code-2 should be List 2$', True), "span[@class='caption-number']", '^Code-1 $', True),
(".//div[@class='code-block-caption']/"
"span[@class='caption-number']", '^Code-2 $', True),
], ],
'foo.html': [ 'foo.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Figure:1.1 should be Fig.1.1$', True), "span[@class='caption-number']", '^Figure:1.1 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Figure:1.2 should be Fig.1.2$', True), "span[@class='caption-number']", '^Figure:1.2 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Figure:1.3 should be Fig.1.3$', True), "span[@class='caption-number']", '^Figure:1.3 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Figure:1.4 should be Fig.1.4$', True), "span[@class='caption-number']", '^Figure:1.4 $', True),
(".//table/caption", '^Tab_1.1 should be Table 1.1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Tab_1.2 should be Table 1.2$', True), '^Tab_1.1 $', True),
(".//table/caption", '^Tab_1.3 should be Table 1.3$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Tab_1.4 should be Table 1.4$', True), '^Tab_1.2 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^Code-1.1 should be List 1.1$', True), '^Tab_1.3 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^Code-1.2 should be List 1.2$', True), '^Tab_1.4 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^Code-1.3 should be List 1.3$', True), "span[@class='caption-number']", '^Code-1.1 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^Code-1.4 should be List 1.4$', True), "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': [ 'bar.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Figure:2.1 should be Fig.2.1$', True), "span[@class='caption-number']", '^Figure:2.1 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Figure:2.3 should be Fig.2.3$', True), "span[@class='caption-number']", '^Figure:2.3 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Figure:2.4 should be Fig.2.4$', True), "span[@class='caption-number']", '^Figure:2.4 $', True),
(".//table/caption", '^Tab_2.1 should be Table 2.1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Tab_2.3 should be Table 2.3$', True), '^Tab_2.1 $', True),
(".//table/caption", '^Tab_2.4 should be Table 2.4$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Tab_2.3 $', True),
'^Code-2.1 should be List 2.1$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Tab_2.4 $', True),
'^Code-2.3 should be List 2.3$', True), (".//div[@class='code-block-caption']/"
(".//div[@class='code-block-caption']", "span[@class='caption-number']", '^Code-2.1 $', True),
'^Code-2.4 should be List 2.4$', 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': [ 'baz.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Figure:2.2 should be Fig.2.2$', True), "span[@class='caption-number']", '^Figure:2.2 $', True),
(".//table/caption", '^Tab_2.2 should be Table 2.2$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Tab_2.2 $', True),
'^Code-2.2 should be List 2.2$', True), (".//div[@class='code-block-caption']/"
"span[@class='caption-number']", '^Code-2.2 $', True),
], ],
} }
@ -784,62 +792,72 @@ def test_numfig_with_secnum_depth(app, status, warning):
expects = { expects = {
'index.html': [ 'index.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.1 should be Fig.1$', True), "span[@class='caption-number']", '^Fig. 1 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.2 should be Fig.2$', True), "span[@class='caption-number']", '^Fig. 2 $', True),
(".//table/caption", '^Table 1 should be Table 1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 2 should be Table 2$', True), '^Table 1 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^List 1 should be List 1$', True), '^Table 2 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^List 2 should be List 2$', True), "span[@class='caption-number']", '^Listing 1 $', True),
(".//div[@class='code-block-caption']/"
"span[@class='caption-number']", '^Listing 2 $', True),
], ],
'foo.html': [ 'foo.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.1.1 should be Fig.1.1$', True), "span[@class='caption-number']", '^Fig. 1.1 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.1.1.1 should be Fig.1.2$', True), "span[@class='caption-number']", '^Fig. 1.1.1 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.1.1.2 should be Fig.1.3$', True), "span[@class='caption-number']", '^Fig. 1.1.2 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.1.2.1 should be Fig.1.4$', True), "span[@class='caption-number']", '^Fig. 1.2.1 $', True),
(".//table/caption", '^Table 1.1 should be Table 1.1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 1.1.1 should be Table 1.2$', True), '^Table 1.1 $', True),
(".//table/caption", '^Table 1.1.2 should be Table 1.3$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 1.2.1 should be Table 1.4$', True), '^Table 1.1.1 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^List 1.1 should be List 1.1$', True), '^Table 1.1.2 $', True),
(".//div[@class='code-block-caption']", (".//table/caption/span[@class='caption-number']",
'^List 1.1.1 should be List 1.2$', True), '^Table 1.2.1 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^List 1.1.2 should be List 1.3$', True), "span[@class='caption-number']", '^Listing 1.1 $', True),
(".//div[@class='code-block-caption']", (".//div[@class='code-block-caption']/"
'^List 1.2.1 should be List 1.4$', True), "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': [ 'bar.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.2.1.1 should be Fig.2.1$', True), "span[@class='caption-number']", '^Fig. 2.1.1 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.2.1.3 should be Fig.2.3$', True), "span[@class='caption-number']", '^Fig. 2.1.3 $', True),
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.2.2.1 should be Fig.2.4$', True), "span[@class='caption-number']", '^Fig. 2.2.1 $', True),
(".//table/caption", '^Table 2.1.1 should be Table 2.1$', True), (".//table/caption/span[@class='caption-number']",
(".//table/caption", '^Table 2.1.3 should be Table 2.3$', True), '^Table 2.1.1 $', True),
(".//table/caption", '^Table 2.2.1 should be Table 2.4$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Table 2.1.3 $', True),
'^List 2.1.1 should be List 2.1$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Table 2.2.1 $', True),
'^List 2.1.3 should be List 2.3$', True), (".//div[@class='code-block-caption']/"
(".//div[@class='code-block-caption']", "span[@class='caption-number']", '^Listing 2.1.1 $', True),
'^List 2.2.1 should be List 2.4$', 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': [ 'baz.html': [
(".//div[@class='figure']/p[@class='caption']", (".//div[@class='figure']/p[@class='caption']/"
'^Fig.2.1.2 should be Fig.2.2$', True), "span[@class='caption-number']", '^Fig. 2.1.2 $', True),
(".//table/caption", '^Table 2.1.2 should be Table 2.2$', True), (".//table/caption/span[@class='caption-number']",
(".//div[@class='code-block-caption']", '^Table 2.1.2 $', True),
'^List 2.1.2 should be List 2.2$', True), (".//div[@class='code-block-caption']/"
"span[@class='caption-number']", '^Listing 2.1.2 $', True),
], ],
} }

View File

@ -52,8 +52,11 @@ def test_code_block_dedent(app, status, warning):
@with_app('html', testroot='directive-code') @with_app('html', testroot='directive-code')
def test_code_block_caption_html(app, status, warning): def test_code_block_caption_html(app, status, warning):
app.builder.build(['caption']) app.builder.build(['caption'])
html = (app.outdir / 'caption.html').text() html = (app.outdir / 'caption.html').text(encoding='utf-8')
caption = '<div class="code-block-caption">caption <em>test</em> rb</div>' 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 assert caption in html
@ -172,10 +175,11 @@ def test_literal_include_lineno_match(app, status, warning):
@with_app('html', testroot='directive-code') @with_app('html', testroot='directive-code')
def test_literalinclude_caption_html(app, status, warning): def test_literalinclude_caption_html(app, status, warning):
app.builder.build('index') app.builder.build('index')
html = (app.outdir / 'caption.html').text() html = (app.outdir / 'caption.html').text(encoding='utf-8')
caption = ('<div class="code-block-caption">' caption = (u'<div class="code-block-caption">'
'caption <strong>test</strong> py' u'<span class="caption-text">caption <strong>test</strong> py'
'</div>') u'</span><a class="headerlink" href="#id2" '
u'title="Permalink to this code">\xb6</a></div>')
assert caption in html assert caption in html