import re
from calibre.web.feeds.news import BasicNewsRecipe


class Evangelizo(BasicNewsRecipe):
    title = 'Evangelizo.org'
    oldest_article = 2
    max_articles_per_feed = 30
    language = 'de'
    __author__ = 'Bobus'
    feeds = [
        ('EvangleliumTagfuerTag',
         'http://www.evangeliumtagfuertag.org/rss/evangelizo_rss-de.xml'),
    ]
    use_embedded_content = True
    preprocess_regexps = [
        (re.compile(
            r'&lt;font size="-2"&gt;([(][0-9]*[)])&lt;/font&gt;'), r'\g<1>'),
        (re.compile(r'([\.!]\n)'), r'\g<1><br />'),
    ]

    def populate_article_metadata(self, article, soup, first):
        article.title = re.sub(
            r'<font size="-2">([(][0-9]*[)])</font>', r'\g<1>', article.title)
        return
