Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9979bc6
feat: initial py2 to 3 work
JacobCoffee Jul 22, 2024
bc58d1c
feat: upgrade sanitze,feedparser
JacobCoffee Jul 22, 2024
7d43518
style(optional): apply basic ruff linting and formatting
JacobCoffee Jul 22, 2024
46dfdf0
feat: pyupgrade against latest
JacobCoffee Jul 22, 2024
d03851f
style(optional): apply ruff against latest
JacobCoffee Jul 22, 2024
a8484cf
style(optional): apply ruff against latest
JacobCoffee Jul 22, 2024
7e5539e
feat: upgrade docker config
JacobCoffee Jul 31, 2024
d0a199e
feat: working-ish app
JacobCoffee Jul 31, 2024
ada79c1
push along
ewdurbin Aug 7, 2024
4be16d9
explicitly check for times when setting to CachedInfo
ewdurbin Aug 8, 2024
cddaff0
Drop the vendored dependencies
offbyone Oct 5, 2024
b023876
Move the top level project into the root
offbyone Oct 6, 2024
44a8595
Convert the test templates to jinja2
offbyone Oct 6, 2024
a1b9e4e
Make the test config use relative paths
offbyone Oct 6, 2024
29e2ea5
Delete replaceable dependencies
offbyone Oct 6, 2024
86e31f9
WIP: upgrade to 3 in truth
offbyone Oct 6, 2024
7419397
Convert the main templates to jinja2
offbyone Oct 6, 2024
4579636
Correctly identify cache keys from the current item
offbyone Oct 6, 2024
1241a86
Various small fixes for 2 to 3
offbyone Oct 7, 2024
aedc01f
Merge remote-tracking branch 'upstream/master' into py2-to-3
offbyone Oct 7, 2024
0998580
Actually add some minimal tests
offbyone Oct 9, 2024
89f8fc5
Update the planet-cache.py admin utility
offbyone Oct 10, 2024
aa13325
Work around a DB consistency bug on macOS
offbyone Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Convert the test templates to jinja2
  • Loading branch information
offbyone committed Oct 6, 2024
commit 44a8595a76c25789da7989476e68ad736f882e91
18 changes: 9 additions & 9 deletions code/python/foafroll.xml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@
xmlns:dc="http://purl.org/dc/elements/1.1/"
>
<foaf:Group>
<foaf:name><TMPL_VAR name></foaf:name>
<foaf:homepage><TMPL_VAR link ESCAPE="HTML"></foaf:homepage>
<rdfs:seeAlso rdf:resource="<TMPL_VAR uri ESCAPE="HTML">" />
<foaf:name>{{ name }}</foaf:name>
<foaf:homepage>{{ link | e }}</foaf:homepage>
<rdfs:seeAlso rdf:resource="{{ uri | e }}" />

<TMPL_LOOP Channels>
{% for channel in Channels %}
<foaf:member>
<foaf:Agent>
<foaf:name><TMPL_VAR name></foaf:name>
<foaf:name>{{ channel.name }}</foaf:name>
<foaf:weblog>
<foaf:Document rdf:about="<TMPL_VAR link ESCAPE="HTML">">
<dc:title><TMPL_VAR title></dc:title>
<foaf:Document rdf:about="{{ channel.link | e }}">
<dc:title>{{ channel.title }}</dc:title>
<rdfs:seeAlso>
<rss:channel rdf:about="<TMPL_VAR uri ESCAPE="HTML">" />
<rss:channel rdf:about="{{ channel.uri | e }}" />
</rdfs:seeAlso>
</foaf:Document>
</foaf:weblog>
</foaf:Agent>
</foaf:member>
</TMPL_LOOP>
{% endfor %}

</foaf:Group>
</rdf:RDF>
78 changes: 20 additions & 58 deletions code/python/index.html.tmpl
Original file line number Diff line number Diff line change
@@ -1,87 +1,49 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

### Planet HTML template.
###
### This is intended to demonstrate and document Planet's templating
### facilities, and at the same time provide a good base for you to
### modify into your own design.
###
### The output's a bit boring though, if you're after less documentation
### and more instant gratification, there's an example with a much
### prettier output in the fancy-examples/ directory of the Planet source.

### Lines like this are comments, and are automatically removed by the
### templating engine before processing.


### Planet makes a large number of variables available for your templates.
### See INSTALL for the complete list. The raw value can be placed in your
### output file using <TMPL_VAR varname>. We'll put the name of our
### Planet in the page title and again in an h1.

<head>
<title><TMPL_VAR name></title>
<title>{{ name }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="generator" content="<TMPL_VAR generator>">
<meta name="generator" content="{{ generator }}">
</head>

<body>
<h1><TMPL_VAR name></h1>

### One of the two loops available is the Channels loop. This allows you
### to easily create a list of subscriptions, which is exactly what we'll do
### here.

### Note that we can also expand variables inside HTML tags, but we need
### to be cautious and HTML-escape any illegal characters using the form
### <TMPL_VAR varname ESCAPE="HTML">
<h1>{{ name }}</h1>

<div style="float: right">
<h2>Subscriptions</h2>
<ul>
<TMPL_LOOP Channels>
<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>
</TMPL_LOOP>
{% for channel in Channels %}
<li><a href="{{ channel.link | e }}" title="{{ channel.title | e }}">{{ channel.name }}</a> <a href="{{ channel.uri | e }}">(feed)</a></li>
{% endfor %}
</ul>
</div>

### The other loop is the Items loop, which will get iterated for each
### news item.

<TMPL_LOOP Items>

### Visually distinguish articles from different days by checking for
### the new_date flag. This demonstrates the <TMPL_IF varname> ... </TMPL_IF>
### check.

<TMPL_IF new_date>
<h2><TMPL_VAR new_date></h2>
</TMPL_IF>

### Group consecutive articles by the same author together by checking
### for the new_channel flag.
{% for item in Items %}

<TMPL_IF new_channel>
<h3><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3>
</TMPL_IF>
{% if item.new_date %}
<h2>{{ item.new_date }}</h2>
{% endif %}

{% if item.new_channel %}
<h3><a href="{{ item.channel_link | e }}" title="{{ item.channel_title | e }}">{{ item.channel_name }}</a></h3>
{% endif %}

<TMPL_IF title>
<h4><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4>
</TMPL_IF>
{% if item.title %}
<h4><a href="{{ item.link | e }}">{{ item.title }}</a></h4>
{% endif %}
<p>
<TMPL_VAR content>
{{ item.content }}
</p>
<p>
<em><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_IF creator>by <TMPL_VAR creator> at </TMPL_IF><TMPL_VAR date></a></em>
<em><a href="{{ item.link | e }}">{% if item.creator %}by {{ item.creator }} at {% endif %}{{ item.date }}</a></em>
</p>
</TMPL_LOOP>
{% endfor %}

<hr>
<p>
<a href="http://www.planetplanet.org/">Powered by Planet!</a><br>
<em>Last updated: <TMPL_VAR date></em>
<em>Last updated: {{ date }}</em>
</p>
</body>

Expand Down
18 changes: 9 additions & 9 deletions code/python/opml.xml.tmpl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0"?>
<opml version="1.1">
<head>
<title><TMPL_VAR name></title>
<dateCreated><TMPL_VAR date_822></dateCreated>
<dateModified><TMPL_VAR date_822></dateModified>
<ownerName><TMPL_VAR owner_name></ownerName>
<ownerEmail><TMPL_VAR owner_email></ownerEmail>
<title>{{ name }}</title>
<dateCreated>{{ date_822 }}</dateCreated>
<dateModified>{{ date_822 }}</dateModified>
<ownerName>{{ owner_name }}</ownerName>
<ownerEmail>{{ owner_email }}</ownerEmail>
</head>

<body>
<TMPL_LOOP Channels>
<outline text="<TMPL_VAR name ESCAPE="HTML">" xmlUrl="<TMPL_VAR uri ESCAPE="HTML">"/>
</TMPL_LOOP>
{% for channel in Channels %}
<outline text="{{ channel.name | e }}" xmlUrl="{{ channel.uri | e }}"/>
{% endfor %}
</body>
</opml>
38 changes: 19 additions & 19 deletions code/python/rss10.xml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns="http://purl.org/rss/1.0/"
>
<channel rdf:about="<TMPL_VAR link ESCAPE="HTML">">
<title><TMPL_VAR name></title>
<link><TMPL_VAR link ESCAPE="HTML"></link>
<description><TMPL_VAR name> - <TMPL_VAR link ESCAPE="HTML"></description>
<channel rdf:about="{{ link | e }}">
<title>{{ name }}</title>
<link>{{ link | e }}</link>
<description>{{ name }} - {{ link | e }}</description>

<items>
<rdf:Seq>
<TMPL_LOOP Items>
<rdf:li rdf:resource="<TMPL_VAR id ESCAPE="HTML">" />
</TMPL_LOOP>
{% for item in Items %}
<rdf:li rdf:resource="{{ item.id | e }}" />
{% endfor %}
</rdf:Seq>
</items>
</channel>

<TMPL_LOOP Items>
<item rdf:about="<TMPL_VAR id ESCAPE="HTML">">
<title><TMPL_VAR channel_name><TMPL_IF title>: <TMPL_VAR title></TMPL_IF></title>
<link><TMPL_VAR link ESCAPE="HTML"></link>
<TMPL_IF content>
<content:encoded><TMPL_VAR content ESCAPE="HTML"></content:encoded>
</TMPL_IF>
<dc:date><TMPL_VAR date_iso></dc:date>
<TMPL_IF creator>
<dc:creator><TMPL_VAR creator></dc:creator>
</TMPL_IF>
{% for item in Items %}
<item rdf:about="{{ item.id | e }}">
<title>{{ item.channel_name }}{% if item.title %}: {{ item.title }}{% endif %}</title>
<link>{{ item.link | e }}</link>
{% if item.content %}
<content:encoded>{{ item.content | e }}</content:encoded>
{% endif %}
<dc:date>{{ item.date_iso }}</dc:date>
{% if item.creator %}
<dc:creator>{{ item.creator }}</dc:creator>
{% endif %}
</item>
</TMPL_LOOP>
{% endfor %}

</rdf:RDF>
34 changes: 17 additions & 17 deletions code/python/rss20.xml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">

<channel>
<title><TMPL_VAR name></title>
<link><TMPL_VAR link ESCAPE="HTML"></link>
<title>{{ name }}</title>
<link>{{ link | e }}</link>
<language>en</language>
<description><TMPL_VAR name> - <TMPL_VAR link ESCAPE="HTML"></description>
<description>{{ name }} - {{ link | e }}</description>

<TMPL_LOOP Items>
<item>
<title><TMPL_VAR channel_name><TMPL_IF title>: <TMPL_VAR title></TMPL_IF></title>
<guid><TMPL_VAR id ESCAPE="HTML"></guid>
<link><TMPL_VAR link ESCAPE="HTML"></link>
<TMPL_IF content>
<description><TMPL_VAR content ESCAPE="HTML"></description>
</TMPL_IF>
<pubDate><TMPL_VAR date_822></pubDate>
<TMPL_IF creator>
<dc:creator><TMPL_VAR creator></dc:creator>
</TMPL_IF>
</item>
</TMPL_LOOP>
{% for item in Items %}
<item>
<title>{{ item.channel_name }}{% if item.title %}: {{ item.title }}{% endif %}</title>
<guid>{{ item.id | e }}</guid>
<link>{{ item.link | e }}</link>
{% if item.content %}
<description>{{ item.content | e }}</description>
{% endif %}
<pubDate>{{ item.date_822 }}</pubDate>
{% if item.creator %}
<dc:creator>{{ item.creator }}</dc:creator>
{% endif %}
</item>
{% endfor %}

</channel>
</rss>