def _generate(self, bottom, feed, art, number_of_articles_in_feed, two_levels, url, __appname__, prefix='', center=True, extra_css=None, style=None): head = HEAD(TITLE('navbar')) if style: head.append(STYLE(style, type='text/css')) if extra_css: head.append(STYLE(extra_css, type='text/css')) if prefix and not prefix.endswith('/'): prefix += '/' align = 'center' if center else 'left' navbar = DIV( attrs('calibre_navbar', rescale=70, style='text-align:' + align)) if bottom: if not url.startswith('file://'): navbar.append(HR()) text = 'This article was downloaded by ' p = PT( text, STRONG(__appname__), A(url, href=url, rel='calibre-downloaded-from'), style='text-align:left; max-width: 100%; overflow: hidden;' ) p[0].tail = ' from ' navbar.append(p) navbar.append(BR()) navbar.append(BR()) else: next_art = 'feed_%d'%(feed+1) if art == number_of_articles_in_feed - 1 \ else 'article_%d'%(art+1) up = '../..' if art == number_of_articles_in_feed - 1 else '..' href = '%s%s/%s/index.html' % (prefix, up, next_art) navbar.text = '| ' navbar.append(A(_('Next'), href=href)) href = '%s../index.html#article_%d' % (prefix, art) next(navbar.iterchildren(reversed=True)).tail = ' | ' navbar.append(A(_('Section menu'), href=href)) href = '%s../../index.html#feed_%d' % (prefix, feed) next(navbar.iterchildren(reversed=True)).tail = ' | ' navbar.append(A(_('Main menu'), href=href)) if art > 0 and not bottom: href = '%s../article_%d/index.html' % (prefix, art - 1) next(navbar.iterchildren(reversed=True)).tail = ' | ' navbar.append(A(_('Previous'), href=href)) next(navbar.iterchildren(reversed=True)).tail = ' | ' if not bottom: navbar.append(HR()) self.root = HTML(head, BODY(navbar))
def _generate(self, bottom, feed, art, number_of_articles_in_feed, two_levels, url, __appname__, prefix='', center=True, extra_css=None, style=None): head = HEAD(TITLE('navbar')) if style: head.append(STYLE(style, type='text/css')) if extra_css: head.append(STYLE(extra_css, type='text/css')) navbar = DIV() navbar_t = TABLE(CLASS('touchscreen_navbar')) navbar_tr = TR() if bottom and not url.startswith('file://'): navbar.append(HR()) text = 'This article was downloaded by ' p = PT(text, STRONG(__appname__), A(url, href=url, rel='calibre-downloaded-from'), style='text-align:left; max-width: 100%; overflow: hidden;') p[0].tail = ' from ' navbar.append(p) navbar.append(BR()) # | Previous if art > 0: link = A(CLASS('article_link'),_('Previous'),href='%s../article_%d/index.html'%(prefix, art-1)) navbar_tr.append(TD(CLASS('article_prev'),link)) else: navbar_tr.append(TD(CLASS('article_prev'),'')) # | Articles | Sections | link = A(CLASS('articles_link'),_('Articles'), href='%s../index.html#article_%d'%(prefix, art)) navbar_tr.append(TD(CLASS('article_articles_list'),link)) link = A(CLASS('sections_link'),_('Sections'), href='%s../../index.html#feed_%d'%(prefix, feed)) navbar_tr.append(TD(CLASS('article_sections_list'),link)) # | Next next = 'feed_%d'%(feed+1) if art == number_of_articles_in_feed - 1 \ else 'article_%d'%(art+1) up = '../..' if art == number_of_articles_in_feed - 1 else '..' link = A(CLASS('article_link'), _('Next'), href='%s%s/%s/index.html'%(prefix, up, next)) 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) self.root = HTML(head, BODY(navbar))