import re

from calibre.web.feeds.news import BasicNewsRecipe

class GermanGovermentPress(BasicNewsRecipe):
    title          = u'Pressemitteilungen der Bundesregierung'
    oldest_article = 14
    __author__ = 'malfi'
    max_articles_per_feed = 100
    no_stylesheets = True
    cover_url = 'http://www.bundesregierung.de/static/images/logoBR.gif'
    language = 'de'
    keep_only_tags = []
    keep_only_tags.append(dict(name = 'h2'))
    keep_only_tags.append(dict(name = 'div', attrs = {'class': 'textblack'}))
    keep_only_tags.append(dict(name = 'div', attrs = {'class': 'subtitle'}))
    keep_only_tags.append(dict(name = 'div', attrs = {'class': 'text'}))
    remove_tags = []
    feeds          = [ (u'Pressemitteilungen',u'http://www.bundesregierung.de/Webs/Breg/DE/Service/RSS/Functions/bundesregierungPressemitteilungenRSS20,templateId=renderNewsfeed.rdf') ]
    extra_css = '''
     h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
     h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
     p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
     body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
     '''
    def print_version(self, url):
         m = re.search(r'^(.*).html$', url)
         return str(m.group(1)) + ',layoutVariant=Druckansicht.html'
