A serverside application, customized for our particular CMS needs, specifically, an interface that utilized familiar technologies was required. Thus, this application integrates with existing directory services. Authors need only mount/connect to their respective directories, create the article in Word/LibreOffice etc... and drop a folder containing: their docx article, a featured image (if any) and category tags to their folder.
A small application - more a utility, built for Linux. providing just enough flexibility and functionality to get the job done. It is currently running as a cronjob but with a little elbow, it can be converted into a daemon or DirectoryWatchService.
During the setup of Docx2Wordpress, author directories are created (or updated) based on existing WP-authors. A set of files representing the available categories are also created.
Directory services, in this use-case, are by ACL over webDav. My user has access to all test accounts however, in practice authors only have access their own folders.
- The article may contain inlined images
- The article may utilize: endnotes, list-styles and the set of common document structures/styles as supported by mammoth
- In Word/LibreOffice, create a style named Title. Use this style to mark the article/post title.
- Create a folder for the article,
article-dir/
- Save the article as a docx file to
article-dir/
- Copy article-dir to the author's folder
- Copy the files representing the desired categories
Connect to Linux shell.
- Maven
- Java 8
- Linux (BASH)
- Wordpress and WP-CLI
mvn clean compile package
java -cp target/converter.jar com.rasajournal.DocxConvSetup WordPressHome WatchedDirectory
This Creates the category files and and author directories and sets file permissions in an attempt to prevent accidental deletion - Note. this depends on the current user's access privilege.
It may be helpful to run setup in a weekly cronjob depending on the frequency that new categories or authors are added.
java -jar target/converter.jar WordPressHome WatchedDirectory
- Find *.docx articles
- Sort out the author and applicable categories
- Post to WordPress
Runs in a cron. Articles have to be in before publish times.
- Extern and integrate configuration with WP-configuration
- Add upload of Video(s) with article
- Enable auto-creation of authors
- Enable remote POSTing
- Implement a strategy to give Publisher control over Publish time/date
In addition to the libraries mentioned in the POM, credit for tackling the more challenging aspects goes to:
- WP-CLI - for talking to Wordpress
- Mammoth Converter - for docx extraction API