update gronk_add_uuid.py

This commit is contained in:
Akbar Rahman 2023-09-20 22:17:06 +01:00 committed by Akbar Rahman
parent b61f1ba3b2
commit 36f40f3269
Signed by: alvierahman90
GPG Key ID: 6217899F07CA2BDF

11
gronk_add_uuid.py Executable file → Normal file
View File

@ -1,11 +1,14 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import editfrontmatter
import frontmatter
import pathlib import pathlib
import sys import sys
import uuid import uuid
import editfrontmatter
import frontmatter
def get_args(): def get_args():
""" Get command line arguments """ """ Get command line arguments """
@ -19,13 +22,13 @@ def get_args():
def main(args): def main(args):
""" Entry point for script """ """ Entry point for script """
template_str= [ template_str= "\n".join([
"author: {{ author }}" "author: {{ author }}"
"date: {{ date }}" "date: {{ date }}"
"title: {{ title }}" "title: {{ title }}"
"tags: {{ tags }}" "tags: {{ tags }}"
"uuid: {{ uuid }}" "uuid: {{ uuid }}"
].join("\n") ])
with open(args.filename) as fp: with open(args.filename) as fp:
fm_pre = frontmatter.load(fp) fm_pre = frontmatter.load(fp)