mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Support `:emphasize-lines:` in PDF output (closes #1238)
This commit is contained in:
7
tests/roots/test-directive-code/emphasize.rst
Normal file
7
tests/roots/test-directive-code/emphasize.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
Literal Includes with Highlighted Lines
|
||||
=======================================
|
||||
|
||||
.. literalinclude:: target.py
|
||||
:language: python
|
||||
:emphasize-lines: 5-6, 13-15, 24-
|
||||
|
||||
@@ -27,6 +27,7 @@ header2
|
||||
|
||||
\endlastfoot
|
||||
|
||||
\fvset{hllines={, ,}}%
|
||||
\begin{sphinxVerbatimintable}[commandchars=\\\{\}]
|
||||
\PYG{n}{hello} \PYG{n}{world}
|
||||
\end{sphinxVerbatimintable}
|
||||
|
||||
@@ -10,6 +10,7 @@ header1
|
||||
header2
|
||||
\unskip}\relax \\
|
||||
\hline
|
||||
\fvset{hllines={, ,}}%
|
||||
\begin{sphinxVerbatimintable}[commandchars=\\\{\}]
|
||||
\PYG{n}{hello} \PYG{n}{world}
|
||||
\end{sphinxVerbatimintable}
|
||||
|
||||
@@ -349,6 +349,14 @@ def test_code_block_namedlink_latex(app, status, warning):
|
||||
assert link2 in latex
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex', testroot='directive-code')
|
||||
def test_code_block_emphasize_latex(app, status, warning):
|
||||
app.builder.build(['emphasize'])
|
||||
latex = (app.outdir / 'Python.tex').text(encoding='utf-8').replace('\r\n', '\n')
|
||||
includes = '\\fvset{hllines={, 5, 6, 13, 14, 15, 24, 25, 26, 27,}}%\n'
|
||||
assert includes in latex
|
||||
|
||||
|
||||
@pytest.mark.sphinx('xml', testroot='directive-code')
|
||||
def test_literal_include(app, status, warning):
|
||||
app.builder.build(['index'])
|
||||
|
||||
@@ -211,7 +211,8 @@ def get_verifier(verify, verify_re):
|
||||
'verify',
|
||||
u'::\n\n @Γ\\∞${}',
|
||||
None,
|
||||
(u'\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\}]\n'
|
||||
(u'\\fvset{hllines={, ,}}%\n'
|
||||
u'\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\}]\n'
|
||||
u'@\\(\\Gamma\\)\\PYGZbs{}\\(\\infty\\)\\PYGZdl{}\\PYGZob{}\\PYGZcb{}\n'
|
||||
u'\\end{sphinxVerbatim}'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user