{ "info": { "author": "Wichert Akkerman", "author_email": "wichert@wiggy.net", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: Markup :: HTML" ], "description": "Introduction\n============\n\nThis package contains several handy python methods to cleanup HTML markup\nor perform other common changes. The cleanup is strict enough to be able\nto clean HTML pasted from MS Word or Apple Pages. This package also contains\nintegration code for `z3c.form`_ to provide fields that automatically\nsanitize HTML on save.\n\nThe implementation is based on the ``Cleaner`` class from `lxml`_.\n\n\nCleanup routines\n================\n\nAll cleanup routines can be invoked through the single ``sanitize`` function.\nThis functions takes an input string as input and will return a cleaned up\nversion of that string. Here is a simple example::\n\n >>> from htmllaundry import sanitize\n >>> sanitize('Hello, world')\n '

Hello, world

'\n\nThe sanitize method takes an extra optional parameter with a lxml Cleaner\ninstance, which can be used to use different filtering rules. htmllaundry\nincludes three cleaners:\n\n* ``htmllaundry.cleaners.DocumentCleaner``, which is the default cleaner. This\n cleaner will allow most safe tags, while stripping out inline styles and\n insecure markup.\n\n* ``htmllaundry.cleaners.LineCleaner`` is a more strict cleaner which only\n allows a few inline elements. This is useful in places where you only\n want to accept single-line input, for example in document titles.\n\n* ``htmllaundry.cleaners.CommentCleaner`` only allows a very limited set of\n HTML elements, and is designed to be useful for user provided comments. It\n will also force all external links to open in a new browser window.\n\n\nIf you want to go all the way you can also use ``strip_markup`` to strip\nall markup from your input::\n\n >>> from htmllaundry import strip_markup\n >>> strip_markup('Hello, world')\n 'Hello, world'\n\n\nz3c.form integration\n====================\n\nIf you want to use the ``z3c.form`` integration you should use the ``z3cform``\nextra for this package::\n\n install_requires=[\n ....\n htmllaundry [z3cform]\n ...\n ],\n\nIn addition you will need to load the ZCML. In your ``configure.zcml`` add\na line like this::\n\n \n \nYou can then use the `HtmlText` field type in your schemas. For example::\n\n from zope.interface import Interface\n from zope import schema\n from htmllaundry.z3cform import HtmlText\n\n class IDocument(Interface):\n title = schema.TextLine(\n title = _(u\"Title\"),\n required = True)\n\n description = HtmlText(\n title = _(u\"Description\"),\n required = True)\n\nPlease note that using ``HtmlText`` will not automatically give you a WYSYWIG\nwidget.\n\n\n.. _z3c.form: http://pypi.python.org/pypi/z3c.form\n.. _lxml: http://lxml.de/\n\n\nChangelog\n=========\n\n2.1 - May 10, 2016\n------------------\n\n* Do not remove empty ```` tags that could be used as anchors.\n* When removing empty tags, allow to define additional tags that are considered OK to be empty\n\n\n2.0 - December 7, 2012\n----------------------\n\n* When wrapping unwrapped text do not create separate wrappers for inline\n elements.\n\n* Use PEP8 naming for all functions. The old names for public methods\n will continue to work for backwards compatibility.\n\n* Add support for Python 3.\n\n\n1.10 - May 17, 2011\n-------------------\n\n* Add option to `sanitize` to specify a different wrap element or\n skip wrapping completely.\n\n\n1.9 - April 27, 2011\n--------------------\n\n* Add MANIFEST.in to faciliate releases not made from subversion.\n\n* Fix all cleaners to strip javascript. This fixes `issue 1\n `_.\n\n\n1.8 - November 30, 2010\n-----------------------\n\n* Remove link target enforcement from hardcoded code path from ``sanitize``.\n This makes it possible to use the new ``link_target`` cleaner option.\n\n\n1.7 - November 30, 2010\n-----------------------\n\n* Make forcing of target attributes on externals linke configurable via a\n new ``link_target`` option in the cleaners. Only enable this option for\n the ``CommentCleaner``.\n\n\n1.6 - November 18, 2010\n-----------------------\n\n* Correct whitespace test for wrapping bare text as well.\n\n\n1.5 - November 18, 2010\n-----------------------\n\n* Correct whitespace checks to handle all unicode whitespace. This fixes problems\n with \\xA0 (or   in HTML-speak) being treated as text.\n\n\n1.4 - August 3, 2010\n--------------------\n\n* Small code cleanup.\n\n* Strip leading breaks.\n\n\n1.3 - July 30, 2010\n-------------------\n\n* Strip all top level br elements. Breaks are fine in blocklevel elements,\n but should not be used to add vertical spacing between block elements.\n\n\n1.2 - February 15, 2010\n-----------------------\n\n* Fix a typo in the documentation.\n\n* Strip trailing breaks.\n\n\n1.1 - February 5, 2010\n----------------------\n\n* Add a simple StripMarkup method.\n\n* Add ZCML necessary for z3c.form integration.\n\n\n1.0 - February 5, 2010\n----------------------\n\n* First release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "html clean", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "htmllaundry", "package_url": "https://pypi.org/project/htmllaundry/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/htmllaundry/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/htmllaundry/2.1/", "requires_dist": null, "requires_python": null, "summary": "Simple HTML cleanup utilities", "version": "2.1" }, "last_serial": 2108637, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "a3c974600d015fba4c3b36953097190f", "sha256": "9154e62da5014c1f32248121d6912a10ee487ef181ad5e2894153fcf6564e82e" }, "downloads": -1, "filename": "htmllaundry-1.0.tar.gz", "has_sig": false, "md5_digest": "a3c974600d015fba4c3b36953097190f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5104, "upload_time": "2010-02-05T18:15:09", "url": "https://files.pythonhosted.org/packages/9a/c5/671462335231773de5c441b4b7065e9119ae7b239a0a8bfe1063d507ec0d/htmllaundry-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "072682cbd8973810616883afe1758253", "sha256": "6fa6b867867168b179e07b745081b3601100943c74d0e282411993a201408978" }, "downloads": -1, "filename": "htmllaundry-1.1.tar.gz", "has_sig": false, "md5_digest": "072682cbd8973810616883afe1758253", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5757, "upload_time": "2010-02-05T18:36:16", "url": "https://files.pythonhosted.org/packages/06/ce/a468e570fdb13b30e889d1557e59af2a85e806859d86e86264dd3412047e/htmllaundry-1.1.tar.gz" } ], "1.10": [ { "comment_text": "", "digests": { "md5": "eed10cc4a1017b72f2fda574f42dcbbd", "sha256": "9a847408243107451fc0408afe1fb0b7fbb6206c63d59775614f89ec341e7e96" }, "downloads": -1, "filename": "htmllaundry-1.10.tar.gz", "has_sig": false, "md5_digest": "eed10cc4a1017b72f2fda574f42dcbbd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7684, "upload_time": "2011-05-17T10:29:00", "url": "https://files.pythonhosted.org/packages/3e/54/5dc2c166a86ba005768f4d535401db17c8598d81a6c225d430c3b0e4d8df/htmllaundry-1.10.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "12966eb7ac2cad30df1a7b920043f316", "sha256": "191df702ecdcb0402866a1706a82eafcece1268a7e489d0b0e0a56b6f712db3e" }, "downloads": -1, "filename": "htmllaundry-1.2.tar.gz", "has_sig": false, "md5_digest": "12966eb7ac2cad30df1a7b920043f316", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5828, "upload_time": "2010-02-15T10:09:14", "url": "https://files.pythonhosted.org/packages/01/b0/9de3e535df5f5a8bae96c8c71398d7a4e941a38ab37876456fe2f57c9c6b/htmllaundry-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "a38511e80257d2baa296d3a7dee5d0f0", "sha256": "596e8890776dc72f24e95fa0cd787c04e836e5a3036721880e310d104797acfa" }, "downloads": -1, "filename": "htmllaundry-1.3.tar.gz", "has_sig": false, "md5_digest": "a38511e80257d2baa296d3a7dee5d0f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6163, "upload_time": "2010-07-30T14:42:42", "url": "https://files.pythonhosted.org/packages/f7/8d/0b0a13a990f84fb05aa054a5a24b143cf182c215dba92911b29c450a1f85/htmllaundry-1.3.tar.gz" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "1c7bf9192d8164c8d389c52a897cb4b3", "sha256": "d8c986798bc9775cc5e177ae1d8ae2e2d6407e2c8bf1466cbd2797ed181a6e0f" }, "downloads": -1, "filename": "htmllaundry-1.4.tar.gz", "has_sig": false, "md5_digest": "1c7bf9192d8164c8d389c52a897cb4b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6262, "upload_time": "2010-08-03T15:27:06", "url": "https://files.pythonhosted.org/packages/01/18/2995a0d75528e1e8469493310b9df93753c917c1d40ef9c7185e5d6edc9a/htmllaundry-1.4.tar.gz" } ], "1.5": [ { "comment_text": "", "digests": { "md5": "ca92b18a42a72accaca3524ff38aa273", "sha256": "54ba55db28a43998b6223e59b508ef5e260bb2547bb134221219a7c41d4a9565" }, "downloads": -1, "filename": "htmllaundry-1.5.tar.gz", "has_sig": false, "md5_digest": "ca92b18a42a72accaca3524ff38aa273", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6494, "upload_time": "2010-11-18T11:41:27", "url": "https://files.pythonhosted.org/packages/e8/45/299d23d76ec121ba56a69cf4043c9d96158eeeeb6ca3b763a40f68732b53/htmllaundry-1.5.tar.gz" } ], "1.6": [ { "comment_text": "", "digests": { "md5": "983b4ab6ccf3bc103a36e603cade4c3f", "sha256": "d53dadefd3ea1d770ed523e40fdfda24e5fd237051f6f7d98a46758877a78de0" }, "downloads": -1, "filename": "htmllaundry-1.6.tar.gz", "has_sig": false, "md5_digest": "983b4ab6ccf3bc103a36e603cade4c3f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6547, "upload_time": "2010-11-18T12:16:19", "url": "https://files.pythonhosted.org/packages/95/9d/9c642054f9d9b74e2919cf6937f057eff4aaf6ed078fb2d75445bd5c9887/htmllaundry-1.6.tar.gz" } ], "1.7": [ { "comment_text": "", "digests": { "md5": "cc4e1ea447b22d0770f1e4e0e2a1ff25", "sha256": "33c5f8064fa05b0081f9210f8769c40b30aaa41ae73e563244e68023ddd66a2d" }, "downloads": -1, "filename": "htmllaundry-1.7.tar.gz", "has_sig": false, "md5_digest": "cc4e1ea447b22d0770f1e4e0e2a1ff25", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6853, "upload_time": "2010-11-30T11:12:31", "url": "https://files.pythonhosted.org/packages/fa/20/43507c73c069655101903ba12b72be09c8d0dedc71e6326327e82a5c6170/htmllaundry-1.7.tar.gz" } ], "1.8": [ { "comment_text": "", "digests": { "md5": "5521a4582e141f47d7fa4054c2cc86c2", "sha256": "fab829c8229c2e3c0b5195bf3086b391cba5b928e82afd4813a224805ec153d7" }, "downloads": -1, "filename": "htmllaundry-1.8.tar.gz", "has_sig": false, "md5_digest": "5521a4582e141f47d7fa4054c2cc86c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6848, "upload_time": "2010-11-30T11:40:19", "url": "https://files.pythonhosted.org/packages/3f/fa/ab22ed73270cd15ddb80409b85f2a114596bf35e5248fd9c1cd5a1f0e860/htmllaundry-1.8.tar.gz" } ], "1.9": [ { "comment_text": "", "digests": { "md5": "c49d87a0e3d6bdd03f132b5531acc501", "sha256": "6a7da812f97050fd22753415010f04975114137c6ad349ab67fc65ace77f8716" }, "downloads": -1, "filename": "htmllaundry-1.9.tar.gz", "has_sig": false, "md5_digest": "c49d87a0e3d6bdd03f132b5531acc501", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7319, "upload_time": "2011-04-27T12:49:19", "url": "https://files.pythonhosted.org/packages/dd/57/dcc2aaa774f764181724be1fc35995ac747592df4ad40323e1e2a0a692af/htmllaundry-1.9.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "6db6909de76c4b259e65d90b5debdbda", "sha256": "e428cba78d5a965e959f5dac2eb7d5f7d627dd889990d5efa8d4e03f3dd768d9" }, "downloads": -1, "filename": "htmllaundry-2.0.tar.gz", "has_sig": false, "md5_digest": "6db6909de76c4b259e65d90b5debdbda", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8166, "upload_time": "2012-12-07T16:13:20", "url": "https://files.pythonhosted.org/packages/62/91/f9bea046aaa5673c3abea2e4b142b7ff0de786dc72ed6f8cb7d7c68f858e/htmllaundry-2.0.tar.gz" } ], "2.1": [ { "comment_text": "", "digests": { "md5": "d4803063c7c467e468a077e3c34933f5", "sha256": "d10d84be703acb54b3ff75bfd904c8cada729b3e3a75775bae51f1ae27bbeb16" }, "downloads": -1, "filename": "htmllaundry-2.1.zip", "has_sig": false, "md5_digest": "d4803063c7c467e468a077e3c34933f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15999, "upload_time": "2016-05-10T14:58:24", "url": "https://files.pythonhosted.org/packages/63/3b/0d385eafe33458b4a571530c3cfe17f12e9336e7b4621a699e2707d08ad7/htmllaundry-2.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d4803063c7c467e468a077e3c34933f5", "sha256": "d10d84be703acb54b3ff75bfd904c8cada729b3e3a75775bae51f1ae27bbeb16" }, "downloads": -1, "filename": "htmllaundry-2.1.zip", "has_sig": false, "md5_digest": "d4803063c7c467e468a077e3c34933f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15999, "upload_time": "2016-05-10T14:58:24", "url": "https://files.pythonhosted.org/packages/63/3b/0d385eafe33458b4a571530c3cfe17f12e9336e7b4621a699e2707d08ad7/htmllaundry-2.1.zip" } ] }