summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2021-05-17 15:56:52 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2021-05-17 15:56:52 -0600
commita57078e898219fdf09004413012d424ac96eb524 (patch)
tree355fd330350405f3469c686147f7a18f0528d35e /src
parent30c699f96429598b9ff88103971ccf689e163799 (diff)
fix sorting of pages and update default templatesv0.2.2
Diffstat (limited to 'src')
-rw-r--r--src/pyssg/builder.py2
-rw-r--r--src/pyssg/parser.py3
-rw-r--r--src/pyssg/template.py8
3 files changed, 7 insertions, 6 deletions
diff --git a/src/pyssg/builder.py b/src/pyssg/builder.py
index b2ff63c..b8acf08 100644
--- a/src/pyssg/builder.py
+++ b/src/pyssg/builder.py
@@ -207,12 +207,10 @@ class HTMLBuilder:
pages: list[Page]) -> None:
for t in tags:
# get a list of all pages that have current tag
- # and sort them (by time)
tag_pages: list[Page] = []
for p in pages:
if p.tags is not None and t in p.tags:
tag_pages.append(p)
- tag_pages.sort(reverse=True)
# build tag page
self.__create_tag(t, tag_pages)
diff --git a/src/pyssg/parser.py b/src/pyssg/parser.py
index 43028ef..548fb05 100644
--- a/src/pyssg/parser.py
+++ b/src/pyssg/parser.py
@@ -55,4 +55,5 @@ class MDParser:
# sort list of tags for consistency
self.all_tags.sort()
- self.updated_pages.sort()
+ self.updated_pages.sort(reverse=True)
+ self.all_pages.sort(reverse=True)
diff --git a/src/pyssg/template.py b/src/pyssg/template.py
index cd80d28..b3ce48d 100644
--- a/src/pyssg/template.py
+++ b/src/pyssg/template.py
@@ -62,7 +62,9 @@ class Template(HF):
os.mkdir('article')
os.chdir('article')
self.__write_template('header.html',
- ['<h1>$$TITLE</h1>'])
+ ['<h1>$$TITLE</h1>\n',
+ '<p>$$AUTHOR</p>\n',
+ '<p>Created: $$CTIME, modified: $$MTIME</p>\n'])
self.__write_template('footer.html',
[''])
@@ -78,9 +80,9 @@ class Template(HF):
['<h2>Articles</h2>\n',
'<ul>\n'])
self.__write_template('list_entry.html',
- ['<li><a href="$$URL">$$DATE - $$TITLE</a></li>\n'])
+ ['<li>$$DATE - <a href="$$URL">$$TITLE</a></li>\n'])
self.__write_template('list_separator.html',
- [''])
+ ['<h3>$$SEP</h3>\n'])
self.__write_template('list_footer.html',
['</ul>\n'])
self.__write_template('footer.html',