#!/usr/bin/env  python2

__license__ = 'GPL v3'
'''
blog.eclicto.pl
'''

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


class BlogeClictoRecipe(BasicNewsRecipe):
    __author__ = 'Mori, Tomasz Długosz'
    language = 'pl'

    title = u'Blog eClicto'
    publisher = u'Blog eClicto'
    description = u'Blog o e-papierze i e-bookach'

    max_articles_per_feed = 100
    cover_url = 'http://blog.eclicto.pl/wordpress/wp-content/themes/blog_eclicto/g/logo.gif'

    no_stylesheets = True
    remove_javascript = True
    encoding = 'utf-8'

    extra_css = '''
            img{float: left; padding-right: 10px; padding-bottom: 5px;}
    '''

    feeds = [
        (u'Blog eClicto', u'http://blog.eclicto.pl/feed/')
    ]

    remove_tags = [
        dict(name='div', attrs={'class': 'social_bookmark'}),
    ]

    keep_only_tags = [
        dict(name='div', attrs={'class': 'post'})
    ]

    preprocess_regexps = [
        (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in
        [
            (r'\s*</', lambda match: '</'),
        ]
    ]
