Skip to content

Commit b349498

Browse files
committed
Fix problem other way
1 parent 550a765 commit b349498

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

tests/test_textile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,6 @@ def test_relURL():
245245

246246

247247
def test_whitespace_at_beginning_and_end():
248-
expect = textile.textile(' \n Testing 1 2 3 \n ', html_type='html5')
249-
result = '\t<p>Testing 1 2 3</p>'
248+
result = textile.textile(' \n Testing 1 2 3 \n ', html_type='html5')
249+
expect = ' Testing 1 2 3 \n '
250250
assert result == expect

textile/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ def block(self, text):
443443
tag = 'p'
444444
atts = cite = ext = ''
445445
out = []
446-
block = None
446+
block = Block(self, tag, atts, ext, cite, '') # init block
447+
block.eat = False # don't eat the next line after init block
447448
for line in text:
448449
# the line is just whitespace, add it to the output, and move on
449450
if not line.strip():

textile/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ def list_type(list_string):
149149

150150
def normalize_newlines(string):
151151
out = re.sub(r'\r\n?', '\n', string)
152-
# strip spaces around first and last newline
153-
out = re.compile(r'^[ \t]*\n[ \t]*', flags=re.M).sub('\n', out)
154-
out = re.compile(r'[ \t]*\n[ \t]*$', flags=re.M).sub('\n', out)
152+
out = re.compile(r'^[ \t]*\n', flags=re.M).sub('\n', out)
155153
out = out.strip('\n')
156154
return out
157155

0 commit comments

Comments
 (0)