~dbalan/blogng unlisted

6d9b32233ba24c98e972c0469c4811679f6c6ccf — Dhananjay Balan 1 year, 11 months ago 58b2010
Update new post script for new tagging format
1 files changed, 4 insertions(+), 7 deletions(-)

M new_post.py
M new_post.py => new_post.py +4 -7
@@ 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: