Skip to content
Snippets Groups Projects
Verified Commit f3728f8c authored by Toby Hodges's avatar Toby Hodges
Browse files

use last_modified_date page variable

parent 5637d690
No related branches found
No related tags found
No related merge requests found
Pipeline #16496 passed
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment