arski / ClaSS2Style

Converts CSS classes to inline styles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ClaSS2Style

Converts CSS classes to inline styles

A simplified, but much more efficient version of premailer and pynliner.

Will only convert simple class definitions from your stylesheet, such as .foo, however, it will do so in a fraction of the time that premailer or pynliner take, so this is really targeted at large, almost semi-structured documents. In the original case, this was applied to the output of pdf2htmlEX, a popular PDF-to-HTML converter.

Getting started

First of all, change into the module's directory and run:

    $ python setup.py install

Next, the most basic use is to use the shortcut function, like this:

    >>> from ClaSS2Style import ClaSS2Style
    >>> print ClaSS2Style(some_html_data).transform()

The ClaSS2Style take a bunch of keyword arguments to control its behaviour, check out the code of the ClaSS2Style class for the full list.

About

Converts CSS classes to inline styles

License:Apache License 2.0


Languages

Language:Python 100.0%