Skip to content

Commit

Permalink
workaround bad regex matching for inline tag
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosarium committed Sep 3, 2023
1 parent bca83cc commit e2da4c5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ def add_inline_tag_to_yaml(md_file_path):
tags_field = [tags_field]

inline_tags = get_inline_tags(md_text)
tags_field = list(set(tags_field + inline_tags))
md_frontmatter["tags"] = tags_field

with open(md_file_path, "wb") as f_w:
frontmatter.dump(md_frontmatter, f_w)
try:
tags_field = list(set(tags_field + inline_tags))
md_frontmatter["tags"] = tags_field

with open(md_file_path, "wb") as f_w:
frontmatter.dump(md_frontmatter, f_w)
except: # whoops that regex isn't strict enough... workaround for now.
pass

return

Expand Down Expand Up @@ -84,7 +87,7 @@ def find_and_copy_published(source_path: str, copy_to_path: str):
# destination should be lower-case (spaces will be handled by hugo with `urlize`)
# file_name_lower = os.path.basename(file_path).lower() # HACK unnecessary?

# print(f"publish: {file_path}")
print(f"publish: {file_path}")
# copy that file to the publish notes directory
shutil.copy(
# file_path, os.path.join(copy_to_path, file_name_lower) # HACK unnecessary?
Expand Down

0 comments on commit e2da4c5

Please sign in to comment.