Update to keep keys in the correct order
This commit is contained in:
parent
3d13813a94
commit
88bbbf4e80
@ -2,10 +2,11 @@ import argparse
|
|||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import frontmatter
|
import frontmatter
|
||||||
from pathlib import Path
|
import yaml
|
||||||
|
|
||||||
BLOG_POST_RE = re.compile(r"^\d{4}-\d+-\d+-(.*)\.md$")
|
BLOG_POST_RE = re.compile(r"^\d{4}-\d+-\d+-(.*)\.md$")
|
||||||
|
|
||||||
|
|
||||||
def main() -> int:
|
def main() -> int:
|
||||||
# Handle program arguments
|
# Handle program arguments
|
||||||
ap = argparse.ArgumentParser(
|
ap = argparse.ArgumentParser(
|
||||||
@ -53,8 +54,9 @@ def main() -> int:
|
|||||||
|
|
||||||
# Write out the new frontmatter
|
# Write out the new frontmatter
|
||||||
post.metadata["aliases"] = aliases
|
post.metadata["aliases"] = aliases
|
||||||
frontmatter.dump(post, file)
|
file_contents = frontmatter.dumps(post, sort_keys=False)
|
||||||
|
file_contents += "\n"
|
||||||
|
file.write_text(file_contents)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user