summaryrefslogtreecommitdiff
path: root/static.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-07-04 15:54:31 +0200
committeremkael <emkael@tlen.pl>2017-07-04 15:55:46 +0200
commit7ad97251669963ec81eb9e808e9a8890939a1b1a (patch)
treeb0afa5ae00a36aac8d8ce9eefa8722e1f24440eb /static.py
parentbf0b6154fe7b5a7853b15ab5d401e3f6524f1ec5 (diff)
Generating static content from common page template
Diffstat (limited to 'static.py')
-rw-r--r--static.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/static.py b/static.py
new file mode 100644
index 0000000..3168843
--- /dev/null
+++ b/static.py
@@ -0,0 +1,13 @@
+import os, sys
+from bs4 import BeautifulSoup as bs4
+
+content_file = sys.argv[1]
+page_header = sys.argv[2] if len(sys.argv) > 2 else ''
+
+template = bs4(file('templates/static.html'), 'lxml')
+template.select('h2 small')[0].string = page_header
+template.find('div', {'id': 'content'}).append(
+ bs4(file(content_file).read(), 'lxml')
+)
+
+print template.prettify().encode('utf-8')