__license__   = 'GPL v3'
__copyright__ = '2008-2011, Darko Miletic <darko.miletic at gmail.com>'
'''
www.cronista.com
'''

from calibre.web.feeds.news import BasicNewsRecipe

class Pagina12(BasicNewsRecipe):
    title                 = 'El Cronista Comercial'
    __author__            = 'Darko Miletic'
    description           = 'El Cronista Comercial es el Diario economico-politico mas valorado. Es la fuente mas confiable de informacion en temas de economia, finanzas y negocios enmarcados politicamente.'
    publisher             = 'Cronista.com'
    category              = 'news, politics, economy, finances, Argentina'
    oldest_article        = 2
    max_articles_per_feed = 200
    no_stylesheets        = True
    encoding              = 'utf8'
    use_embedded_content  = False
    language              = 'es_AR'
    remove_empty_feeds    = True
    publication_type      = 'newspaper'
    masthead_url          = 'http://www.cronista.com/export/sites/diarioelcronista/arte/header-logo.gif'
    extra_css             = """
                               body{font-family: Arial,Helvetica,sans-serif }
                               h2{font-family: Georgia,"Times New Roman",Times,serif }
                               img{margin-bottom: 0.4em; display:block}
                               .nom{font-weight: bold; vertical-align: baseline}
                               .autor-cfoto{border-bottom: 1px solid #D2D2D2;
                                            border-top: 1px solid #D2D2D2;
                                            display: inline-block;
                                            margin: 0 10px 10px 0;
                                            padding: 10px;
                                            width: 210px}
                                .under{font-weight: bold}
                                .time{font-size: small}
                            """

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

    remove_tags = [
                     dict(name=['meta','link','base','iframe','object','embed'])
                    ,dict(attrs={'class':['user-tools','tabsmedia']})
                  ]
    remove_attributes  = ['lang']
    remove_tags_before = dict(attrs={'class':'top'})
    remove_tags_after  = dict(attrs={'class':'content-nota'})
    feeds = [(u'Ultimas noticias', u'http://www.cronista.com/rss.html')]


    def preprocess_html(self, soup):
        for item in soup.findAll(style=True):
            del item['style']
        return soup
