mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Merge from trunk
This commit is contained in:
commit
40b263f7a9
@ -22,8 +22,19 @@ class NewYorker(BasicNewsRecipe):
|
|||||||
masthead_url = 'http://www.newyorker.com/css/i/hed/logo.gif'
|
masthead_url = 'http://www.newyorker.com/css/i/hed/logo.gif'
|
||||||
extra_css = """
|
extra_css = """
|
||||||
body {font-family: "Times New Roman",Times,serif}
|
body {font-family: "Times New Roman",Times,serif}
|
||||||
.articleauthor{color: #9F9F9F; font-family: Arial, sans-serif; font-size: small; text-transform: uppercase}
|
.articleauthor{color: #9F9F9F;
|
||||||
.rubric{color: #CD0021; font-family: Arial, sans-serif; font-size: small; text-transform: uppercase}
|
font-family: Arial, sans-serif;
|
||||||
|
font-size: small;
|
||||||
|
text-transform: uppercase}
|
||||||
|
.rubric,.dd,h6#credit{color: #CD0021;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
font-size: small;
|
||||||
|
text-transform: uppercase}
|
||||||
|
.descender:first-letter{display: inline; font-size: xx-large; font-weight: bold}
|
||||||
|
.dd,h6#credit{color: gray}
|
||||||
|
.c{display: block}
|
||||||
|
.caption,h2#articleintro{font-style: italic}
|
||||||
|
.caption{font-size: small}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
@ -39,7 +50,7 @@ class NewYorker(BasicNewsRecipe):
|
|||||||
]
|
]
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['meta','iframe','base','link','embed','object'])
|
dict(name=['meta','iframe','base','link','embed','object'])
|
||||||
,dict(attrs={'class':['utils','articleRailLinks','icons'] })
|
,dict(attrs={'class':['utils','socialUtils','articleRailLinks','icons'] })
|
||||||
,dict(attrs={'id':['show-header','show-footer'] })
|
,dict(attrs={'id':['show-header','show-footer'] })
|
||||||
]
|
]
|
||||||
remove_attributes = ['lang']
|
remove_attributes = ['lang']
|
||||||
@ -59,3 +70,13 @@ class NewYorker(BasicNewsRecipe):
|
|||||||
cover_url = 'http://www.newyorker.com' + cover_item['src'].strip()
|
cover_url = 'http://www.newyorker.com' + cover_item['src'].strip()
|
||||||
return cover_url
|
return cover_url
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for item in soup.findAll(style=True):
|
||||||
|
del item['style']
|
||||||
|
auth = soup.find(attrs={'id':'articleauthor'})
|
||||||
|
if auth:
|
||||||
|
alink = auth.find('a')
|
||||||
|
if alink and alink.string is not None:
|
||||||
|
txt = alink.string
|
||||||
|
alink.replaceWith(txt)
|
||||||
|
return soup
|
||||||
|
@ -147,8 +147,13 @@ class EditMetadataAction(InterfaceAction):
|
|||||||
|
|
||||||
d = MetadataSingleDialog(self.gui, row_list[current_row], db,
|
d = MetadataSingleDialog(self.gui, row_list[current_row], db,
|
||||||
prev=prev, next_=next_)
|
prev=prev, next_=next_)
|
||||||
|
d.view_format.connect(lambda
|
||||||
|
fmt:self.gui.iactions['View'].view_format(row_list[current_row],
|
||||||
|
fmt))
|
||||||
if d.exec_() != d.Accepted:
|
if d.exec_() != d.Accepted:
|
||||||
|
d.view_format.disconnect()
|
||||||
break
|
break
|
||||||
|
d.view_format.disconnect()
|
||||||
changed.add(d.id)
|
changed.add(d.id)
|
||||||
if d.row_delta == 0:
|
if d.row_delta == 0:
|
||||||
break
|
break
|
||||||
|
@ -26,7 +26,6 @@ class ViewAction(InterfaceAction):
|
|||||||
|
|
||||||
def genesis(self):
|
def genesis(self):
|
||||||
self.persistent_files = []
|
self.persistent_files = []
|
||||||
self.metadata_view_id = None
|
|
||||||
self.qaction.triggered.connect(self.view_book)
|
self.qaction.triggered.connect(self.view_book)
|
||||||
self.view_menu = QMenu()
|
self.view_menu = QMenu()
|
||||||
self.view_menu.addAction(_('View'), partial(self.view_book, False))
|
self.view_menu.addAction(_('View'), partial(self.view_book, False))
|
||||||
@ -51,14 +50,6 @@ class ViewAction(InterfaceAction):
|
|||||||
if fmt_path:
|
if fmt_path:
|
||||||
self._view_file(fmt_path)
|
self._view_file(fmt_path)
|
||||||
|
|
||||||
def metadata_view_format(self, fmt):
|
|
||||||
fmt_path = self.gui.library_view.model().db.\
|
|
||||||
format_abspath(self.metadata_view_id,
|
|
||||||
fmt, index_is_id=True)
|
|
||||||
if fmt_path:
|
|
||||||
self._view_file(fmt_path)
|
|
||||||
|
|
||||||
|
|
||||||
def book_downloaded_for_viewing(self, job):
|
def book_downloaded_for_viewing(self, job):
|
||||||
if job.failed:
|
if job.failed:
|
||||||
self.gui.device_job_exception(job)
|
self.gui.device_job_exception(job)
|
||||||
|
@ -18,8 +18,9 @@ from functools import partial
|
|||||||
from calibre.ebooks.metadata import title_sort, author_to_author_sort
|
from calibre.ebooks.metadata import title_sort, author_to_author_sort
|
||||||
from calibre.utils.config import tweaks
|
from calibre.utils.config import tweaks
|
||||||
from calibre.utils.date import parse_date, isoformat
|
from calibre.utils.date import parse_date, isoformat
|
||||||
from calibre import isbytestring
|
from calibre import isbytestring, force_unicode
|
||||||
from calibre.constants import iswindows, DEBUG
|
from calibre.constants import iswindows, DEBUG
|
||||||
|
from calibre.utils.icu import strcmp
|
||||||
|
|
||||||
global_lock = RLock()
|
global_lock = RLock()
|
||||||
|
|
||||||
@ -115,8 +116,8 @@ def pynocase(one, two, encoding='utf-8'):
|
|||||||
pass
|
pass
|
||||||
return cmp(one.lower(), two.lower())
|
return cmp(one.lower(), two.lower())
|
||||||
|
|
||||||
def icu_collator(s1, s2, func=None):
|
def icu_collator(s1, s2):
|
||||||
return cmp(func(unicode(s1)), func(unicode(s2)))
|
return strcmp(force_unicode(s1, 'utf-8'), force_unicode(s2, 'utf-8'))
|
||||||
|
|
||||||
def load_c_extensions(conn, debug=DEBUG):
|
def load_c_extensions(conn, debug=DEBUG):
|
||||||
try:
|
try:
|
||||||
@ -169,8 +170,7 @@ class DBThread(Thread):
|
|||||||
self.conn.create_function('uuid4', 0, lambda : str(uuid.uuid4()))
|
self.conn.create_function('uuid4', 0, lambda : str(uuid.uuid4()))
|
||||||
# Dummy functions for dynamically created filters
|
# Dummy functions for dynamically created filters
|
||||||
self.conn.create_function('books_list_filter', 1, lambda x: 1)
|
self.conn.create_function('books_list_filter', 1, lambda x: 1)
|
||||||
from calibre.utils.icu import sort_key
|
self.conn.create_collation('icucollate', icu_collator)
|
||||||
self.conn.create_collation('icucollate', partial(icu_collator, func=sort_key))
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user