# -*- coding: utf-8 -*-
#!/usr/bin/env  python

__license__   = 'GPL v3'
__copyright__ = u'2011, Silviu Cotoar\u0103'
'''
publika.md
'''

from calibre.web.feeds.news import BasicNewsRecipe

class Publika(BasicNewsRecipe):
    title                 = u'Publika'
    __author__            = u'Silviu Cotoar\u0103'
    description           = u'\u015etiri din Moldova'
    publisher             = u'Publika'
    oldest_article        = 25
    language              = 'ro'
    max_articles_per_feed = 100
    no_stylesheets        = True
    use_embedded_content  = False
    category              = 'Ziare,Stiri,Moldova'
    encoding              = 'utf-8'
    cover_url             = 'http://assets.publika.md/images/logo.jpg'

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

    keep_only_tags = [
                          dict(name='div', attrs={'id':'colLeft'})
                     ]

    remove_tags = [
                          dict(name='div', attrs={'class':['articleInfo']})
                        , dict(name='div', attrs={'class':['articleRelated']})
                        , dict(name='div', attrs={'class':['roundedBox socialSharing']})
                        , dict(name='div', attrs={'class':['comment clearfix']})
                  ]

    remove_tags_after = [
                              dict(name='div', attrs={'class':['roundedBox socialSharing']})
                            , dict(name='div', attrs={'class':['comment clearfix']})
                        ]

    feeds          = [
                        (u'Feeds', u'http://rss.publika.md/stiri.xml')
                     ]

    def preprocess_html(self, soup):
        return self.adeify_images(soup)
