summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2021-05-27 21:35:25 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2021-05-27 21:35:25 -0600
commitb37ef5689b6f36fa175e168f227920a230376188 (patch)
treef41b2a31f49f6d4c41de61d221c0cecd53c72b4d
parent476084674076b8a802cf9272f58da0445f7bef75 (diff)
add tags inside article footer instead of separate html element
-rw-r--r--ChangeLog4
-rw-r--r--src/pyssg/builder.py24
2 files changed, 23 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 707d387..4daacd3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
CHANGES
=======
+v0.4.0
+------
+
+* fix bug
* fix bug
* fix bug
* add sitemap support
diff --git a/src/pyssg/builder.py b/src/pyssg/builder.py
index 4939bcc..8f7b67c 100644
--- a/src/pyssg/builder.py
+++ b/src/pyssg/builder.py
@@ -148,6 +148,12 @@ class HTMLBuilder:
t_list: list[str] = None
if page.tags is not None:
t_list = self.__get_tags_formatted(page.tags, t)
+ # tags formatted as a single string.
+ tags_formatted: str = ''.join(t_list)
+ # join list header and footer with all tags list.
+ tags_formatted = ''.join([t.tags.list_header,
+ tags_formatted,
+ t.tags.list_footer])
# common
t.header = t.header.replace("$$LANG", page.lang)
@@ -171,17 +177,25 @@ class HTMLBuilder:
else:
t.article.footer = t.article.footer.replace('$$MTIME', '')
+ # add tags to article list
+ if t_list is not None:
+ t.article.footer = t.article.footer.replace('$$TAGS',
+ tags_formatted)
+ else:
+ t.article.footer = t.article.footer.replace('$$TAGS', '')
+
with open(os.path.join(self.dst, f_name), 'w') as f:
f.write(t.header)
f.write(t.article.header)
f.write(page.html)
- if t_list is not None:
- f.write(t.tags.list_header)
- for tag in t_list:
- f.write(tag)
- f.write(t.tags.list_footer)
+ # not required anymore, tags included in article footer
+ # if t_list is not None:
+ # f.write(t.tags.list_header)
+ # for tag in t_list:
+ # f.write(tag)
+ # f.write(t.tags.list_footer)
f.write(t.article.footer)
f.write(t.footer)