1
0
mirror of https://github.com/tiyn/beaker-blog.git synced 2025-04-01 15:07:46 +02:00

structure and list

- .gitignore added
- archive in list style
This commit is contained in:
TiynGER 2020-05-27 14:50:04 +02:00
parent 0c7b9e6172
commit b2e1003176
3 changed files with 15 additions and 4 deletions

View File

@ -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

1
src/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__/

View File

@ -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 += '<h2>' + curr_month + '</h2>'
if last_month != '':
content_string += '</ul>\n'
content_string += '<h2>' + curr_month + '</h2>\n'
content_string += '<ul>\n'
last_month = curr_month
filename = pathlib.PurePath(file)
title = open(filename).readline().rstrip('\n')
filename = filename.name
if filename[0] != '.':
filename = filename.split('.', 1)[0]
content_string += '<li>'
content_string += curr_date + ' - '
content_string += '<a href="' + '/index.html#' + \
filename + '">' + title + '</a><br>\n'
filename + '">' + title + '</a><br>'
content_string += '</li>\n'
content_string += '</ul>\n'
return content_string