#!/usr/bin/env  python2
__license__ = 'GPL 3'
__copyright__ = 'zotzo'
__docformat__ = 'restructuredtext en'

from calibre.web.feeds.news import BasicNewsRecipe


class CreditSlips(BasicNewsRecipe):
    language = 'en'
    __author__ = 'zotzot'
    version = 2
    title = u'Credit Slips.org'
    publisher = u'Bankr-L'
    category = u'Economic blog'
    description = u'A discussion on credit and bankruptcy'
    cover_url = 'http://bit.ly/eAKNCB'
    oldest_article = 15
    max_articles_per_feed = 100
    use_embedded_content = True
    no_stylesheets = True
    remove_javascript = True

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

    feeds = [
        (u'Credit Slips', u'http://www.creditslips.org/creditslips/atom.xml')
    ]

    extra_css =    '''
                       .author {font-family:Helvetica,sans-serif; font-weight:normal;font-size:small;}
                       h1      {font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
                       p       {font-family:Helvetica,Arial,sans-serif;font-size:small;}
                       body    {font-family:Helvetica,Arial,sans-serif;font-size:small;}
                   '''

    def populate_article_metadata(self, article, soup, first):
        h2 = soup.find('h2')
        h2.replaceWith(h2.prettify() + '<p><em>Posted by ' +
                       article.author + '</em></p>')
