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="left">
<div class="leftcontent"> <div class="leftcontent">
<h2>Screenshots</h2> <h2>Screenshots</h2>
@ -16,12 +12,8 @@
</div> </div>
<div class="leftcontent"> <div class="leftcontent">
<p>&nbsp;</p> <h2>Recent changes</h2>
</div> %(rss_content)s
<div class="leftcontent">
<h2>foo bar</h2>
<p>today is the day</p>
</div> </div>
</div> </div>

View file

@ -56,7 +56,33 @@
</div> </div>
</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> </body>
</html> </html>

View file

@ -110,7 +110,33 @@
</div> </div>
</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> </body>
</html> </html>

View file

@ -100,7 +100,33 @@
</div> </div>
</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> </body>
</html> </html>

View file

@ -108,7 +108,33 @@
</div> </div>
</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> </body>
</html> </html>

View file

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

View file

@ -196,3 +196,28 @@ ol.toc li {
ol.toc a { ol.toc a {
text-decoration: none; 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> <p>Any Questions? Mail to <i>info(at)cryptobox.org</i>!</p>
</div> </div>
<!-- RFC: what about putting the latest svn commit logs here?
all the other stuff is redundant [l] -->
<div class="left"> <div class="left">
<div class="leftcontent"> <div class="leftcontent">
<h2>Screenshots</h2> <h2>Screenshots</h2>
@ -61,12 +57,25 @@
</div> </div>
<div class="leftcontent"> <div class="leftcontent">
<p>&nbsp;</p> <h2>Recent changes</h2>
</div> <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>
</div> </div>
@ -128,7 +137,33 @@
</div> </div>
</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> </body>
</html> </html>

View file

@ -5,5 +5,31 @@
</div> </div>
</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> </body>
</html> </html>

View file

@ -113,7 +113,33 @@
</div> </div>
</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> </body>
</html> </html>

View file

@ -60,7 +60,33 @@
</div> </div>
</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> </body>
</html> </html>

View file

@ -1,19 +1,29 @@
#!/usr/bin/env python #!/usr/bin/env python
import os, re 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: class TemplateWriter:
templatefile = "gerippe.tmpl" templatefile = "./gerippe.tmpl"
tmpldir = "./placeholder" tmpldir = "./placeholder"
contentdir = "./content" contentdir = "./content"
tmplfileext = ".tmpl" tmplfileext = ".tmpl"
outfileext = ".html" outfileext = ".html"
max_rss_items = 5
## regular expressions of not-wanted file/directory names ## regular expressions of not-wanted file/directory names
## for now: no svn, no vi-swap files, no backup files ## for now: no svn, no vi-swap files, no backup files
ignore_items = [ r'\.svn', r'\.swp$', r'~$' ] ignore_items = [ r'\.svn', r'\.swp$', r'~$' ]
def __init__(self): def __init__(self):
pass self.placeholder = self.__get_placeholder_dict()
self.template = open(self.templatefile).read()
def get_sorted(self, flist): def get_sorted(self, flist):
@ -35,54 +45,61 @@ class TemplateWriter:
return result return result
def string_replace(self, infile, outfile): def __get_placeholder_dict(self):
template = open(infile).read() """returns the common dictionary for all files - except for the 'entries'
open(outfile, "w").write(template) """
text = {} placeholder = {}
for tmpl in self.get_sorted(self.get_filtered(os.listdir(self.tmpldir))): 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): if not os.path.isfile(tmplfile):
print " str.repl: cancelling %s - not a file" % tmplfile print " str.repl: cancelling %s - not a file" % tmplfile
else: else:
template = open(outfile).read() placeholder[tmpl] = file(tmplfile).read()
print " str.repl: using %s" % tmplfile placeholder["rss_content"] = self.get_rss_info()
newcontent = open(tmplfile).read() return placeholder
text[tmpl] = template.replace("<!-- $%s$ -->" % tmpl, newcontent)
open(outfile, "w").write(text[tmpl])
return
def build_sites(self): def get_entries(self, html_name):
'''use all files ending with .tmpl''' """reads all files in the given directory sorted into a string
for tmplfile in self.get_sorted(self.get_filtered(os.listdir("./"))): """
if tmplfile.rfind(self.tmplfileext) >= 1: entries = ""
infile = tmplfile for entry in self.get_sorted(self.get_filtered(os.listdir(
(tmplfilename, tmplfileext)=os.path.splitext(tmplfile) os.path.join(self.contentdir, html_name)))):
outfile = tmplfilename + self.outfileext entries += file(os.path.join(self.contentdir, html_name, entry)).read()
print "building: %s -> %s" % (tmplfile, outfile) return entries
self.string_replace(infile, outfile)
return
def build_sites_from_gerippe(self): 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))): for html in self.get_sorted(self.get_filtered(os.listdir(self.contentdir))):
print " building: %s%s" % (html, self.outfileext) print " building: %s%s" % (html, self.outfileext)
entries = "" self.placeholder["entries"] = self.get_entries(html)
for entry in self.get_sorted(self.get_filtered(os.listdir(os.path.join(self.contentdir, html)))): ## start with the content of the template
print " adding entry: %s " % entry text = self.template
entries += open(os.path.join(self.contentdir, html, entry)).read() ## repeat substitution for five times - for recursive stuff
text = text % self.placeholder
template = open(self.templatefile).read() text = text % self.placeholder
text = template.replace("<!-- $entries$ -->", entries) text = text % self.placeholder
infile = html+".tmp" text = text % self.placeholder
open(infile,"w").write(text) text = text % self.placeholder
outfile = html+self.outfileext ## write the result
self.string_replace(infile, outfile) outfile = open(html + self.outfileext, "w")
os.unlink(infile) outfile.write(text)
outfile.close()
return 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__": if __name__ == "__main__":
TemplateWriter().build_sites_from_gerippe() TemplateWriter().build_sites_from_gerippe()