58b20109cf
import sys import yaml with open(sys.argv[1]) as fp: data = fp.read() if not data.find("---") == 0: # no head print("NO YAML HEAD FOUND") sys.exit(-1) data = data[3:] head_end = data.find("---") head = data[0:head_end] data = data[head_end+3:] metadata = yaml.safe_load(head) cats = metadata.pop('categories', None) if cats != None: if type(cats) == list: tags = cats elif type(cats) == str: tags = cats.split() tags = list(map(lambda t: t.lower(), tags)) metadata["tags"] = ", ".join(tags) new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}" # write it print(f"coverted: categories to tags: {tags} - {sys.argv[1]}") with open(sys.argv[1], "w") as fp: fp.write(new_data) sys.exit(0) if not metadata.get("tags", None): metadata["tags"] = "untagged" new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}" print(f"untagged: {sys.argv[1]}") # write it with open(sys.argv[1], "w") as fp: fp.write(new_data) sys.exit(0) print("No changes needed")
524 B
524 B
comments | date | layout | tags | title |
---|---|---|---|---|
true | 2013-05-03 21:01 | post | posterous, update, octopress | New Home |
I loved posterous. I don't know how I missed it but till the final day I had no clue they were shutting down. It was an hour of panic. I had every itch not to go back to wordpress. It was bloated and just not my thing, and Jekyll was way to much work!
Then I found Octopress - just the right thing, simply perfect. And it was love at first sight. :)
Welcome to my new home, Backtrace