diff options
-rw-r--r-- | public/css/sublab-2012-09-16.css (renamed from public/css/sublab-2011-11-02.css) | 60 | ||||
-rwxr-xr-x | scripts/template.py | 10 | ||||
-rwxr-xr-x | scripts/wikitemplate.py | 94 | ||||
-rw-r--r-- | template/pages/wiki_template/content.html | 165 | ||||
-rw-r--r-- | template/template/template.html | 12 |
5 files changed, 325 insertions, 16 deletions
diff --git a/public/css/sublab-2011-11-02.css b/public/css/sublab-2012-09-16.css index 20e9c5b..7f55d01 100644 --- a/public/css/sublab-2011-11-02.css +++ b/public/css/sublab-2012-09-16.css @@ -1,6 +1,4 @@ * { - padding: 0px; - margin: 0px; font-family: Verdana, Helvetica, sans-serif; font-size: 12px; color: #ddd; @@ -176,13 +174,10 @@ hr { clear: both; } -ul { - margin-left: 40px; - } - #menu { list-style: none; margin: 5px; + padding: 0px; } #menu a { @@ -305,7 +300,7 @@ a.img:active { color: #999; } -span { +span.box { border: 1px solid #222; padding: 2px; } @@ -328,3 +323,54 @@ span { #mapdiv img { border: 0px; } + +/* These are for the wiki */ +div.page { + border: none; + margin: 0px; + margin-right: 1em; +} + +.actions ul { + text-align: right; + margin-top: -3px; +} +.actions li { + display: inline; + padding: 2px; + border-style: solid; + border-width: 1px; + border-top-width: 0px; + border-color: #444; + background-color: rgba(16,16,16,0.5); +} + +.actions a { + border-bottom: 0px; +} + +div.pageheader { + margin-left: 10px; +} + +div.pagedate { + text-align: right; +} + +span.title, span.parentlinks, .parentlinks a { + font-size: 18px; + font-weight: bold; + line-height: 40px; +} + +span.title:after { + content: " ]"; +} + +span.parentlinks:before { + content: "[ "; +} + +textarea, input, select { + background-color: #101010; +} diff --git a/scripts/template.py b/scripts/template.py index 2cfdf79..f6b073e 100755 --- a/scripts/template.py +++ b/scripts/template.py @@ -27,9 +27,11 @@ class Page: data = {"content.html":"", "keywords":"", "desc_de":"", "desc_en":""} for c in data: - f = open(os.path.join(pagepath, name, c), "r") - data[c] = f.read() - f.close + try: + with open(os.path.join(pagepath, name, c), "r") as f: + data[c] = f.read() + except Exception: + sys.excepthook(*sys.exc_info()) self._data = plugin.plugin_manager.process_content(data) @@ -104,6 +106,8 @@ if __name__ == '__main__': if __name__ == '__main__': for page in os.listdir(pagepath): + if page.endswith('_template'): + continue Page(page).render_and_save() if verbose: print "%s.html written" % page diff --git a/scripts/wikitemplate.py b/scripts/wikitemplate.py new file mode 100755 index 0000000..612219e --- /dev/null +++ b/scripts/wikitemplate.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +#Filename: newtemp.py +#Author: stayawake@lavabit.com +# --- +# Copyright (C) 2011 Christian Franke <nobody@nowhere.ws> +# +# Permission is hereby granted to use and distribute this +# file for any purpose, provided the above copyright notice +# is kept in place. +# + +import imp +import os +import os.path +import sys +import getopt +import time +import datetime +from string import Template +import ConfigParser + +import plugin +import template + +class WikiTemplate(template.Page): + def __init__(self): + template.Page.__init__(self, 'wiki_template') + + @property + def html(self): + #create template-string + htmltext = Template(htmltemplate) + htmltext = htmltext.substitute( + template_date = '', #<TMPL_VAR MTIME>', + template_chattopic = topic, + template_keywords = self._data["keywords"], + template_content = self._data["content.html"], + template_desc_de = self._data["desc_de"], + template_desc_en = self._data["desc_en"] + ) + return htmltext + +configfile = "template.conf" +verbose = False +opts, args = getopt.getopt(sys.argv[1:], "c:vh", ["config=", "verbose", "help"]) +for opt, arg in opts: + if opt in ("-c", "--config"): + configfile = arg + elif opt in ("-v", "--verbose"): + verbose = True + elif opt in ("-h", "--help"): + print >>sys.stderr, "Please read the non-existing man page for further assistance" + sys.exit(0) + +basedir = os.path.dirname(os.path.abspath(__file__)) + +def makeabs(path): + if not os.path.isabs(path): + return os.path.join(basedir, path) + return path + +configfile = makeabs(configfile) +config = ConfigParser.ConfigParser() +config.read(configfile) + +path = makeabs(config.get("Default", "path")) +targetdir = makeabs(config.get("Default", "target")) +pagepath = os.path.join(path, "pages") +templatepath = os.path.join(path, "template") +topicpath = os.path.join(path, "topic") + +#set template +htmltemplate = open(os.path.join(templatepath, "template.html"), "r").read() +topic = open(os.path.join(topicpath, "topic"), "r").read() +datenow = time.strftime("%Y-%m-%dT%H:%M:%S +0100") + +if __name__ == '__main__': + if verbose: + print >>sys.stderr, "Pagepath: %s" % pagepath + print >>sys.stderr, "Templatepath: %s" % templatepath + print >>sys.stderr, "topicpath: %s" % topicpath + print >>sys.stderr, "datenow: %s" % datenow + + pluginlist = config.items('Plugins') + for pluginname, pluginarg in pluginlist: + modinfo = imp.find_module(pluginname) + try: + imp.load_module(pluginname, *modinfo) + finally: + modinfo[0].close() + + print WikiTemplate().html + +# vi: noexpandtab:tabstop=8:shiftwidth=8 diff --git a/template/pages/wiki_template/content.html b/template/pages/wiki_template/content.html new file mode 100644 index 0000000..06ee5e6 --- /dev/null +++ b/template/pages/wiki_template/content.html @@ -0,0 +1,165 @@ +<TMPL_IF HTML5><article class="page"><TMPL_ELSE><div class="page"></TMPL_IF> + +<TMPL_IF HTML5><section class="pageheader"><TMPL_ELSE><div class="pageheader"></TMPL_IF> +<TMPL_IF HAVE_ACTIONS> +<TMPL_IF HTML5><nav class="actions"><TMPL_ELSE><div class="actions"></TMPL_IF> +<ul> +<TMPL_IF EDITURL> +<li><a href="<TMPL_VAR EDITURL>" rel="nofollow">Edit</a></li> +</TMPL_IF> +<TMPL_IF RECENTCHANGESURL> +<li><a href="<TMPL_VAR RECENTCHANGESURL>">RecentChanges</a></li> +</TMPL_IF> +<TMPL_IF HISTORYURL> +<li><a href="<TMPL_VAR HISTORYURL>">History</a></li> +</TMPL_IF> +<TMPL_IF GETSOURCEURL> +<li><a href="<TMPL_VAR GETSOURCEURL>">Source</a></li> +</TMPL_IF> +<TMPL_IF PREFSURL> +<li><a href="<TMPL_VAR PREFSURL>">Preferences</a></li> +</TMPL_IF> +<TMPL_IF ACTIONS> +<TMPL_LOOP ACTIONS> +<li><TMPL_VAR ACTION></li> +</TMPL_LOOP> +</TMPL_IF> +<TMPL_IF COMMENTSLINK> +<li><TMPL_VAR COMMENTSLINK></li> +<TMPL_ELSE> +<TMPL_IF DISCUSSIONLINK> +<li><TMPL_VAR DISCUSSIONLINK></li> +</TMPL_IF> +</TMPL_IF> +</ul> +<TMPL_IF HTML5></nav><TMPL_ELSE></div></TMPL_IF> +</TMPL_IF> + +<TMPL_IF OTHERLANGUAGES> +<TMPL_IF HTML5><nav id="otherlanguages"><TMPL_ELSE><div id="otherlanguages"></TMPL_IF> +<ul> +<TMPL_LOOP OTHERLANGUAGES> +<li> +<a href="<TMPL_VAR URL>"><TMPL_VAR LANGUAGE></a> +<TMPL_IF MASTER> +(master) +<TMPL_ELSE> + (<TMPL_VAR PERCENT>%) +</TMPL_IF> +</li> +</TMPL_LOOP> +</ul> +<TMPL_IF HTML5></nav><TMPL_ELSE></div></TMPL_IF> +</TMPL_IF> + +<TMPL_VAR TRAILS> +<TMPL_IF HTML5><header class="header"><TMPL_ELSE><div class="header"></TMPL_IF> +<span> +<span class="parentlinks"> +<TMPL_LOOP PARENTLINKS> +<a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a>/ +</TMPL_LOOP> +</span> +<span class="title"> +<TMPL_VAR TITLE> +<TMPL_IF ISTRANSLATION> + (<TMPL_VAR PERCENTTRANSLATED>%) +</TMPL_IF> +</span> +</span> +<TMPL_IF SEARCHFORM> +<TMPL_VAR SEARCHFORM> +</TMPL_IF> +<TMPL_IF HTML5></header><TMPL_ELSE></div></TMPL_IF> + + +<TMPL_IF HTML5></section><TMPL_ELSE></div></TMPL_IF> + +<TMPL_IF SIDEBAR> +<TMPL_IF HTML5><aside class="sidebar"><TMPL_ELSE><div class="sidebar"></TMPL_IF> +<TMPL_VAR SIDEBAR> +<TMPL_IF HTML5></aside><TMPL_ELSE></div></TMPL_IF> +</TMPL_IF> + +<div id="pagebody"> + +<TMPL_IF HTML5><section id="content"><TMPL_ELSE><div id="content"></TMPL_IF> +<TMPL_VAR CONTENT> +<TMPL_IF HTML5></section><TMPL_ELSE></div></TMPL_IF> + +<TMPL_UNLESS DYNAMIC> +<TMPL_IF COMMENTS> +<TMPL_IF HTML5><section id="comments"><TMPL_ELSE><div id="comments"></TMPL_IF> +<TMPL_VAR COMMENTS> +<TMPL_IF ADDCOMMENTURL> +<div class="addcomment"> +<a href="<TMPL_VAR ADDCOMMENTURL>">Add a comment</a> +</div> +<TMPL_ELSE> +<div class="addcomment">Comments on this page are closed.</div> +</TMPL_IF> +<TMPL_IF HTML5></section><TMPL_ELSE></div></TMPL_IF> +</TMPL_IF> +</TMPL_UNLESS> + +</div> + +<TMPL_IF HTML5><footer id="footer" class="pagefooter"><TMPL_ELSE><div id="footer" class="pagefooter"></TMPL_IF> +<TMPL_UNLESS DYNAMIC> +<TMPL_IF HTML5><nav id="pageinfo"><TMPL_ELSE><div id="pageinfo"></TMPL_IF> + +<TMPL_VAR TRAILS> + +<TMPL_IF TAGS> +<TMPL_IF HTML5><nav class="tags"><TMPL_ELSE><div class="tags"></TMPL_IF> +Tags: +<TMPL_LOOP TAGS> +<TMPL_VAR LINK> +</TMPL_LOOP> +<TMPL_IF HTML5></nav><TMPL_ELSE></div></TMPL_IF> +</TMPL_IF> + +<TMPL_IF BACKLINKS> +<TMPL_IF HTML5><nav id="backlinks"><TMPL_ELSE><div id="backlinks"></TMPL_IF> +Links: +<TMPL_LOOP BACKLINKS> +<a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a> +</TMPL_LOOP> +<TMPL_IF MORE_BACKLINKS> +<span class="popup">... +<span class="balloon"> +<TMPL_LOOP MORE_BACKLINKS> +<a href="<TMPL_VAR URL>"><TMPL_VAR PAGE></a> +</TMPL_LOOP> +</span> +</span> +</TMPL_IF> +<TMPL_IF HTML5></nav><TMPL_ELSE></div></TMPL_IF> +</TMPL_IF> + +<TMPL_IF COPYRIGHT> +<div class="pagecopyright"> +<a name="pagecopyright"></a> +<TMPL_VAR COPYRIGHT> +</div> +</TMPL_IF> + +<TMPL_IF LICENSE> +<div class="pagelicense"> +<a name="pagelicense"></a> +License: <TMPL_VAR LICENSE> +</div> +</TMPL_IF> + +<div class="pagedate"> +Last edited <TMPL_VAR MTIME> +<!-- Created <TMPL_VAR CTIME> --> +</div> + +<TMPL_IF HTML5></nav><TMPL_ELSE></div></TMPL_IF> +<TMPL_IF EXTRAFOOTER><TMPL_VAR EXTRAFOOTER></TMPL_IF> +</TMPL_UNLESS> +<!-- from <TMPL_VAR WIKINAME> --> +<TMPL_IF HTML5></footer><TMPL_ELSE></div></TMPL_IF> + +<TMPL_IF HTML5></article><TMPL_ELSE></div></TMPL_IF> diff --git a/template/template/template.html b/template/template/template.html index 344af80..14ee17e 100644 --- a/template/template/template.html +++ b/template/template/template.html @@ -15,7 +15,7 @@ <meta name="description" lang="de" content="$template_desc_de"> <meta name="description" lang="en" content="$template_desc_en"> - <link rel="stylesheet" href="/css/sublab-2011-11-02.css" type="text/css"> + <link rel="stylesheet" href="/css/sublab-2012-09-16.css" type="text/css"> <link rel="stylesheet" href="/css/taifun.status.css" type="text/css"> <link rel="stylesheet" href="/css/trieste.status.css" type="text/css"> <link rel="stylesheet" href="/css/nautilus.status.css" type="text/css"> @@ -32,7 +32,7 @@ <div class="image"> <p class="header"> - <span class="header">[ <a href="/mate">mate</a> und technik ]</span> + <span class="box header">[ <a href="/mate">mate</a> und technik ]</span> </p> <h1> Das sublab - ein Hackerspace in Leipzig @@ -93,7 +93,7 @@ sublab: </td> <td class="statusinfo"> - <span class="sublabopen">Open</span> <span class="sublabclosed">Closed</span> + <span class="box sublabopen">Open</span> <span class="box sublabclosed">Closed</span> </td> </tr> </table> @@ -104,7 +104,7 @@ Taifun: </td> <td class="statusinfo"> - <span class="taifunonline">Online</span> <span class="taifunoffline">Offline</span> + <span class="box taifunonline">Online</span> <span class="box taifunoffline">Offline</span> </td> </tr> <tr> @@ -112,7 +112,7 @@ Trieste: </td> <td class="status"> - <span class="triesteonline">Online</span> <span class="triesteoffline">Offline</span> + <span class="box triesteonline">Online</span> <span class="box triesteoffline">Offline</span> </td> </tr> <tr> @@ -120,7 +120,7 @@ Nautilus: </td> <td class="status"> - <span class="nautilusonline">Online</span> <span class="nautilusoffline">Offline</span> + <span class="box nautilusonline">Online</span> <span class="box nautilusoffline">Offline</span> </td> </tr> </table> |