setup.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # Copyright 2009 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. from distutils.core import setup
  21. longdesc = """\
  22. 0.2.0: Works on Windows! See documentation for available DLL download
  23. locations. Documentation rewritten and expanded.
  24. `PyTidyLib`_ is a Python package that wraps the `HTML Tidy`_ library. This
  25. allows you, from Python code, to "fix" invalid (X)HTML markup. Some of the
  26. library's many capabilities include:
  27. * Clean up unclosed tags and unescaped characters such as ampersands
  28. * Output HTML 4 or XHTML, strict or transitional, and add missing doctypes
  29. * Convert named entities to numeric entities, which can then be used in XML
  30. documents without an HTML doctype.
  31. * Clean up HTML from programs such as Word (to an extent)
  32. * Indent the output, including proper (i.e. no) indenting for ``pre`` elements,
  33. which some (X)HTML indenting code overlooks.
  34. Small example of use
  35. ====================
  36. The following code cleans up an invalid HTML document and sets an option::
  37. from tidylib import tidy_document
  38. document, errors = tidy_document('''<p>f&otilde;o <img src="bar.jpg">''',
  39. options={'numeric-entities':1})
  40. print document
  41. print errors
  42. Docs
  43. ====
  44. Documentation is shipped with the source distribution and is available at
  45. the `PyTidyLib`_ web page.
  46. .. _`HTML Tidy`: http://tidy.sourceforge.net/
  47. .. _`PyTidyLib`: http://countergram.com/open-source/pytidylib/
  48. """
  49. VERSION = "0.2.1"
  50. setup(
  51. name="pytidylib",
  52. version=VERSION,
  53. description="Python wrapper for HTML Tidy (tidylib)",
  54. long_description=longdesc,
  55. author="Jason Stitt",
  56. author_email="js@jasonstitt.com",
  57. url="http://countergram.com/open-source/pytidylib/",
  58. download_url="http://cloud.github.com/downloads/countergram/pytidylib/pytidylib-%s.tar.gz" % VERSION,
  59. packages=['tidylib'],
  60. classifiers=[
  61. 'Development Status :: 4 - Beta',
  62. 'Environment :: Other Environment',
  63. 'Intended Audience :: Developers',
  64. 'License :: OSI Approved :: MIT License',
  65. 'Programming Language :: Python',
  66. 'Natural Language :: English',
  67. 'Topic :: Utilities',
  68. 'Topic :: Text Processing :: Markup :: HTML',
  69. 'Topic :: Text Processing :: Markup :: XML',
  70. ],
  71. )