GwR tweaks

This commit is contained in:
Kovid Goyal 2010-06-03 23:10:57 -06:00
commit ef47738914
2 changed files with 15 additions and 9 deletions

View File

@ -538,7 +538,7 @@ class BasicNewsRecipe(Recipe):
Intended to be used to get article metadata like author/summary/etc. Intended to be used to get article metadata like author/summary/etc.
from the parsed HTML (soup). from the parsed HTML (soup).
:param article: A object of class :class:`calibre.web.feeds.Article`. :param article: A object of class :class:`calibre.web.feeds.Article`.
If you chane the sumamry, remeber to also change the If you change the summary, remember to also change the
text_summary text_summary
:param soup: Parsed HTML belonging to this article :param soup: Parsed HTML belonging to this article
:param first: True iff the parsed HTML is the first page of the article. :param first: True iff the parsed HTML is the first page of the article.
@ -800,9 +800,6 @@ class BasicNewsRecipe(Recipe):
table.toc { table.toc {
font-size:large; font-size:large;
} }
td.article_count {
text-align:right;
}
''' '''
templ = templates.TouchscreenFeedTemplate() templ = templates.TouchscreenFeedTemplate()
@ -1135,7 +1132,8 @@ class BasicNewsRecipe(Recipe):
mi.publisher = __appname__ mi.publisher = __appname__
mi.author_sort = __appname__ mi.author_sort = __appname__
if self.output_profile.name == 'iPad': if self.output_profile.name == 'iPad':
mi.authors = [strftime('%A, %d %B %Y')] date_as_author = '%s, %s %s, %s' % (strftime('%A'), strftime('%B'), strftime('%d').lstrip('0'), strftime('%Y'))
mi.authors = [date_as_author]
mi.author_sort = strftime('%Y-%m-%d') mi.author_sort = strftime('%Y-%m-%d')
mi.publication_type = 'periodical:'+self.publication_type mi.publication_type = 'periodical:'+self.publication_type
mi.timestamp = nowf() mi.timestamp = nowf()

View File

@ -120,6 +120,7 @@ class TouchscreenNavBarTemplate(Template):
href = '%s%s/%s/index.html'%(prefix, up, next) href = '%s%s/%s/index.html'%(prefix, up, next)
navbar.text = '| ' navbar.text = '| '
navbar.append(A('Next', href=href)) navbar.append(A('Next', href=href))
href = '%s../index.html#article_%d'%(prefix, art) href = '%s../index.html#article_%d'%(prefix, art)
navbar.iterchildren(reversed=True).next().tail = ' | ' navbar.iterchildren(reversed=True).next().tail = ' | '
navbar.append(A('Section Menu', href=href)) navbar.append(A('Section Menu', href=href))
@ -130,6 +131,7 @@ class TouchscreenNavBarTemplate(Template):
href = '%s../article_%d/index.html'%(prefix, art-1) href = '%s../article_%d/index.html'%(prefix, art-1)
navbar.iterchildren(reversed=True).next().tail = ' | ' navbar.iterchildren(reversed=True).next().tail = ' | '
navbar.append(A('Previous', href=href)) navbar.append(A('Previous', href=href))
navbar.iterchildren(reversed=True).next().tail = ' | ' navbar.iterchildren(reversed=True).next().tail = ' | '
if not bottom: if not bottom:
navbar.append(HR()) navbar.append(HR())
@ -165,8 +167,14 @@ class TouchscreenIndexTemplate(Template):
def _generate(self, title, masthead, datefmt, feeds, extra_css=None, style=None): def _generate(self, title, masthead, datefmt, feeds, extra_css=None, style=None):
if isinstance(datefmt, unicode): if isinstance(datefmt, unicode):
datefmt = datefmt.encode(preferred_encoding) datefmt = datefmt.encode(preferred_encoding)
date = strftime(datefmt) date = '%s, %s %s, %s' % (strftime('%A'), strftime('%B'), strftime('%d').lstrip('0'), strftime('%Y'))
masthead_img = IMG(src=masthead,alt="masthead") masthead_p = etree.Element("p")
masthead_p.set("style","text-align:center")
masthead_img = etree.Element("img")
masthead_img.set("src",masthead)
masthead_img.set("alt","masthead")
masthead_p.append(masthead_img)
head = HEAD(TITLE(title)) head = HEAD(TITLE(title))
if style: if style:
head.append(STYLE(style, type='text/css')) head.append(STYLE(style, type='text/css'))
@ -178,11 +186,11 @@ class TouchscreenIndexTemplate(Template):
if feed: if feed:
tr = TR() tr = TR()
tr.append(TD( CLASS('toc_item'), A(feed.title, href='feed_%d/index.html'%i))) tr.append(TD( CLASS('toc_item'), A(feed.title, href='feed_%d/index.html'%i)))
tr.append(TD( CLASS('article_count'),'%d' % len(feed.articles))) tr.append(TD( '%s' % len(feed.articles), style="text-align:right"))
toc.append(tr) toc.append(tr)
div = DIV( div = DIV(
PT(masthead_img,style='text-align:center'), masthead_p,
PT(date, style='text-align:center'), PT(date, style='text-align:center'),
toc, toc,
CLASS('calibre_rescale_100')) CLASS('calibre_rescale_100'))