# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import unicode_literals
from calibre.web.feeds.recipes import BasicNewsRecipe
import re


class demagogRecipe(BasicNewsRecipe):
    __author__ = 'bubak'
    title = u'Demagog.cz'
    publisher = u''
    description = 'demagog.cz'
    oldest_article = 6
    max_articles_per_feed = 20
    use_embedded_content = False
    remove_empty_feeds = True

    feeds = [
        (u'Aktuality', u'http://demagog.cz/rss')
    ]

    language = 'cs'
    cover_url = 'http://demagog.cz/content/images/demagog.cz.png'
    remove_javascript = True
    no_stylesheets = True
    extra_css             = """
                .vyrok_suhrn{margin-top:50px; }
                .vyrok{margin-bottom:30px; }
                            """

    remove_tags = [dict(name='a', attrs={'class': 'vyrok_odovodnenie_tgl'}),
                   dict(name='img', attrs={'class': 'vyrok_fotografia'})]
    remove_tags_before = dict(name='h1')
    remove_tags_after = dict(name='div', attrs={'class': 'vyrok_text_after'})
    preprocess_regexps = [(re.compile(
        r'(<div class="vyrok_suhrn">)', re.DOTALL | re.IGNORECASE), lambda match: '\1<hr>')]
