a925e3cb5f82f3bc57a1076d4c096c98072c91ee — rjpcasalino 2 months ago 3728f16
adds datetime and formatting for page modifed dates
1 files changed, 4 insertions(+), 2 deletions(-)

M src/odyssey
M src/odyssey => src/odyssey +4 -2
@@ 16,6 16,7 @@ import shutil
import datetime
import jinja2
from jinja2 import Environment, FileSystemLoader, select_autoescape
from datetime import datetime

# consts

@@ 122,14 123,15 @@ def do_build():
                f = re.match("(?:png|jpg|jpeg|gif|svg|md|pdf)", file.split(".")[1])
                if "md" in f.group():
                    filename = os.path.join(dirpath, file)
                    file_last_modified = os.stat(filename).st_mtime
                    with open(filename, "r+") as f:
                        # returns a tuple containing a count (from start which defaults to 0) and
                        # the values obtained from iterating over iterable.
                        block = list(enumerate(read_file(f, "---")))
                    if "index.md" in filename:
                        build_index(filename, block[0][1], block[1][1], time.ctime())                           
                        build_index(filename, block[0][1], block[1][1], datetime.fromtimestamp(file_last_modified))                           
                        build_page(filename, block[0][1], block[1][1], time.ctime())
                        build_page(filename, block[0][1], block[1][1], datetime.fromtimestamp(file_last_modified))
                elif "pdf" in f.group():
                    ## this is cv related
                    shutil.copy(os.path.join(dirpath, file), "_site/cv/")