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 datetime
import yaml
blog_title = input('title for the entry: ') blog_title = input('title for the entry: ')
title_date = input('date for the entry (format:yyyy-mm-dd|defaults to today): ') 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" title: "go: `:=` operator causes accidental shadowing"
date: 2016-01-14 21:13 date: 2016-01-14 21:13
comments: true comments: true
categories: tags: tag1, tag2..
- go
''' '''
metadata_fmt = """--- metadata_fmt = """---
layout: post layout: post
title: "{}" title: "{}"
date: {} date: {}
comments: true comments: true
categories: tags: {}
{}
--- ---
""" """
catblock = " - {}" catblock = " - {}"
@ -39,7 +36,7 @@ cats = map(catblock.format, tags.split())
metadata_fmt = metadata_fmt.format( metadata_fmt = metadata_fmt.format(
blog_title, blog_title,
title_date, title_date,
'\n'.join(cats) ', '.join(cats)
) )
with open('blog/{}'.format(filename), 'w') as f: with open('blog/{}'.format(filename), 'w') as f: