{ "info": { "author": "Peter Bengtsson", "author_email": "mail@peterbe.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Other Environment", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: Python Software Foundation License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Communications", "Topic :: Internet :: WWW/HTTP", "Topic :: Other/Nonlisted Topic", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "premailer\n=========\n\n\nTurns CSS blocks into style attributes\n--------------------------------------\n\nWhen you send HTML emails you can't used style tags but instead you\nhave to put inline `style` attributes on every element. So from this::\n\n \n \n

Peter

\n

Hej

\n \n\nYou want this::\n\n \n

Peter

\n

Hej

\n \n\n\npremailer does this. It parses an HTML page, looks up `style` blocks\nand parses the CSS. It then uses the `lxml.html` parser to modify the\nDOM tree of the page accordingly.\n\nGetting started\n---------------\n\nIf you havena't already done so, install `premailer` first::\n\n $ pip install premailer\n\nNext, the most basic use is to use the shortcut function, like this::\n\n >>> from premailer import transform\n >>> print transform(\"\"\"\n ... \n ... \n ...

Peter

\n ...

Hej

\n ... \n ... \"\"\")\n \n \n \n

Peter

\n

Hej

\n \n \n\nFor more advanced options, check out the code of the `Premailer` class\nand all its options in its constructor.\n\n\nTurning relative URLs into absolute URLs\n----------------------------------------\n\nAnother thing premailer can do for you is to turn relative URLs (e.g.\n\"/some/page.html\" into \"http://www.peterbe.com/some/page.html\"). It\ndoes this to all `href` and `src` attributes that don't have a `://`\npart in it. For example, turning this::\n\n \n \n Home\n Page\n External\n Folder\n \n \n\nInto this::\n\n \n \n Home\n Page\n External\n Folder\n \n \n\nby using `transform('...', base_url='http://www.peterbe.com/')`.\n\n\nHTML attributes created additionally\n------------------------------------\n\nCertain HTML attributes are also created on the HTML if the CSS\ncontains any ones that are easily translated into HTML attributes. For\nexample, if you have this CSS: `td { background-color:#eee; }` then\nthis is transformed into `style=\"background-color:#eee\"` AND as an\nHTML attribute `bgcolor=\"#eee\"`.\n\nHaving these extra attributes basically as a \"back up\" for really shit\nemail clients that can't even take the style attributes. A lot of\nprofessional HTML newsletters such as Amazon's use this.", "description_content_type": null, "docs_url": null, "download_url": "http://github.com/peterbe/premailer", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/peterbe/premailer", "keywords": "html lxml email mail style", "license": "Python", "maintainer": null, "maintainer_email": null, "name": "premailer_cspw", "package_url": "https://pypi.org/project/premailer_cspw/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/premailer_cspw/", "project_urls": { "Download": "http://github.com/peterbe/premailer", "Homepage": "http://github.com/peterbe/premailer" }, "release_url": "https://pypi.org/project/premailer_cspw/1.2.2/", "requires_dist": null, "requires_python": null, "summary": "Turns CSS blocks into style attributes", "version": "1.2.2" }, "last_serial": 834610, "releases": { "1.2.2": [ { "comment_text": "", "digests": { "md5": "86aa8beac7832c17d04062a936c452f0", "sha256": "2c17358641c29d2783adc0dae61ea1a9c6d6eeea4de477193b52ad4c9762f57a" }, "downloads": -1, "filename": "premailer_cspw-1.2.2.tar.gz", "has_sig": false, "md5_digest": "86aa8beac7832c17d04062a936c452f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10991, "upload_time": "2013-08-07T15:48:08", "url": "https://files.pythonhosted.org/packages/5f/d7/9429f0adbdf70b342310e7fab1d9ba2e9f49cf1f70117b9f1b2c2a4527cc/premailer_cspw-1.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "86aa8beac7832c17d04062a936c452f0", "sha256": "2c17358641c29d2783adc0dae61ea1a9c6d6eeea4de477193b52ad4c9762f57a" }, "downloads": -1, "filename": "premailer_cspw-1.2.2.tar.gz", "has_sig": false, "md5_digest": "86aa8beac7832c17d04062a936c452f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10991, "upload_time": "2013-08-07T15:48:08", "url": "https://files.pythonhosted.org/packages/5f/d7/9429f0adbdf70b342310e7fab1d9ba2e9f49cf1f70117b9f1b2c2a4527cc/premailer_cspw-1.2.2.tar.gz" } ] }