mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch 'master' of github.com:sphinx-doc/sphinx
This commit is contained in:
commit
89cf56da1c
6
CHANGES
6
CHANGES
@ -56,6 +56,8 @@ Features added
|
||||
:confval:`suppress_warnings`.
|
||||
* #3377: latex: Add support for Docutils 0.13 ``:align:`` option for tables
|
||||
(but does not implement text flow around table).
|
||||
* latex: footnotes from inside tables are hyperlinked (except from captions or
|
||||
headers) (refs: #3422)
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
@ -82,6 +84,10 @@ Deprecated
|
||||
- ``BuildEnvironment.create_index()``
|
||||
|
||||
Please use ``sphinx.environment.adapters`` modules instead.
|
||||
* The LaTeX package ``footnote.sty`` will not be loaded anymore at Sphinx 1.7,
|
||||
as Sphinx's ``footnotehyper-sphinx.sty`` will define all macros rather than
|
||||
patch them. In particular the ``\makesavenoteenv`` macro is not in use anymore
|
||||
and its definition will be removed at Sphinx 1.7.
|
||||
|
||||
Release 1.5.3 (in development)
|
||||
==============================
|
||||
|
@ -1,4 +1,4 @@
|
||||
\begin{longtable}
|
||||
\begin{savenotes}\begin{longtable}
|
||||
<%- if table.align == 'center' -%>
|
||||
[c]
|
||||
<%- elif table.align == 'left' -%>
|
||||
@ -26,6 +26,8 @@
|
||||
\endfoot
|
||||
|
||||
\endlastfoot
|
||||
|
||||
<% if table.caption_footnotetexts -%>
|
||||
<%= ''.join(table.caption_footnotetexts) %>
|
||||
<% endif -%>
|
||||
<%= ''.join(table.body) %>
|
||||
\end{longtable}
|
||||
\end{longtable}\end{savenotes}
|
||||
|
@ -1,4 +1,4 @@
|
||||
\begingroup
|
||||
\begin{savenotes}
|
||||
<% if table.align -%>
|
||||
<%- if table.align == 'center' -%>
|
||||
\centering
|
||||
@ -17,10 +17,13 @@
|
||||
\begin{tabular}<%= table.get_colspec() -%>
|
||||
\hline
|
||||
<%= ''.join(table.header) %>
|
||||
<%- if table.caption_footnotetexts -%>
|
||||
<%= ''.join(table.caption_footnotetexts) -%>
|
||||
<%- endif -%>
|
||||
<%=- ''.join(table.body) %>
|
||||
\end{tabular}
|
||||
<%- if table.caption %>
|
||||
\end{threeparttable}
|
||||
<%- endif %>
|
||||
\par
|
||||
\endgroup
|
||||
\end{savenotes}
|
||||
|
@ -1,4 +1,4 @@
|
||||
\begingroup
|
||||
\begin{savenotes}
|
||||
<% if table.align -%>
|
||||
<%- if table.align == 'center' -%>
|
||||
\centering
|
||||
@ -17,10 +17,13 @@
|
||||
\begin{tabulary}{\linewidth}<%= table.get_colspec() -%>
|
||||
\hline
|
||||
<%= ''.join(table.header) %>
|
||||
<%- if table.caption_footnotetexts -%>
|
||||
<%= ''.join(table.caption_footnotetexts) -%>
|
||||
<%- endif -%>
|
||||
<%=- ''.join(table.body) %>
|
||||
\end{tabulary}
|
||||
<%- if table.caption %>
|
||||
\end{threeparttable}
|
||||
<%- endif %>
|
||||
\par
|
||||
\endgroup
|
||||
\end{savenotes}
|
||||
|
@ -1,6 +1,6 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{footnotehyper-sphinx}%
|
||||
[2017/01/16 v1.5.2 hyperref aware footnote.sty for sphinx (JFB)]
|
||||
[2017/02/15 v1.6 hyperref aware footnote.sty for sphinx (JFB)]
|
||||
%%
|
||||
%% Package: footnotehyper-sphinx
|
||||
%% Version: based on footnotehyper.sty v0.9f (2016/10/03)
|
||||
@ -10,13 +10,14 @@
|
||||
%% Differences from footnotehyper v0.9f (2016/10/03):
|
||||
%% 1. hyperref is assumed in use (with default hyperfootnotes=true),
|
||||
%% 2. no need to check if footnote.sty was loaded,
|
||||
%% 3. a special tabulary compatibility layer added, (partial but enough for
|
||||
%% Sphinx),
|
||||
%% 4. \sphinxfootnotemark, and use of \spx@opt@BeforeFootnote from sphinx.sty.
|
||||
%% Note: with \footnotemark[N]/\footnotetext[N] syntax, hyperref
|
||||
%% does not insert an hyperlink. This is _not_ improved here.
|
||||
%% 3. a tabulary compatibility layer added, (partial but enough for Sphinx),
|
||||
%% 4. \sphinxfootnotemark, and use of \spx@opt@BeforeFootnote from sphinx.sty,
|
||||
%% 5. use of \sphinxunactivateextrasandspace for parsed literals
|
||||
%%
|
||||
%% 6. macro \sphinxlongtablepatch
|
||||
%% 7. some import from future footnotehyper v0.99 (\FNH@fn@fntext)
|
||||
%% 8. deprecation of \makesavenoteenv.
|
||||
%% Future version of footnotehyper will not load footnote.sty and it will define
|
||||
%% all macros rather than adding hyperref awareness and fixing bugs.
|
||||
\DeclareOption*{\PackageWarning{footnotehyper}{Option `\CurrentOption' is unknown}}%
|
||||
\ProcessOptions\relax
|
||||
\let\FNH@@makefntext\@makefntext\let\@makefntext\@firstofone
|
||||
@ -31,6 +32,7 @@
|
||||
\let\fn@latex@@footnote \footnote % meaning of \footnote at end of preamble
|
||||
\let\fn@latex@@footnotetext\footnotetext
|
||||
\let\fn@fntext \FNH@hyper@fntext
|
||||
\let\savenotes \FNH@savenotes
|
||||
\let\spewnotes \FNH@hyper@spewnotes
|
||||
\let\endsavenotes\spewnotes
|
||||
\let\fn@endfntext\FNH@fixed@endfntext
|
||||
@ -39,13 +41,33 @@
|
||||
\let\endfootnote\fn@endfntext
|
||||
\let\endfootnotetext\endfootnote
|
||||
}%
|
||||
\def\FNH@hyper@fntext {%
|
||||
%% patch \savenotes for good functioning of \footnotetext[N]{..} syntax even
|
||||
%% though Sphinx now uses only environment form. In future, will simply copy
|
||||
%% over full footnotehyper v0.99.
|
||||
\toks@\expandafter\expandafter\expandafter{\expandafter\@gobble\savenotes}%
|
||||
\edef\FNH@savenotes{\begingroup
|
||||
\unexpanded{\if@savingnotes\else\let\H@@mpfootnotetext\FNH@fn@fntext\fi}%
|
||||
\the\toks@ }%
|
||||
\def\FNH@fn@fntext {\FNH@fntext\FNH@fn@fntext@i}%
|
||||
\def\FNH@hyper@fntext{\FNH@fntext\FNH@hyper@fntext@i}%
|
||||
\def\FNH@fntext #1{%
|
||||
%% amsmath compatibility
|
||||
\ifx\ifmeasuring@\undefined\expandafter\@secondoftwo
|
||||
\else\expandafter\@firstofone\fi
|
||||
{\ifmeasuring@\expandafter\@gobbletwo\else\expandafter\@firstofone\fi}%
|
||||
%% partial tabulary compatibility, [N] must be used, but Sphinx does it
|
||||
{\ifx\equation$\expandafter\@gobbletwo\fi\FNH@hyper@fntext@i }%$
|
||||
{\ifx\equation$\expandafter\@gobbletwo\fi #1}%$
|
||||
}%
|
||||
%% footnote.sty's replacement for \@footnotetext
|
||||
\long\def\FNH@fn@fntext@i #1{\global\setbox\fn@notes\vbox
|
||||
{\unvbox\fn@notes
|
||||
\fn@startnote
|
||||
\@makefntext
|
||||
{\rule\z@\footnotesep\ignorespaces
|
||||
#1%
|
||||
\@finalstrut\strutbox
|
||||
}%
|
||||
\fn@endnote }%
|
||||
}%
|
||||
\long\def\FNH@hyper@fntext@i #1{\global\setbox\fn@notes\vbox
|
||||
{\unvbox\fn@notes
|
||||
@ -62,7 +84,8 @@
|
||||
\let\@currentHref\Hy@footnote@currentHref
|
||||
\let\@currentlabelname\@empty
|
||||
#1}%
|
||||
\@finalstrut\strutbox }%
|
||||
\@finalstrut\strutbox
|
||||
}%
|
||||
\fn@endnote }%
|
||||
}%
|
||||
\def\FNH@hyper@spewnotes {\endgroup
|
||||
@ -87,7 +110,7 @@
|
||||
\def\FNH@endfntext@nolink {\begingroup
|
||||
\let\@makefntext\@empty\let\@finalstrut\@gobble
|
||||
\let\rule\@gobbletwo
|
||||
\if@savingnotes\expandafter\fn@fntext\else\expandafter\H@@footnotetext\fi
|
||||
\if@savingnotes\expandafter\FNH@fn@fntext\else\expandafter\H@@footnotetext\fi
|
||||
{\unvbox\z@}\endgroup
|
||||
}%
|
||||
%% \spx@opt@BeforeFootnote is defined in sphinx.sty
|
||||
@ -139,12 +162,13 @@
|
||||
\def\FNH@check@c #11.2!3?4,#2#3\relax
|
||||
{\ifx\FNH@check@c#2\expandafter\@gobble\fi\FNH@bad@footnote@env}%
|
||||
\def\FNH@bad@footnote@env
|
||||
{\PackageWarningNoLine{footnotehyper}%
|
||||
{The footnote environment from package footnote^^J
|
||||
will be dysfunctional, sorry (not my fault...). You may try to make a bug^^J
|
||||
report at https://github.com/sphinx-doc/sphinx including the next lines:}%
|
||||
{\PackageWarningNoLine{footnotehyper-sphinx}%
|
||||
{Footnotes will be sub-optimal, sorry. This is due to the class or^^J
|
||||
some package modifying macro \string\@makefntext.^^J
|
||||
You can try to report this incompatibility at^^J
|
||||
https://github.com/sphinx-doc/sphinx with this info:}%
|
||||
\typeout{\meaning\@makefntext}%
|
||||
\let\fn@prefntext\@empty\let\fn@postfntext\@empty
|
||||
\let\fn@prefntext\@empty\let\fn@postfntext\@empty
|
||||
}%
|
||||
%% \sphinxfootnotemark: usable in section titles and silently removed from
|
||||
%% TOCs.
|
||||
@ -153,6 +177,19 @@
|
||||
\protect\footnotemark[#1]\fi}%
|
||||
\AtBeginDocument % let hyperref less complain
|
||||
{\pdfstringdefDisableCommands{\def\sphinxfootnotemark [#1]{}}}%
|
||||
% to obtain hyperlinked footnotes in longtable environment we must replace
|
||||
% hyperref's patch of longtable's patch of \@footnotetext by our own
|
||||
\def\sphinxlongtablepatch {% only for longtable wrapped in "savenotes"
|
||||
\let\LT@p@ftntext\FNH@hyper@fntext
|
||||
}%
|
||||
%% deprecate \makesavenoteenv
|
||||
\def\makesavenoteenv{%
|
||||
\AtEndDocument{\PackageWarning{footnotehyper-sphinx}
|
||||
{^^J^^J^^J!\@spaces**** SPHINX DEPRECATION WARNING ****^^J!^^J%
|
||||
!\@spaces\string\makesavenoteenv\space from footnote.sty is deprecated^^J%
|
||||
!\@spaces and will be removed at Sphinx 1.7 !^^J^^J^^J}}%
|
||||
\@ifnextchar[\fn@msne@ii\fn@msne@i%]
|
||||
}%
|
||||
\endinput
|
||||
%%
|
||||
%% End of file `footnotehyper-sphinx.sty'.
|
||||
|
@ -59,10 +59,7 @@
|
||||
% For hyperlinked footnotes in tables; also for gathering footnotes from
|
||||
% topic and warning blocks. Also to allow code-blocks in footnotes.
|
||||
\RequirePackage{footnotehyper-sphinx}
|
||||
\makesavenoteenv{tabulary}
|
||||
\makesavenoteenv{tabular}
|
||||
\makesavenoteenv{threeparttable}
|
||||
% (longtable is hyperref compatible and needs no special treatment here.)
|
||||
\AtBeginDocument{\@ifpackageloaded{longtable}{\sphinxlongtablepatch}{}}%
|
||||
% For the H specifier. Do not \restylefloat{figure}, it breaks Sphinx code
|
||||
% for allowing figures in tables.
|
||||
\RequirePackage{float}
|
||||
|
@ -327,6 +327,8 @@ class Table(object):
|
||||
self.has_problematic = False
|
||||
self.has_verbatim = False
|
||||
self.caption = None # type: List[unicode]
|
||||
self.caption_footnotetexts = [] # type: List[unicode]
|
||||
self.header_footnotetexts = [] # type: List[unicode]
|
||||
|
||||
# current position
|
||||
self.col = 0
|
||||
@ -1052,6 +1054,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
elif isinstance(parent, nodes.table):
|
||||
# Redirect body output until title is finished.
|
||||
self.pushbody([])
|
||||
self.restrict_footnote(node)
|
||||
else:
|
||||
logger.warning('encountered title node not in section, topic, table, '
|
||||
'admonition or sidebar',
|
||||
@ -1065,9 +1068,14 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
self.in_title = 0
|
||||
if isinstance(node.parent, nodes.table):
|
||||
self.table.caption = self.popbody()
|
||||
# temporary buffer for footnotes from caption
|
||||
self.pushbody([])
|
||||
self.unrestrict_footnote(node)
|
||||
# the footnote texts from caption
|
||||
self.table.caption_footnotetexts = self.popbody()
|
||||
else:
|
||||
self.body.append(self.context.pop())
|
||||
self.unrestrict_footnote(node)
|
||||
self.unrestrict_footnote(node)
|
||||
|
||||
def visit_subtitle(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
@ -1262,7 +1270,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
def depart_collected_footnote(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
if 'footnotetext' in node:
|
||||
self.body.append('%\n\\end{footnotetext}')
|
||||
# the \ignorespaces in particular for after table header use
|
||||
self.body.append('%\n\\end{footnotetext}\\ignorespaces ')
|
||||
else:
|
||||
if self.in_parsed_literal:
|
||||
self.body.append('\\end{footnote}')
|
||||
@ -1293,7 +1302,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
if self.next_table_colspec:
|
||||
self.table.colspec = '{%s}\n' % self.next_table_colspec
|
||||
self.next_table_colspec = None
|
||||
self.restrict_footnote(node)
|
||||
|
||||
def depart_table(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
@ -1310,7 +1318,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
self.body.append(table)
|
||||
self.body.append("\n")
|
||||
|
||||
self.unrestrict_footnote(node)
|
||||
self.table = None
|
||||
|
||||
def visit_colspec(self, node):
|
||||
@ -1333,15 +1340,27 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
|
||||
def visit_thead(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
self.pushbody(self.table.header) # Redirect head output until header is finished.
|
||||
# Redirect head output until header is finished.
|
||||
self.pushbody(self.table.header)
|
||||
# footnotes in longtable header must be restricted
|
||||
self.restrict_footnote(node)
|
||||
|
||||
def depart_thead(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
self.popbody()
|
||||
# temporary buffer for footnotes from table header
|
||||
self.pushbody([])
|
||||
self.unrestrict_footnote(node)
|
||||
# the footnote texts from header
|
||||
self.table.header_footnotetexts = self.popbody()
|
||||
|
||||
def visit_tbody(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
self.pushbody(self.table.body) # Redirect body output until table is finished.
|
||||
# Redirect body output until table is finished.
|
||||
self.pushbody(self.table.body)
|
||||
# insert footnotetexts from header at start of body (due to longtable)
|
||||
# those from caption are handled by templates (to allow caption at foot)
|
||||
self.body.extend(self.table.header_footnotetexts)
|
||||
|
||||
def depart_tbody(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
@ -2244,7 +2263,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
|
||||
def visit_line(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
self.body.append(r'\item[] ')
|
||||
self.body.append('\\item[] ')
|
||||
|
||||
def depart_line(self, node):
|
||||
# type: (nodes.Node) -> None
|
||||
|
@ -33,7 +33,7 @@ footnotes in table
|
||||
* - name [#]_
|
||||
- desription
|
||||
* - VIDIOC_CROPCAP
|
||||
- Information about VIDIOC_CROPCAP
|
||||
- Information about VIDIOC_CROPCAP [#]_
|
||||
|
||||
footenotes
|
||||
--------------------
|
||||
@ -50,6 +50,8 @@ footenotes
|
||||
|
||||
.. [bar] cite
|
||||
|
||||
.. [#] footnotes in table caption
|
||||
.. [#] footnote in table caption
|
||||
|
||||
.. [#] footnotes in table
|
||||
.. [#] footnote in table header
|
||||
|
||||
.. [#] footnote in table not in header
|
||||
|
@ -415,18 +415,19 @@ def test_static_output(app):
|
||||
(".//li/a", "double"),
|
||||
],
|
||||
'footnote.html': [
|
||||
(".//a[@class='footnote-reference'][@href='#id7'][@id='id1']", r"\[1\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id8'][@id='id2']", r"\[2\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id8'][@id='id1']", r"\[1\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id9'][@id='id2']", r"\[2\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#foo'][@id='id3']", r"\[3\]"),
|
||||
(".//a[@class='reference internal'][@href='#bar'][@id='id4']", r"\[bar\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id9'][@id='id5']", r"\[4\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id10'][@id='id6']", r"\[5\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id10'][@id='id5']", r"\[4\]"),
|
||||
(".//a[@class='footnote-reference'][@href='#id11'][@id='id6']", r"\[5\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id1']", r"\[1\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id2']", r"\[2\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id3']", r"\[3\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id4']", r"\[bar\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id5']", r"\[4\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id6']", r"\[5\]"),
|
||||
(".//a[@class='fn-backref'][@href='#id7']", r"\[6\]"),
|
||||
],
|
||||
'otherext.html': [
|
||||
(".//h1", "Generated section"),
|
||||
|
@ -480,12 +480,15 @@ def test_footnote(app, status, warning):
|
||||
'{\\phantomsection\\label{\\detokenize{footnote:bar}} '
|
||||
'\ncite\n}') in result
|
||||
assert '\\caption{Table caption \\sphinxfootnotemark[4]' in result
|
||||
assert 'name \\sphinxfootnotemark[5]' in result
|
||||
assert ('\\end{threeparttable}\n\\par\n\\endgroup\n%\n'
|
||||
'\\begin{footnotetext}[4]\\sphinxAtStartFootnote\n'
|
||||
'footnotes in table caption\n%\n\\end{footnotetext}%\n'
|
||||
assert ('\\hline%\n\\begin{footnotetext}[4]\\sphinxAtStartFootnote\n'
|
||||
'footnote in table caption\n%\n\\end{footnotetext}\\ignorespaces %\n'
|
||||
'\\begin{footnotetext}[5]\\sphinxAtStartFootnote\n'
|
||||
'footnotes in table\n%\n\\end{footnotetext}') in result
|
||||
'footnote in table header\n%\n\\end{footnotetext}\\ignorespaces \n'
|
||||
'VIDIOC\\_CROPCAP\n&\n') in result
|
||||
assert ('Information about VIDIOC\\_CROPCAP %\n'
|
||||
'\\begin{footnote}[6]\\sphinxAtStartFootnote\n'
|
||||
'footnote in table not in header\n%\n\\end{footnote}\n\\\\\n\hline\n'
|
||||
'\\end{tabulary}\n\\end{threeparttable}\n\\par\n\\end{savenotes}\n') in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex', testroot='footnotes')
|
||||
@ -514,14 +517,18 @@ def test_reference_in_caption_and_codeblock_in_footnote(app, status, warning):
|
||||
'in caption of normal table}\\label{\\detokenize{index:id28}}') in result
|
||||
assert ('\\caption{footnote \\sphinxfootnotemark[8] '
|
||||
'in caption \\sphinxfootnotemark[9] of longtable}') in result
|
||||
assert ('\\end{longtable}\n%\n\\begin{footnotetext}[8]'
|
||||
'\\sphinxAtStartFootnote\n'
|
||||
'Foot note in longtable\n%\n\\end{footnotetext}' in result)
|
||||
assert ('\\endlastfoot\n%\n\\begin{footnotetext}[8]\\sphinxAtStartFootnote\n'
|
||||
'Foot note in longtable\n%\n\\end{footnotetext}\\ignorespaces %\n'
|
||||
'\\begin{footnotetext}[9]\\sphinxAtStartFootnote\n'
|
||||
'Second footnote in caption of longtable\n') in result
|
||||
assert ('This is a reference to the code-block in the footnote:\n'
|
||||
'{\\hyperref[\\detokenize{index:codeblockinfootnote}]'
|
||||
'{\\sphinxcrossref{\\DUrole{std,std-ref}{I am in a footnote}}}}') in result
|
||||
assert ('&\nThis is one more footnote with some code in it '
|
||||
'\\sphinxfootnotemark[10].\n\\\\') in result
|
||||
assert ('&\nThis is one more footnote with some code in it %\n'
|
||||
'\\begin{footnote}[10]\\sphinxAtStartFootnote\n'
|
||||
'Third footnote in longtable\n') in result
|
||||
assert ('\\end{sphinxVerbatim}\n\\let\\sphinxVerbatimTitle\\empty\n'
|
||||
'\\let\\sphinxLiteralBlockLabel\\empty\n%\n\\end{footnote}.\n') in result
|
||||
assert '\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\}]' in result
|
||||
|
||||
|
||||
@ -561,7 +568,8 @@ def test_latex_show_urls_is_inline(app, status, warning):
|
||||
'(http://sphinx-doc.org/)}] \\leavevmode\nDescription' in result)
|
||||
assert ('\\item[{Footnote in term \\sphinxfootnotemark[5]}] '
|
||||
'\\leavevmode%\n\\begin{footnotetext}[5]\\sphinxAtStartFootnote\n'
|
||||
'Footnote in term\n%\n\\end{footnotetext}\nDescription') in result
|
||||
'Footnote in term\n%\n\\end{footnotetext}\\ignorespaces \n'
|
||||
'Description') in result
|
||||
assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist} '
|
||||
'(http://sphinx-doc.org/)}] \\leavevmode\nDescription') in result
|
||||
assert '\\url{https://github.com/sphinx-doc/sphinx}\n' in result
|
||||
@ -607,15 +615,16 @@ def test_latex_show_urls_is_footnote(app, status, warning):
|
||||
'{URL in term}\\sphinxfootnotemark[8]}] '
|
||||
'\\leavevmode%\n\\begin{footnotetext}[8]\\sphinxAtStartFootnote\n'
|
||||
'\\nolinkurl{http://sphinx-doc.org/}\n%\n'
|
||||
'\\end{footnotetext}\nDescription') in result
|
||||
'\\end{footnotetext}\\ignorespaces \nDescription') in result
|
||||
assert ('\\item[{Footnote in term \\sphinxfootnotemark[10]}] '
|
||||
'\\leavevmode%\n\\begin{footnotetext}[10]\\sphinxAtStartFootnote\n'
|
||||
'Footnote in term\n%\n\\end{footnotetext}\nDescription') in result
|
||||
'Footnote in term\n%\n\\end{footnotetext}\\ignorespaces \n'
|
||||
'Description') in result
|
||||
assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}'
|
||||
'\\sphinxfootnotemark[9]}] '
|
||||
'\\leavevmode%\n\\begin{footnotetext}[9]\\sphinxAtStartFootnote\n'
|
||||
'\\nolinkurl{http://sphinx-doc.org/}\n%\n'
|
||||
'\\end{footnotetext}\nDescription') in result
|
||||
'\\end{footnotetext}\\ignorespaces \nDescription') in result
|
||||
assert ('\\url{https://github.com/sphinx-doc/sphinx}\n' in result)
|
||||
assert ('\\href{mailto:sphinx-dev@googlegroups.com}'
|
||||
'{sphinx-dev@googlegroups.com}\n') in result
|
||||
@ -655,7 +664,8 @@ def test_latex_show_urls_is_no(app, status, warning):
|
||||
'\\leavevmode\nDescription') in result
|
||||
assert ('\\item[{Footnote in term \\sphinxfootnotemark[5]}] '
|
||||
'\\leavevmode%\n\\begin{footnotetext}[5]\\sphinxAtStartFootnote\n'
|
||||
'Footnote in term\n%\n\\end{footnotetext}\nDescription') in result
|
||||
'Footnote in term\n%\n\\end{footnotetext}\\ignorespaces \n'
|
||||
'Description') in result
|
||||
assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}}] '
|
||||
'\\leavevmode\nDescription') in result
|
||||
assert ('\\url{https://github.com/sphinx-doc/sphinx}\n' in result)
|
||||
@ -831,32 +841,33 @@ def test_latex_table_tabulars(app, status, warning):
|
||||
|
||||
# simple_table
|
||||
table = tables['simple table']
|
||||
assert ('\\begingroup\n\\centering\n\\begin{tabulary}{\\linewidth}{|L|L|}' in table)
|
||||
assert ('\\begin{savenotes}\n\\centering\n'
|
||||
'\\begin{tabulary}{\\linewidth}{|L|L|}' in table)
|
||||
assert ('\\hline\n'
|
||||
'\\sphinxstylethead{\\relax \nheader1\n\\unskip}\\relax &'
|
||||
'\\sphinxstylethead{\\relax \nheader2\n\\unskip}\\relax' in table)
|
||||
assert ('\\hline\ncell1-1\n&\ncell1-2\n\\\\' in table)
|
||||
assert ('\\hline\ncell2-1\n&\ncell2-2\n\\\\' in table)
|
||||
assert ('\\hline\ncell3-1\n&\ncell3-2\n\\\\' in table)
|
||||
assert ('\\hline\n\\end{tabulary}\n\\par\n\\endgroup' in table)
|
||||
assert ('\\hline\n\\end{tabulary}\n\\par\n\\end{savenotes}' in table)
|
||||
|
||||
# table having :widths: option
|
||||
table = tables['table having :widths: option']
|
||||
assert ('\\begingroup\n\\centering\n'
|
||||
assert ('\\begin{savenotes}\n\\centering\n'
|
||||
'\\begin{tabular}{|\\X{30}{100}|\\X{70}{100}|}' in table)
|
||||
assert ('\\hline\n\\end{tabular}\n\\par\n\\endgroup' in table)
|
||||
assert ('\\hline\n\\end{tabular}\n\\par\n\\end{savenotes}' in table)
|
||||
|
||||
# table having :align: option (tabulary)
|
||||
table = tables['table having :align: option (tabulary)']
|
||||
assert ('\\begingroup\n\\raggedleft\n'
|
||||
assert ('\\begin{savenotes}\n\\raggedleft\n'
|
||||
'\\begin{tabulary}{\\linewidth}{|L|L|}\n' in table)
|
||||
assert ('\\hline\n\\end{tabulary}\n\\par\n\\endgroup' in table)
|
||||
assert ('\\hline\n\\end{tabulary}\n\\par\n\\end{savenotes}' in table)
|
||||
|
||||
# table having :align: option (tabular)
|
||||
table = tables['table having :align: option (tabular)']
|
||||
assert ('\\begingroup\n\\raggedright\n'
|
||||
assert ('\\begin{savenotes}\n\\raggedright\n'
|
||||
'\\begin{tabular}{|\\X{30}{100}|\\X{70}{100}|}\n' in table)
|
||||
assert ('\\hline\n\\end{tabular}\n\\par\n\\endgroup' in table)
|
||||
assert ('\\hline\n\\end{tabular}\n\\par\n\\end{savenotes}' in table)
|
||||
|
||||
# table with tabularcolumn
|
||||
table = tables['table with tabularcolumn']
|
||||
@ -864,12 +875,12 @@ def test_latex_table_tabulars(app, status, warning):
|
||||
|
||||
# table having caption
|
||||
table = tables['table having caption']
|
||||
assert ('\\begingroup\n\\centering\n'
|
||||
assert ('\\begin{savenotes}\n\\centering\n'
|
||||
'\\begin{threeparttable}\n\\capstart\\caption{caption for table}'
|
||||
'\\label{\\detokenize{tabular:id1}}' in table)
|
||||
assert ('\\begin{tabulary}{\\linewidth}{|L|L|}' in table)
|
||||
assert ('\\hline\n\\end{tabulary}\n\\end{threeparttable}'
|
||||
'\n\\par\n\\endgroup' in table)
|
||||
'\n\\par\n\\end{savenotes}' in table)
|
||||
|
||||
# table having verbatim
|
||||
table = tables['table having verbatim']
|
||||
@ -898,7 +909,7 @@ def test_latex_table_longtable(app, status, warning):
|
||||
|
||||
# longtable
|
||||
table = tables['longtable']
|
||||
assert ('\\begin{longtable}{|l|l|}\n\\hline' in table)
|
||||
assert ('\\begin{savenotes}\\begin{longtable}{|l|l|}\n\\hline' in table)
|
||||
assert ('\\hline\n'
|
||||
'\\sphinxstylethead{\\relax \nheader1\n\\unskip}\\relax &'
|
||||
'\\sphinxstylethead{\\relax \nheader2\n\\unskip}\\relax \\\\\n'
|
||||
@ -915,7 +926,7 @@ def test_latex_table_longtable(app, status, warning):
|
||||
assert ('\ncell1-1\n&\ncell1-2\n\\\\' in table)
|
||||
assert ('\\hline\ncell2-1\n&\ncell2-2\n\\\\' in table)
|
||||
assert ('\\hline\ncell3-1\n&\ncell3-2\n\\\\' in table)
|
||||
assert ('\\hline\n\\end{longtable}' in table)
|
||||
assert ('\\hline\n\\end{longtable}\\end{savenotes}' in table)
|
||||
|
||||
# longtable having :widths: option
|
||||
table = tables['longtable having :widths: option']
|
||||
|
Loading…
Reference in New Issue
Block a user