[svn r38140] Empty literal blocks are not allowed: removing them.
--HG-- branch : trunk
This commit is contained in:
parent
938680d50f
commit
fd0cbdb95a
|
@ -133,7 +133,8 @@ class Rest(AbstractNode):
|
||||||
for child in self.children:
|
for child in self.children:
|
||||||
outcome.append(child.text())
|
outcome.append(child.text())
|
||||||
|
|
||||||
text = self.sep.join(outcome) + "\n" # trailing newline
|
# always a trailing newline
|
||||||
|
text = self.sep.join([i for i in outcome if i]) + "\n"
|
||||||
return text + self.render_links()
|
return text + self.render_links()
|
||||||
|
|
||||||
class Transition(AbstractNode):
|
class Transition(AbstractNode):
|
||||||
|
@ -251,6 +252,8 @@ class LiteralBlock(AbstractText):
|
||||||
start = '::\n\n'
|
start = '::\n\n'
|
||||||
|
|
||||||
def text(self):
|
def text(self):
|
||||||
|
if not self._text.strip():
|
||||||
|
return ''
|
||||||
text = self.escape(self._text).split('\n')
|
text = self.escape(self._text).split('\n')
|
||||||
for i, line in py.builtin.enumerate(text):
|
for i, line in py.builtin.enumerate(text):
|
||||||
if line.strip():
|
if line.strip():
|
||||||
|
|
|
@ -175,6 +175,17 @@ Paragraph
|
||||||
assert txt == expected
|
assert txt == expected
|
||||||
checkrest(txt)
|
checkrest(txt)
|
||||||
|
|
||||||
|
def test_blockquote_empty():
|
||||||
|
expected = """\
|
||||||
|
Foo
|
||||||
|
|
||||||
|
Bar
|
||||||
|
"""
|
||||||
|
txt = Rest(Paragraph('Foo'), LiteralBlock(''), Paragraph('Bar')).text()
|
||||||
|
print repr(txt)
|
||||||
|
assert txt == expected
|
||||||
|
checkrest(txt)
|
||||||
|
|
||||||
def test_title():
|
def test_title():
|
||||||
txt = Title(Text("Some title"), belowchar="=").text()
|
txt = Title(Text("Some title"), belowchar="=").text()
|
||||||
assert txt == "Some title\n=========="
|
assert txt == "Some title\n=========="
|
||||||
|
|
Loading…
Reference in New Issue