Mobile theme

This commit is contained in:
Sam Ruby 2006-09-01 10:13:23 -04:00
parent 4b7891110f
commit 83a76b1022
6 changed files with 270 additions and 11 deletions

View File

@ -4,8 +4,11 @@ Installing Planet
You'll need at least Python 2.2 installed on your system, we recommend
Python 2.4 though as there may be bugs with the earlier libraries.
Everything Pythonesque Planet needs should be included in the
distribution.
Everything Pythonesque Planet need to provide basic operation should be
included in the distribution. Usage of XSLT requires either xsltproc
or python-libxslt. The current interface to filters written in
non-templating languages (e.g., python) uses the subprocess module
which was introduced in Python 2.4.
i.
First you'll need to extract the files into a folder somewhere.

View File

@ -1,15 +1,14 @@
# Planet configuration file
#
# This illustrates some of Planet's features with example.
# This illustrates some of Planet's fancier features with example.
# Every planet needs a [Planet] section
[Planet]
# name: Your planet's name
# link: Link to the main page
# owner_name: Your name
# owner_email: Your e-mail address
name = Top 100
name = OPML Top 100
link = http://planet.intertwingly.net/top100/
owner_name = Sam Ruby
owner_email = rubys@intertwingly.net
@ -17,16 +16,24 @@ owner_email = rubys@intertwingly.net
# cache_directory: Where cached feeds are stored
# log_level: One of DEBUG, INFO, WARNING, ERROR or CRITICAL
cache_directory = /home/rubys/planet/top100
log_level = DEBUG
log_level = INFO
# The following provide defaults for each template:
# output_theme: "theme" of the output
# output_dir: Directory to place output files
# items_per_page: How many items to put on each page
output_theme = asf
output_theme = mobile
output_dir = /home/rubys/public_html/top100
items_per_page = 60
activity_threshold = 90
# Reading lists, one per line, indented
reading_lists =
http://share.opml.org/opml/top100.opml
filters = excerpt.py
[excerpt.py]
omit = img p br
width = 500

View File

@ -132,6 +132,20 @@ h1 {
text-decoration: none !important;
}
/* ---------------------------- Footer --------------------------- */
#footer ul {
margin: 0 20px 0 -25px;
padding: 0;
}
#footer li {
margin: 0;
padding: 0;
list-style: none;
display: inline;
}
/* ----------------------------- Body ---------------------------- */
#body {

View File

@ -53,14 +53,31 @@
<dl>
<dt>Last updated:</dt>
<dd><span class="date" title="GMT"><xsl:value-of select="atom:updated/@planet:format"/></span></dd>
<dd>
<span class="date" title="GMT">
<xsl:value-of select="atom:updated/@planet:format"/>
</span>
</dd>
<dt>Powered by:</dt>
<dd><a href="http://intertwingly.net/code/venus/"><img src="images/planet.png" width="80" height="15" alt="Planet" border="0" /></a></dd>
<dd>
<a href="http://intertwingly.net/code/venus/">
<img src="images/planet.png" width="80" height="15"
alt="Planet" border="0"/>
</a>
</dd>
<dt>Export:</dt>
<dd>
<ul>
<li><a href="opml.xml"><img src="images/opml.png" alt="OPML" /></a></li>
<li><a href="foafroll.xml"><img src="images/foaf.png" alt="FOAF" /></a></li>
<li>
<a href="opml.xml">
<img src="images/opml.png" alt="OPML"/>
</a>
</li>
<li>
<a href="foafroll.xml">
<img src="images/foaf.png" alt="FOAF"/>
</a>
</li>
</ul>
</dd>
</dl>

22
themes/mobile/config.ini Normal file
View File

@ -0,0 +1,22 @@
# In addition to the outputs produced by the 'asf' theme, this one adds
# a 'mobile' version. For best results, this needs to be combined with
# the 'excerpt.py' filter.
[Planet]
template_files:
atom.xml.xslt
foafroll.xml.xslt
index.html.xslt
mobile.html.xslt
opml.xml.xslt
template_directories:
../asf
../common
bill_of_materials:
default.css
personalize.js
images/feed-icon-10x10.png
images/opml.png
images/foaf.png

View File

@ -0,0 +1,196 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:planet="http://planet.intertwingly.net/"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="atom:feed">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- head -->
<xsl:text>&#10;&#10;</xsl:text>
<head>
<link rel="stylesheet" href="default.css" type="text/css" />
<title><xsl:value-of select="atom:title"/></title>
<meta name="generator" content="{atom:generator}" />
<xsl:if test="atom:link[@rel='self']">
<link rel="alternate" href="{atom:link[@rel='self']/@uri}"
title="{atom:title}" type="{atom:link[@rel='self']/@type}" />
</xsl:if>
<link rel="shortcut icon" href="/favicon.ico" />
<script type="text/javascript" src="personalize.js"></script>
</head>
<xsl:text>&#10;&#10;</xsl:text>
<body>
<xsl:text>&#10;</xsl:text>
<h1><xsl:value-of select="atom:title"/></h1>
<xsl:text>&#10;&#10;</xsl:text>
<div id="body">
<xsl:apply-templates select="atom:entry"/>
<xsl:text>&#10;&#10;</xsl:text>
</div>
<xsl:text>&#10;&#10;</xsl:text>
<h1>Subscriptions</h1>
<xsl:text>&#10;</xsl:text>
<div id="sidebar">
<xsl:text>&#10;&#10;</xsl:text>
<h2>Info</h2>
<dl>
<dt>Last updated:</dt>
<dd>
<span class="date" title="GMT">
<xsl:value-of select="atom:updated/@planet:format"/>
</span>
</dd>
<dt>Powered by:</dt>
<dd>
<a href="http://intertwingly.net/code/venus/">
<img src="images/planet.png" width="80" height="15"
alt="Planet" border="0"/>
</a>
</dd>
<dt>Export:</dt>
<dd>
<ul>
<li>
<a href="opml.xml">
<img src="images/opml.png" alt="OPML"/>
</a>
</li>
<li>
<a href="foafroll.xml">
<img src="images/foaf.png" alt="FOAF"/>
</a>
</li>
</ul>
</dd>
</dl>
</div>
<xsl:text>&#10;</xsl:text>
<div id="footer">
<xsl:text>&#10;&#10;</xsl:text>
<xsl:text>&#10;</xsl:text>
<ul>
<xsl:for-each select="planet:source">
<xsl:sort select="planet:name"/>
<xsl:text>&#10;</xsl:text>
<li>
<a href="{atom:link[@rel='alternate']/@href}">
<xsl:value-of select="planet:name"/>
</a>
</li>
</xsl:for-each>
<xsl:text>&#10;</xsl:text>
</ul>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="atom:entry">
<!-- date header -->
<xsl:variable name="date" select="substring(atom:updated,1,10)"/>
<xsl:if test="not(preceding-sibling::atom:entry
[substring(atom:updated,1,10) = $date])">
<xsl:text>&#10;&#10;</xsl:text>
<h2 class="date">
<xsl:value-of select="substring-before(atom:updated/@planet:format,', ')"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="substring-before(substring-after(atom:updated/@planet:format,', '), ' ')"/>
</h2>
</xsl:if>
<xsl:text>&#10;&#10;</xsl:text>
<div class="news">
<xsl:if test="@xml:lang">
<xsl:attribute name="xml:lang">
<xsl:value-of select="@xml:lang"/>
</xsl:attribute>
</xsl:if>
<!-- entry title -->
<xsl:text>&#10;</xsl:text>
<h3>
<xsl:if test="atom:source/atom:icon">
<img src="{atom:source/atom:icon}" class="icon"/>
</xsl:if>
<a href="{atom:source/atom:link['alternate']/@href}" class="icon">
<xsl:attribute name="title" select="{atom:source/atom:title}"/>
<xsl:value-of select="atom:source/planet:name"/>
</a>
<xsl:if test="atom:title">
<xsl:text>&#x2014;</xsl:text>
<a href="{atom:link[@rel='alternate']/@href}">
<xsl:if test="atom:title/@xml:lang != @xml:lang">
<xsl:attribute name="xml:lang" select="{atom:title/@xml:lang}"/>
</xsl:if>
<xsl:value-of select="atom:title"/>
</a>
</xsl:if>
</h3>
<!-- entry content -->
<xsl:text>&#10;</xsl:text>
<xsl:apply-templates select="planet:excerpt"/>
<!-- entry footer -->
<xsl:text>&#10;</xsl:text>
<div class="permalink">
<a href="{atom:link[@rel='alternate']/@href}">
<xsl:choose>
<xsl:when test="atom:author/atom:name">
<xsl:text>by </xsl:text>
<xsl:value-of select="atom:author/atom:name"/>
<xsl:text> at </xsl:text>
</xsl:when>
<xsl:when test="atom:source/atom:author/atom:name">
<xsl:text>by </xsl:text>
<xsl:value-of select="atom:source/atom:author/atom:name"/>
<xsl:text> at </xsl:text>
</xsl:when>
</xsl:choose>
<span class="date" title="GMT">
<xsl:value-of select="atom:updated/@planet:format"/>
</span>
</a>
</div>
</div>
</xsl:template>
<!-- xhtml content -->
<xsl:template match="planet:excerpt/xhtml:div">
<xsl:copy>
<xsl:if test="../@xml:lang and not(../@xml:lang = ../../@xml:lang)">
<xsl:attribute name="xml:lang">
<xsl:value-of select="../@xml:lang"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="class">content</xsl:attribute>
<xsl:copy-of select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- plain text content -->
<xsl:template match="planet:excerpt/text()">
<div class="content" xmlns="http://www.w3.org/1999/xhtml">
<xsl:if test="../@xml:lang and not(../@xml:lang = ../../@xml:lang)">
<xsl:attribute name="xml:lang">
<xsl:value-of select="../@xml:lang"/>
</xsl:attribute>
</xsl:if>
<xsl:copy-of select="."/>
</div>
</xsl:template>
</xsl:stylesheet>