Update new post script for new tagging format

This commit is contained in:
Dhananjay Balan 2019-01-28 17:23:15 -05:00
parent 58b20109cf
commit 6d9b32233b

View File

@ -1,6 +1,5 @@
#!/usr/bin/env python
#!/usr/local/bin/python3
import datetime
import yaml
blog_title = input('title for the entry: ')
title_date = input('date for the entry (format:yyyy-mm-dd|defaults to today): ')
@ -20,16 +19,14 @@ layout: post
title: "go: `:=` operator causes accidental shadowing"
date: 2016-01-14 21:13
comments: true
categories:
- go
tags: tag1, tag2..
'''
metadata_fmt = """---
layout: post
title: "{}"
date: {}
comments: true
categories:
{}
tags: {}
---
"""
catblock = " - {}"
@ -39,7 +36,7 @@ cats = map(catblock.format, tags.split())
metadata_fmt = metadata_fmt.format(
blog_title,
title_date,
'\n'.join(cats)
', '.join(cats)
)
with open('blog/{}'.format(filename), 'w') as f: