Skip to content

Commit

Permalink
Merge pull request #380 from praetorian20/master
Browse files Browse the repository at this point in the history
Render newlines as separate paragraphs
  • Loading branch information
vermeeren authored Jun 1, 2018
2 parents e5e1946 + a64809c commit 1206eea
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,16 @@ def visit_unicode(self, node):
# We counter that second issue slightly by allowing through single white spaces
#
if node.strip():
if "<linebreak>" not in node:
return [self.node_factory.Text(node)]
# Render lines as paragraphs because RST doesn't have line breaks.
return [self.node_factory.paragraph('', '', self.node_factory.Text(line))
for line in node.split("<linebreak>")]
delimiter = None
if "<linebreak>" in node:
delimiter = "<linebreak>"
elif "\n" in node:
delimiter = "\n"
if delimiter:
# Render lines as paragraphs because RST doesn't have line breaks.
return [self.node_factory.paragraph('', '', self.node_factory.Text(line))
for line in node.split(delimiter) if line.strip()]
return [self.node_factory.Text(node)]
if node == six.u(" "):
return [self.node_factory.Text(node)]
return []
Expand Down

0 comments on commit 1206eea

Please sign in to comment.