__license__   = 'GPL v3'
__copyright__ = '2012, Darko Miletic <darko.miletic at gmail.com>'
'''
www.pravda.ru
'''

from calibre.web.feeds.news import BasicNewsRecipe

class Pravda_ru(BasicNewsRecipe):
    title                 = u'Правда'
    __author__            = 'Darko Miletic'
    description           = u'Правда.Ру: Аналитика и новости'
    publisher             = 'PRAVDA.Ru'
    category              = 'news, politics, Russia'
    oldest_article        = 2
    max_articles_per_feed = 200
    no_stylesheets        = True
    encoding              = 'utf8'
    use_embedded_content  = False
    language              = 'ru'
    remove_empty_feeds    = True
    publication_type      = 'newspaper'
    masthead_url          = 'http://www.pravda.ru/pix/logo.gif'
    extra_css             = """
                               body{font-family: Arial,sans-serif }
                               img{margin-bottom: 0.4em; display:block}
                            """

    conversion_options = {
                          'comment'   : description
                        , 'tags'      : category
                        , 'publisher' : publisher
                        , 'language'  : language
                        }

    remove_attributes=['lang', 'style']
    keep_only_tags = [dict(name='div', attrs={'id':'article'})]

    feeds = [
              (u'Мир'         , u'http://www.pravda.ru/world/export.xml'    )
             ,(u'Религия'     , u'http://www.pravda.ru/faith/export.xml'    )
             ,(u'Общество'    , u'http://www.pravda.ru/society/export.xml'  )
             ,(u'Происшествия', u'http://www.pravda.ru/accidents/export.xml')
             ,(u'Наука'       , u'http://www.pravda.ru/science/export.xml'  )
             ,(u'Экономика'   , u'http://www.pravda.ru/economics/export.xml')
             ,(u'Политика'    , u'http://www.pravda.ru/politics/export.xml' )
            ]

    def print_version(self, url):
        return url + '?mode=print'
