From f5c46575f21272468f75eccc170b372d12586754 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 29 Nov 2009 18:18:22 -0700 Subject: [PATCH] Implement #4095 (Allow custom news recipes to reverse the order of articles) --- Changelog.yaml | 60 ++++++++++++++++++++++++++ src/calibre/ebooks/pml/pmlconverter.py | 6 +-- src/calibre/web/feeds/news.py | 7 +++ 3 files changed, 70 insertions(+), 3 deletions(-) diff --git a/Changelog.yaml b/Changelog.yaml index 874d090d84..3dcf869d88 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -4,6 +4,66 @@ # for important features/bug fixes. # Also, each release can have new and improved recipes. +- version: 0.6.25 + date: 2009-11-30 + + new features: + - title: Add option to swap title and author in the Bulk metadata dialog + tickets: [3885] + + - title: Make the metadata download plugins customizable + + - title: Various improvements to the conversion of PDB/PML books with an all new state machine based parser + + - title: Driver for upgraded SONY PRS 500 + + - title: Full support for PocketBook 360 with SD card + + - title: "ODT Input: Reflow positioned images" + tickets: [4060] + + - title: "Conversion pipeline: Add option to control the inserted paragraph indent when using the remove blank line between paragraphs option" + + - title: When reading metadata from PDf files, look for the ISBN in the file text. + tickets: [3013] + + - title: Periodically check for updates to calibre instead of just at startup + tickets: [4040] + + bug fixes: + - title: Reorganize Dutch language news sources into Belgium and Netherlands categories + tickets: [4098] + + - title: Fix bad markup in some New York Times articles causing download to fail + tickets: [4032] + + - title: Fix recipe for Glasgow Herald + + - title: Fixed recipe for The Australian + + - title: Add PDF to list of supported formats for the Kindle 2 + + + new recipes: + - title: The Economist (no subscription required) + author: Kovid Goyal + + - title: Sports Illustrated1 + author: kwetal + + - title: Levante + author: kwetal + + - title: ncrnext + author: kwetal + + improved recipes: + - The Philadelphia Inquirer + - Harpers + - Our Daily Bread + - Sydney Morning Herald + + - version: 0.6.24 date: 2009-11-16 diff --git a/src/calibre/ebooks/pml/pmlconverter.py b/src/calibre/ebooks/pml/pmlconverter.py index cd5bafa260..e495c24042 100644 --- a/src/calibre/ebooks/pml/pmlconverter.py +++ b/src/calibre/ebooks/pml/pmlconverter.py @@ -143,7 +143,7 @@ class PML_HTMLizer(object): pml = re.sub(r'(?mus)^[ ]*(?=.)', '', pml) pml = re.sub(r'(?mus)(?<=.)[ ]*$', '', pml) pml = re.sub(r'(?mus)^[ ]*$', '', pml) - + # Footnotes and Sidebars pml = re.sub(r'(?mus).+?)">\s*(?P.*?)\s*', lambda match: '\\FN="fns-%s"%s\\FN' % (match.group('target'), match.group('text')) if match.group('text') else '', pml) pml = re.sub(r'(?mus).+?)">\s*(?P.*?)\s*', lambda match: '\\SB="fns-%s"%s\\SB' % (match.group('target'), match.group('text')) if match.group('text') else '', pml) @@ -230,13 +230,13 @@ class PML_HTMLizer(object): elif code in self.BLOCK_STATES: text = self.process_code_block(code, stream, pre) else: - text = self.process_code_simple(code) + text = self.process_code_simple(code, stream) self.state[code][0] = not self.state[code][0] return text - def process_code_simple(self, code): + def process_code_simple(self, code, stream): text = u'' if self.state[code][0]: diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index 08ccb1f708..8a7f25158e 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -122,6 +122,9 @@ class BasicNewsRecipe(Recipe): #: websites that try to make it difficult to scrape content. articles_are_obfuscated = False + #: Reverse the order of articles in each feed + reverse_article_order = False + #: Specify any extra :term:`CSS` that should be addded to downloaded :term:`HTML` files #: It will be inserted into `