From f326d6d7e4bb67916a0a78e995432c0d61bb1e89 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 9 Jul 2011 09:51:59 -0600 Subject: [PATCH] Pecat by DM. Fixes #808028 (New recipe for serbian magazine Pecat) --- recipes/icons/pecat.png | Bin 0 -> 383 bytes recipes/pecat.recipe | 72 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 recipes/icons/pecat.png create mode 100644 recipes/pecat.recipe diff --git a/recipes/icons/pecat.png b/recipes/icons/pecat.png new file mode 100644 index 0000000000000000000000000000000000000000..6f9c1dec4f51c02cf2bc71e727018d754a6bd86c GIT binary patch literal 383 zcmV-_0f7FAP)392&IMnc3KY z^z*lG*q^^-)7ORwf4%zj=tCG!&z_Z(kz(NG z0kU7edd>0YFLn(qni>$s=M$$S_4J^&-MP)r&4t4TDMVca#-? zj2BzCyWG6{vMBr0|9_u={+Tkvg^?ADhP^j#eEa=NhJoo9Cx;X}`{$1zA>zh7eBTx1 duxKC>007GkaTD~2&|Clj002ovPDHLkV1i~fw}Sux literal 0 HcmV?d00001 diff --git a/recipes/pecat.recipe b/recipes/pecat.recipe new file mode 100644 index 0000000000..f5da27a065 --- /dev/null +++ b/recipes/pecat.recipe @@ -0,0 +1,72 @@ + +__license__ = 'GPL v3' +__copyright__ = '2011, Darko Miletic ' +''' +www.pecat.co.rs +''' + +import re +from calibre.web.feeds.news import BasicNewsRecipe + +class Pecat_rs(BasicNewsRecipe): + title = 'Pecat' + __author__ = 'Darko Miletic' + description = 'Internet portal slobodne Srbije' + oldest_article = 15 + max_articles_per_feed = 100 + language = 'sr' + encoding = 'utf-8' + no_stylesheets = True + use_embedded_content = True + masthead_url = 'http://www.pecat.co.rs/wp-content/themes/zenko-v1/images/logo.jpg' + publication_type = 'magazine' + extra_css = """ + @font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} + @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} + body{font-family: Arial,Helvetica,sans1,sans-serif} + img{display: block; margin-bottom: 1em; margin-top: 1em} + p{display: block; margin-bottom: 1em; margin-top: 1em} + """ + + conversion_options = { + 'comment' : description + , 'tags' : 'politika, Srbija' + , 'publisher': 'Pecat' + , 'language' : language + } + + preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')] + + feeds = [(u'Clanci', u'http://www.pecat.co.rs/feed/')] + + def preprocess_html(self, soup): + for item in soup.findAll(style=True): + del item['style'] + for item in soup.findAll('a'): + limg = item.find('img') + if item.string is not None: + str = item.string + item.replaceWith(str) + else: + if limg: + limg.extract() + item.replaceWith(limg) + else: + str = self.tag_to_string(item) + item.replaceWith(str) + for item in soup.findAll('img'): + dad = item.findParent('p') + if dad: + mydad = dad.parent + myIndex = mydad.contents.index(dad) + item.extract() + mydad.insert(myIndex,item) + for item in soup.findAll('strong'): + dad = item.findParent('p') + if dad: + mydad = dad.parent + myIndex = mydad.contents.index(dad) + item.extract() + item.name='h4' + mydad.insert(myIndex,item) + return soup