Publish AsciiDoc to WordPress

I wrote my last blog post about my first thoughts on AsciiDoc, in AsciiDoc. So when I have finished to write I wanted to post the article on my Blog. I have to confess that I thought there was a Worpdress plugin for writing in AsciiDoc.

But there is no one !

So after a Google Search, I found a python script that will use the Worpdress rpc feature to publish a post (or a page).

Installation

❗️ IMPORTANT You need to have Python 2.5 installed on your system

Before you need to install AsciiDoc, i will explain here how to install on OSx but, you will find all you need to know on the AsciiDoc WebSite.

Let see how to install on OSX.

The distribution source tarballs can be downloaded from the SourceForge http://sourceforge.net/projects/asciidoc/.

You can check if all went good :

Install Configure Script

Once you have installed AsciiDoc you can download and try the python script.

As I write this article, the Blogpost Script can be downloaded (or mercurial cloned) from Google Code. But the service is closing. I forked the project on GitHub so you can download (or clone) it from the GitHub Repo here.

Download Latest

DISCLAIMER I did not created the project and all rights are to Stuart Rackham. See his blog https://srackham.wordpress.com/blogpost-readme/

Install AsciiDoc Backend

Once you have downloaded the package, uncompress it and install the wordpress asciidoc backend :

Configure

Then you need to configure the script by creating a config file in your HOME directory :

You also need to disable the Convert emoticons like 😃 and 😛 to graphics on display feature of Worpdress.

You can find this option in the Writing Settings page of your Worpdress installation.

Then open the file ~/.blogpost to specify yout blog url and credentials :

  • ~/.blogpost
# WordPress XML_RPC URL (don't forget to append /xmlrpc.php)
URL = 'http://example.com/blog/xmlrpc.php'

# WordPress login name.
USERNAME = 'login'

# WordPress password.
PASSWORD = 'p@sszord'

Then you can use the script.

Usage

CAUTION You may want to read the script documentation to know how the script works, and which command line parameters you can use.

For example you want to publish your the article you wrote in the file : article.adoc.

Imagine you want to send this article to your blog, but not to publish the article (ie: you want to preview before publishing), you also want to define the title to “My First AsciiDoc Post” and you want to publish the article in the categorie AsciiDoc :

You will have to use the script like that :

This is quite simple, so please read the full documentation to learn how to use the script for your usage.

blogpost.py -c AsciiDoc -u -t "My First AsciiDoc Post" post article.adoc

NOTE :

When you use the script, it creates a file aside to the AsciiDoc file with the same name, and the extension : blogspot. This will allow the script to retrieve data in order to update blog post.

Here it is …

Good Writing !