added cc license information (rdf) to footer

templatewriter rewritten
rss feed of trac integrated
This commit is contained in:
lars 2007-01-04 18:24:26 +00:00
parent fde9fb5996
commit bbe38e4649
12 changed files with 310 additions and 59 deletions

View file

@ -1,7 +1,3 @@
<!-- RFC: what about putting the latest svn commit logs here?
all the other stuff is redundant [l] -->
<div class="left">
<div class="leftcontent">
<h2>Screenshots</h2>
@ -16,12 +12,8 @@
</div>
<div class="leftcontent">
<p>&nbsp;</p>
</div>
<div class="leftcontent">
<h2>foo bar</h2>
<p>today is the day</p>
<h2>Recent changes</h2>
%(rss_content)s
</div>
</div>

View file

@ -56,7 +56,33 @@
</div>
</div>
<!-- /Creative Commons License -->
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/de/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/de/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<requires rdf:resource="http://web.resource.org/cc/Attribution" />
<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
</License>
</rdf:RDF>
-->
</body>
</html>

View file

@ -110,7 +110,33 @@
</div>
</div>
<!-- /Creative Commons License -->
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/de/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/de/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<requires rdf:resource="http://web.resource.org/cc/Attribution" />
<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
</License>
</rdf:RDF>
-->
</body>
</html>

View file

@ -100,7 +100,33 @@
</div>
</div>
<!-- /Creative Commons License -->
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/de/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/de/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<requires rdf:resource="http://web.resource.org/cc/Attribution" />
<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
</License>
</rdf:RDF>
-->
</body>
</html>

View file

@ -108,7 +108,33 @@
</div>
</div>
<!-- /Creative Commons License -->
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/de/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/de/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<requires rdf:resource="http://web.resource.org/cc/Attribution" />
<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
</License>
</rdf:RDF>
-->
</body>
</html>

View file

@ -1,5 +1,5 @@
<!-- $header$ -->
<!-- $nav$ -->
<!-- $entries$ -->
<!-- $footer$ -->
%(header)s
%(nav)s
%(entries)s
%(footer)s

View file

@ -196,3 +196,28 @@ ol.toc li {
ol.toc a {
text-decoration: none;
}
/* recent changes (rss feed) */
ul.recent_changes {
padding-left: 0;
list-style-type: none;
}
ul.recent_changes li {
}
ul.recent_changes li h3 {
font-size: 0.9em;
margin: 2px;
text-decoration: none;
}
ul.recent_changes li h3 a {
text-decoration: none;
}
ul.recent_changes li p.date {
padding: 2px 2px 0 2px;
font-size: 0.8em;
}

View file

@ -43,10 +43,6 @@
<p>Any Questions? Mail to <i>info(at)cryptobox.org</i>!</p>
</div>
<!-- RFC: what about putting the latest svn commit logs here?
all the other stuff is redundant [l] -->
<div class="left">
<div class="leftcontent">
<h2>Screenshots</h2>
@ -61,12 +57,25 @@
</div>
<div class="leftcontent">
<p>&nbsp;</p>
</div>
<h2>Recent changes</h2>
<ul class="recent_changes">
<li><p class="date">Thu, 04 Jan 2007 14:28:24 GMT</p><h3><a href="http://devel.cryptobox.org/changeset/655">Changeset [655] by phil</a></h3><p>
Minor stylish changes to the website
</p></li>
<li><p class="date">Thu, 04 Jan 2007 03:05:24 GMT</p><h3><a href="http://devel.cryptobox.org/changeset/654">Changeset [654] by lars</a></h3><p>
remove obsolete live-cd files
</p></li>
<li><p class="date">Thu, 04 Jan 2007 01:19:55 GMT</p><h3><a href="http://devel.cryptobox.org/ticket/109">Ticket #109 resolved: server configuration changed yesterday</a></h3><p>
server configuration changed yesterday
</p></li>
<li><p class="date">Thu, 04 Jan 2007 01:19:10 GMT</p><h3><a href="http://devel.cryptobox.org/ticket/107">Ticket #107 resolved: done in [506]</a></h3><p>
done in [<a title="cleaned up all languages ..." href="http://devel.cryptobox.org/changeset/506">506</a>]
</p></li>
<li><p class="date">Wed, 03 Jan 2007 15:10:41 GMT</p><h3><a href="http://devel.cryptobox.org/changeset/653">Changeset [653] by lars</a></h3><p>
added patch for custom preparation/cleanup scripts for dfsbuild
installation of samba package works now
</p></li></ul>
<div class="leftcontent">
<h2>foo bar</h2>
<p>today is the day</p>
</div>
</div>
@ -128,7 +137,33 @@
</div>
</div>
<!-- /Creative Commons License -->
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/de/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/de/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<requires rdf:resource="http://web.resource.org/cc/Attribution" />
<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
</License>
</rdf:RDF>
-->
</body>
</html>

View file

@ -5,5 +5,31 @@
</div>
</div>
<!-- /Creative Commons License -->
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/de/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/de/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<requires rdf:resource="http://web.resource.org/cc/Attribution" />
<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
</License>
</rdf:RDF>
-->
</body>
</html>

View file

@ -113,7 +113,33 @@
</div>
</div>
<!-- /Creative Commons License -->
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/de/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/de/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<requires rdf:resource="http://web.resource.org/cc/Attribution" />
<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
</License>
</rdf:RDF>
-->
</body>
</html>

View file

@ -60,7 +60,33 @@
</div>
</div>
<!-- /Creative Commons License -->
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/de/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/de/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<requires rdf:resource="http://web.resource.org/cc/Attribution" />
<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
</License>
</rdf:RDF>
-->
</body>
</html>

View file

@ -1,19 +1,29 @@
#!/usr/bin/env python
import os, re
try:
import feedparser
except ImportError:
sys.stderr.write("Could not load python module 'feedparser'!\n")
sys.stderr.write("Maybe you should run 'apt-get install python-feedparser.\n")
sys.exit(1)
class TemplateWriter:
templatefile = "gerippe.tmpl"
templatefile = "./gerippe.tmpl"
tmpldir = "./placeholder"
contentdir = "./content"
tmplfileext = ".tmpl"
outfileext = ".html"
max_rss_items = 5
## regular expressions of not-wanted file/directory names
## for now: no svn, no vi-swap files, no backup files
ignore_items = [ r'\.svn', r'\.swp$', r'~$' ]
def __init__(self):
pass
self.placeholder = self.__get_placeholder_dict()
self.template = open(self.templatefile).read()
def get_sorted(self, flist):
@ -35,52 +45,59 @@ class TemplateWriter:
return result
def string_replace(self, infile, outfile):
template = open(infile).read()
open(outfile, "w").write(template)
text = {}
def __get_placeholder_dict(self):
"""returns the common dictionary for all files - except for the 'entries'
"""
placeholder = {}
for tmpl in self.get_sorted(self.get_filtered(os.listdir(self.tmpldir))):
tmplfile = str(os.path.join(self.tmpldir, tmpl))
tmplfile = os.path.join(self.tmpldir, tmpl)
if not os.path.isfile(tmplfile):
print " str.repl: cancelling %s - not a file" % tmplfile
else:
template = open(outfile).read()
print " str.repl: using %s" % tmplfile
newcontent = open(tmplfile).read()
text[tmpl] = template.replace("<!-- $%s$ -->" % tmpl, newcontent)
open(outfile, "w").write(text[tmpl])
return
placeholder[tmpl] = file(tmplfile).read()
placeholder["rss_content"] = self.get_rss_info()
return placeholder
def build_sites(self):
'''use all files ending with .tmpl'''
for tmplfile in self.get_sorted(self.get_filtered(os.listdir("./"))):
if tmplfile.rfind(self.tmplfileext) >= 1:
infile = tmplfile
(tmplfilename, tmplfileext)=os.path.splitext(tmplfile)
outfile = tmplfilename + self.outfileext
print "building: %s -> %s" % (tmplfile, outfile)
self.string_replace(infile, outfile)
return
def get_entries(self, html_name):
"""reads all files in the given directory sorted into a string
"""
entries = ""
for entry in self.get_sorted(self.get_filtered(os.listdir(
os.path.join(self.contentdir, html_name)))):
entries += file(os.path.join(self.contentdir, html_name, entry)).read()
return entries
def build_sites_from_gerippe(self):
print "Let's build some html files from: %s" % self.templatefile
for html in self.get_sorted(self.get_filtered(os.listdir(self.contentdir))):
print " building: %s%s" % (html, self.outfileext)
entries = ""
for entry in self.get_sorted(self.get_filtered(os.listdir(os.path.join(self.contentdir, html)))):
print " adding entry: %s " % entry
entries += open(os.path.join(self.contentdir, html, entry)).read()
template = open(self.templatefile).read()
text = template.replace("<!-- $entries$ -->", entries)
infile = html+".tmp"
open(infile,"w").write(text)
outfile = html+self.outfileext
self.string_replace(infile, outfile)
os.unlink(infile)
self.placeholder["entries"] = self.get_entries(html)
## start with the content of the template
text = self.template
## repeat substitution for five times - for recursive stuff
text = text % self.placeholder
text = text % self.placeholder
text = text % self.placeholder
text = text % self.placeholder
text = text % self.placeholder
## write the result
outfile = open(html + self.outfileext, "w")
outfile.write(text)
outfile.close()
return
def get_rss_info(self):
"""retrieve rss feed from http://devel.cryptobox.org/timeline"""
timeline_url = r'http://devel.cryptobox.org/timeline?max=%d&wiki=off&ticket=on&changeset=on&milestone=off&format=rss' % self.max_rss_items
entry_html = r'<li><p class="date">%(updated)s</p><h3><a href="%(link)s">%(title)s</a></h3>%(summary)s</li>'
feed = feedparser.parse(timeline_url)
if feed["entries"]:
html_items = [ entry_html % e for e in feed["entries"] ]
return '<ul class="recent_changes">\n' + '\n'.join(html_items) + '</ul>\n'
else:
return '<p>The latest development changes are temporarily unavailable. Sorry!</p>'
if __name__ == "__main__":