View Single Post
Old 10-30-2010, 05:47 PM   #1
marbs
Zealot
marbs began at the beginning.
 
Posts: 122
Karma: 10
Join Date: Jul 2010
Device: nook
postprocess_html

i have a recipe that i am working on.
it has a few tags in the middle od the article text like this:
<p>&nbsp;&nbsp;</p>
and some like this:
<p>&nbsp;</p>
there is now way to remove them with remove_tag.
thought of something like this:
Spoiler:
Code:
    def postprocess_html(self, soup):
        print 'the soup is', soup
        for tag in soup.findAll(name=['p']):
            print tag
            text= tag.contents()
            print text
            if text = '&nbsp;':
                tag.extract ()


once i add this function, the recipe does not give me any articles. am i using it right?

on an other recipe i am working on i want to use the description form the rss feed replace with a tag in the article it self.

can i the description as one of the variables that postprocess_html gets?
what is the name of the description variable in calibre?
something along the lines of
Spoiler:
Code:
    def postprocess_html(self, soup, description):
        print 'the soup is', soup
        for tag in soup.findAll(name=['td']):
            print tag
            text= tag.id
            print text
            if text ='titleContainer1':
                tag.replaceWith (description)

or something like that?
marbs is offline   Reply With Quote