Skip to content

Commit

Permalink
newline ambiguity resolved in reading raw_haml
Browse files Browse the repository at this point in the history
  • Loading branch information
boscoh committed Jun 21, 2013
1 parent beda2a0 commit f6a56cb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions hamlpy/nodes.py
Expand Up @@ -593,10 +593,14 @@ def _render(self):
if self.children:
if not _markdown_available:
raise NotAvailableError("Markdown is not available")

self.before = self.render_newlines()[1:]
indent_offset = len(self.children[0].spaces)
text = ''.join(''.join([c.spaces[indent_offset:], c.raw_haml.lstrip(), c.render_newlines()]) for c in self.children)
self.before += markdown(text)
lines = []
for c in self.children:
haml = c.raw_haml.lstrip()
if haml[-1] == '\n':
haml = haml[:-1]
lines.append(c.spaces[indent_offset:] + haml + c.render_newlines())
self.before += markdown( ''.join(lines))
else:
self.after = self.render_newlines()

0 comments on commit f6a56cb

Please sign in to comment.