__license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
'''
emg.rs/en/news
'''

from calibre.web.feeds.news import BasicNewsRecipe


class emportal_en(BasicNewsRecipe):
    title = 'Ekonom:east News'
    __author__ = 'Darko Miletic'
    description = 'Daily business news from Serbia.'
    publisher = 'Ekonom:east Media Group'
    category = 'Business, SEE, Serbia, Belgrade, news, Ekonomist, EMportal'
    oldest_article = 2
    max_articles_per_feed = 200
    no_stylesheets = True
    encoding = 'utf8'
    use_embedded_content = False
    language = 'en'
    remove_empty_feeds = True
    masthead_url = 'http://www.emg.rs/img/emportal-rss.png'
    extra_css = ' body{font-family: Arial,Helvetica,sans-serif } '

    conversion_options = {
        'comment': description, 'tags': category, 'publisher': publisher, 'language': language
    }

    remove_tags = [dict(attrs={'class': ['text-share']})]
    keep_only_tags = [dict(attrs={'class': 'text'})]
    remove_tags_after = dict(attrs={'class': 'text-share'})
    remove_attributes = ['width', 'height']

    feeds = [(u'Serbia', u'http://www.emg.rs/en/news/serbia/rss.xml')]

    def print_version(self, url):
        return url.replace('.html', '.print.html')

    def preprocess_html(self, soup):
        for item in soup.findAll(style=True):
            del item['style']
        return soup
