18
18
if isinstance(arg, basestring) and not isinstance(arg, unicode):
19
19
arg = unicode(arg, 'utf-8', 'replace')
21
21
return MarkupTemplate.generate(self, *args, **kwargs)
23
23
class NavBarTemplate(Template):
25
25
def __init__(self):
26
26
Template.__init__(self, u'''\
27
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
27
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
28
28
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
29
<html xmlns="http://www.w3.org/1999/xhtml"
29
<html xmlns="http://www.w3.org/1999/xhtml"
31
31
xmlns:xi="http://www.w3.org/2001/XInclude"
32
xmlns:py="http://genshi.edgewall.org/"
32
xmlns:py="http://genshi.edgewall.org/"
36
36
<style py:if="extra_css" type="text/css">
67
def generate(self, bottom, feed, art, number_of_articles_in_feed,
67
def generate(self, bottom, feed, art, number_of_articles_in_feed,
68
68
two_levels, url, __appname__, prefix='', center=True,
70
70
if prefix and not prefix.endswith('/'):
72
72
return Template.generate(self, bottom=bottom, art=art, feed=feed,
73
num=number_of_articles_in_feed,
73
num=number_of_articles_in_feed,
74
74
two_levels=two_levels, url=url,
75
75
__appname__=__appname__, prefix=prefix,
76
76
center=center, extra_css=extra_css)
79
79
class IndexTemplate(Template):
81
81
def __init__(self):
82
82
Template.__init__(self, u'''\
83
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
83
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
84
84
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
85
<html xmlns="http://www.w3.org/1999/xhtml"
85
<html xmlns="http://www.w3.org/1999/xhtml"
87
87
xmlns:xi="http://www.w3.org/2001/XInclude"
88
xmlns:py="http://genshi.edgewall.org/"
88
xmlns:py="http://genshi.edgewall.org/"
92
92
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
102
<h1 class="calibre_recipe_title">${title}</h1>
103
<p style="text-align:right">${date}</p>
104
<ul class="calibre_feed_list">
105
<py:for each="i, feed in enumerate(feeds)">
106
<li py:if="feed" id="feed_${str(i)}">
107
<a class="feed" href="${'feed_%d/index.html'%i}">${feed.title}</a>
102
<div class="calibre_rescale_100">
103
<h1 class="calibre_recipe_title calibre_rescale_180">${title}</h1>
104
<p style="text-align:right">${date}</p>
105
<ul class="calibre_feed_list">
106
<py:for each="i, feed in enumerate(feeds)">
107
<li py:if="feed" id="feed_${str(i)}">
108
<a class="feed calibre_rescale_120" href="${'feed_%d/index.html'%i}">${feed.title}</a>
118
120
date = strftime(datefmt)
119
121
return Template.generate(self, title=title, date=date, feeds=feeds,
120
122
extra_css=extra_css)
123
125
class FeedTemplate(Template):
125
127
def __init__(self):
126
128
Template.__init__(self, u'''\
127
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
129
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
128
130
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
129
<html xmlns="http://www.w3.org/1999/xhtml"
131
<html xmlns="http://www.w3.org/1999/xhtml"
131
133
xmlns:xi="http://www.w3.org/2001/XInclude"
132
xmlns:py="http://genshi.edgewall.org/"
134
xmlns:py="http://genshi.edgewall.org/"
136
138
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
145
147
<body style="page-break-before:always">
146
<h2 class="calibre_feed_title">${feed.title}</h2>
148
<div class="calibre_rescale_100">
149
<h2 class="calibre_feed_title calibre_rescale_160">${feed.title}</h2>
147
150
<py:if test="getattr(feed, 'image', None)">
148
151
<div class="calibre_feed_image">
149
152
<img alt="${feed.image_alt}" src="${feed.image_url}" />
152
<div class="calibre_feed_description" py:if="getattr(feed, 'description', None)">
155
<div class="calibre_feed_description calibre_rescale_80" py:if="getattr(feed, 'description', None)">
153
156
${feed.description}<br />
155
158
<ul class="calibre_article_list">
156
159
<py:for each="i, article in enumerate(feed.articles)">
157
<li id="${'article_%d'%i}" py:if="getattr(article, 'downloaded', False)" style="padding-bottom:0.5em">
158
<a class="article" href="${article.url}">${article.title}</a>
160
<li id="${'article_%d'%i}" py:if="getattr(article, 'downloaded',
161
False)" style="padding-bottom:0.5em" class="calibre_rescale_100">
162
<a class="article calibre_rescale_120" href="${article.url}">${article.title}</a>
159
163
<span class="article_date">${article.localtime.strftime(" [%a, %d %b %H:%M]")}</span>
160
<div class="article_decription" py:if="article.summary">
164
<div class="article_description calibre_rescale_70" py:if="article.summary">
161
165
${Markup(cutoff(article.text_summary))}
166
<div class="navbar" style="text-align:center; font-family:monospace; font-size:8pt">
170
<div class="navbar calibre_rescale_70">
167
171
| <a href="../index.html">Up one level</a> |
173
178
def generate(self, feed, cutoff, extra_css=None):
174
return Template.generate(self, feed=feed, cutoff=cutoff,
179
return Template.generate(self, feed=feed, cutoff=cutoff,
175
180
extra_css=extra_css)
177
182
class EmbeddedContent(Template):
179
184
def __init__(self):
180
185
Template.__init__(self, u'''\
181
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
186
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
182
187
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
183
<html xmlns="http://www.w3.org/1999/xhtml"
188
<html xmlns="http://www.w3.org/1999/xhtml"
185
190
xmlns:xi="http://www.w3.org/2001/XInclude"
186
xmlns:py="http://genshi.edgewall.org/"
191
xmlns:py="http://genshi.edgewall.org/"
190
195
<title>${article.title}</title>
194
199
<h2>${article.title}</h2>
196
201
${Markup(article.content if len(article.content if article.content else '') > len(article.summary if article.summary else '') else article.summary)}
202
207
def generate(self, article):
203
208
return Template.generate(self, article=article)