How to convert HTML CSS class into style in pure python - what kind of library could be used on GAE
Is there any pure python librar开发者_开发问答y to use on Google App Engine which allow to convert HTML with CSS class into HTML with styles only for emailing purpose on gmail.
Want to make such conversion on google app engine.
XHTML with CSS class:
<p class="xx">xxx</p>
<p class="yy">yyy</p>
Considering that CSS is such:
p.xx, p.yy { font-size: 120%; }
p.yy { color:red; }
I want to convert XHTML classes into styles to remove CSS inclusion as it required by Gmail:
<p style="font-size:120%">xx</p>
<p style="font-size:120%;color:red;">yy</p>
Is any hint - I could try to code it in regex since CSS is simple but not want to invent the wheel again.
Take a look at xhtml2pdf (under Apache License) for the code that combines the HTML and CSS together and then change the output from PDF to HTML.
精彩评论