pax_global_header 0000666 0000000 0000000 00000000064 14674064430 0014522 g ustar 00root root 0000000 0000000 52 comment=a1c31e525dfdb1745ae8d09d5a08323ef579f414 python-textile-4.0.3/ 0000775 0000000 0000000 00000000000 14674064430 0014523 5 ustar 00root root 0000000 0000000 python-textile-4.0.3/.coveragerc 0000664 0000000 0000000 00000000153 14674064430 0016643 0 ustar 00root root 0000000 0000000 [run] branch = True source = textile parallel = True [report] show_missing = True omit = textile/tests/* python-textile-4.0.3/.flake8 0000664 0000000 0000000 00000000104 14674064430 0015671 0 ustar 00root root 0000000 0000000 [flake8] ignore = # line too long E501 exclude = build/ python-textile-4.0.3/.github/ 0000775 0000000 0000000 00000000000 14674064430 0016063 5 ustar 00root root 0000000 0000000 python-textile-4.0.3/.github/workflows/ 0000775 0000000 0000000 00000000000 14674064430 0020120 5 ustar 00root root 0000000 0000000 python-textile-4.0.3/.github/workflows/lint_and_test.yml 0000664 0000000 0000000 00000001675 14674064430 0023503 0 ustar 00root root 0000000 0000000 --- name: python-textile on: [push] jobs: lint_and_test: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.10"] image_size: ['true', 'false'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Python flake8 Lint uses: py-actions/flake8@v2.3.0 - name: Install dependencies run: | imagesize='' pip install -U pytest pytest-cov coverage codecov if [[ ${{ matrix.image_size }} == true ]] ; then imagesize='[imagesize]' ; fi pip install -e ".${imagesize}" - name: run tests run: | pytest - name: Codecov uses: codecov/codecov-action@v4 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} python-textile-4.0.3/.gitignore 0000664 0000000 0000000 00000000300 14674064430 0016504 0 ustar 00root root 0000000 0000000 *.pyc *.orig *.rej *~ *.pyo *.egg-info .cache/ .coverage .eggs/ .noseids* .pytest_cache docs/build docs/coverage build bin dist eggs htmlcov parts develop-eggs .DS_Store *.swp .tox README.txt python-textile-4.0.3/CHANGELOG.textile 0000664 0000000 0000000 00000017667 14674064430 0017433 0 ustar 00root root 0000000 0000000 h1. Textile Changelog h2. Version 4.0.3 * Update supported Python versions to 3.8 - 3.12 ("#83":https://github.com/textile/python-textile/issues/83) * Replace html5lib with nh3 for html sanitization * General code cleanup * Bugfixes: ** Wrong HTML output when "bc.." is the very last in the document ("#81":https://github.com/textile/python-textile/issues/81) * Other: ** Use github actions instead of travis for automated testing h2. Version 4.0.2 * Bugfixes: ** Support non-http schemas in url refs ("#75":https://github.com/textile/python-textile/pull/75) ** pytest-runner is deprecated ("#77":https://github.com/textile/python-textile/issues/77) *** other changes related to CI infrastructure h2. Version 4.0.1 * Bugfixes: ** SyntaxWarnings with Python 3.8 i("#71":https://github.com/textile/python-textile/issues/71) ** testsuite: internal error with coverage 5.0.X ("#72":https://github.com/textile/python-textile/issues/72) ** DeprecationWarnings about invalid escape sequences ("#73":https://github.com/textile/python-textile/issues/73) h2. Version 4.0.0 * Drop support for Python 2, hence the version bump. Update list of PY3K versions to currently-supported versions. If you need to use textile on Python 2.7 or Python 3.3 or 3.4, please use textile Version 3.0.4. * For use in PyPy environments, textile used to work well with the regex package. Lately, it's running into trouble. Please uninstall regex if this is the case for you. h2. Version 3.0.4 * BUGFIX: Restricted mode strips out CSS attributes again. * Update travis to more current versions and test against current Pillow version. 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 * Bugfixes: ** Fix handling of HTML entities in extended pre blocks. ("#55":https://github.com/textile/python-textile/issues/55) ** Empty definitions in definition lists raised an exception ("#56":https://github.com/textile/python-textile/issues/56) ** Fix handling of unicode in img attributes ("#58":https://github.com/textile/python-textile/issues/58) h2. Version 2.3.16 * Bugfixes: ** Fix processing of extended code blocks ("#50":https://github.com/textile/python-textile/issues/50) ** Don't break when links fail to include "http:" ("#51":https://github.com/textile/python-textile/issues/51) ** Better handling of poorly-formatted tables ("#52":https://github.com/textile/python-textile/issues/52) h2. Version 2.3.15 * Bugfix: Don't break on unicode characters in the fragment of a url. h2. Version 2.3.14 * Bugfix: Fix textile on Python 2.6 ("#48":https://github.com/textile/python-textile/issues/48) h2. Version 2.3.13 * Remove extraneous arguments from textile method. These were originally added long ago to work with django, but markup languages are long gone from django. * Bugfix: Don't mangle percent-encoded URLs so much. ("#45":https://github.com/textile/python-textile/issues/45) * Bugfix: More fixes for poorly-formatted lists. ("#46":https://github.com/textile/python-textile/issues/46) * Bugfix: Improve handling of whitespace in pre-formatted blocks. This now matches php-textile's handling of pre blocks much more closely. ("#47":https://github.com/textile/python-textile/issues/47) h2. Version 2.3.12 * Bugfix: Don't die on pre blocks with unicode characters. ("#43":https://github.com/textile/python-textile/issues/43) * Bugfix: Fix regressions introduced into the code between 2.2.2 and 2.3.11. (Special thanks to "@adam-iris":https://github.com/adam-iris for providing pull request "#44":https://github.com/textile/python-textile/pull/44) * Bugfix: Don't just die when processing poorly-formatted textile lists. ("#37":https://github.com/textile/python-textile/issues/37) * Add Python 3.6 to testing. * Add a "print the version string and exit" argument to the cli tool: @pytextile -v@ h2. Version 2.3.11 * Bugfix: Don't strip leading dot from image URIs ("#42":https://github.com/textile/python-textile/issues/42) h2. Version 2.3.10 * Packaging: cleanup in MANIFEST.IN leads to better linux packaging, and smaller wheel size. h2. Version 2.3.9 * Packaging: remove extraneous files from the source distribution upload. * Remove a lingering file from a feature branch for overhauling list handling. This brings coverage back up to 100% h2. Version 2.3.8 * Bugfix: Fix process of string containing only whitespaces ("#40":https://github.com/textile/python-textile/issues/40) * Bugfix: Fix process of formatted text after lists ("#37":https://github.com/textile/python-textile/issues/37) * Test: Use sys.executable instead of 'python' to test the CLI ("#38":https://github.com/textile/python-textile/issues/38) h2. Version 2.3.7 * Bugfix: Don't assume pytest is available to be imported in setup.py ("#39":https://github.com/textile/python-textile/issues/39) h2. Version 2.3.6 * Packaging: @tests@ directory is correctly included in source-tarball. ("#33":https://github.com/textile/python-textile/issues/33) h2. Version 2.3.5 * Bugfix: Correctly handle unicode text in url query-strings. ("#36":https://github.com/textile/python-textile/issues/36) h2. Version 2.3.4 * Bugfix: fix an issue with extended block code * Remove misplaced shebang on non-callable files. * Packaging: Add test-command to setup.py directly. * Packaging: Included the tests/ directory for source-tarballs, useful for packaging checks. ("#33":https://github.com/textile/python-textile/issues/33) * Add a cli tool @pytextile@ which takes textile input and prints html output. See @pytextile -h@ for details. h2. Version 2.3.3 * Bugfix: Unicode in URL titles no longer break everything ("#30":https://github.com/textile/python-textile/issues/30) * Display DeprecationWarning when using textile on Python 2.6. h2. Version 2.3.2 * Bugfix: properly handle @":"@ as text, not a link. h2. Version 2.3.1 * Regression bugfix: empty string input returns empty string again. h2. Version 2.3.0 * Bugfixes: ** Support data URIs in img tags ** Fix autolink urls with image references ("#17":https://github.com/textile/python-textile/issues/17) ** Fix textile links containing parentheses ("#20":https://github.com/textile/python-textile/issues/20) ** Fix double-encoding of code blocks ("#21":https://github.com/textile/python-textile/issues/21) ** Fix handling of scheme in self-linked URLs ("#16":https://github.com/textile/python-textile/issues/16) ** Fix Markup not parsed if followed by certain characters ("#22":Markup not parsed if followed by certain characters) * Convert testing over to "py.test":http://pytest.org/, improving unicode testing * Update functionality for tables, notelists, and footnotes. This involved a major reworking of parts of the code, but it should now match php-textile and txstyle.org precisely. Please file an issue for any bugs you come across. * Remove @head_offset@ option from parse. I'm not sure it ever existed in php-textile. h2. Version 2.2.2 * bugfix: "regex":https://pypi.python.org/pypi/regex is now an optional dependency h2. Version 2.2.1 * drop textilefactory support for html. * Various development-related bugfixes. * Added this changelog. h2. Version 2.2.0 * Started refactoring the code to be less repetitive. @textile.Textile().parse()@ is a little more friendly than @textile.Textile().textile()@ There may be more work to be done on this front to make the flow a little smoother. * We now support versions 2.6 - 3.4 (including 3.2) using the same codebase. Many thanks to Radek Czajka for this. * Drop support for html4. We now only output xhtml or html5. * Various development-related bugfixes. h2. Version 2.1.8 * Add support for html5 output. * Lots of new functionality added bringing us in line with the official Textile 2.4 python-textile-4.0.3/CONTRIBUTORS.txt 0000664 0000000 0000000 00000000257 14674064430 0017225 0 ustar 00root root 0000000 0000000 Dennis Burke Radek Czajka Roberto A. F. De Almeida Matt Layman Mark Pilgrim Alex Shiels Jason Samsa Kurt Raschke Dave Brondsema Dmitry Shachnev Kirill Mavreshko Brad Schoening python-textile-4.0.3/LICENSE.txt 0000664 0000000 0000000 00000002645 14674064430 0016355 0 ustar 00root root 0000000 0000000 L I C E N S E ============= Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name Textile nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. python-textile-4.0.3/Makefile 0000664 0000000 0000000 00000000725 14674064430 0016167 0 ustar 00root root 0000000 0000000 clean: $(RM) README.txt $(RM) -r ./dist ./build generate_pypi_README: ${VIRTUAL_ENV}/bin/pytextile README.textile | sed -e 's/^\t//' > README.txt build: generate_pypi_README python -m build upload_to_test: build twine check ./dist/* twine upload --repository test_textile ./dist/* upload_to_prod: build twine check ./dist/* # for now, don't actually upload to prod PyPI, just output the command to do so. @echo "twine upload --repository textile ./dist/*" python-textile-4.0.3/README.textile 0000664 0000000 0000000 00000003233 14674064430 0017061 0 ustar 00root root 0000000 0000000 !https://github.com/textile/python-textile/actions/workflows/lint_and_test.yml/badge.svg(python-textile)!:https://github.com/textile/python-textile/actions/workflows/lint_and_test.yml !https://codecov.io/github/textile/python-textile/coverage.svg!:https://codecov.io/github/textile/python-textile !https://img.shields.io/pypi/pyversions/textile! !https://img.shields.io/pypi/wheel/textile! h1. python-textile python-textile is a Python port of "Textile":https://textile-lang.com/, Dean Allen's humane web text generator. h2. Installation @pip install textile@ Dependencies: * "nh3":https://pypi.org/project/nh3/ * "regex":https://pypi.org/project/regex/ (The regex package causes problems with PyPy, and is not installed as a dependency in such environments. If you are upgrading a textile install on PyPy which had regex previously included, you may need to uninstall it.) Optional dependencies include: * "PIL/Pillow":http://python-pillow.github.io/ (for checking image sizes). If needed, install via @pip install 'textile[imagesize]'@ h2. Usage bc.. import textile >>> s = """ ... _This_ is a *test.* ... ... * One ... * Two ... * Three ... ... Link to "Slashdot":http://slashdot.org/ ... """ >>> html = textile.textile(s) >>> print html
This is a test.
Link to Slashdot
>>> h3. Notes: * Active development supports Python 3.8 or later. h3. Running Tests To run the test suite, use pytest. `pytest-cov` is required as well. When textile is installed locally: bc. pytest When textile is not installed locally: bc. PYTHONPATH=. pytest python-textile-4.0.3/TODO.textile 0000664 0000000 0000000 00000000557 14674064430 0016677 0 ustar 00root root 0000000 0000000 TODO * Improve documentation, both of the code and Textile syntax. ** Not all functions have docstrings or adequate docstrings. ** Because the Textile syntax implemented by PyTextile has deviated from the syntax implemented by other implementations of Textile, PyTextile-specific documentation needs to be produced for end-users. * Update to comply with Textile 2.5 python-textile-4.0.3/pyproject.toml 0000664 0000000 0000000 00000003307 14674064430 0017442 0 ustar 00root root 0000000 0000000 [build-system] requires = ["setuptools", "setuptools-scm", "nh3"] build-backend = "setuptools.build_meta" [project] name = "textile" authors = [ { name = "Dennis Burke", email = "ikirudennis@gmail.com"} ] description = 'Textile processing for python.' classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Topic :: Software Development :: Libraries :: Python Modules', ] dynamic = ["version",] dependencies = [ 'nh3', 'regex>1.0; implementation_name != "pypy"', ] requires-python = '>=3.8' keywords = ['textile', 'text', 'html markup'] # Use the following command to generate a README.txt which is compatible with # pypi's readme rendering: # pytextile README.textile | sed -e 's/^\t//' > README.txt readme = {file = 'README.txt', content-type = 'text/markdown'} [project.optional-dependencies] develop = ['pytest', 'pytest-cov'] imagesize = ['Pillow>=3.0.0',] [project.urls] Homepage = "https://github.com/textile/python-textile" Repository = "https://github.com/textile/python-textile.git" Issues = "https://github.com/textile/python-textile/issues" [project.scripts] pytextile = "textile.__main__:main" [tool.setuptools.dynamic] version = {attr = "textile.__version__"} python-textile-4.0.3/pytest.ini 0000664 0000000 0000000 00000000154 14674064430 0016554 0 ustar 00root root 0000000 0000000 [pytest] testpaths = tests addopts = --cov=textile --cov-report=html --cov-append --cov-report=term-missing python-textile-4.0.3/tests/ 0000775 0000000 0000000 00000000000 14674064430 0015665 5 ustar 00root root 0000000 0000000 python-textile-4.0.3/tests/__init__.py 0000664 0000000 0000000 00000000000 14674064430 0017764 0 ustar 00root root 0000000 0000000 python-textile-4.0.3/tests/fixtures/ 0000775 0000000 0000000 00000000000 14674064430 0017536 5 ustar 00root root 0000000 0000000 python-textile-4.0.3/tests/fixtures/README.txt 0000664 0000000 0000000 00000004443 14674064430 0021241 0 ustar 00root root 0000000 0000000python-textile is a Python port of Textile, Dean Allen’s humane web text generator.
pip install textile
Dependencies:
Optional dependencies include:
pip install 'textile[imagesize]'
import textile
>>> s = """
... _This_ is a *test.*
...
... * One
... * Two
... * Three
...
... Link to "Slashdot":http://slashdot.org/
... """
>>> html = textile.textile(s)
>>> print html
<p><em>This</em> is a <strong>test.</strong></p>
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
<p>Link to <a href="http://slashdot.org/">Slashdot</a></p>
>>>
To run the test suite, use pytest. `pytest-cov` is required as well.
When textile is installed locally:
pytest
When textile is not installed locally:
PYTHONPATH=. pytest