Skip to content

Commit 7419397

Browse files
committed
Convert the main templates to jinja2
1 parent 86e31f9 commit 7419397

7 files changed

Lines changed: 125 additions & 156 deletions

File tree

config/foafroll.xml.tmpl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77
xmlns:dc="http://purl.org/dc/elements/1.1/"
88
>
99
<foaf:Group>
10-
<foaf:name><TMPL_VAR name></foaf:name>
11-
<foaf:homepage><TMPL_VAR link ESCAPE="HTML"></foaf:homepage>
12-
<rdfs:seeAlso rdf:resource="<TMPL_VAR uri ESCAPE="HTML">" />
10+
<foaf:name>{{ name }}</foaf:name>
11+
<foaf:homepage>{{ link | e }}</foaf:homepage>
12+
<rdfs:seeAlso rdf:resource="{{ uri | e }}" />
1313

14-
<TMPL_LOOP Channels>
14+
{% for channel in Channels %}
1515
<foaf:member>
1616
<foaf:Agent>
17-
<foaf:name><TMPL_VAR name></foaf:name>
17+
<foaf:name>{{ channel.name }}</foaf:name>
1818
<foaf:weblog>
19-
<foaf:Document rdf:about="<TMPL_VAR link ESCAPE="HTML">">
20-
<dc:title><TMPL_VAR title></dc:title>
19+
<foaf:Document rdf:about="{{ channel.link | e }}">
20+
<dc:title>{{ channel.title }}</dc:title>
2121
<rdfs:seeAlso>
22-
<rss:channel rdf:about="<TMPL_VAR uri ESCAPE="HTML">" />
22+
<rss:channel rdf:about="{{ channel.uri | e }}" />
2323
</rdfs:seeAlso>
2424
</foaf:Document>
2525
</foaf:weblog>
2626
</foaf:Agent>
2727
</foaf:member>
28-
</TMPL_LOOP>
28+
{% endfor %}
2929

3030
</foaf:Group>
3131
</rdf:RDF>

config/index.html.tmpl

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
33
<head>
44
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
5-
<title><TMPL_VAR name></title>
5+
<title>{{ name }}</title>
66
<link media="screen" href="/static/styles/screen-switcher-default.css"
77
type="text/css" id="screen-switcher-stylesheet" rel="stylesheet" />
88
<link rel="stylesheet" type="text/css" media="sc&#82;een" href="/static/styles/netscape4.css" />
99
<link rel="stylesheet" type="text/css" media="print" href="/static/styles/print.css" />
1010
<link rel="alternate stylesheet" type="text/css" media="screen" href="/static/styles/largestyles.css" title="large text" />
1111
<link media="screen" href="/static/styles/defaultfonts.css" type="text/css"
1212
rel="alternate stylesheet" title="default fonts" />
13-
<meta name="generator" content="<TMPL_VAR generator>" />
13+
<meta name="generator" content="{{ generator }}" />
1414
<meta name="keywords"
1515
content="Python weblog blog blogs blogger weblogger aggregator rss" />
1616
<meta name="description" content="Recent postings from Python-related blogs." />
@@ -32,8 +32,7 @@
3232
<body>
3333
<!-- Logo -->
3434
<h1 id="logoheader">
35-
<a href="/" id="logolink" accesskey="1"><img id="logo"
36-
src="/static/images/python-logo.gif" alt="homepage" border="0" /></a>
35+
<a href="/" id="logolink" accesskey="1"><img id="logo" src="/static/images/python-logo.gif" alt="homepage" border="0" /></a>
3736
</h1>
3837
<!-- Skip to Navigation -->
3938
<div class="skiptonav"><a href="#left-hand-navigation" accesskey="2"><img src="/static/images/trans.gif" id="skiptonav" alt="skip to navigation" border="0" /></a></div>
@@ -42,38 +41,30 @@ src="/static/images/python-logo.gif" alt="homepage" border="0" /></a>
4241
<div id="content-body">
4342
<div id="body-main">
4443

45-
<h1 class="pageheading"><TMPL_VAR name></h1>
44+
<h1 class="pageheading">{{ name }}</h1>
4645

47-
<p>Last update: <TMPL_VAR date>
46+
<p>Last update: {{ date }}</p>
4847

49-
<TMPL_LOOP Items>
48+
{% for item in Items %}
5049

51-
### Visually distinguish articles from different days by checking for
52-
### the new_date flag. This demonstrates the <TMPL_IF varname> ... </TMPL_IF>
53-
### check.
50+
{% if item.new_date %}
51+
<h2>{{ item.new_date }}</h2>
52+
{% endif %}
5453

55-
<TMPL_IF new_date>
56-
<h2><TMPL_VAR new_date></h2>
57-
</TMPL_IF>
54+
{% if item.new_channel %}
55+
<hr /><h3 class="post"><a href="{{ item.channel_link | e }}" title="{{ item.channel_title | e }}">{{ item.channel_name }}</a></h3>
56+
{% endif %}
5857

59-
### Group consecutive articles by the same author together by checking
60-
### for the new_channel flag.
61-
62-
<TMPL_IF new_channel>
63-
<hr /><h3 class="post"><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3>
64-
</TMPL_IF>
65-
66-
67-
<TMPL_IF title>
68-
<h4><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4>
69-
</TMPL_IF>
58+
{% if item.title %}
59+
<h4><a href="{{ item.link | e }}">{{ item.title }}</a></h4>
60+
{% endif %}
7061
<p>
71-
<TMPL_VAR content>
62+
{{ item.content }}
7263
</p>
7364
<p>
74-
<em><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_IF creator>by <TMPL_VAR creator> at </TMPL_IF><TMPL_VAR date></a></em>
65+
<em><a href="{{ item.link | e }}">{% if item.creator %}by {{ item.creator }} at {% endif %}{{ item.date }}</a></em>
7566
</p>
76-
</TMPL_LOOP>
67+
{% endfor %}
7768

7869
</div>
7970
</div>
@@ -127,10 +118,10 @@ src="/static/images/python-logo.gif" alt="homepage" border="0" /></a>
127118
<li>Subscriptions
128119
<ul class="level-two">
129120
<li><a href="opml.xml">[OPML feed]</a></li>
130-
<TMPL_LOOP Channels>
131-
<li><a href="<TMPL_VAR link ESCAPE="HTML">" title="<TMPL_VAR title ESCAPE="HTML">"><TMPL_VAR name></a>
121+
{% for channel in Channels %}
122+
<li><a href="{{ channel.link | e }}" title="{{ channel.title | e }}">{{ channel.name }}</a>
132123
</li>
133-
</TMPL_LOOP>
124+
{% endfor %}
134125

135126
<li>
136127
<i>

config/opml.xml.tmpl

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
<?xml version="1.0"?>
22
<opml version="1.1">
3-
<head>
4-
<title><TMPL_VAR name></title>
5-
<dateCreated><TMPL_VAR date_822></dateCreated>
6-
<dateModified><TMPL_VAR date_822></dateModified>
7-
<ownerName><TMPL_VAR owner_name></ownerName>
8-
<ownerEmail><TMPL_VAR owner_email></ownerEmail>
9-
</head>
10-
11-
<body>
12-
<TMPL_LOOP Channels>
13-
<outline text="<TMPL_VAR name ESCAPE="HTML">" xmlUrl="<TMPL_VAR url ESCAPE="HTML">"/>
14-
</TMPL_LOOP>
3+
<head>
4+
<title>{{ name }}</title>
5+
<dateCreated>{{ date_822 }}</dateCreated>
6+
<dateModified>{{ date_822 }}</dateModified>
7+
<ownerName>{{ owner_name }}</ownerName>
8+
<ownerEmail>{{ owner_email }}</ownerEmail>
9+
</head>
10+
<body>
11+
{% for channel in Channels %}
12+
<outline text="{{ channel.name | e }}" xmlUrl="{{ channel.url | e }}"/>
13+
{% endfor %}
1514
</body>
1615
</opml>

config/rss10.xml.tmpl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@
66
xmlns:content="http://purl.org/rss/1.0/modules/content/"
77
xmlns="http://purl.org/rss/1.0/"
88
>
9-
<channel rdf:about="<TMPL_VAR link ESCAPE="HTML">">
10-
<title><TMPL_VAR name ESCAPE="HTML"></title>
11-
<link><TMPL_VAR link ESCAPE="HTML"></link>
12-
<description><TMPL_VAR name> - <TMPL_VAR link ESCAPE="HTML"></description>
9+
<channel rdf:about="{{ link | e }}">
10+
<title>{{ name | e }}</title>
11+
<link>{{ link | e }}</link>
12+
<description>{{ name }} - {{ link | e }}</description>
1313

1414
<items>
1515
<rdf:Seq>
16-
<TMPL_LOOP Items>
17-
<rdf:li rdf:resource="<TMPL_VAR id ESCAPE="HTML">" />
18-
</TMPL_LOOP>
16+
{% for item in Items %}
17+
<rdf:li rdf:resource="{{ item.id | e }}" />
18+
{% endfor %}
1919
</rdf:Seq>
2020
</items>
2121
</channel>
2222

23-
<TMPL_LOOP Items>
24-
<item rdf:about="<TMPL_VAR link ESCAPE="HTML">">
25-
<title><TMPL_VAR channel_name ESCAPE="HTML"><TMPL_IF title>: <TMPL_VAR title ESCAPE="HTML"></TMPL_IF></title>
26-
<link><TMPL_VAR link ESCAPE="HTML"></link>
27-
<TMPL_IF content>
28-
<content:encoded><TMPL_VAR content ESCAPE="HTML"></content:encoded>
29-
</TMPL_IF>
30-
<dc:date><TMPL_VAR date_iso></dc:date>
31-
<TMPL_IF creator>
32-
<dc:creator><TMPL_VAR creator ESCAPE="HTML"></dc:creator>
33-
</TMPL_IF>
23+
{% for item in Items %}
24+
<item rdf:about="{{ item.link | e }}">
25+
<title>{{ item.channel_name | e }}{% if item.title %}: {{ item.title | e }}{% endif %}</title>
26+
<link>{{ item.link | e }}</link>
27+
{% if item.content %}
28+
<content:encoded>{{ item.content | e }}</content:encoded>
29+
{% endif %}
30+
<dc:date>{{ item.date_iso }}</dc:date>
31+
{% if item.creator %}
32+
<dc:creator>{{ item.creator | e }}</dc:creator>
33+
{% endif %}
3434
</item>
35-
</TMPL_LOOP>
35+
{% endfor %}
3636

3737
</rdf:RDF>

config/rss20.xml.tmpl

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
<?xml version="1.0"?>
22
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
3-
43
<channel>
5-
<title><TMPL_VAR name ESCAPE="HTML"></title>
6-
<link><TMPL_VAR link ESCAPE="HTML"></link>
4+
<title>{{ name | e }}</title>
5+
<link>{{ link | e }}</link>
76
<language>en</language>
8-
<description><TMPL_VAR name> - <TMPL_VAR link ESCAPE="HTML"></description>
7+
<description>{{ name }} - {{ link | e }}</description>
98

10-
<TMPL_LOOP Items>
11-
<item>
12-
<title><TMPL_VAR channel_name ESCAPE="HTML"><TMPL_IF title>: <TMPL_VAR title ESCAPE="HTML"></TMPL_IF></title>
13-
<guid><TMPL_VAR link ESCAPE="HTML"></guid>
14-
<link><TMPL_VAR link ESCAPE="HTML"></link>
15-
<TMPL_IF content>
16-
<description><TMPL_VAR content ESCAPE="HTML"></description>
17-
</TMPL_IF>
18-
<pubDate><TMPL_VAR date_822></pubDate>
19-
<TMPL_IF creator>
20-
<dc:creator><TMPL_VAR creator ESCAPE="HTML"></dc:creator>
21-
</TMPL_IF>
22-
</item>
23-
</TMPL_LOOP>
9+
{% for item in Items %}
10+
<item>
11+
<title>{{ item.channel_name | e }}{% if item.title %}: {{ item.title | e }}{% endif%}</title>
12+
<guid>{{ item.link | e }}</guid>
13+
<link>{{ item.link | e }}</link>
14+
{% if item.content %}
15+
<description>{{ item.content | e }}</description>
16+
{% endif %}
17+
<pubDate>{{ item.date_822 }}</pubDate>
18+
{% if item.creator %}
19+
<dc:creator>{{ item.creator | e }}</dc:creator>
20+
{% endif %}
21+
</item>
22+
{% endfor %}
2423

2524
</channel>
2625
</rss>

config/summary.html.tmpl

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
33
<head>
44
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
5-
<title><TMPL_VAR name></title>
5+
<title>{{ name }}</title>
66
<link media="screen" href="/static/styles/screen-switcher-default.css"
77
type="text/css" id="screen-switcher-stylesheet" rel="stylesheet" />
88
<link rel="stylesheet" type="text/css" media="sc&#82;een" href="/static/styles/netscape4.css" />
99
<link rel="stylesheet" type="text/css" media="print" href="/static/styles/print.css" />
1010
<link rel="alternate stylesheet" type="text/css" media="screen" href="/static/styles/largestyles.css" title="large text" />
1111
<link media="screen" href="/static/styles/defaultfonts.css" type="text/css"
1212
rel="alternate stylesheet" title="default fonts" />
13-
<meta name="generator" content="<TMPL_VAR generator>">
13+
<meta name="generator" content="{{ generator }}">
1414
<meta name="keywords"
1515
content="Python weblog blog blogger weblogger aggregator rss">
1616
<meta name="description" content="Recent postings from Python-related weblogs.">
@@ -20,8 +20,7 @@
2020
<body>
2121
<!-- Logo -->
2222
<h1 id="logoheader">
23-
<a href="/" id="logolink" accesskey="1"><img id="logo"
24-
src="/static/images/python-logo.gif" alt="homepage" border="0" /></a>
23+
<a href="/" id="logolink" accesskey="1"><img id="logo" src="/static/images/python-logo.gif" alt="homepage" border="0" /></a>
2524
</h1>
2625
<!-- Skip to Navigation -->
2726
<div class="skiptonav"><a href="#left-hand-navigation" accesskey="2"><img src="/static/images/trans.gif" id="skiptonav" alt="skip to navigation" border="0" /></a></div>
@@ -30,38 +29,30 @@ src="/static/images/python-logo.gif" alt="homepage" border="0" /></a>
3029
<div id="content-body">
3130
<div id="body-main">
3231

33-
<h1 class="pageheading"><TMPL_VAR name></h1>
32+
<h1 class="pageheading">{{ name }}</h1>
3433

35-
<p>Last update: <TMPL_VAR date>
34+
<p>Last update: {{ date }}</p>
3635

37-
<TMPL_LOOP Items>
36+
{% for item in Items %}
3837

39-
### Visually distinguish articles from different days by checking for
40-
### the new_date flag. This demonstrates the <TMPL_IF varname> ... </TMPL_IF>
41-
### check.
38+
{% if item.new_date %}
39+
<h2>{{ item.new_date }}</h2>
40+
{% endif %}
4241

43-
<TMPL_IF new_date>
44-
<h2><TMPL_VAR new_date></h2>
45-
</TMPL_IF>
42+
{% if item.new_channel %}
43+
<hr><h3 class="post"><a href="{{ item.channel_link | e }}" title="{{ item.channel_title | e }}">{{ item.channel_name }}</a></h3>
44+
{% endif %}
4645

47-
### Group consecutive articles by the same author together by checking
48-
### for the new_channel flag.
49-
50-
<TMPL_IF new_channel>
51-
<hr><h3 class="post"><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3>
52-
</TMPL_IF>
53-
54-
55-
<TMPL_IF title>
56-
<h4><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4>
57-
</TMPL_IF>
46+
{% if item.title %}
47+
<h4><a href="{{ item.link | e }}">{{ item.title }}</a></h4>
48+
{% endif %}
5849
<p>
59-
<TMPL_VAR summary>
50+
{{ item.summary }}
6051
</p>
6152
<p>
62-
<em><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_IF creator>by <TMPL_VAR creator> at </TMPL_IF><TMPL_VAR date></a></em>
53+
<em><a href="{{ item.link | e }}">{% if item.creator %}by {{ item.creator }} at {% endif %}{{ item.date }}</a></em>
6354
</p>
64-
</TMPL_LOOP>
55+
{% endfor %}
6556

6657
</div>
6758
</div>
@@ -98,10 +89,10 @@ src="/static/images/python-logo.gif" alt="homepage" border="0" /></a>
9889
</ul></li>
9990
<li>Subscriptions
10091
<ul class="level-two">
101-
<li><a href="opml.xml">[OPML feed]</a></li>
102-
<TMPL_LOOP Channels>
103-
<li><a href="<TMPL_VAR link ESCAPE="HTML">" title="<TMPL_VAR title ESCAPE="HTML">"><TMPL_VAR name></a></li>
104-
</TMPL_LOOP>
92+
<li><a href="opml.xml">[OPML feed]</a></li>
93+
{% for channel in Channels %}
94+
<li><a href="{{ channel.link | e }}" title="{{ channel.title | e }}">{{ channel.name }}</a></li>
95+
{% endfor %}
10596
</ul></li>
10697
</ul>
10798
</div>

0 commit comments

Comments
 (0)