diff --git a/recipes/icons/nezavisne_novine.png b/recipes/icons/nezavisne_novine.png new file mode 100644 index 0000000000..29da3de24f Binary files /dev/null and b/recipes/icons/nezavisne_novine.png differ diff --git a/recipes/nezavisne_novine.recipe b/recipes/nezavisne_novine.recipe new file mode 100644 index 0000000000..357c478ce1 --- /dev/null +++ b/recipes/nezavisne_novine.recipe @@ -0,0 +1,59 @@ +__license__ = 'GPL v3' +__copyright__ = '2013, Darko Miletic ' +''' +www.nezavisne.com +''' +from calibre import strftime +from calibre.web.feeds.news import BasicNewsRecipe + +class NezavisneNovine(BasicNewsRecipe): + title = 'Nezavisne novine' + __author__ = 'Darko Miletic' + description = 'Nezavisne novine - Najnovije vijesti iz BiH, Srbije, Hrvatske, Crne Gore i svijeta' + publisher = 'NIGP "DNN"' + category = 'news, politics, Bosnia, Balcans' + oldest_article = 2 + max_articles_per_feed = 200 + no_stylesheets = True + encoding = 'utf8' + use_embedded_content = False + language = 'sr' + remove_empty_feeds = True + publication_type = 'newspaper' + cover_url = strftime('http://pdf.nezavisne.com/slika/novina/nezavisne_novine.jpg?v=%Y%m%d') + masthead_url = 'http://www.nezavisne.com/slika/osnova/nezavisne-novine-logo.gif' + extra_css = """ + body{font-family: Arial,Helvetica,sans-serif } + img{margin-bottom: 0.4em; display:block} + """ + + conversion_options = { + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : language + } + keep_only_tags = [dict(name='div', attrs={'class':'vijest'})] + remove_tags_after = dict(name='div', attrs={'id':'wrap'}) + remove_tags = [ + dict(name=['meta','link','iframe','object']) + ,dict(name='div', attrs={'id':'wrap'}) + ] + remove_attributes=['lang','xmlns:fb','xmlns:og'] + + + feeds = [ + (u'Novosti' , u'http://feeds.feedburner.com/Novosti-NezavisneNovine' ) + ,(u'Posao' , u'http://feeds.feedburner.com/Posao-NezavisneNovine' ) + ,(u'Sport' , u'http://feeds.feedburner.com/Sport-NezavisneNovine' ) + ,(u'Komentar' , u'http://feeds.feedburner.com/Komentari-NezavisneNovine' ) + ,(u'Umjetnost i zabava' , u'http://feeds.feedburner.com/UmjetnostIZabava-NezavisneNovine' ) + ,(u'Život i stil' , u'http://feeds.feedburner.com/ZivotIStil-NezavisneNovine' ) + ,(u'Auto' , u'http://feeds.feedburner.com/Auto-NezavisneNovine' ) + ,(u'Nauka i tehnologija', u'http://feeds.feedburner.com/NaukaITehnologija-NezavisneNovine') + ] + + def preprocess_html(self, soup): + for item in soup.findAll(style=True): + del item['style'] + return soup diff --git a/src/calibre/utils/icu.py b/src/calibre/utils/icu.py index aaf8c415e1..e1e6c1a1c6 100644 --- a/src/calibre/utils/icu.py +++ b/src/calibre/utils/icu.py @@ -341,6 +341,7 @@ pêché''' german = create(german) c = _icu.Collator('de') + c.numeric = True gs = list(sorted(german, key=c.sort_key)) if gs != create(german_good): print 'German sorting failed' @@ -348,6 +349,7 @@ pêché''' print french = create(french) c = _icu.Collator('fr') + c.numeric = True fs = list(sorted(french, key=c.sort_key)) if fs != create(french_good): print 'French sorting failed (note that French fails with icu < 4.6)' @@ -396,6 +398,25 @@ pêché''' print 'startswith() failed' return + print '\nTesting collation_order()' + for group in [ + ('Šaa', 'Smith', 'Solženicyn', 'Štepánek'), + ('calibre', 'Charon', 'Collins'), + ('01', '1'), + ('1', '11', '13'), + ]: + last = None + for x in group: + val = icu_collation_order(sort_collator(), x) + if val[1] != 1: + prints('collation_order() returned incorrect length for', x) + if last is None: + last = val + else: + if val != last: + prints('collation_order() returned incorrect value for', x) + last = val + # }}} if __name__ == '__main__':