mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #4066 from aszekMosek/patch-1
Avoiding indent after index entries in latex
This commit is contained in:
commit
59b4f32b38
@ -2008,6 +2008,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
logger.warning('unknown index entry type %s found', type)
|
||||
except ValueError as err:
|
||||
logger.warning(str(err))
|
||||
if not node.get('inline', True):
|
||||
self.body.append('\\ignorespaces ')
|
||||
raise nodes.SkipNode
|
||||
|
||||
def visit_raw(self, node):
|
||||
|
3
tests/roots/test-latex-index/conf.py
Normal file
3
tests/roots/test-latex-index/conf.py
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
master_doc = 'index'
|
12
tests/roots/test-latex-index/index.rst
Normal file
12
tests/roots/test-latex-index/index.rst
Normal file
@ -0,0 +1,12 @@
|
||||
test-latex-index
|
||||
================
|
||||
|
||||
A :index:`famous` :index:`equation`:
|
||||
|
||||
.. math::
|
||||
|
||||
E = m c^2
|
||||
|
||||
.. index:: Einstein, relativity
|
||||
|
||||
and some text.
|
@ -1020,3 +1020,12 @@ def test_latex_remote_images(app, status, warning):
|
||||
assert '\\sphinxincludegraphics{{NOT_EXIST}.PNG}' not in result
|
||||
assert ('WARNING: Could not fetch remote image: '
|
||||
'http://example.com/NOT_EXIST.PNG [404]' in warning.getvalue())
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex', testroot='latex-index')
|
||||
def test_latex_index(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
result = (app.outdir / 'Python.tex').text(encoding='utf8')
|
||||
assert 'A \\index{famous}famous \\index{equation}equation:\n' in result
|
||||
assert '\n\\index{Einstein}\\index{relativity}\\ignorespaces \nand' in result
|
||||
|
Loading…
Reference in New Issue
Block a user