diff --git a/src/calibre/ebooks/pml/pmlml.py b/src/calibre/ebooks/pml/pmlml.py
index 1777d1290b..2438fd9bef 100644
--- a/src/calibre/ebooks/pml/pmlml.py
+++ b/src/calibre/ebooks/pml/pmlml.py
@@ -75,13 +75,13 @@ class PMLMLizer(object):
self.log = log
self.image_hrefs = {}
self.link_hrefs = {}
-
+
def extract_content(self, oeb_book, opts):
self.log.info('Converting XHTML to PML markup...')
self.oeb_book = oeb_book
self.opts = opts
return self.pmlmlize_spine()
-
+
def pmlmlize_spine(self):
self.image_hrefs = {}
self.link_hrefs = {}
@@ -139,15 +139,15 @@ class PMLMLizer(object):
# Remove excess spaces at beginning and end of lines
text = re.sub('(?m)^[ ]+', '', text)
text = re.sub('(?m)[ ]+$', '', text)
-
+
# Remove excessive newlines
text = re.sub('%s{1,1}' % os.linesep, '%s%s' % (os.linesep, os.linesep), text)
text = re.sub('%s{3,}' % os.linesep, '%s%s' % (os.linesep, os.linesep), text)
text = re.sub('[ ]{2,}', ' ', text)
-
+
# Remove excessive \p tags
text = re.sub(r'\\p\s*\\p', '', text)
-
+
# Remove anchors that do not have links
anchors = set(re.findall(r'(?<=\\Q=").+?(?=")', text))
links = set(re.findall(r'(?<=\\q="#).+?(?=")', text))
@@ -157,7 +157,7 @@ class PMLMLizer(object):
for entity in set(re.findall('&.+?;', text)):
mo = re.search('(%s)' % entity[1:-1], text)
text = text.replace(entity, entity_to_unicode(mo))
-
+
return text
def dump_text(self, elem, stylizer, page, tag_stack=[]):
@@ -167,7 +167,7 @@ class PMLMLizer(object):
text = u''
style = stylizer.style(elem)
-
+
if style['display'] in ('none', 'oeb-page-head', 'oeb-page-foot') \
or style['visibility'] == 'hidden':
return u''
@@ -180,7 +180,7 @@ class PMLMLizer(object):
if 'block' not in tag_stack:
tag_count += 1
tag_stack.append('block')
-
+
# Process tags that need special processing and that do not have inner
# text. Usually these require an argument
if tag in IMAGE_TAGS:
@@ -192,15 +192,15 @@ class PMLMLizer(object):
text += '\\w'
width = elem.get('width')
if width:
- text += '="%s%"' % width
+ text += '="%s%%"' % width
else:
text += '="50%"'
-
+
# Process style information that needs holds a single tag
# Commented out because every page in an OEB book starts with this style
#if style['page-break-before'] == 'always':
# text += '\\p'
-
+
pml_tag = TAG_MAP.get(tag, None)
if pml_tag and pml_tag not in tag_stack:
tag_count += 1
@@ -240,23 +240,23 @@ class PMLMLizer(object):
# Proccess tags that contain text.
if hasattr(elem, 'text') and elem.text != None and elem.text.strip() != '':
text += self.elem_text(elem, tag_stack)
-
+
for item in elem:
text += self.dump_text(item, stylizer, page, tag_stack)
-
+
close_tag_list = []
for i in range(0, tag_count):
close_tag_list.insert(0, tag_stack.pop())
text += self.close_tags(close_tag_list)
if tag in SEPARATE_TAGS:
text += os.linesep + os.linesep
-
+
if 'block' not in tag_stack:
text += os.linesep + os.linesep
#if style['page-break-after'] == 'always':
# text += '\\p'
-
+
if hasattr(elem, 'tail') and elem.tail != None and elem.tail.strip() != '':
text += self.elem_tail(elem, tag_stack)
diff --git a/src/calibre/gui2/dialogs/metadata_bulk.ui b/src/calibre/gui2/dialogs/metadata_bulk.ui
index f3cf8ab251..59fdc5d27a 100644
--- a/src/calibre/gui2/dialogs/metadata_bulk.ui
+++ b/src/calibre/gui2/dialogs/metadata_bulk.ui
@@ -17,232 +17,225 @@
:/images/edit_input.svg:/images/edit_input.svg
-
- -
-
-
- Qt::Horizontal
+
+
-
+
+
+ 6
-
-
-
- 6
+
+ 0
+
+
-
+
+
+ Meta information
-
- 0
-
-
-
-
-
- Meta information
-
-
-
-
-
-
- &Author(s):
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- authors
-
-
-
- -
-
-
- Author s&ort:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- author_sort
-
-
-
- -
-
-
- Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles.
-
-
-
- -
-
-
- &Rating:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- rating
-
-
-
- -
-
-
- Rating of this book. 0-5 stars
-
-
- Rating of this book. 0-5 stars
-
-
- QAbstractSpinBox::PlusMinus
-
-
- stars
-
-
- 5
-
-
-
- -
-
-
- &Publisher:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- publisher
-
-
-
- -
-
-
- Add ta&gs:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- tags
-
-
-
- -
-
-
- Tags categorize the book. This is particularly useful while searching. <br><br>They can be any words or phrases, separated by commas.
-
-
-
- -
-
-
- Open Tag Editor
-
-
- Open Tag Editor
-
-
-
- :/images/chapters.svg:/images/chapters.svg
-
-
-
- -
-
-
- &Remove tags:
-
-
- remove_tags
-
-
-
- -
-
-
- Comma separated list of tags to remove from the books.
-
-
-
- -
-
-
- &Series:
-
-
- Qt::PlainText
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- series
-
-
-
- -
-
-
- List of known series. You can add new series.
-
-
- List of known series. You can add new series.
-
-
- true
-
-
- QComboBox::InsertAlphabetically
-
-
- QComboBox::AdjustToContents
-
-
-
- -
-
-
- -
-
-
- Remove &format:
-
-
- remove_format
-
-
-
- -
-
-
- A&utomatically set author sort
-
-
-
- -
-
-
- true
-
-
-
- -
-
-
- true
-
-
-
-
-
-
-
-
-
+
+ -
+
+
+ &Author(s):
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ authors
+
+
+
+ -
+
+
+ A&utomatically set author sort
+
+
+
+ -
+
+
+ Author s&ort:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ author_sort
+
+
+
+ -
+
+
+ Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles.
+
+
+
+ -
+
+
+ &Rating:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ rating
+
+
+
+ -
+
+
+ Rating of this book. 0-5 stars
+
+
+ Rating of this book. 0-5 stars
+
+
+ QAbstractSpinBox::PlusMinus
+
+
+ stars
+
+
+ 5
+
+
+
+ -
+
+
+ &Publisher:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ publisher
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ Add ta&gs:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ tags
+
+
+
+ -
+
+
+ Tags categorize the book. This is particularly useful while searching. <br><br>They can be any words or phrases, separated by commas.
+
+
+
+ -
+
+
+ Open Tag Editor
+
+
+ Open Tag Editor
+
+
+
+ :/images/chapters.svg:/images/chapters.svg
+
+
+
+ -
+
+
+ &Remove tags:
+
+
+ remove_tags
+
+
+
+ -
+
+
+ Comma separated list of tags to remove from the books.
+
+
+
+ -
+
+
+ &Series:
+
+
+ Qt::PlainText
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ series
+
+
+
+ -
+
+
+ List of known series. You can add new series.
+
+
+ List of known series. You can add new series.
+
+
+ true
+
+
+ QComboBox::InsertAlphabetically
+
+
+ QComboBox::AdjustToContents
+
+
+
+ -
+
+
+ Remove &format:
+
+
+ remove_format
+
+
+
+ -
+
+
+ -
+
+
+ true
+
+
+
+
+
+
+
- -
+
-
Qt::Horizontal
diff --git a/src/calibre/gui2/search_box.py b/src/calibre/gui2/search_box.py
index 1263ff003e..6ecd3ad239 100644
--- a/src/calibre/gui2/search_box.py
+++ b/src/calibre/gui2/search_box.py
@@ -41,7 +41,7 @@ class SearchBox2(QComboBox):
self.connect(self.line_edit, SIGNAL('key_pressed(PyQt_PyObject)'),
self.key_pressed, Qt.DirectConnection)
self.connect(self.line_edit, SIGNAL('mouse_released(PyQt_PyObject)'),
- self.key_pressed, Qt.DirectConnection)
+ self.mouse_released, Qt.DirectConnection)
self.setEditable(True)
self.help_state = True
self.as_you_type = True
diff --git a/src/calibre/web/feeds/recipes/recipe_cnn.py b/src/calibre/web/feeds/recipes/recipe_cnn.py
index 369aff2e99..f9aef380f9 100644
--- a/src/calibre/web/feeds/recipes/recipe_cnn.py
+++ b/src/calibre/web/feeds/recipes/recipe_cnn.py
@@ -3,7 +3,6 @@ __copyright__ = '2008, Kovid Goyal '
'''
Profile to download CNN
'''
-import re
from calibre.web.feeds.news import BasicNewsRecipe
class CNN(BasicNewsRecipe):
@@ -11,28 +10,53 @@ class CNN(BasicNewsRecipe):
title = 'CNN'
description = 'Global news'
timefmt = ' [%d %b %Y]'
- __author__ = 'Kovid Goyal'
+ __author__ = 'Kovid Goyal and Sujata Raman'
language = _('English')
no_stylesheets = True
use_embedded_content = False
oldest_article = 15
- preprocess_regexps = [(re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in [
- (r'.*?.*?', lambda match : ''),
- (r'', lambda match : ''),
- (r'<\!\-\-Article End\-\->.*?', lambda match : '