Exemple #1
0
 def _generate(self, title, masthead, datefmt, feeds, extra_css=None, style=None):
     self.IS_HTML = False
     if isinstance(datefmt, unicode):
         datefmt = datefmt.encode(preferred_encoding)
     date = strftime(datefmt)
     head = HEAD(TITLE(title))
     if style:
         head.append(STYLE(style, type="text/css"))
     if extra_css:
         head.append(STYLE(extra_css, type="text/css"))
     ul = UL(CLASS("calibre_feed_list"))
     for i, feed in enumerate(feeds):
         if feed:
             li = LI(
                 A(feed.title, CLASS("feed", "calibre_rescale_120", href="feed_%d/index.html" % i)), id="feed_%d" % i
             )
             ul.append(li)
     div = DIV(
         PT(IMG(src=masthead, alt="masthead"), style="text-align:center"),
         PT(date, style="text-align:right"),
         ul,
         CLASS("calibre_rescale_100"),
     )
     self.root = HTML(head, BODY(div))
     if self.html_lang:
         self.root.set("lang", self.html_lang)
Exemple #2
0
 def _generate(self,
               title,
               masthead,
               datefmt,
               feeds,
               extra_css=None,
               style=None):
     self.IS_HTML = False
     date = strftime(datefmt)
     head = HEAD(TITLE(title))
     if style:
         head.append(STYLE(style, type='text/css'))
     if extra_css:
         head.append(STYLE(extra_css, type='text/css'))
     ul = UL(attrs('calibre_feed_list'))
     for i, feed in enumerate(feeds):
         if len(feed):
             li = LI(A(
                 feed.title,
                 attrs('feed', rescale=120, href='feed_%d/index.html' % i)),
                     id='feed_%d' % i)
             ul.append(li)
     div = DIV(
         PT(IMG(src=masthead, alt="masthead"), style='text-align:center'),
         PT(date, style='text-align:right'), ul, attrs(rescale=100))
     self.root = HTML(head, BODY(div))
     if self.html_lang:
         self.root.set('lang', self.html_lang)
Exemple #3
0
 def _generate(self,
               title,
               masthead,
               datefmt,
               feeds,
               extra_css=None,
               style=None):
     self.IS_HTML = False
     if isinstance(datefmt, unicode):
         datefmt = datefmt.encode(preferred_encoding)
     date = strftime(datefmt)
     head = HEAD(TITLE(title))
     if style:
         head.append(STYLE(style, type='text/css'))
     if extra_css:
         head.append(STYLE(extra_css, type='text/css'))
     ul = UL(CLASS('calibre_feed_list'))
     for i, feed in enumerate(feeds):
         if feed:
             li = LI(A(
                 feed.title,
                 CLASS('feed',
                       'calibre_rescale_120',
                       href='feed_%d/index.html' % i)),
                     id='feed_%d' % i)
             ul.append(li)
     div = DIV(
         PT(IMG(src=masthead, alt="masthead"), style='text-align:center'),
         PT(date, style='text-align:right'), ul,
         CLASS('calibre_rescale_100'))
     self.root = HTML(head, BODY(div))
     if self.html_lang:
         self.root.set('lang', self.html_lang)
Exemple #4
0
    def _generate(self, f, feeds, cutoff, extra_css=None, style=None):
        from calibre.utils.cleantext import clean_xml_chars
        feed = feeds[f]
        head = HEAD(TITLE(feed.title))
        if style:
            head.append(STYLE(style, type='text/css'))
        if extra_css:
            head.append(STYLE(extra_css, type='text/css'))
        body = BODY()
        body.append(self.get_navbar(f, feeds))

        div = DIV(
                H2(feed.title,
                    CLASS('calibre_feed_title', 'calibre_rescale_160')),
                CLASS('calibre_rescale_100')
              )
        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
                ),
                CLASS('calibre_feed_image')))
        if getattr(feed, 'description', None):
            d = DIV(clean_xml_chars(feed.description), CLASS('calibre_feed_description',
                'calibre_rescale_80'))
            d.append(BR())
            div.append(d)
        ul = UL(CLASS('calibre_article_list'))
        for i, article in enumerate(feed.articles):
            if not getattr(article, 'downloaded', False):
                continue
            li = LI(
                    A(article.title, CLASS('article calibre_rescale_120',
                                    href=article.url)),
                    SPAN(article.formatted_date, CLASS('article_date')),
                    CLASS('calibre_rescale_100', id='article_%d'%i,
                            style='padding-bottom:0.5em')
                    )
            if article.summary:
                li.append(DIV(clean_xml_chars(cutoff(article.text_summary)),
                    CLASS('article_description', 'calibre_rescale_70')))
            ul.append(li)
        div.append(ul)
        div.append(self.get_navbar(f, feeds, top=False))
        self.root = HTML(head, body)
        if self.html_lang:
            self.root.set('lang', self.html_lang)
Exemple #5
0
    def _generate(self, f, feeds, cutoff, extra_css=None, style=None):
        from calibre.utils.cleantext import clean_xml_chars
        feed = feeds[f]
        head = HEAD(TITLE(feed.title))
        if style:
            head.append(STYLE(style, type='text/css'))
        if extra_css:
            head.append(STYLE(extra_css, type='text/css'))
        body = BODY()
        body.append(self.get_navbar(f, feeds))

        div = DIV(
                H2(feed.title,
                    CLASS('calibre_feed_title', 'calibre_rescale_160')),
                CLASS('calibre_rescale_100')
              )
        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
                ),
                CLASS('calibre_feed_image')))
        if getattr(feed, 'description', None):
            d = DIV(clean_xml_chars(feed.description), CLASS('calibre_feed_description',
                'calibre_rescale_80'))
            d.append(BR())
            div.append(d)
        ul = UL(CLASS('calibre_article_list'))
        for i, article in enumerate(feed.articles):
            if not getattr(article, 'downloaded', False):
                continue
            li = LI(
                    A(article.title, CLASS('article calibre_rescale_120',
                                    href=article.url)),
                    SPAN(article.formatted_date, CLASS('article_date')),
                    CLASS('calibre_rescale_100', id='article_%d'%i,
                            style='padding-bottom:0.5em')
                    )
            if article.summary:
                li.append(DIV(clean_xml_chars(cutoff(article.text_summary)),
                    CLASS('article_description', 'calibre_rescale_70')))
            ul.append(li)
        div.append(ul)
        div.append(self.get_navbar(f, feeds, top=False))
        self.root = HTML(head, body)
        if self.html_lang:
            self.root.set('lang', self.html_lang)
Exemple #6
0
 def _generate(self, title, masthead, datefmt, feeds, extra_css=None, style=None):
     self.IS_HTML = False
     date = strftime(datefmt)
     head = HEAD(TITLE(title))
     if style:
         head.append(STYLE(style, type='text/css'))
     if extra_css:
         head.append(STYLE(extra_css, type='text/css'))
     ul = UL(CLASS('calibre_feed_list'))
     for i, feed in enumerate(feeds):
         if feed:
             li = LI(A(feed.title, CLASS('feed', 'calibre_rescale_120',
                 href='feed_%d/index.html'%i)), id='feed_%d'%i)
             ul.append(li)
     div = DIV(
             PT(IMG(src=masthead,alt="masthead"),style='text-align:center'),
             PT(date, style='text-align:right'),
             ul,
             CLASS('calibre_rescale_100'))
     self.root = HTML(head, BODY(div))
     if self.html_lang:
         self.root.set('lang', self.html_lang)
Exemple #7
0
    def _generate(self, f, feeds, cutoff, extra_css=None, style=None):
        feed = feeds[f]
        head = HEAD(TITLE(feed.title))
        if style:
            head.append(STYLE(style, type="text/css"))
        if extra_css:
            head.append(STYLE(extra_css, type="text/css"))
        body = BODY()
        body.append(self.get_navbar(f, feeds))

        div = DIV(H2(feed.title, CLASS("calibre_feed_title", "calibre_rescale_160")), CLASS("calibre_rescale_100"))
        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), CLASS("calibre_feed_image"))
            )
        if getattr(feed, "description", None):
            d = DIV(feed.description, CLASS("calibre_feed_description", "calibre_rescale_80"))
            d.append(BR())
            div.append(d)
        ul = UL(CLASS("calibre_article_list"))
        for i, article in enumerate(feed.articles):
            if not getattr(article, "downloaded", False):
                continue
            li = LI(
                A(article.title, CLASS("article calibre_rescale_120", href=article.url)),
                SPAN(article.formatted_date, CLASS("article_date")),
                CLASS("calibre_rescale_100", id="article_%d" % i, style="padding-bottom:0.5em"),
            )
            if article.summary:
                li.append(DIV(cutoff(article.text_summary), CLASS("article_description", "calibre_rescale_70")))
            ul.append(li)
        div.append(ul)
        div.append(self.get_navbar(f, feeds, top=False))
        self.root = HTML(head, body)
        if self.html_lang:
            self.root.set("lang", self.html_lang)