Skip to content

Commit

Permalink
Fix sphinx-doc#4206: latex: reST label between paragraphs loses parag…
Browse files Browse the repository at this point in the history
…raph break
  • Loading branch information
tk0miya committed Nov 1, 2017
1 parent e03ec5b commit 29c62c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Features added
Bugs fixed
----------

* #4206: latex: reST label between paragraphs loses paragraph break

Testing
--------

Expand Down
6 changes: 6 additions & 0 deletions sphinx/writers/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,12 @@ def add_target(id):
# will be generated differently
if id.startswith('index-'):
return

# insert blank line, if the target follows a paragraph node
index = node.parent.index(node)
if index > 0 and isinstance(node.parent[index - 1], nodes.paragraph):
self.body.append('\n')

# do not generate \phantomsection in \section{}
anchor = not self.in_title
self.body.append(self.hypertarget(id, anchor=anchor))
Expand Down

0 comments on commit 29c62c6

Please sign in to comment.