Skip to content

Commit 1aead68

Browse files
committed
more cleanup in aisle block.
1 parent db7cd11 commit 1aead68

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

tests/test_block.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,24 @@ def test_block():
1313

1414
result = t.fBlock("bq", "", None, "", "Hello BlockQuote")
1515
expect = ('blockquote', OrderedDict(), 'p', OrderedDict(),
16-
'Hello BlockQuote', False)
16+
'Hello BlockQuote')
1717
assert result == expect
1818

1919
result = t.fBlock("bq", "", None, "http://google.com", "Hello BlockQuote")
2020
citation = '{0}1:url'.format(t.uid)
2121
expect = ('blockquote', OrderedDict([('cite',
2222
'{0.uid}{0.refIndex}:url'.format(t))]), 'p', OrderedDict(),
23-
'Hello BlockQuote', False)
23+
'Hello BlockQuote')
2424
assert result == expect
2525

2626
result = t.fBlock("bc", "", None, "", 'printf "Hello, World";')
2727
# the content of text will be turned shelved, so we'll asert only the
2828
# deterministic portions of the expected values, below
29-
expect = ('pre', OrderedDict(), 'code', OrderedDict(), 'shelve', False)
29+
expect = ('pre', OrderedDict(), 'code', OrderedDict(), 'shelve')
3030
assert result[0:3] == expect[0:3]
31-
assert result[-1] == expect[-1]
3231

3332
result = t.fBlock("h1", "", None, "", "foobar")
34-
expect = ('h1', OrderedDict(), '', OrderedDict(), 'foobar', False)
33+
expect = ('h1', OrderedDict(), '', OrderedDict(), 'foobar')
3534
assert result == expect
3635

3736
def test_block_tags_false():

textile/core.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,8 @@ def block(self, text):
577577
# tag specified on this line.
578578
if match:
579579
tag, atts, ext, cite, content = match.groups()
580-
(outer_tag, outer_atts, inner_tag, inner_atts, content,
581-
eat) = self.fBlock(**match.groupdict())
580+
(outer_tag, outer_atts, inner_tag, inner_atts,
581+
content) = self.fBlock(**match.groupdict())
582582
inner_block = generate_tag(inner_tag, content, inner_atts)
583583
# code tags and raw text won't be indented inside outer_tag.
584584
if inner_tag != 'code' and not has_raw_text(inner_block):
@@ -598,8 +598,8 @@ def block(self, text):
598598
line = '{0}\n{1}'.format(out.pop(), line)
599599
whitespace = ' \t\n\r\f\v'
600600
if ext or not line[0] in whitespace:
601-
(outer_tag, outer_atts, inner_tag, inner_atts, content,
602-
eat) = self.fBlock(tag, atts, ext, cite, line)
601+
(outer_tag, outer_atts, inner_tag, inner_atts,
602+
content) = self.fBlock(tag, atts, ext, cite, line)
603603
if tag == 'p' and not has_raw_text(content):
604604
line = content
605605
else:
@@ -612,7 +612,7 @@ def block(self, text):
612612
line = self.doPBr(line)
613613
line = re.sub(r'<br>', '<br />', line)
614614

615-
if not eat and line:
615+
if line.strip():
616616
out.append(line)
617617

618618
if not ext:
@@ -651,8 +651,7 @@ def fBlock(self, tag, atts, ext, cite, content):
651651
# It will be empty if the regex matched and ate it.
652652
if '' == notedef:
653653
content = notedef
654-
return (outer_tag, outer_atts, inner_tag, inner_atts, content,
655-
eat)
654+
return (outer_tag, outer_atts, inner_tag, inner_atts, content)
656655

657656
fns = re.search(r'fn(?P<fnid>{0}+)'.format(regex_snippets['digit']),
658657
tag, flags=re.U)
@@ -728,7 +727,7 @@ def fBlock(self, tag, atts, ext, cite, content):
728727
content = self.graf(content)
729728
else:
730729
content = ''
731-
return (outer_tag, outer_atts, inner_tag, inner_atts, content, eat)
730+
return (outer_tag, outer_atts, inner_tag, inner_atts, content)
732731

733732
def footnoteRef(self, text):
734733
# somehow php-textile gets away with not capturing the space.

0 commit comments

Comments
 (0)