move local styling to plugin, so we don't override other layout.html files

This commit is contained in:
Seb Bacon 2011-04-07 09:18:35 +01:00
parent 04ea42339a
commit 8dfa04434f
2 changed files with 10 additions and 19 deletions

View File

@ -70,6 +70,13 @@ class GoogleAnalyticsPlugin(SingletonPlugin):
pos) pos)
yield mark, (kind, data, pos) yield mark, (kind, data, pos)
# and some styling
download_style = '''<style type="text/css">
span.downloads-count {
font-size: 75%;
}
</style>'''
# perform the stream transform # perform the stream transform
stream = stream | Transformer( stream = stream | Transformer(
'//div[@id="package"]//td/a')\ '//div[@id="package"]//td/a')\
@ -78,6 +85,9 @@ class GoogleAnalyticsPlugin(SingletonPlugin):
stream = stream | Transformer( stream = stream | Transformer(
'//div[@id="package"]//td/a')\ '//div[@id="package"]//td/a')\
.apply(download_adder) .apply(download_adder)
stream = stream | Transformer(
'//link[@rel="stylesheet"]')\
.append(HTML(download_style))
return stream return stream
def after_map(self, map): def after_map(self, map):

View File

@ -1,19 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:doap="http://usefulinc.com/ns/doap"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
py:strip=""
>
<py:match path="//link[@rel='stylesheet']">
${select('.*')}
<style type="text/css">
span.downloads-count {
font-size: 75%;
}
</style>
</py:match>
<xi:include href="layout_base.html" />
</html>