1import re
2from calibre.web.feeds.news import BasicNewsRecipe
3
4
5class ABCRecipe(BasicNewsRecipe):
6    title = u'ABC Linuxu'
7    oldest_article = 5
8    max_articles_per_feed = 3  # 5
9    __author__ = 'Funthomas'
10    language = 'cs'
11
12    feeds = [
13        # (u'Blogy', u'http://www.abclinuxu.cz/auto/blogDigest.rss'),
14        (u'Články', u'http://www.abclinuxu.cz/auto/abc.rss'),
15        (u'Zprávičky', 'http://www.abclinuxu.cz/auto/zpravicky.rss')
16    ]
17
18    remove_javascript = True
19    no_stylesheets = True
20    remove_attributes = ['width', 'height']
21
22    remove_tags_before = dict(name='h1')
23    remove_tags = [
24        dict(attrs={'class': ['meta-vypis', 'page_tools', 'cl_perex']}),
25        dict(attrs={'class': ['cl_nadpis-link', 'komix-nav']})
26    ]
27
28    remove_tags_after = [
29        dict(name='div', attrs={'class': ['cl_perex', 'komix-nav']}),
30        dict(attrs={'class': ['meta-vypis', 'page_tools']}),
31        dict(name='', attrs={'': ''}),
32    ]
33
34    preprocess_regexps = [
35        (re.compile(r'</div>.*<p class="perex">', re.DOTALL),
36         lambda match: '</div><p class="perex">')
37    ]
38
39    def print_version(self, url):
40        return url + '?varianta=print&noDiz'
41
42    extra_css = '''
43            h1 {font-size:130%; font-weight:bold}
44            h3 {font-size:111%; font-weight:bold}
45        '''
46