From f3728f8c19239404ea80e8b517704532ff5aff91 Mon Sep 17 00:00:00 2001 From: Toby Hodges <tbyhdgs@gmail.com> Date: Tue, 14 Jul 2020 16:13:24 +0200 Subject: [PATCH] use last_modified_date page variable --- add_timestamp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/add_timestamp.py b/add_timestamp.py index 72e7a624..7eff811d 100644 --- a/add_timestamp.py +++ b/add_timestamp.py @@ -16,7 +16,7 @@ import subprocess def get_last_modified_date(markdown_file): '''Extract the date of the most recent commit that included changes to markdown_file.''' - git_log_cmd = "git log --pretty='format:%ai' {} | cut -d' ' -f1 | head -1" + git_log_cmd = "git log --pretty='format:%ai' {} | head -1" date_string = subprocess.check_output(git_log_cmd.format(markdown_file), shell=True).strip() return date_string @@ -26,7 +26,7 @@ for filename in argv[1:]: lines = infh.readlines() assert lines[0].startswith('---'), "Error: {} doesn't appear to be a valid Markdown file with a YAML header. Please check you filenames and try again.".format(filename) last_modified = get_last_modified_date(filename) - lines.insert(1, "modified_date: '{}'\n".format(last_modified)) + lines.insert(1, "last_modified_date: '{}'\n".format(last_modified)) with open('{}.modified'.format(filename), 'w') as outfh: for line in lines: outfh.write(line) -- GitLab