home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_280 / climate_progress.recipe < prev    next >
Text File  |  2011-09-09  |  2KB  |  56 lines

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
  5. '''
  6. climateprogress.org
  7. '''
  8.  
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10. from calibre.ebooks.BeautifulSoup import Tag
  11.  
  12. class ClimateProgress(BasicNewsRecipe):
  13.     title                 = 'Climate Progress'
  14.     __author__            = 'Darko Miletic'
  15.     description           = "An insider's view of climate science, politics and solutions"
  16.     publisher             = 'Climate Progress'
  17.     category              = 'news, ecology, climate, blog'
  18.     oldest_article        = 7
  19.     max_articles_per_feed = 100
  20.     no_stylesheets        = True
  21.     use_embedded_content  = True
  22.     encoding              = 'utf-8'
  23.     language = 'en'
  24.  
  25.     lang                  = 'en-US'
  26.     direction             = 'ltr'
  27.  
  28.     html2lrf_options = [
  29.                           '--comment', description
  30.                         , '--category', category
  31.                         , '--publisher', publisher
  32.                         ]
  33.  
  34.     html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
  35.  
  36.     extra_css = '''
  37.                 h2{color:#003366;font-size: large ;font-family:Arial,Helvetica,sans-serif; font-weight:bold;}
  38.                 h3{color:#003366;font-size: small ;font-family:Arial,Helvetica,sans-serif; font-weight:bold;}
  39.                 h4{color:#003366;font-size: x-small ;font-family:Arial,Helvetica,sans-serif; font-weight:bold;}
  40.                 .date{color:#333333; font-size:xx-small; font-family:Arial,Helvetica,sans-serif; font-style:italic}
  41.                 a{color:#339966;}
  42.                 body{font-family:Georgia,Times New Roman,Times,serif; font-size:x-small;color:#333333;}
  43.                 '''
  44.  
  45.     feeds = [(u'Posts', u'http://feeds.feedburner.com/climateprogress/lCrX')]
  46.  
  47.     def preprocess_html(self, soup):
  48.         soup.html['lang'] = self.lang
  49.         soup.html['dir' ] = self.direction
  50.         mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
  51.         mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
  52.         soup.head.insert(0,mlang)
  53.         soup.head.insert(1,mcharset)
  54.         return self.adeify_images(soup)
  55.  
  56.