|
1 | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
2 | 2 | <html> |
3 | 3 |
|
4 | | -### Planet HTML template. |
5 | | -### |
6 | | -### This is intended to demonstrate and document Planet's templating |
7 | | -### facilities, and at the same time provide a good base for you to |
8 | | -### modify into your own design. |
9 | | -### |
10 | | -### The output's a bit boring though, if you're after less documentation |
11 | | -### and more instant gratification, there's an example with a much |
12 | | -### prettier output in the fancy-examples/ directory of the Planet source. |
13 | | - |
14 | | -### Lines like this are comments, and are automatically removed by the |
15 | | -### templating engine before processing. |
16 | | - |
17 | | - |
18 | | -### Planet makes a large number of variables available for your templates. |
19 | | -### See INSTALL for the complete list. The raw value can be placed in your |
20 | | -### output file using <TMPL_VAR varname>. We'll put the name of our |
21 | | -### Planet in the page title and again in an h1. |
22 | | - |
23 | 4 | <head> |
24 | | -<title><TMPL_VAR name></title> |
| 5 | +<title>{{ name }}</title> |
25 | 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
26 | | -<meta name="generator" content="<TMPL_VAR generator>"> |
| 7 | +<meta name="generator" content="{{ generator }}"> |
27 | 8 | </head> |
28 | 9 |
|
29 | 10 | <body> |
30 | | -<h1><TMPL_VAR name></h1> |
31 | | - |
32 | | -### One of the two loops available is the Channels loop. This allows you |
33 | | -### to easily create a list of subscriptions, which is exactly what we'll do |
34 | | -### here. |
35 | | - |
36 | | -### Note that we can also expand variables inside HTML tags, but we need |
37 | | -### to be cautious and HTML-escape any illegal characters using the form |
38 | | -### <TMPL_VAR varname ESCAPE="HTML"> |
| 11 | +<h1>{{ name }}</h1> |
39 | 12 |
|
40 | 13 | <div style="float: right"> |
41 | 14 | <h2>Subscriptions</h2> |
42 | 15 | <ul> |
43 | | -<TMPL_LOOP Channels> |
44 | | -<li><a href="<TMPL_VAR link ESCAPE="HTML">" title="<TMPL_VAR title ESCAPE="HTML">"><TMPL_VAR name></a> <a href="<TMPL_VAR uri ESCAPE="HTML">">(feed)</a></li> |
45 | | -</TMPL_LOOP> |
| 16 | +{% for channel in Channels %} |
| 17 | +<li><a href="{{ channel.link | e }}" title="{{ channel.title | e }}">{{ channel.name }}</a> <a href="{{ channel.uri | e }}">(feed)</a></li> |
| 18 | +{% endfor %} |
46 | 19 | </ul> |
47 | 20 | </div> |
48 | 21 |
|
49 | | -### The other loop is the Items loop, which will get iterated for each |
50 | | -### news item. |
51 | | - |
52 | | -<TMPL_LOOP Items> |
53 | | - |
54 | | -### Visually distinguish articles from different days by checking for |
55 | | -### the new_date flag. This demonstrates the <TMPL_IF varname> ... </TMPL_IF> |
56 | | -### check. |
57 | | - |
58 | | -<TMPL_IF new_date> |
59 | | -<h2><TMPL_VAR new_date></h2> |
60 | | -</TMPL_IF> |
61 | | - |
62 | | -### Group consecutive articles by the same author together by checking |
63 | | -### for the new_channel flag. |
| 22 | +{% for item in Items %} |
64 | 23 |
|
65 | | -<TMPL_IF new_channel> |
66 | | -<h3><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3> |
67 | | -</TMPL_IF> |
| 24 | +{% if item.new_date %} |
| 25 | +<h2>{{ item.new_date }}</h2> |
| 26 | +{% endif %} |
68 | 27 |
|
| 28 | +{% if item.new_channel %} |
| 29 | +<h3><a href="{{ item.channel_link | e }}" title="{{ item.channel_title | e }}">{{ item.channel_name }}</a></h3> |
| 30 | +{% endif %} |
69 | 31 |
|
70 | | -<TMPL_IF title> |
71 | | -<h4><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4> |
72 | | -</TMPL_IF> |
| 32 | +{% if item.title %} |
| 33 | +<h4><a href="{{ item.link | e }}">{{ item.title }}</a></h4> |
| 34 | +{% endif %} |
73 | 35 | <p> |
74 | | -<TMPL_VAR content> |
| 36 | +{{ item.content }} |
75 | 37 | </p> |
76 | 38 | <p> |
77 | | -<em><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_IF creator>by <TMPL_VAR creator> at </TMPL_IF><TMPL_VAR date></a></em> |
| 39 | +<em><a href="{{ item.link | e }}">{% if item.creator %}by {{ item.creator }} at {% endif %}{{ item.date }}</a></em> |
78 | 40 | </p> |
79 | | -</TMPL_LOOP> |
| 41 | +{% endfor %} |
80 | 42 |
|
81 | 43 | <hr> |
82 | 44 | <p> |
83 | 45 | <a href="http://www.planetplanet.org/">Powered by Planet!</a><br> |
84 | | -<em>Last updated: <TMPL_VAR date></em> |
| 46 | +<em>Last updated: {{ date }}</em> |
85 | 47 | </p> |
86 | 48 | </body> |
87 | 49 |
|
|
0 commit comments