diff -Nru python-textile-3.0.0/CHANGELOG.textile python-textile-3.0.3/CHANGELOG.textile --- python-textile-3.0.0/CHANGELOG.textile 2017-11-16 20:22:13.000000000 +0000 +++ python-textile-3.0.3/CHANGELOG.textile 2018-04-22 14:16:38.000000000 +0000 @@ -1,5 +1,14 @@ h1. Textile Changelog +h2. Version 3.0.3 +* BUGFIX: Improve handling code block following extended p block ("#63":https://github.com/textile/python-textile/pull/63) + +h2. Version 3.0.2 +* BUGFIX: Fix for multiple multi-line paragraphs. ("#62":https://github.com/textile/python-textile/pull/62) + +h2. Version 3.0.1 +* BUGFIX: Fix improper handling of extended code blocks. ("#61":https://github.com/textile/python-textile/pull/61) + h2. Version 3.0.0 * Drop support for Python 2.6 and 3.2. * Update to the current version of html5lib diff -Nru python-textile-3.0.0/debian/changelog python-textile-3.0.3/debian/changelog --- python-textile-3.0.0/debian/changelog 2017-11-25 11:39:25.000000000 +0000 +++ python-textile-3.0.3/debian/changelog 2018-05-19 12:16:25.000000000 +0000 @@ -1,3 +1,20 @@ +python-textile (1:3.0.3-1) unstable; urgency=medium + + [ Ondřej Nový ] + * d/control: Set Vcs-* to salsa.debian.org + * d/control: Remove ancient X-Python-Version field + * d/control: Remove ancient X-Python3-Version field + + [ Dmitry Shachnev ] + * New upstream release. + * Update to debhelper compat level 11. + * Drop 0002-Fix-path-to-README.textile-when-running-the-tests.patch. + Add README.textile to pybuild.testfiles instead. + * Add autopkgtests that run the upstream test suite. + * Bump Standards-Version to 4.1.4, no changes needed. + + -- Dmitry Shachnev Sat, 19 May 2018 15:16:25 +0300 + python-textile (1:3.0.0-1) unstable; urgency=medium * New upstream release. @@ -156,4 +173,3 @@ * Initial Release (closes: Bug#286528). -- Ricardo Javier Cardenes Medina Mon, 20 Dec 2004 17:10:29 +0000 - diff -Nru python-textile-3.0.0/debian/compat python-textile-3.0.3/debian/compat --- python-textile-3.0.0/debian/compat 2017-11-25 11:39:25.000000000 +0000 +++ python-textile-3.0.3/debian/compat 2018-05-19 12:16:25.000000000 +0000 @@ -1 +1 @@ -9 +11 diff -Nru python-textile-3.0.0/debian/control python-textile-3.0.3/debian/control --- python-textile-3.0.0/debian/control 2017-11-25 11:39:25.000000000 +0000 +++ python-textile-3.0.3/debian/control 2018-05-19 12:16:25.000000000 +0000 @@ -3,8 +3,8 @@ Priority: optional Maintainer: Debian Python Modules Team Uploaders: Dmitry Shachnev -Build-Depends: debhelper (>= 9), - dh-python, +Build-Depends: debhelper (>= 11), + dh-python (>= 3.20180313), python (>= 2.6.6-3~), python-html5lib (>= 0.999999999), python-pytest, @@ -17,12 +17,10 @@ python3-pytest-cov, python3-pytest-runner, python3-setuptools -Standards-Version: 4.1.1 -X-Python-Version: >= 2.7 -X-Python3-Version: >= 3.3 +Standards-Version: 4.1.4 Homepage: https://github.com/textile/python-textile -Vcs-Git: https://anonscm.debian.org/git/python-modules/packages/python-textile.git -Vcs-Browser: https://anonscm.debian.org/cgit/python-modules/packages/python-textile.git +Vcs-Git: https://salsa.debian.org/python-team/modules/python-textile.git +Vcs-Browser: https://salsa.debian.org/python-team/modules/python-textile Package: python-textile Architecture: all diff -Nru python-textile-3.0.0/debian/patches/0002-Fix-path-to-README.textile-when-running-the-tests.patch python-textile-3.0.3/debian/patches/0002-Fix-path-to-README.textile-when-running-the-tests.patch --- python-textile-3.0.0/debian/patches/0002-Fix-path-to-README.textile-when-running-the-tests.patch 2017-11-25 11:39:25.000000000 +0000 +++ python-textile-3.0.3/debian/patches/0002-Fix-path-to-README.textile-when-running-the-tests.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -From: Dmitry Shachnev -Date: Wed, 9 Nov 2016 20:53:04 +0300 -Subject: Fix path to README.textile when running the tests - ---- - tests/test_block.py | 2 +- - tests/test_cli.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/test_block.py b/tests/test_block.py -index c69105c..1fdeeb7 100644 ---- a/tests/test_block.py -+++ b/tests/test_block.py -@@ -56,7 +56,7 @@ def test_blockcode_extended(): - assert result == expect - - def test_blockcode_in_README(): -- with open('README.textile') as f: -+ with open('../../../README.textile') as f: - readme = ''.join(f.readlines()) - result = textile.textile(readme) - with open('tests/fixtures/README.txt') as f: -diff --git a/tests/test_cli.py b/tests/test_cli.py -index 8d37614..7dfab47 100644 ---- a/tests/test_cli.py -+++ b/tests/test_cli.py -@@ -5,7 +5,7 @@ import sys - import textile - - def test_console_script(): -- command = [sys.executable, '-m', 'textile', 'README.textile'] -+ command = [sys.executable, '-m', 'textile', '../../../README.textile'] - try: - result = subprocess.check_output(command) - except AttributeError: diff -Nru python-textile-3.0.0/debian/patches/series python-textile-3.0.3/debian/patches/series --- python-textile-3.0.0/debian/patches/series 2017-11-25 11:39:25.000000000 +0000 +++ python-textile-3.0.3/debian/patches/series 2018-05-19 12:16:25.000000000 +0000 @@ -1,2 +1 @@ 0001-Skip-a-test-that-requires-access-to-www.google.com.patch -0002-Fix-path-to-README.textile-when-running-the-tests.patch diff -Nru python-textile-3.0.0/debian/pybuild.testfiles python-textile-3.0.3/debian/pybuild.testfiles --- python-textile-3.0.0/debian/pybuild.testfiles 1970-01-01 00:00:00.000000000 +0000 +++ python-textile-3.0.3/debian/pybuild.testfiles 2018-05-19 12:16:25.000000000 +0000 @@ -0,0 +1,2 @@ +tests +README.textile diff -Nru python-textile-3.0.0/debian/tests/control python-textile-3.0.3/debian/tests/control --- python-textile-3.0.0/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 +++ python-textile-3.0.3/debian/tests/control 2018-05-19 12:16:25.000000000 +0000 @@ -0,0 +1,7 @@ +Tests: python-textile +Depends: python-textile, + python-pytest + +Tests: python3-textile +Depends: python3-textile, + python3-pytest diff -Nru python-textile-3.0.0/debian/tests/python3-textile python-textile-3.0.3/debian/tests/python3-textile --- python-textile-3.0.0/debian/tests/python3-textile 1970-01-01 00:00:00.000000000 +0000 +++ python-textile-3.0.3/debian/tests/python3-textile 2018-05-19 12:16:25.000000000 +0000 @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e -u +cp -r tests/ README.textile "$AUTOPKGTEST_TMP/" +cd "$AUTOPKGTEST_TMP" + +for python in $(py3versions -i); do + echo "Testing with $python..." + $python -m pytest -vv +done diff -Nru python-textile-3.0.0/debian/tests/python-textile python-textile-3.0.3/debian/tests/python-textile --- python-textile-3.0.0/debian/tests/python-textile 1970-01-01 00:00:00.000000000 +0000 +++ python-textile-3.0.3/debian/tests/python-textile 2018-05-19 12:16:25.000000000 +0000 @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e -u +cp -r tests/ README.textile "$AUTOPKGTEST_TMP/" +cd "$AUTOPKGTEST_TMP" + +for python in $(pyversions -i); do + echo "Testing with $python..." + $python -m pytest -vv +done diff -Nru python-textile-3.0.0/tests/test_github_issues.py python-textile-3.0.3/tests/test_github_issues.py --- python-textile-3.0.0/tests/test_github_issues.py 2017-11-16 20:22:13.000000000 +0000 +++ python-textile-3.0.3/tests/test_github_issues.py 2018-04-22 14:16:38.000000000 +0000 @@ -258,7 +258,150 @@ 'return configs;\n}\n}') assert result == expect -def test_issue_56(): +def test_github_issue_56(): + """Empty description lists throw error""" result = textile.textile("- :=\n-") expect = '
\n
' assert result == expect + +def test_github_pull_61(): + """Fixed code block multiline encoding on quotes/span""" + test = '''bc.. This is some TEXT inside a "Code BLOCK" + +{ + if (JSON) { + + return {"JSON":"value"} + } +} + +Back to 10-4 CAPS + +p.. Some multiline Paragragh + +Here is some output!!! "Some" CAPS''' + + expect = '''
This is some TEXT inside a "Code BLOCK"
+
+{
+  if (JSON) {
+
+    return {"JSON":"value"}
+  }
+}
+
+Back to 10-4 CAPS 
+ +

Some multiline Paragragh

+ +

Here is some output!!! “Some” CAPS

''' + t = textile.Textile() + result = t.parse(test) + assert result == expect + +def test_github_pull_62(): + """Fix for paragraph multiline, only last paragraph is rendered + correctly""" + test = '''p.. First one 'is' + +ESCAPED "bad" + +p.. Second one 'is' + + + +ESCAPED "bad" + +p.. Third one 'is' + +ESCAPED "bad" + +p.. Last one 'is' + +ESCAPED "good" test''' + + expect = '''

First one ‘is’

+ +

ESCAPED “bad”

+ +

Second one ‘is’

+ + + +

ESCAPED “bad”

+ +

Third one ‘is’

+ +

ESCAPED “bad”

+ +

Last one ‘is’

+ +

ESCAPED “good” test

''' + t = textile.Textile() + result = t.parse(test) + assert result == expect + +def test_github_pull_63(): + """Forgot to set multiline_para to False""" + test = '''p.. First one 'is' + +ESCAPED "bad" + +bc.. { + First code BLOCK + + {"JSON":'value'} +} + +p.. Second one 'is' + + + +ESCAPED "bad" + +p.. Third one 'is' + +ESCAPED "bad" + +bc.. { + Last code BLOCK + + {"JSON":'value'} +} + +p.. Last one 'is' + +ESCAPED "good" test''' + + expect = '''

First one ‘is’

+ +

ESCAPED “bad”

+ +
{
+ First code BLOCK
+
+ {"JSON":'value'}
+}
+ +

Second one ‘is’

+ + + +

ESCAPED “bad”

+ +

Third one ‘is’

+ +

ESCAPED “bad”

+ +
{
+ Last code BLOCK
+
+ {"JSON":'value'}
+}
+ +

Last one ‘is’

+ +

ESCAPED “good” test

''' + t = textile.Textile() + result = t.parse(test) + assert result == expect diff -Nru python-textile-3.0.0/textile/core.py python-textile-3.0.3/textile/core.py --- python-textile-3.0.0/textile/core.py 2017-11-16 20:22:13.000000000 +0000 +++ python-textile-3.0.3/textile/core.py 2018-04-22 14:16:38.000000000 +0000 @@ -433,6 +433,12 @@ # the case, we'd want to drop the whitespace which comes after it. eat_whitespace = False + # check to see if previous block has already been escaped + escaped = False + + # check if multiline paragraph (p..) tags

..

are added to line + multiline_para = False + tag = 'p' atts = cite = ext = '' @@ -458,11 +464,17 @@ if ext and out: # it's out[-2] because the last element in out is the # whitespace that preceded this line - content = encode_html(out[-2], quotes=True) - content = generate_tag(block.inner_tag, content, - block.inner_atts) - content = generate_tag(block.outer_tag, content, - block.outer_atts) + if not escaped: + content = encode_html(out[-2], quotes=True) + escaped = True + else: + content = out[-2] + + if not multiline_para: + content = generate_tag(block.inner_tag, content, + block.inner_atts) + content = generate_tag(block.outer_tag, content, + block.outer_atts) out[-2] = content tag, atts, ext, cite, content = match.groups() block = Block(self, **match.groupdict()) @@ -479,11 +491,18 @@ # pre tags and raw text won't be indented. if block.outer_tag != 'pre' and not has_raw_text(line): line = "\t{0}".format(line) + + # set having paragraph tags to false + if block.tag == 'p' and ext: + multiline_para = False # no tag specified else: # if we're inside an extended block, add the text from the # previous line to the front if ext and out: + if block.tag == 'p': + line = generate_tag(block.tag, line, block.outer_atts) + multiline_para = True line = '{0}{1}'.format(out.pop(), line) # the logic in the if statement below is a bit confusing in # php-textile. I'm still not sure I understand what the php @@ -503,12 +522,23 @@ block.outer_atts) line = "\t{0}".format(line) else: - if block.tag == 'pre': + if block.tag == 'pre' or block.inner_tag == 'code': line = self.shelve(encode_html(line, quotes=True)) else: line = self.graf(line) - line = self.doPBr(line) + if block.tag == 'p': + escaped = True + + if block.tag == 'p' and ext and not multiline_para: + line = generate_tag(block.tag, line, block.outer_atts) + multiline_para = True + else: + line = self.doPBr(line) + + if not block.tag == 'p': + multiline_para = False + line = line.replace('
', '
') # if we're in an extended block, and we haven't specified a new @@ -533,7 +563,7 @@ # at this point, we've gone through all the lines, and if there's still # an extension in effect, we close it here. - if ext and out: + if ext and out and not block.tag == 'p': block.content = out.pop() block.process() final = generate_tag(block.outer_tag, block.content, diff -Nru python-textile-3.0.0/textile/version.py python-textile-3.0.3/textile/version.py --- python-textile-3.0.0/textile/version.py 2017-11-16 20:22:13.000000000 +0000 +++ python-textile-3.0.3/textile/version.py 2018-04-22 14:16:38.000000000 +0000 @@ -1 +1 @@ -VERSION = '3.0.0' +VERSION = '3.0.3'