summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pyssg/builder.py8
-rw-r--r--src/pyssg/plt/page.html4
-rw-r--r--src/pyssg/plt/page_index.html2
3 files changed, 5 insertions, 9 deletions
diff --git a/src/pyssg/builder.py b/src/pyssg/builder.py
index d70b976..f4fa1b2 100644
--- a/src/pyssg/builder.py
+++ b/src/pyssg/builder.py
@@ -132,20 +132,17 @@ class Builder:
copy_file(src_file, dst_file)
def __render_pages(self, template_name: str) -> None:
- log.debug('rendering pages with template "%s"', template_name)
page_vars: dict = deepcopy(self.common_vars)
for p in self.all_files:
p_fname: str = p.name.replace('.md', '.html')
- log.debug('adding page "%s" to exposed vars for jinja', p_fname)
page_vars['page'] = p
# actually render article
self.__render_template(template_name, p_fname, **page_vars)
def __render_tags(self, template_name: str) -> None:
- log.debug('rendering tags with template "%s"', template_name)
tag_prefix: str = ''
- if self.dir_cfg['tags_prefix']:
+ if 'tags_prefix' in self.dir_cfg:
tag_prefix = self.dir_cfg['tags_prefix']
tag_vars: dict = deepcopy(self.common_vars)
tag_pages: list[Page]
@@ -161,7 +158,6 @@ class Builder:
t_fname: str = f'tags/{tag_prefix}{t}.html'
# actually render tag page
self.__render_template(template_name, t_fname, **tag_vars)
- log.debug('rendered tag "%s"', t)
def __render_template(self, template_name: str,
file_name: str,
@@ -172,5 +168,5 @@ class Builder:
with open(dst_path, 'w') as f:
f.write(content)
- log.debug('wrote html at "%s"', dst_path)
+ log.debug('rendered "%s" with template %s', dst_path, template_name)
diff --git a/src/pyssg/plt/page.html b/src/pyssg/plt/page.html
index c412938..3e6cfdb 100644
--- a/src/pyssg/plt/page.html
+++ b/src/pyssg/plt/page.html
@@ -8,12 +8,12 @@
<p>By {{', '.join(page.author)}}</p>
<p>Created: {{page.date(page.cts, 'date')}}</p>
- {%if page.mtimestamp != 0.0%}
+ {%if page.mts != 0.0%}
<p>Modified: {{page.date(page.mts, 'date')}}</p>
{%endif%}
{{page.content}}
{%import "tag_list.html" as tag_list%}
- {{tag_list.print(page.tags, config['tags_prefix'])}}
+ {{tag_list.print(page.tags, dir_config['tags_prefix'])}}
{%endblock body_content%}
diff --git a/src/pyssg/plt/page_index.html b/src/pyssg/plt/page_index.html
index 677005c..96b0931 100644
--- a/src/pyssg/plt/page_index.html
+++ b/src/pyssg/plt/page_index.html
@@ -8,7 +8,7 @@
<p>Some text here</p>
{%import "tag_list.html" as tag_list%}
- {{tag_list.print(all_tags, config['tags_prefix'])}}
+ {{tag_list.print(all_tags, dir_config['tags_prefix'])}}
{%import "page_list.html" as page_list%}
{{page_list.print("Articles", all_pages)}}