Skip to content

Commit

Permalink
planet
Browse files Browse the repository at this point in the history
  • Loading branch information
garbas committed Apr 4, 2020
1 parent 8207cb3 commit f658919
Show file tree
Hide file tree
Showing 26 changed files with 825 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/cron.yml
Expand Up @@ -16,6 +16,8 @@ jobs:
run: ./update.sh
- name: Building nixos.org
run: nix-build && mkdir build && cp -RL ./result/* ./build/
- name: Building nixos.org/planet
run: nix-shell --command "venus-planet planet.ini"
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.0.5
env:
Expand All @@ -26,4 +28,3 @@ jobs:
production-branch: 'master'
deploy-message: 'Deploy from GitHub Actions'
if: github.repository == 'NixOS/nixos-homepage'

2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -18,6 +18,8 @@ jobs:
run: ./update.sh
- name: Building nixos.org
run: nix-build && mkdir build && cp -RL ./result/* ./build/
- name: Building nixos.org/planet
run: nix-shell --command "venus-planet planet.ini"
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.0.5
env:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -16,5 +16,7 @@
/favicon.png
/news-rss.xml
/nixos-release.tt
/planet/
/planet-cache/

/result*
1 change: 1 addition & 0 deletions flake.nix
Expand Up @@ -56,6 +56,7 @@
jq
python3
entr
venus
];

preBuild = ''
Expand Down
41 changes: 41 additions & 0 deletions planet-theme/admin.html.tmpl
@@ -0,0 +1,41 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><TMPL_VAR name> administration</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="generator" content="<TMPL_VAR generator ESCAPE="HTML">">
</head>

<body>
<h2>Maintenance tasks</h2>
<form action="admin_cb.py" method="GET">
<input type="hidden" name="command" value="refresh" />
<input type="submit" value="Refresh planet" />
</form><br />
<form action="admin_cb.py" method="GET">
<input type="hidden" name="command" value="run" />
<input type="submit" value="Run planet" />
</form><br />
<form action="admin_cb.py" method="GET">
<input type="hidden" name="command" value="expunge" />
<input type="submit" value="Expunge planet" />
</form>

<h2>Blacklist</h2>
<div>
<form action="admin_cb.py" method="GET">
<input type="hidden" name="command" value="blacklist" />
<TMPL_LOOP Items>
<input type="checkbox" value="<TMPL_VAR id ESCAPE="HTML">" name="bl<TMPL_VAR __PASS__>">
<a target="_blank" href="<TMPL_VAR channel_link ESCAPE="HTML">">
<TMPL_VAR channel_name>
</a>: <a target="_blank" href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></input>
<br />
</TMPL_LOOP>
<br />
<input type="submit" value="Blacklist" />
</form>
</div>
</body>

</html>
80 changes: 80 additions & 0 deletions planet-theme/atom.xml.xslt
@@ -0,0 +1,80 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:access="http://www.bloglines.com/about/specs/fac-1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:indexing="urn:atom-extension:indexing"
xmlns:planet="http://planet.intertwingly.net/"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="planet xhtml">

<!-- strip planet elements and attributes -->
<xsl:template match="planet:*|@planet:*"/>

<!-- strip obsolete link relationships -->
<xsl:template match="atom:link[@rel='service.edit']"/>
<xsl:template match="atom:link[@rel='service.post']"/>
<xsl:template match="atom:link[@rel='service.feed']"/>

<!-- Feedburner detritus -->
<xsl:template match="xhtml:div[@class='feedflare']"/>

<!-- Strip site meter -->
<xsl:template match="xhtml:div[comment()[. = ' Site Meter ']]"/>

<!-- add Google/LiveJournal-esque and Bloglines noindex directive -->
<xsl:template match="atom:feed">
<xsl:copy>
<xsl:attribute name="indexing:index">no</xsl:attribute>
<xsl:apply-templates select="@*"/>
<access:restriction relationship="deny"/>
<xsl:apply-templates select="node()"/>
<xsl:text>&#10;</xsl:text>
</xsl:copy>
</xsl:template>

<!-- popular customization: add planet name to each entry title
<xsl:template match="atom:entry/atom:title">
<xsl:text>&#10; </xsl:text>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:value-of select="../atom:source/planet:name"/>
<xsl:text>: </xsl:text>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
-->

<!-- indent atom elements -->
<xsl:template match="atom:*">
<!-- double space before atom:entries -->
<xsl:if test="self::atom:entry">
<xsl:text>&#10;</xsl:text>
</xsl:if>

<!-- indent start tag -->
<xsl:text>&#10;</xsl:text>
<xsl:for-each select="ancestor::*">
<xsl:text> </xsl:text>
</xsl:for-each>

<xsl:copy>
<xsl:apply-templates select="@*|node()"/>

<!-- indent end tag if there are element children -->
<xsl:if test="*">
<xsl:text>&#10;</xsl:text>
<xsl:for-each select="ancestor::*">
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:if>
</xsl:copy>
</xsl:template>

<!-- pass through everything else -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
16 changes: 16 additions & 0 deletions planet-theme/config.ini
@@ -0,0 +1,16 @@
# This theme reimplements the classic "fancy" htmltmpl using genshi

[Planet]
template_files:
atom.xml.xslt
foafroll.xml.xslt
index.html.tmpl
opml.xml.xslt
rss10.xml.tmpl
rss20.xml.tmpl

bill_of_materials:
planet.css
images/feed-icon-10x10.png
images/logo.png
images/planet.png
39 changes: 39 additions & 0 deletions planet-theme/foafroll.xml.xslt
@@ -0,0 +1,39 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rss="http://purl.org/rss/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:planet="http://planet.intertwingly.net/"
exclude-result-prefixes="atom planet">

<xsl:output indent="yes" method="xml"/>

<xsl:template match="atom:feed">
<rdf:RDF>
<foaf:Group>
<foaf:name><xsl:value-of select="atom:author/atom:name"/></foaf:name>
<foaf:homepage><xsl:value-of select="atom:author/atom:uri"/></foaf:homepage>

<xsl:apply-templates select="planet:source"/>
</foaf:Group>
</rdf:RDF>
</xsl:template>

<xsl:template match="planet:source">
<foaf:member>
<foaf:Agent>
<foaf:name><xsl:value-of select="planet:name"/></foaf:name>
<foaf:weblog>
<foaf:Document rdf:about="{atom:link[@rel='alternate']/@href}">
<dc:title><xsl:value-of select="atom:title"/></dc:title>
<rdfs:seeAlso>
<rss:channel rdf:about="{atom:link[@rel='self']/@href}" />
</rdfs:seeAlso>
</foaf:Document>
</foaf:weblog>
</foaf:Agent>
</foaf:member>
</xsl:template>
</xsl:stylesheet>
Binary file added planet-theme/images/feed-icon-10x10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added planet-theme/images/foaf.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added planet-theme/images/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added planet-theme/images/opml.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added planet-theme/images/planet.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added planet-theme/images/tcosm11.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added planet-theme/images/venus.ico
Binary file not shown.
Binary file added planet-theme/images/venus.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
126 changes: 126 additions & 0 deletions planet-theme/index.html.tmpl
@@ -0,0 +1,126 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

### Fancy Planet HTML template.
###
### When combined with the stylesheet and images in the output/ directory
### of the Planet source, this gives you a much prettier result than the
### default examples template and demonstrates how to use the config file
### to support things like faces
###
### For documentation on the more boring template elements, see
### examples/config.ini and examples/index.html.tmpl in the Planet source.

<head>
<title><TMPL_VAR name></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="generator" content="<TMPL_VAR generator ESCAPE="HTML">">
<link rel="stylesheet" href="planet.css" type="text/css">
<TMPL_IF feedtype>
<link rel="alternate" href="<TMPL_VAR feed ESCAPE="HTML">" title="<TMPL_VAR channel_title_plain ESCAPE="HTML">" type="application/<TMPL_VAR feedtype>+xml">
</TMPL_IF>
</head>

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

<TMPL_LOOP Items>
<TMPL_IF new_date>
<TMPL_UNLESS __FIRST__>
### End <div class="channelgroup">
</div>
### End <div class="daygroup">
</div>
</TMPL_UNLESS>
<div class="daygroup">
<h2><TMPL_VAR new_date></h2>
</TMPL_IF>

<TMPL_IF new_channel>
<TMPL_UNLESS new_date>
### End <div class="channelgroup">
</div>
</TMPL_UNLESS>
<div class="channelgroup">

### Planet provides template variables for *all* configuration options for
### the channel (and defaults), even if it doesn't know about them. We
### exploit this here to add hackergotchi faces to our channels. Planet
### doesn't know about the "face", "facewidth" and "faceheight" configuration
### variables, but makes them available to us anyway.

<h3><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title_plain ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3>
<TMPL_IF channel_face>
<img class="face" src="images/<TMPL_VAR channel_face ESCAPE="HTML">" width="<TMPL_VAR channel_facewidth ESCAPE="HTML">" height="<TMPL_VAR channel_faceheight ESCAPE="HTML">" alt="">
</TMPL_IF>
</TMPL_IF>


<div class="entrygroup" id="<TMPL_VAR id>"<TMPL_IF channel_language> lang="<TMPL_VAR channel_language>"</TMPL_IF>>
<TMPL_IF title>
<h4<TMPL_IF title_language> lang="<TMPL_VAR title_language>"</TMPL_IF>><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4>
</TMPL_IF>
<div class="entry">
<div class="content"<TMPL_IF content_language> lang="<TMPL_VAR content_language>"</TMPL_IF>>
<TMPL_VAR content>
</div>

### Planet also makes available all of the information from the feed
### that it can. Use the 'planet-cache' tool on the cache file for
### a particular feed to find out what additional keys it supports.
### Comment extra fields are 'author' and 'category' which we
### demonstrate below.

<p class="date">
<a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_IF author>by <TMPL_VAR author ESCAPE="HTML"> at </TMPL_IF><TMPL_VAR date><TMPL_IF category> under <TMPL_VAR category></TMPL_IF></a>
</p>
</div>
</div>

<TMPL_IF __LAST__>
### End <div class="channelgroup">
</div>
### End <div class="daygroup">
</div>
</TMPL_IF>
</TMPL_LOOP>


<div class="sidebar">
<img src="images/logo.png" width="136" height="136" alt="">

<h2>Subscriptions</h2>
<ul>
<TMPL_LOOP Channels>
<li>
<a href="<TMPL_VAR url ESCAPE="HTML">" title="subscribe"><img src="images/feed-icon-10x10.png" alt="(feed)"></a> <a <TMPL_IF link>href="<TMPL_VAR link ESCAPE="HTML">" </TMPL_IF><TMPL_IF message>class="message" title="<TMPL_VAR message ESCAPE="HTML">"</TMPL_IF><TMPL_UNLESS message>title="<TMPL_VAR title_plain ESCAPE="HTML">"</TMPL_UNLESS>><TMPL_VAR name></a>
</li>
</TMPL_LOOP>
</ul>

<p>
<strong>Last updated:</strong><br>
<TMPL_VAR date><br>
<em>All times are UTC.</em><br>
<br>
Powered by:<br>
<a href="http://www.planetplanet.org/"><img src="images/planet.png" width="80" height="15" alt="Planet" border="0"></a>
</p>

<p>
<h2>Planetarium:</h2>
<ul>
<li><a href="http://www.planetapache.org/">Planet Apache</a></li>
<li><a href="http://planet.freedesktop.org/">Planet freedesktop.org</a></li>
<li><a href="http://planet.gnome.org/">Planet GNOME</a></li>
<li><a href="http://planet.debian.net/">Planet Debian</a></li>
<li><a href="http://planet.fedoraproject.org/">Planet Fedora</a></li>
<li><a href="http://planets.sun.com/">Planet Sun</a></li>
<li><a href="http://www.planetplanet.org/">more...</a></li>
</ul>
</p>
</div>
</body>

</html>
Binary file added planet-theme/index.html.tmplc
Binary file not shown.
40 changes: 40 additions & 0 deletions planet-theme/opml.xml.xslt
@@ -0,0 +1,40 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:planet="http://planet.intertwingly.net/"
exclude-result-prefixes="atom planet">

<xsl:output indent="yes" method="xml"/>

<xsl:template name="rfc822" xmlns:date="http://exslt.org/dates-and-times">
<xsl:param name="date"/>
<!-- http://www.trachtenberg.com/blog/2005/03/03/xslt-cookbook-generating-an-rfc-822-date/ -->
<xsl:value-of select="concat(date:day-abbreviation($date), ', ',
format-number(date:day-in-month($date), '00'), ' ',
date:month-abbreviation($date), ' ', date:year($date), ' ',
format-number(date:hour-in-day($date), '00'), ':',
format-number(date:minute-in-hour($date), '00'), ':',
format-number(date:second-in-minute($date), '00'), ' GMT')"/>
</xsl:template>

<xsl:template match="atom:feed">
<opml version="1.1">
<head>
<title><xsl:value-of select="atom:title"/></title>
<dateModified>
<xsl:call-template name="rfc822">
<xsl:with-param name="date" select="atom:updated"/>
</xsl:call-template>
</dateModified>
<ownerName><xsl:value-of select="atom:author/atom:name"/></ownerName>
<ownerEmail><xsl:value-of select="atom:author/atom:email"/></ownerEmail>
</head>

<body>
<xsl:for-each select="planet:source">
<outline type="rss" text="{planet:name}" title="{atom:title}"
xmlUrl="{atom:link[@rel='self']/@href}"/>
</xsl:for-each>
</body>
</opml>
</xsl:template>
</xsl:stylesheet>

0 comments on commit f658919

Please sign in to comment.