mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-30 23:00:21 -04:00
Implement #4095 (Allow custom news recipes to reverse the order of articles)
This commit is contained in:
parent
269ac13f42
commit
f5c46575f2
@ -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
|
||||
|
||||
|
@ -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)<footnote\s+id="(?P<target>.+?)">\s*(?P<text>.*?)\s*</footnote>', lambda match: '\\FN="fns-%s"%s\\FN' % (match.group('target'), match.group('text')) if match.group('text') else '', pml)
|
||||
pml = re.sub(r'(?mus)<sidebar\s+id="(?P<target>.+?)">\s*(?P<text>.*?)\s*</sidebar>', 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]:
|
||||
|
@ -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 `<style>` tags, just before the closing
|
||||
#: `</head>` tag thereby overriding all :term:`CSS` except that which is
|
||||
@ -728,6 +731,10 @@ class BasicNewsRecipe(Recipe):
|
||||
fi.write(html)
|
||||
|
||||
self.jobs = []
|
||||
|
||||
if self.reverse_article_order:
|
||||
feeds = [list(reversed(feed)) for feed in feeds]
|
||||
|
||||
for f, feed in enumerate(feeds):
|
||||
feed_dir = os.path.join(self.output_dir, 'feed_%d'%f)
|
||||
if not os.path.isdir(feed_dir):
|
||||
|
Loading…
x
Reference in New Issue
Block a user