From b2e1003176cdb1f92983ae5502190cb33e18c6f1 Mon Sep 17 00:00:00 2001 From: TiynGER Date: Wed, 27 May 2020 14:50:04 +0200 Subject: [PATCH] structure and list - .gitignore added - archive in list style --- README.md | 2 ++ src/.gitignore | 1 + src/content.py | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 src/.gitignore diff --git a/README.md b/README.md index 9a77658..8e89785 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Python Flask Blog This is a simple blog based on Pythons Flask framework. +The basic design is based on LukeSmithXYZs blog. +However I dislike using a script for adding entries and just want to add entries via plain text files. ## Features/To-Dos diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/src/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/src/content.py b/src/content.py index e6c69a1..4217093 100644 --- a/src/content.py +++ b/src/content.py @@ -19,19 +19,27 @@ def gen_arch_string(): content_string = '' last_month = '' for file in reversed(contents): - curr_date = datetime.fromtimestamp(os.path.getctime(file)).strftime('%Y-%m-%d') - curr_month = datetime.fromtimestamp(os.path.getctime(file)).strftime('%b %Y') + curr_date = datetime.fromtimestamp( + os.path.getctime(file)).strftime('%Y-%m-%d') + curr_month = datetime.fromtimestamp( + os.path.getctime(file)).strftime('%b %Y') if curr_month != last_month: - content_string += '

' + curr_month + '

' + if last_month != '': + content_string += '\n' + content_string += '

' + curr_month + '

\n' + content_string += '\n' return content_string