# -*- coding: utf-8 -*-

__license__   = 'GPL v3'
__copyright__ = 'Marcin Urban 2011'

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

class recipeMagic(BasicNewsRecipe):
    title                  = 'National Geographic PL'
    __author__             = 'Marcin Urban 2011'
    description            = 'legenda wśród magazynów z historią sięgającą 120 lat'
    cover_url      	       = 'http://www.guj.pl/var/guj/storage/images/media/nasze_magazyny/national_geographic/logo/ng_logo/2606-1-pol-PL/ng_logo.jpg'
    oldest_article         = 7
    max_articles_per_feed  = 100
    no_stylesheets         = True
    #delay                 = 1
    use_embedded_content   = False
    encoding               = 'utf8'
    publisher              = 'G+J Gruner+Jahr Polska'
    category               = 'news, PL,'
    language               = 'pl'
    publication_type       = 'newsportal'
    extra_css              = ''' body {font-family: verdana, arial, helvetica, geneva, sans-serif ;}
	                    h1{text-align: center;}
        	 	           h2{font-size: medium; font-weight: bold;}
        	   	         .authordate {font-size: small; color: #696969;}
        		            p.lead {font-weight: bold; text-align: center;}
        		            .fot{font-size: x-small; color: #666666;} '''
    preprocess_regexps     = [(re.compile(r'<!--.*?-->', re.DOTALL), lambda m: '')]
    conversion_options = {
                             'comments'        : description
                            ,'tags'            : category
                            ,'language'        : language
                            ,'publisher'       : publisher
                            ,'linearize_tables': True
                         }

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

    remove_attributes = ['width','height']

    feeds          = [
                      ('National Geographic PL', 'http://www.national-geographic.pl/rss/'),
                    ]

    def print_version(self, url):
        return url.replace('artykuly0Cpokaz', 'drukuj-artykul')

