Balasankar C

Balasankar C

Geek. Freedom. Privacy.

Home | Blog | Talks | Setup | Feed

publish2wp - Wordpress Publisher

Heyo folks,
I am pretty sure you all know about the numerous wordpress publishing scripts out there. Still, I wrote one. Why? Just to scratch my personal itch. I am not at all interested in opening up my browser (Mozilla Firefox) which actually is a memory thief. I would be in heaven if I could just do everything via the command line. So, writing posts was a "should-i-do-it-or-not" task for me always, just because of the laziness to open Firefox.

So, I checked out some of the wordpress posting apis and found out the package xmlrpc_wordpress to be a good one. So, I wrote a custom tool using that wrapper which read text files and posts them(or saves them as draft) to a wordpress instance. Guess what? I am publishing this post using that tool and it seems to work pretty fine. May update it so as to add support for tags and categories, but not sure if I'll still have the enthusiasm to do that after some time. Added category and tag support. So, if anyone want to try that tool, it is hosted in my GitLab Repo

I am using it in combination with a markdown to html converter script (which is actually a wrapper around the Python markdown module), which can be seen here. This is done to make sure as part of proofreading so that I can happily publish it directly.

import markdown
import sys

inputfile = open(sys.argv[1])
outputfile = open(sys.argv[2],'w')
markdowntext =
htmltext = markdown.markdown(markdowntext)