import datetime
from datetime import datetime
import markdown
import os
from os import path
import pathlib
WEBSITE = 'localhost:5000'
ENTRY_DIR = 'templates/entry'
def gen_arch_string():
path_ex = ENTRY_DIR
if path.exists(path_ex):
name_list = os.listdir(path_ex)
full_list = [os.path.join(path_ex, i) for i in name_list]
contents = sorted(full_list, key=os.path.getctime)
content_string = ''
for file in reversed(contents):
filename = pathlib.PurePath(file)
title = open(filename).readline().rstrip('\n')
filename = filename.name
if filename[0] != '.':
filename = filename.split('.', 1)[0]
content_string += '' + title + '
\n'
return content_string
def gen_index_string():
path_ex = ENTRY_DIR
content_string = ''
if path.exists(path_ex):
name_list = os.listdir(path_ex)
full_list = [os.path.join(path_ex, i) for i in name_list]
contents = sorted(full_list, key=os.path.getctime)
for file in reversed(contents):
filename = pathlib.PurePath(file)
purefile = filename
title = open(filename).readline().rstrip('\n')
text = open(filename).readlines()[1:]
filename = filename.name
if filename[0] != '.':
filename = filename.split('.', 1)[0]
content_string += '