summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Franke <nobody@nowhere.ws>2013-05-05 16:10:03 +0200
committerChristian Franke <nobody@nowhere.ws>2013-05-05 16:10:03 +0200
commit736fc85277f59a75db6062319a00b516d3b076cf (patch)
treec6c9756ce45a38662a298b7cce61f10aa366e958
parentd21337f08bd7df15183e538f02fbfceef74b6f8e (diff)
Add option to set header by template
-rwxr-xr-xscripts/template.py14
-rw-r--r--template/pages/wiki_template/head.html5
-rw-r--r--template/template/template.html1
3 files changed, 17 insertions, 3 deletions
diff --git a/scripts/template.py b/scripts/template.py
index f6b073e..91cfdd3 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -24,14 +24,21 @@ import plugin
class Page:
def __init__(self, name):
self.name = name
- data = {"content.html":"", "keywords":"", "desc_de":"", "desc_en":""}
+ data = {
+ "content.html":"",
+ "keywords":"",
+ "desc_de":"",
+ "desc_en":"",
+ "head.html":"",
+ }
for c in data:
try:
with open(os.path.join(pagepath, name, c), "r") as f:
data[c] = f.read()
except Exception:
- sys.excepthook(*sys.exc_info())
+ if c != "head.html":
+ sys.excepthook(*sys.exc_info())
self._data = plugin.plugin_manager.process_content(data)
@@ -45,7 +52,8 @@ class Page:
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"]
+ template_desc_en = self._data["desc_en"],
+ template_head = self._data["head.html"]
)
return htmltext
diff --git a/template/pages/wiki_template/head.html b/template/pages/wiki_template/head.html
new file mode 100644
index 0000000..d4f31f1
--- /dev/null
+++ b/template/pages/wiki_template/head.html
@@ -0,0 +1,5 @@
+<TMPL_IF DYNAMIC>
+<TMPL_IF FORCEBASEURL><base href="<TMPL_VAR FORCEBASEURL>" /><TMPL_ELSE>
+<TMPL_IF BASEURL><base href="<TMPL_VAR BASEURL>" /></TMPL_IF>
+</TMPL_IF>
+</TMPL_IF>
diff --git a/template/template/template.html b/template/template/template.html
index d67cca5..f4cb07f 100644
--- a/template/template/template.html
+++ b/template/template/template.html
@@ -1,6 +1,7 @@
<!DOCTYPE HTML>
<html>
<head>
+ $template_head
<meta charset="UTF-8">
<title>