Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render newlines as separate paragraphs #380

Merged
merged 1 commit into from
Jun 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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