File base post to Wordpress with Asciidoc format


Keywords
wordpress, asciidoc, asciidoctor, markup, api
License
MIT
Install
pip install asc2wp==0.7.0

Documentation

asc2wp

Asc2wp is Asciidoc format file base post solution for Wordpress.

Requirement

  • Asciidoctor

  • python-wordpress-xmlrpc

  • pyyaml

Installation

You can install the Asc2wp using the pip command:

$ pip install asc2wp

Usage

Initialize

Make setting file (setting.yaml).

$ asc2wp init
Example
url: http://abcdefg.abc
xmlrpc_url: http://abcdefg.abc/xmlrpc.php
username: admin
password: admin
remove_div: False
remove_p: False
remove_p_tableblock: False

Please write your informations.
Don’t use "https://", Please write "http://".

Options

  • remove_div

  • remove_p

  • remove_p_tableblock

Can you remove DIV, P tags. If you want these tags, please input "True". Default setteing is "Fales".

Make template file

Make Post type or Page type Template file.

$ asc2wp makefile

The extension will be added automatically. (.adoc)

Example
:wp_type: post
:wp_status: publish ( draft / private / pending / publish )
:wp_date: (automatically)
:wp_modified: (automatically)
:wp_id: (automatically)
:wp_title:
:wp_slug:
:wp_category: cat1, cat2, cat3 (separated by commas)
:wp_tag: tag1, tag2, tag3 (separated by commas)
:wp_excerpt:
:wp_thumbnail: (input attachments id)

:toc:
:imagesdir: https://abcdefg.abc/wp-content/uploads/

//asciidoc contents

You can also use Asciidoctor Document headers.
If you have new posts, posts id’s will be added after ":wp_id: ".
So, If already have id’s in the file, it is treated as editing post.

Post to Wordpress

$ asc2wp {asciidoc-files}

You can also use wild card.

Example
$ asc2wp 2016-05-*.adoc

After upload, displayed Post informations on console.

Media Upload

$ asc2wp -m {image-files}

You can also use wild card.

Example
$ asc2wp -m /images/*.jpg

After upload, displayed attachments ID and file name and file’s URL on console.