View Single Post
Old 08-12-2009, 03:24 AM   #2
phkoech
Member
phkoech began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Jul 2009
Device: Sony PRS-505
I've tried to modify my code (see below), but I still have the problem with comments not output by Calibre.
That's very strange because HTML is quite simple. The only strange things I see is :
- fontsize = 1 (rest of the page have fontsize = 2) => I supose Calibre is able to manage it
- there is a bug in HTML source code because there is a </b> tag without the <b> before => can I correct it with proprocess_html ?


Code:
class RecettesPrint(BasicNewsRecipe):
    title          = 'RecettesPrint'
    __author__ = 'Kek <kek.fr>'
    description = 'Recettes'
    oldest_article = 3
    language = _('French')
    max_articles_per_feed = 5000
    no_stylesheets = True
    use_embedded_content = False
    remove_javascript = True
    extra_css      = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt  }'
    html2lrf_options = ['--ignore-tables']    
    html2epub_options = 'linearize_tables = True'

    def preprocess_html(self, soup):
        for item in soup.findAll(style=True):
            del item['style']
        for item in soup.findAll(align=True):
            del item['align']
        for item in soup.findAll(valign=True):
            del item['valign']
        for item in soup.findAll(face=True):
            del item['face']
        return soup
    
    def print_version(self, url):
        if 'marmiton.org/Recettes/' in url:
            url = re.sub('Recettes/Recette', 'Recettes/Recette-Impression', url)
            return url
phkoech is offline   Reply With Quote