Skip to content

Commit

Permalink
Merge pull request #82 from kpot/master
Browse files Browse the repository at this point in the history
Fix wrong output when "bc.." is the last block #81
  • Loading branch information
ikirudennis authored Aug 5, 2024
2 parents 6cdcd52 + 82157c7 commit 89310f3
Show file tree
Hide file tree
Showing 8 changed files with 545 additions and 259 deletions.
2 changes: 1 addition & 1 deletion tests/fixtures/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@

When textile is not installed locally:</code></pre>

<pre>PYTHONPATH=. pytest</pre>
<pre><code>PYTHONPATH=. pytest</code></pre>
6 changes: 3 additions & 3 deletions tests/test_span.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

def test_span():
t = Textile()
result = t.span("hello %(bob)span *strong* and **bold**% goodbye")
result = t.retrieveTags(t.span("hello %(bob)span *strong* and **bold**% goodbye"))
expect = ('hello <span class="bob">span <strong>strong</strong> and '
'<b>bold</b></span> goodbye')
assert result == expect

result = t.span('%:http://domain.tld test%')
result = t.retrieveTags(t.span('%:http://domain.tld test%'))
expect = '<span cite="http://domain.tld">test</span>'
assert result == expect

t = Textile()
# cover the partial branch where we exceed the max_span_depth.
t.max_span_depth = 2
result = t.span('_-*test*-_')
result = t.retrieveTags(t.span('_-*test*-_'))
expect = '<em><del>*test*</del></em>'
assert result == expect
8 changes: 4 additions & 4 deletions tests/test_textile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ def test_Footnote():

def test_issue_35():
result = textile.textile('"z"')
expect = '\t<p>&#8220;z&#8221; </p>'
expect = '\t<p>&#8220;z&#8221;</p>'
assert result == expect

result = textile.textile('" z"')
expect = '\t<p>&#8220; z&#8221; </p>'
expect = '\t<p>&#8220; z&#8221;</p>'
assert result == expect

def test_restricted():
Expand Down Expand Up @@ -72,7 +72,7 @@ def test_restricted():
expect = '''\
\t<table>
\t<caption>Your caption goes here</caption>
\t
\t<tfoot>
\t\t<tr>
\t\t\t<td>A footer </td>
Expand Down Expand Up @@ -159,7 +159,7 @@ def test_endnotes_malformed():
def test_endnotes_undefined_note():
test = """Scientists say the moon is slowly shrinking[#my_first_label].\n\nnotelist!."""
html = textile.textile(test)
result_pattern = r"""\t<p>Scientists say the moon is slowly shrinking<sup><a href="#note([a-f0-9]{32})-2"><span id="noteref\1-1">1</span></a></sup>.</p>\n\n\t<ol>\n\t\t<li> Undefined Note \[#my_first_label\].<li>\n\t</ol>$"""
result_pattern = r"""\t<p>Scientists say the moon is slowly shrinking<sup><a href="#note([a-f0-9]{32})-2"><span id="noteref\1-1">1</span></a></sup>.</p>\n\n\t<ol>\n\t\t<li> Undefined Note \[#my_first_label\].</li>\n\t</ol>$"""
result_re = re.compile(result_pattern)
assert result_re.search(html) is not None

Expand Down
205 changes: 201 additions & 4 deletions tests/test_values.py

Large diffs are not rendered by default.

Loading

0 comments on commit 89310f3

Please sign in to comment.