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

View File

@ -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 = {}

View File

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

View File

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

View File

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

View File

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

View File

@ -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):
@ -253,9 +248,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])
@ -264,6 +261,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':
@ -275,6 +278,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):
@ -307,8 +312,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:
@ -575,20 +589,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)

View File

@ -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:
@ -464,62 +469,32 @@ def test_numfig(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),
],
'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),
],
}
@ -547,62 +522,72 @@ 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),
(".//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),
],
'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),
],
}
@ -626,62 +611,72 @@ 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),
(".//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),
],
'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),
],
}
@ -699,68 +694,81 @@ 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),
],
'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),
],
}
@ -784,62 +792,72 @@ 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),
(".//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),
],
'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),
],
}

View File

@ -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
@ -172,10 +175,11 @@ def test_literal_include_lineno_match(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