diff --git a/voussoir.net/writing/generate_site.py b/voussoir.net/writing/generate_site.py index 6dd67c6..450c36c 100644 --- a/voussoir.net/writing/generate_site.py +++ b/voussoir.net/writing/generate_site.py @@ -64,7 +64,7 @@ def git_repo_for_file(path): folder = folder.parent raise Exception('No Git repo.') -def git_file_edited_date(path) -> str: +def git_file_edited_date(path) -> datetime.datetime: ''' Return the ISO formatted date of the most recent commit that touched this file, ignoring commits marked as "[minor]". @@ -87,7 +87,7 @@ def git_file_edited_date(path) -> str: date = check_output(command) date = dateutil.parser.parse(date) date = date.astimezone(datetime.timezone.utc) - return date.isoformat() + return date def git_file_commit_history(path): ''' @@ -115,7 +115,7 @@ def git_file_commit_history(path): lines = [line.split(' ', 1) for line in lines] return lines -def git_file_published_date(path) -> str: +def git_file_published_date(path) -> datetime.datetime: ''' Return the ISO formatted date of the commit where this file first appeared. ''' @@ -136,7 +136,7 @@ def git_file_published_date(path) -> str: date = check_output(command) date = dateutil.parser.parse(date) date = date.astimezone(datetime.timezone.utc) - return date.isoformat() + return date # SOUP ################################################################################ @@ -200,8 +200,14 @@ class Article: self.md_file = pathclass.Path(md_file) self.html_file = self.md_file.replace_extension('html') self.web_path = self.md_file.parent.relative_to(WRITING_ROOTDIR, simple=True).replace('\\', '/') - self.date = git_file_published_date(self.md_file) + + self.published = git_file_published_date(self.md_file) + self.published_iso = self.published.isoformat() + self.published_date = self.published.strftime('%Y-%m-%d') + self.edited = git_file_edited_date(self.md_file) + self.edited_iso = self.edited.isoformat() + self.edited_date = self.edited.strftime('%Y-%m-%d') repo_path = git_repo_for_file(self.md_file) relative_path = self.md_file.relative_to(repo_path, simple=True).replace('\\', '/') @@ -362,7 +368,7 @@ def make_tag_page(index, path):