Added basic template functionality.
[cmless] / bin / template.py
CommitLineData
d955cfad
AT
1# (c) 2017 Aaron Taylor <ataylor at subgeniuskitty dot com>
2# See LICENSE file for copyright and license details.
3
4# Python imports
5import os
6
7# CMless imports
8import config, misc
9
10def tpl_title(template):
11 keyword = "page_title"
12 return template.replace(config.template_delimiter + keyword +
13 config.template_delimiter, os.environ['REQUEST_URI'])
14
15def tpl_body(template):
16 keyword = "page_content"
17 body = misc.load_file(config.site_data_prefix + os.environ['REQUEST_URI'] +
18 config.markup_file_extension)
19 body = misc.process_markup(body)
20 return template.replace(config.template_delimiter + keyword +
21 config.template_delimiter, body)