From 163043de3485cff161ad0ea0c852e34bccdc6bba Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 15 Jan 2011 08:17:40 -0700 Subject: [PATCH 1/4] Fix #8365 (Capitalize not working) --- src/calibre/utils/icu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/icu.py b/src/calibre/utils/icu.py index 659984e7f9..f17ff1b17f 100644 --- a/src/calibre/utils/icu.py +++ b/src/calibre/utils/icu.py @@ -80,7 +80,7 @@ def icu_case_sensitive_strcmp(collator, a, b): def icu_capitalize(s): s = lower(s) - return s.replace(s[0], upper(s[0]), 1) + return s.replace(s[0], upper(s[0]), 1) if s else s load_icu() load_collator() From ae815183898a8bb2777c7e07d7b1660b0940b025 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 15 Jan 2011 08:28:10 -0700 Subject: [PATCH 2/4] South Africa Mail and Guardian by 77ja65. Fixes #8375 (South Africa Mail & Guardian Newspaper Recipe to add to official list) --- resources/recipes/mail_and_guardian.recipe | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 resources/recipes/mail_and_guardian.recipe diff --git a/resources/recipes/mail_and_guardian.recipe b/resources/recipes/mail_and_guardian.recipe new file mode 100644 index 0000000000..5b58f3f938 --- /dev/null +++ b/resources/recipes/mail_and_guardian.recipe @@ -0,0 +1,32 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1295081935(BasicNewsRecipe): + title = u'Mail & Guardian ZA News' + __author__ = '77ja65' + language = 'en' + oldest_article = 7 + max_articles_per_feed = 30 + no_stylesheets = True + masthead_url = 'http://c1608832.cdn.cloudfiles.rackspacecloud.com/mg_logo.gif' + remove_tags_after = [dict(id='content')] + + feeds = [ + (u'National News', u'http://www.mg.co.za/rss/national'), + (u'Top Stories', u'http://www.mg.co.za/rss'), + (u'Africa News', u'http://www.mg.co.za/rss/africa'), + (u'Sport', u'http://www.mg.co.za/rss/sport'), + (u'Business', u'http://www.mg.co.za/rss/business'), + (u'And In Other News', u'http://www.mg.co.za/rss/and-in-other-news'), + (u'World News', u'http://www.mg.co.za/rss/world') + ] + + def print_version(self, url): + return url.replace('http://www.mg.co.za/article/', + 'http://www.mg.co.za/printformat/single/') + + extra_css = ''' + h1{font-family:Arial,Helvetica,sans-serif; font- + weight:bold;font-size:large;} + h2{font-family:Arial,Helvetica,sans-serif; font- + weight:normal;font-size:small;} + ''' From a3ae3121eb843f57994751d6d2e93abb0642c155 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 15 Jan 2011 09:53:43 -0700 Subject: [PATCH 3/4] Fix #8366 (Adding Capitalize option in Edit metadata individually) --- src/calibre/gui2/widgets.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index d87bb45f7a..f2ff783a76 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -386,11 +386,13 @@ class LineEditECM(object): action_lower_case = case_menu.addAction(_('Lower Case')) action_swap_case = case_menu.addAction(_('Swap Case')) action_title_case = case_menu.addAction(_('Title Case')) + action_capitalize = case_menu.addAction(_('Capitalize')) self.connect(action_upper_case, SIGNAL('triggered()'), self.upper_case) self.connect(action_lower_case, SIGNAL('triggered()'), self.lower_case) self.connect(action_swap_case, SIGNAL('triggered()'), self.swap_case) self.connect(action_title_case, SIGNAL('triggered()'), self.title_case) + self.connect(action_capitalize, SIGNAL('triggered()'), self.capitalize) menu.addMenu(case_menu) menu.exec_(event.globalPos()) @@ -408,6 +410,10 @@ class LineEditECM(object): from calibre.utils.titlecase import titlecase self.setText(titlecase(unicode(self.text()))) + def capitalize(self): + from calibre.utils.icu import capitalize + self.setText(capitalize(unicode(self.text()))) + class EnLineEdit(LineEditECM, QLineEdit): From 9e90f63214cb5b75900a0b762cef7735f9512b29 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 15 Jan 2011 10:14:31 -0700 Subject: [PATCH 4/4] template-functions.json skeleton --- setup/resources.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup/resources.py b/setup/resources.py index 977d753828..03d9e28ea6 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -84,6 +84,12 @@ class Resources(Command): cPickle.dump(complete, open(dest, 'wb'), -1) + self.info('\tCreating template-functions.json') + dest = self.j(self.RESOURCES, 'template-functions.json') + function_dict = {'test': 'def test(*args): return test'} + import json + json.dump(function_dict, open(dest, 'wb')) + def clean(self): for x in ('scripts', 'recipes', 'ebook-convert-complete'): x = self.j(self.RESOURCES, x+'.pickle')