From a57078e898219fdf09004413012d424ac96eb524 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Mon, 17 May 2021 15:56:52 -0600 Subject: fix sorting of pages and update default templates --- src/pyssg/builder.py | 2 -- src/pyssg/parser.py | 3 ++- src/pyssg/template.py | 8 +++++--- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') 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', - ['

$$TITLE

']) + ['

$$TITLE

\n', + '

$$AUTHOR

\n', + '

Created: $$CTIME, modified: $$MTIME

\n']) self.__write_template('footer.html', ['']) @@ -78,9 +80,9 @@ class Template(HF): ['

Articles

\n', '\n']) self.__write_template('footer.html', -- cgit v1.2.3-70-g09d2