View Single Post
Old 12-31-2009, 07:54 AM   #1052
evanmaastrigt
Connoisseur
evanmaastrigt doesn't litterevanmaastrigt doesn't litter
 
Posts: 78
Karma: 192
Join Date: Nov 2009
Device: Sony PRS-600
Bad HTML

Quote:
Originally Posted by jimmypatrick View Post
So I'm trying to write the ps3center recipe that was requested here.
You could try the following: add the following line at the top of your file (before the class declaration)
Code:
from calibre.ebooks.BeautifulSoup import BeautifulSoup
Then add the following method:
Code:
    def preprocess_html(self, soup):
        tag = soup.find('td')
        for attr, value in tag.attrs:
            del tag[attr]
        tag.name = 'div'

        newSoup = BeautifulSoup('<html><head><title></title></head><body></body></html>')
        newSoup.body.append(tag)

        return newSoup
Not tested, but should work.
evanmaastrigt is offline