mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #2850 (Background colour)
This commit is contained in:
commit
03036a0d2e
@ -465,6 +465,12 @@ OptionRecommendation(name='list_recipes',
|
||||
|
||||
# Remove the options that have been disabled by recommendations from the
|
||||
# plugins.
|
||||
for w in ('input_options', 'output_options',
|
||||
'all_format_options'):
|
||||
temp = set([])
|
||||
for x in getattr(self, w):
|
||||
temp.add(x.clone())
|
||||
setattr(self, w, temp)
|
||||
self.merge_plugin_recommendations()
|
||||
|
||||
@classmethod
|
||||
|
@ -60,6 +60,7 @@ class FormatState(object):
|
||||
self.bold = False
|
||||
self.preserve = False
|
||||
self.family = 'serif'
|
||||
self.bgcolor = 'transparent'
|
||||
self.href = None
|
||||
self.list_num = 0
|
||||
self.attrib = {}
|
||||
@ -71,7 +72,8 @@ class FormatState(object):
|
||||
and self.href == other.href \
|
||||
and self.valign == other.valign \
|
||||
and self.preserve == other.preserve \
|
||||
and self.family == other.family
|
||||
and self.family == other.family \
|
||||
and self.bgcolor == other.bgcolor
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
@ -232,6 +234,9 @@ class MobiMLizer(object):
|
||||
inline = etree.SubElement(inline, XHTML('i'))
|
||||
if istate.bold:
|
||||
inline = etree.SubElement(inline, XHTML('b'))
|
||||
if istate.bgcolor is not None and istate.bgcolor != 'transparent' :
|
||||
inline = etree.SubElement(inline, XHTML('span'),
|
||||
bgcolor=istate.bgcolor)
|
||||
bstate.inline = inline
|
||||
bstate.istate = istate
|
||||
inline = bstate.inline
|
||||
@ -308,6 +313,7 @@ class MobiMLizer(object):
|
||||
weight = style['font-weight']
|
||||
istate.bold = weight in ('bold', 'bolder') or asfloat(weight) > 400
|
||||
istate.preserve = (style['white-space'] in ('pre', 'pre-wrap'))
|
||||
istate.bgcolor = style['background-color']
|
||||
if 'monospace' in style['font-family']:
|
||||
istate.family = 'monospace'
|
||||
elif 'sans-serif' in style['font-family']:
|
||||
|
@ -6,16 +6,21 @@ class WashingtonPost(BasicNewsRecipe):
|
||||
|
||||
title = 'Washington Post'
|
||||
description = 'US political news'
|
||||
__author__ = 'Kovid Goyal'
|
||||
__author__ = 'Kovid Goyal and Sujata Raman'
|
||||
use_embedded_content = False
|
||||
max_articles_per_feed = 20
|
||||
language = _('English')
|
||||
|
||||
|
||||
remove_javascript = True
|
||||
no_stylesheets = True
|
||||
|
||||
extra_css = '''
|
||||
#articleCopyright { font-family:Arial,helvetica,sans-serif ; font-weight:bold ; font-size:x-small ;}
|
||||
p { font-family:"Times New Roman",times,serif ; font-weight:normal ; font-size:small ;}
|
||||
body{font-family:arial,helvetica,sans-serif}
|
||||
'''
|
||||
|
||||
feeds = [ ('Today\'s Highlights', 'http://www.washingtonpost.com/wp-dyn/rss/linkset/2005/03/24/LI2005032400102.xml'),
|
||||
feeds = [ ('Today\'s Highlights', 'http://www.washingtonpost.com/wp-dyn/rss/linkset/2005/03/24/LI2005032400102.xml'),
|
||||
('Politics', 'http://www.washingtonpost.com/wp-dyn/rss/politics/index.xml'),
|
||||
('Nation', 'http://www.washingtonpost.com/wp-dyn/rss/nation/index.xml'),
|
||||
('World', 'http://www.washingtonpost.com/wp-dyn/rss/world/index.xml'),
|
||||
@ -30,7 +35,7 @@ class WashingtonPost(BasicNewsRecipe):
|
||||
|
||||
|
||||
def get_article_url(self, article):
|
||||
return article.get('pheedo_origlink', article.get('link', None))
|
||||
return article.get('guid', article.get('link', None))
|
||||
|
||||
def print_version(self, url):
|
||||
return url.rpartition('.')[0] + '_pf.html'
|
||||
|
Loading…
x
Reference in New Issue
Block a user