From 4bad10031619797b36508564e877ae16f48c1d1f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Oct 2009 17:11:20 -0600 Subject: [PATCH 1/5] IGN:Fix #2152 (Typo in GUI) --- src/calibre/ebooks/tcr/output.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/tcr/output.py b/src/calibre/ebooks/tcr/output.py index 8aed995c44..603d35d099 100644 --- a/src/calibre/ebooks/tcr/output.py +++ b/src/calibre/ebooks/tcr/output.py @@ -24,7 +24,7 @@ class TCROutput(OutputFormatPlugin): 'The default is utf-8.')), OptionRecommendation(name='compression_level', recommended_value=5, level=OptionRecommendation.LOW, - help=_('Speciy the compression level to use. Scale 1 - 10. 1 ' \ + help=_('Specify the compression level to use. Scale 1 - 10. 1 ' \ 'being the lowest compression but the fastest and 10 being the ' \ 'highest compression but the slowest.')), ]) From 7b8bdfc3a8b39b77849ed5cd952e113eb6973439 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Oct 2009 17:14:46 -0600 Subject: [PATCH 2/5] Fix #3841 (Python version for development is important) --- src/calibre/manual/develop.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/manual/develop.rst b/src/calibre/manual/develop.rst index 626a784142..e0cf2fa8b5 100644 --- a/src/calibre/manual/develop.rst +++ b/src/calibre/manual/develop.rst @@ -9,6 +9,7 @@ Setting up a |app| development environment This means that you are free to download and modify the program to your hearts content. In this section, you will learn how to get a |app| development environment setup on the operating system of your choice. |app| is written primarily in `Python `_ with some C/C++ code for speed and system interfacing. +Note that |app| is not compatible with Python 3 and requires at least Python 2.6. .. contents:: Contents :depth: 2 From cc92acadb88f44f8c45b7fd8a42f8ff9ef3eab5b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Oct 2009 17:21:35 -0600 Subject: [PATCH 3/5] Improved recipe for The Australian --- resources/recipes/the_oz.recipe | 23 ++++++++++++++++++++++- src/calibre/translations/calibre.pot | 6 +++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/resources/recipes/the_oz.recipe b/resources/recipes/the_oz.recipe index 6455a69a20..b2c0a412fc 100644 --- a/resources/recipes/the_oz.recipe +++ b/resources/recipes/the_oz.recipe @@ -11,7 +11,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class DailyTelegraph(BasicNewsRecipe): title = u'The Australian' - __author__ = u'Matthew Briggs' + __author__ = u'Matthew Briggs and Sujata Raman' description = u'National broadsheet newspaper from down under - colloquially known as The Oz' language = 'en_AU' @@ -34,6 +34,15 @@ class DailyTelegraph(BasicNewsRecipe): remove_tags = [dict(name=['object','link'])] + extra_css = ''' + h1{font-family :Georgia,"Times New Roman",Times,serif; font-size:large; } + #article{font-family :Georgia,"Times New Roman",Times,serif; font-size: x-small;} + .module-subheader{font-family :Tahoma,Geneva,Arial,Helvetica,sans-serif; color:#666666; font-size: xx-small;} + .intro{ font-family:Trebuchet MS,Trebuchet,Helvetica,sans-serif;font-size: x-small; } + .article-source{font-family:Trebuchet MS,Trebuchet,Helvetica,sans-serif; color:#666666; font-size: xx-small;} + .caption{font-family:Trebuchet MS,Trebuchet,Helvetica,sans-serif; font-size: xx-small;} + ''' + feeds = [ (u'News', u'http://feeds.news.com.au/public/rss/2.0/aus_news_807.xml'), (u'World News', u'http://feeds.news.com.au/public/rss/2.0/aus_world_808.xml'), @@ -53,3 +62,15 @@ class DailyTelegraph(BasicNewsRecipe): (u'Property', u'http://feeds.news.com.au/public/rss/2.0/aus_property_59.xml'), (u'US Election', u'http://feeds.news.com.au/public/rss/2.0/aus_uselection_687.xml') ] + + def get_cover_url(self): + + href = 'http://www.theaustralian.news.com.au/' + + soup = self.index_to_soup(href) + img = soup.find('img',alt ="Digital editions of The Australian") + print img + if img : + cover_url = img['src'] + + return cover_url diff --git a/src/calibre/translations/calibre.pot b/src/calibre/translations/calibre.pot index 20fd3fe3fb..d1e6a9d9a2 100644 --- a/src/calibre/translations/calibre.pot +++ b/src/calibre/translations/calibre.pot @@ -5,8 +5,8 @@ msgid "" msgstr "" "Project-Id-Version: calibre 0.6.19\n" -"POT-Creation-Date: 2009-10-20 18:49+MDT\n" -"PO-Revision-Date: 2009-10-20 18:49+MDT\n" +"POT-Creation-Date: 2009-10-22 17:20+MDT\n" +"PO-Revision-Date: 2009-10-22 17:20+MDT\n" "Last-Translator: Automatically generated\n" "Language-Team: LANGUAGE\n" "MIME-Version: 1.0\n" @@ -1831,7 +1831,7 @@ msgid "Specify the character encoding of the output document. The default is utf msgstr "" #: /home/kovid/work/calibre/src/calibre/ebooks/tcr/output.py:27 -msgid "Speciy the compression level to use. Scale 1 - 10. 1 being the lowest compression but the fastest and 10 being the highest compression but the slowest." +msgid "Specify the compression level to use. Scale 1 - 10. 1 being the lowest compression but the fastest and 10 being the highest compression but the slowest." msgstr "" #: /home/kovid/work/calibre/src/calibre/ebooks/txt/input.py:32 From ad003cc12913ed2a8657d2b34511c8f5ae478b53 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Oct 2009 21:02:46 -0600 Subject: [PATCH 4/5] PML Input: Fix handling of \w and \s tags --- src/calibre/ebooks/pml/pmlconverter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/pml/pmlconverter.py b/src/calibre/ebooks/pml/pmlconverter.py index 7133e3f251..dafe1e4f6a 100644 --- a/src/calibre/ebooks/pml/pmlconverter.py +++ b/src/calibre/ebooks/pml/pmlconverter.py @@ -26,9 +26,9 @@ PML_HTML_RULES = [ (re.compile(r'\\v(?P.*?)\\v', re.DOTALL), lambda match: '' % match.group('text') if match.group('text') else ''), (re.compile(r'\\t(?P.*?)\\t', re.DOTALL), lambda match: '
%s
' % match.group('text') if match.group('text') else ''), (re.compile(r'\\T="(?P\d+)%*"(?P.*?)$', re.MULTILINE), lambda match: r'
%s
' % (match.group('val'), match.group('text')) if match.group('text') else ''), - (re.compile(r'\\w="(?P\d+)%"'), lambda match: '
' % match.group('val')), + (re.compile(r'\\w="(?P\d+)%"'), lambda match: '
' % match.group('val')), (re.compile(r'\\n'), lambda match: ''), - (re.compile(r'\\s'), lambda match: ''), + (re.compile(r'\\s(?P.*?)\\s', re.DOTALL), lambda match: '%s' % match.group('text') if match.group('text') else ''), (re.compile(r'\\b(?P.*?)\\b', re.DOTALL), lambda match: '%s' % match.group('text') if match.group('text') else ''), # \b is deprecated; \B should be used instead. (re.compile(r'\\l(?P.*?)\\l', re.DOTALL), lambda match: '%s' % match.group('text') if match.group('text') else ''), (re.compile(r'\\B(?P.*?)\\B', re.DOTALL), lambda match: '%s' % match.group('text') if match.group('text') else ''), From f81395da37ae22c2159913d1db684ded5ed6f8af Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Oct 2009 21:03:25 -0600 Subject: [PATCH 5/5] PML Output: Use specified cover or first image if no cover is specified --- src/calibre/ebooks/pml/pmlml.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/pml/pmlml.py b/src/calibre/ebooks/pml/pmlml.py index 9582d2bfbb..8cce91f8ac 100644 --- a/src/calibre/ebooks/pml/pmlml.py +++ b/src/calibre/ebooks/pml/pmlml.py @@ -95,6 +95,9 @@ class PMLMLizer(object): def get_cover_page(self): output = u'' + if 'cover' in self.oeb_book.guide: + output += '\\m="cover.png"\n' + self.image_hrefs[self.oeb_book.guide['cover'].href] = 'cover.png' if 'titlepage' in self.oeb_book.guide: self.log.debug('Generating title page...') href = self.oeb_book.guide['titlepage'].href @@ -191,8 +194,10 @@ class PMLMLizer(object): if tag in IMAGE_TAGS: if elem.attrib.get('src', None): if page.abshref(elem.attrib['src']) not in self.image_hrefs.keys(): - self.image_hrefs[page.abshref(elem.attrib['src'])] = image_name('%s' % len(self.image_hrefs.keys()), self.image_hrefs.keys()).strip('\x00') - text += '\\m="%s"' % self.image_hrefs[page.abshref(elem.attrib['src'])] + if len(self.image_hrefs.keys()) == 0: + self.image_hrefs[page.abshref(elem.attrib['src'])] = 'cover.png' + else: + self.image_hrefs[page.abshref(elem.attrib['src'])] = image_name('%s' % len(self.image_hrefs.keys()), self.image_hrefs.keys()).strip('\x00') if tag == 'hr': text += '\\w' width = elem.get('width')