mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-21 06:53:15 +02:00
pep8
This commit is contained in:
parent
8bd6cc840c
commit
8020f489ca
1 changed files with 13 additions and 13 deletions
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
from calibre import preferred_encoding, strftime, isbytestring
|
||||
|
||||
def CLASS(*args, **kwargs): # class is a reserved word in Python
|
||||
def CLASS(*args, **kwargs): # class is a reserved word in Python
|
||||
kwargs['class'] = ' '.join(args)
|
||||
return kwargs
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ def __init__(self, lang=None):
|
|||
self.html_lang = lang
|
||||
|
||||
def generate(self, *args, **kwargs):
|
||||
if not kwargs.has_key('style'):
|
||||
if 'style' not in kwargs:
|
||||
kwargs['style'] = ''
|
||||
for key in kwargs.keys():
|
||||
if isbytestring(kwargs[key]):
|
||||
|
|
@ -152,8 +152,8 @@ def _generate(self, f, feeds, cutoff, extra_css=None, style=None):
|
|||
body.append(div)
|
||||
if getattr(feed, 'image', None):
|
||||
div.append(DIV(IMG(
|
||||
alt = feed.image_alt if feed.image_alt else '',
|
||||
src = feed.image_url
|
||||
alt=feed.image_alt if feed.image_alt else '',
|
||||
src=feed.image_url
|
||||
),
|
||||
CLASS('calibre_feed_image')))
|
||||
if getattr(feed, 'description', None):
|
||||
|
|
@ -261,8 +261,8 @@ def _generate(self, title, masthead, datefmt, feeds, extra_css=None, style=None)
|
|||
for i, feed in enumerate(feeds):
|
||||
if feed:
|
||||
tr = TR()
|
||||
tr.append(TD( CLASS('calibre_rescale_120'), A(feed.title, href='feed_%d/index.html'%i)))
|
||||
tr.append(TD( '%s' % len(feed.articles), style="text-align:right"))
|
||||
tr.append(TD(CLASS('calibre_rescale_120'), A(feed.title, href='feed_%d/index.html'%i)))
|
||||
tr.append(TD('%s' % len(feed.articles), style="text-align:right"))
|
||||
toc.append(tr)
|
||||
div = DIV(
|
||||
masthead_p,
|
||||
|
|
@ -307,7 +307,7 @@ def trim_title(title,clip=18):
|
|||
if f > 0:
|
||||
link = A(CLASS('feed_link'),
|
||||
trim_title(feeds[f-1].title),
|
||||
href = '../feed_%d/index.html' % int(f-1))
|
||||
href='../feed_%d/index.html' % int(f-1))
|
||||
navbar_tr.append(TD(CLASS('feed_prev'),link))
|
||||
|
||||
# Up to Sections
|
||||
|
|
@ -319,13 +319,12 @@ def trim_title(title,clip=18):
|
|||
if f < len(feeds)-1:
|
||||
link = A(CLASS('feed_link'),
|
||||
trim_title(feeds[f+1].title),
|
||||
href = '../feed_%d/index.html' % int(f+1))
|
||||
href='../feed_%d/index.html' % int(f+1))
|
||||
navbar_tr.append(TD(CLASS('feed_next'),link))
|
||||
navbar_t.append(navbar_tr)
|
||||
top_navbar = navbar_t
|
||||
bottom_navbar = copy.copy(navbar_t)
|
||||
#print "\n%s\n" % etree.tostring(navbar_t, pretty_print=True)
|
||||
|
||||
# print "\n%s\n" % etree.tostring(navbar_t, pretty_print=True)
|
||||
|
||||
# Build the page
|
||||
head = HEAD(TITLE(feed.title))
|
||||
|
|
@ -342,8 +341,8 @@ def trim_title(title,clip=18):
|
|||
|
||||
if getattr(feed, 'image', None):
|
||||
div.append(DIV(IMG(
|
||||
alt = feed.image_alt if feed.image_alt else '',
|
||||
src = feed.image_url
|
||||
alt=feed.image_alt if feed.image_alt else '',
|
||||
src=feed.image_url
|
||||
),
|
||||
CLASS('calibre_feed_image')))
|
||||
if getattr(feed, 'description', None):
|
||||
|
|
@ -411,6 +410,7 @@ def _generate(self, bottom, feed, art, number_of_articles_in_feed,
|
|||
navbar_tr.append(TD(CLASS('article_next'),link))
|
||||
navbar_t.append(navbar_tr)
|
||||
navbar.append(navbar_t)
|
||||
#print "\n%s\n" % etree.tostring(navbar, pretty_print=True)
|
||||
# print "\n%s\n" % etree.tostring(navbar, pretty_print=True)
|
||||
|
||||
self.root = HTML(head, BODY(navbar))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue