View Single Post
Old 01-26-2014, 05:24 AM   #5
fenuks
Enthusiast
fenuks began at the beginning.
 
Posts: 34
Karma: 10
Join Date: Aug 2011
Device: Amazon Kindle 3
I see. Changing classes in postprocess_html works but css is still not applied. I have to add inline style myself:
Code:
def postprocess_html(self, soup, first_fetch):
    for tag in soup.findAll(attrs={'class':re.compile('alignright')}):
        tag['class'] = 'alignright'
        tag['style'] = 'float: right; margin: 0px 0px 5px 10px;'
    for tag in soup.findAll(attrs={'class':re.compile('alignleft')}):
        tag['class'] = 'alignleft'
        tag['style'] = 'float:left; margin-right:5px;'
    for tag in soup.findAll(attrs={'class':re.compile('aligncenter')}):
        tag['class'] = 'aligncenter'
        tag['style'] = 'margin: 0px auto; display: block;'
    return soup
fenuks is offline   Reply With Quote