1# Copyright 2009-2015 Jason Stitt
2#
3# Permission is hereby granted, free of charge, to any person obtaining a copy
4# of this software and associated documentation files (the "Software"), to deal
5# in the Software without restriction, including without limitation the rights
6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7# copies of the Software, and to permit persons to whom the Software is
8# furnished to do so, subject to the following conditions:
9#
10# The above copyright notice and this permission notice shall be included in
11# all copies or substantial portions of the Software.
12#
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19# THE SOFTWARE.
20
21from distutils.core import setup
22
23longdesc = """\
24`PyTidyLib`_ is a Python package that wraps the `HTML Tidy`_ library. This
25allows you, from Python code, to "fix" invalid (X)HTML markup. Some of the
26library's many capabilities include:
27
28* Clean up unclosed tags and unescaped characters such as ampersands
29* Output HTML 4 or XHTML, strict or transitional, and add missing doctypes
30* Convert named entities to numeric entities, which can then be used in XML
31  documents without an HTML doctype.
32* Clean up HTML from programs such as Word (to an extent)
33* Indent the output, including proper (i.e. no) indenting for ``pre`` elements,
34  which some (X)HTML indenting code overlooks.
35
36Changes
37=======
38
39* 0.3.2: Initialization bug fix
40
41* 0.3.1: find_library support while still allowing a list of library names
42
43* 0.3.0: Refactored to use Tidy and PersistentTidy classes while keeping the
44functional interface (which will lazily create a global Tidy() object) for
45backward compatibility. You can now pass a list of library names and base
46options when instantiating Tidy. The keep_doc argument is now deprecated
47and does nothing; use PersistentTidy.
48
49* 0.2.4: Bugfix for a strange memory allocation corner case in Tidy.
50
51* 0.2.3: Python 3 support (2 + 3 cross compatible) with passing Tox tests.
52
53Small example of use
54====================
55
56The following code cleans up an invalid HTML document and sets an option::
57
58    from tidylib import tidy_document
59    document, errors = tidy_document('''<p>f&otilde;o <img src="bar.jpg">''',
60      options={'numeric-entities':1})
61    print document
62    print errors
63
64Docs
65====
66
67Documentation is shipped with the source distribution and is available at
68the `PyTidyLib`_ web page.
69
70.. _`HTML Tidy`: http://tidy.sourceforge.net/
71.. _`PyTidyLib`: http://countergram.com/open-source/pytidylib/
72"""
73
74VERSION = "0.3.2"
75
76setup(
77    name="pytidylib",
78    version=VERSION,
79    description="Python wrapper for HTML Tidy (tidylib) on Python 2 and 3",
80    long_description=longdesc,
81    author="Jason Stitt",
82    author_email="js@jasonstitt.com",
83    url="http://countergram.com/open-source/pytidylib/",
84    packages=['tidylib'],
85    classifiers=[
86        'Development Status :: 5 - Production/Stable',
87        'Environment :: Other Environment',
88        'Intended Audience :: Developers',
89        'License :: OSI Approved :: MIT License',
90        'Programming Language :: Python',
91        'Programming Language :: Python :: 3',
92        'Natural Language :: English',
93        'Topic :: Utilities',
94        'Topic :: Text Processing :: Markup :: HTML',
95        'Topic :: Text Processing :: Markup :: XML',
96    ],
97    test_suite='tests',
98)
99