From: Aaron Taylor Date: Sun, 7 Jan 2018 02:38:03 +0000 (-0800) Subject: Added %%site_title%% template keyword. X-Git-Url: http://git.subgeniuskitty.com/cmless/.git/commitdiff_plain/0a58f7f180aedab31fdb9fdded7eaba1221893e4 Added %%site_title%% template keyword. --- diff --git a/bin/cmless.py b/bin/cmless.py index ddba963..6663cdc 100755 --- a/bin/cmless.py +++ b/bin/cmless.py @@ -13,8 +13,9 @@ def main(): print("Content-Type: text/html;charset=utf-8\n") content = misc.load_file(config.site_template_prefix + "/" + config.template_file) - content = template.tpl_title(content) - content = template.tpl_body(content) + content = template.page_title(content) + content = template.site_title(content) + content = template.body(content) print(content) if __name__ == "__main__": diff --git a/bin/config.py b/bin/config.py index 6d9e90b..5ee585f 100644 --- a/bin/config.py +++ b/bin/config.py @@ -1,6 +1,13 @@ # (c) 2017 Aaron Taylor # See LICENSE file for copyright and license details. +##### +# Site Configuration Options +##### + +# Site name. For example, "Microsoft" or "Bob's Hardware". +site_name = "Site Name" + ##### # CMless Configuration Options ##### diff --git a/bin/template.py b/bin/template.py index c5b1d19..f27f493 100644 --- a/bin/template.py +++ b/bin/template.py @@ -7,12 +7,18 @@ import os # CMless imports import config, misc -def tpl_title(template): +def page_title(template): keyword = "page_title" return template.replace(config.template_delimiter + keyword + - config.template_delimiter, os.environ['REQUEST_URI']) + config.template_delimiter, config.site_name + " - " + + os.environ['REQUEST_URI']) -def tpl_body(template): +def site_title(template): + keyword = "site_title" + return template.replace(config.template_delimiter + keyword + + config.template_delimiter, config.site_name) + +def body(template): keyword = "page_content" body = misc.load_file(config.site_data_prefix + os.environ['REQUEST_URI'] + config.markup_file_extension)