forked from sebix/python-textile
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
190 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
exclude .gitignore | ||
exclude TODO.textile | ||
exclude .travis.yml | ||
include CHANGELOG.textile | ||
include CONTRIBUTORS.txt | ||
include .coveragerc | ||
include LICENSE.txt | ||
include MANIFEST.in | ||
include pytest.ini | ||
include README.textile | ||
include requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from setuptools import setup, find_packages | ||
import os | ||
import sys | ||
import pytest | ||
|
||
def get_version(): | ||
basedir = os.path.dirname(__file__) | ||
|
@@ -13,6 +14,8 @@ def get_version(): | |
setup( | ||
name='textile', | ||
version=get_version(), | ||
author='Dennis Burke', | ||
author_email='[email protected]', | ||
description='Textile processing for python.', | ||
url='http://github.com/textile/python-textile', | ||
packages=find_packages(), | ||
|
@@ -40,8 +43,10 @@ def get_version(): | |
':python_version=="2.6"': ['ordereddict>=1.1'], | ||
'develop': ['regex', 'pytest', 'pytest-cov'], | ||
}, | ||
entry_points={'console_scripts': ['pytextile=textile.__main__:main']}, | ||
setup_requires=['pytest-runner'], | ||
tests_require=['pytest', 'pytest-cov'], | ||
cmdclass = {'test': pytest}, | ||
include_package_data=True, | ||
zip_safe=False, | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<p><a href="https://travis-ci.org/textile/python-textile"><img alt="" src="https://travis-ci.org/textile/python-textile.svg" /></a> <a href="https://coveralls.io/github/textile/python-textile?branch=master"><img alt="" src="https://coveralls.io/repos/github/textile/python-textile/badge.svg" /></a> <a href="https://codecov.io/github/textile/python-textile"><img alt="" src="https://codecov.io/github/textile/python-textile/coverage.svg" /></a></p> | ||
|
||
<h1>python-textile</h1> | ||
|
||
<p>python-textile is a Python port of <a href="http://txstyle.org/">Textile</a>, Dean Allen’s humane web text generator.</p> | ||
|
||
<h2>Installation</h2> | ||
|
||
<p><code>pip install textile</code></p> | ||
|
||
<p>Optional dependencies include: | ||
<ul> | ||
<li><a href="http://python-pillow.github.io/"><span class="caps">PIL</span>/Pillow</a> (for checking images size)</li> | ||
<li><a href="https://pypi.python.org/pypi/regex">regex</a> (for faster unicode-aware string matching).</li> | ||
</ul></p> | ||
|
||
<h2>Usage</h2> | ||
|
||
<pre><code>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> | ||
>>></code></pre> | ||
|
||
<h3>Notes:</h3> | ||
|
||
<ul> | ||
<li>Active development supports Python 2.6 or later (including Python 3.2+).</li> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import six | ||
import subprocess | ||
|
||
def test_console_script(): | ||
command = ['python', '-m', 'textile', 'README.textile'] | ||
try: | ||
result = subprocess.check_output(command) | ||
except AttributeError: | ||
command[2] = 'textile.__main__' | ||
result = subprocess.Popen(command, | ||
stdout=subprocess.PIPE).communicate()[0] | ||
with open('tests/fixtures/README.txt') as f: | ||
expect = ''.join(f.readlines()) | ||
if type(result) == bytes: | ||
result = result.decode('utf-8') | ||
assert result == expect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
from __future__ import unicode_literals | ||
|
||
import sys | ||
import warnings | ||
|
||
from .core import textile, textile_restricted, Textile | ||
from .version import VERSION | ||
|
||
__all__ = ['textile', 'textile_restricted'] | ||
|
||
__version__ = VERSION | ||
|
||
|
||
if sys.version_info[:2] == (2, 6): | ||
warnings.warn( | ||
"Python 2.6 is no longer supported by the Python core team, please " | ||
"upgrade your Python. A future version of textile will drop support " | ||
"for Python 2.6", | ||
DeprecationWarning | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import argparse | ||
import sys | ||
import textile | ||
|
||
|
||
def main(): | ||
"""A CLI tool in the style of python's json.tool. In fact, this is mostly | ||
copied directly from that module. This allows us to create a stand-alone | ||
tool as well as invoking it via `python -m textile`.""" | ||
prog = 'textile' | ||
description = ('A simple command line interface for textile module ' | ||
'to convert textile input to HTML output. This script ' | ||
'accepts input as a file or stdin and can write out to ' | ||
'a file or stdout.') | ||
parser = argparse.ArgumentParser(prog=prog, description=description) | ||
parser.add_argument('infile', nargs='?', type=argparse.FileType(), | ||
help='a textile file to be converted') | ||
parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'), | ||
help='write the output of infile to outfile') | ||
options = parser.parse_args() | ||
|
||
infile = options.infile or sys.stdin | ||
outfile = options.outfile or sys.stdout | ||
with infile: | ||
output = textile.textile(''.join(infile.readlines())) | ||
with outfile: | ||
outfile.write(output) | ||
|
||
|
||
if __name__ == '__main__': #pragma: no cover | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
VERSION = '2.3.2' | ||
VERSION = '2.3.4' |