mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
More generator tests.
This commit is contained in:
parent
7073a5bd2c
commit
2ba9ec3456
@ -80,39 +80,39 @@ def test_inline():
|
||||
# correct interpretation of code with whitespace
|
||||
_html = ('<p><tt class="docutils literal"><span class="pre">'
|
||||
'code</span> <span class="pre">sample</span></tt></p>')
|
||||
verify('``code sample``', _html, '\\code{code sample}')
|
||||
verify(':samp:`code sample`', _html, '\\samp{code sample}')
|
||||
yield verify, '``code sample``', _html, '\\code{code sample}'
|
||||
yield verify, ':samp:`code sample`', _html, '\\samp{code sample}'
|
||||
|
||||
# interpolation of braces in samp and file roles (HTML only)
|
||||
verify(':samp:`a{b}c`',
|
||||
yield (verify, ':samp:`a{b}c`',
|
||||
'<p><tt class="docutils literal"><span class="pre">a</span>'
|
||||
'<em><span class="pre">b</span></em>'
|
||||
'<span class="pre">c</span></tt></p>',
|
||||
'\\samp{abc}')
|
||||
|
||||
# interpolation of arrows in menuselection
|
||||
verify(':menuselection:`a --> b`',
|
||||
yield (verify, ':menuselection:`a --> b`',
|
||||
u'<p><em>a \N{TRIANGULAR BULLET} b</em></p>',
|
||||
'\\emph{a \\(\\rightarrow\\) b}')
|
||||
|
||||
# non-interpolation of dashes in option role
|
||||
verify_re(':option:`--with-option`',
|
||||
'<p><em( class="xref")?>--with-option</em></p>$',
|
||||
r'\\emph{\\texttt{-{-}with-option}}$')
|
||||
yield (verify_re, ':option:`--with-option`',
|
||||
'<p><em( class="xref")?>--with-option</em></p>$',
|
||||
r'\\emph{\\texttt{-{-}with-option}}$')
|
||||
|
||||
# verify smarty-pants quotes
|
||||
verify('"John"', '<p>“John”</p>', "``John''")
|
||||
yield verify, '"John"', '<p>“John”</p>', "``John''"
|
||||
# ... but not in literal text
|
||||
verify('``"John"``',
|
||||
yield (verify, '``"John"``',
|
||||
'<p><tt class="docutils literal"><span class="pre">'
|
||||
'"John"</span></tt></p>',
|
||||
'\\code{"John"}')
|
||||
|
||||
def test_latex_escaping():
|
||||
# correct escaping in normal mode
|
||||
verify(u'Γ\\\\∞$', None, ur'\(\Gamma\)\textbackslash{}\(\infty\)\$')
|
||||
yield verify, u'Γ\\\\∞$', None, ur'\(\Gamma\)\textbackslash{}\(\infty\)\$'
|
||||
# in verbatim code fragments
|
||||
verify(u'::\n\n @Γ\\∞$[]', None,
|
||||
yield (verify, u'::\n\n @Γ\\∞$[]', None,
|
||||
u'\\begin{Verbatim}[commandchars=@\\[\\]]\n'
|
||||
u'@PYGZat[]@(@Gamma@)\\@(@infty@)@$@PYGZlb[]@PYGZrb[]\n'
|
||||
u'\\end{Verbatim}')
|
||||
|
Loading…
Reference in New Issue
Block a user