diff --git a/add_timestamp.py b/add_timestamp.py index 72e7a6240a35c4d23c6766ce7019ef69b13ca4f1..7eff811d6e499b29b77c1938e2e52d9e87eb30d2 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)