Added %%current_year%% as template keyword.
authorAaron Taylor <ataylor@subgeniuskitty.com>
Sun, 7 Jan 2018 03:57:51 +0000 (19:57 -0800)
committerAaron Taylor <ataylor@subgeniuskitty.com>
Sun, 7 Jan 2018 03:57:51 +0000 (19:57 -0800)
bin/cmless.py
bin/template.py
site_sample/template/template.tpl

index 6663cdc..84d5b69 100755 (executable)
@@ -15,6 +15,7 @@ def main():
     content = misc.load_file(config.site_template_prefix + "/" + config.template_file)
     content = template.page_title(content)
     content = template.site_title(content)
     content = misc.load_file(config.site_template_prefix + "/" + config.template_file)
     content = template.page_title(content)
     content = template.site_title(content)
+    content = template.current_year(content)
     content = template.body(content)
     print(content)
 
     content = template.body(content)
     print(content)
 
index f27f493..a39090f 100644 (file)
@@ -2,7 +2,7 @@
 # See LICENSE file for copyright and license details.
 
 # Python imports
 # See LICENSE file for copyright and license details.
 
 # Python imports
-import os
+import os, datetime
 
 # CMless imports
 import config, misc
 
 # CMless imports
 import config, misc
@@ -25,3 +25,9 @@ def body(template):
     body = misc.process_markup(body)
     return template.replace(config.template_delimiter + keyword +
             config.template_delimiter, body)
     body = misc.process_markup(body)
     return template.replace(config.template_delimiter + keyword +
             config.template_delimiter, body)
+
+def current_year(template):
+    keyword = "current_year"
+    now = datetime.datetime.now()
+    return template.replace(config.template_delimiter + keyword +
+            config.template_delimiter, str(now.year))
index 1098ce9..18fcc43 100644 (file)
@@ -20,7 +20,7 @@
     </div>
     <div id="footer">
         <span class="left">Powered by <a href="https://github.com/subgeniuskitty/cmless">CMless</a></span>
     </div>
     <div id="footer">
         <span class="left">Powered by <a href="https://github.com/subgeniuskitty/cmless">CMless</a></span>
-        <span class="right">&copy; 2018 subgeniuskitty.com</span>
+        <span class="right">&copy; %%current_year%% subgeniuskitty.com</span>
     </div>
 </body>
 </html>
     </div>
 </body>
 </html>