__license__ = 'GPL v3'
__copyright__ = '2011, Oscar Megia Lopez'
'''
perezreverte.com
'''
import re
from calibre.web.feeds.recipes import BasicNewsRecipe


class PerezReverte(BasicNewsRecipe):
    title = u'Patente de Corso'
    __author__ = 'Oscar Megia Lopez'
    description = 'Arturo Perez Reverte'
    oldest_article = 90
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    encoding = 'utf8'
    publisher = 'Arturo Perez Reverte'
    category = 'Articulo'
    language = 'es'
    publication_type = 'Magazine'
    extra_css = ' body{ font-family: Verdana,Helvetica,Arial,sans-serif } .contentheading{font-weight: bold} .txt_articulo{display: block; padding: 0; border: 1px solid; width: 40%; font-size: small} .story-feature h2{text-align: center; text-transform: uppercase} '  # noqa
    preprocess_regexps = [(re.compile(r'<!--.*?-->', re.DOTALL), lambda m: '')]
    conversion_options = {
        'comments': description, 'tags': category, 'language': language, 'publisher': publisher, 'linearize_tables': True
    }

    keep_only_tags = [
        dict(name='h2', attrs={'class': ['titular']}),
        dict(name='p', attrs={'class': ['fecha']}),
        dict(name='div', attrs={'class': ['bloqueTexto']})
    ]

    remove_attributes = ['width', 'height']

    feeds = [
        ('Patente de corso - Web oficial de Arturo Perez Reverte',
         'http://www.perezreverte.com/rss/patentes-corso/')
    ]
