WordPress Codex Article Converter to HelpHub or translated version.
The codex-converter is aid tool for WordPress Codex migrator or translater. It automatically converts Codex article written by MediaWiki format to specified format.
For example, Codex article
==Title==
This is example article.
* List1
* List2
will be converted to HelpHub article by Codex to HelpHub converter.
<h2>Title</h2>
<p>This is example article.</p>
<ul>
<li>List1</li>
<li>List2</li>
</ul>
Current codex-converter package includes two type of converter:
Codex to HelpHub: http://unofficialtokyo.com/codex-converter
Codex Translator Aid Tool (Beta): http://unofficialtokyo.com/codex-translater-aid
You can convert on your local computer.
Codex to HelpHub:
php command-codextohelphub.php -i <input_file> -o <output_file>
Refer codex-converter.log. To change log file name or log level, edit class-logger.php direct.
codex-converter uses own Logger class only for a removal of external library dependency. That has the same interface with log4php with limitations.
You should use log4php if it is possible.
To use log4php
Codex to HelpHub:
<pre>
tag or line begin with space character is always converted to [code language="php"]
.Codex Translater Aid Tool (Beta):
README.md readme (This file)
testrun.bat (Windows) phpunit test kicker
run.bat (Windows) command line HelpHub launcher
src/
class-codex.php Codex class (main)
interface-converter.php Interface of Converter
ws-codex-converter.php receiver
class-logger.php Own poor Logger
class-result.php Output result keeper
class-util.php Utility handles line type
codex-converter.css stylesheet
loader.gif animated loader
sample-functions.php sample functions.php (part of)
sample-log-config.xml sample log4php configuration file
(codex-converter.log) (not included) log file
// --- Codex to HelpHub ---
page-codextohelphub.php Page Template
codex-converter.js invoker
codextohelphub.html standalone web page (test purpose)
command-codextohelphub.php command line interface
helphub
class-helphub-converter.php Converter class (main logic)
// ---Codex Translator Aid ---
page-codextranslatoraid.php Page Template
codex-translator-aid.js invoker
codextranslatoraid.html standalone web page (test purpose)
jacodex
class-jacodex-converter.php Converter class (main logic)
tests/
CodexHelpHubTest.php phpunit test for Codex to HelpHub
CodexJaCodexTest.php phpunit test for Codex Translator Aid
(others) test files
(others_expected) expected results
Codex to HelpHub Deployment steps are as following. Codex Translator Aid tool is the same except file name.
TARGET_URL
in codex-converter.js
to point the ws-codex-converter.php. For example, it is var TARGET_URL = 'ws-codex-converter.php';
or var TARGET_URL = '/ws-codex-converter/ws-codex-converter.php';
TARGET_URL
in codex-converter.js
as the first step, if you get error "XMLHttpRequest : 404, textStatus : error, errorThrown : undefined".It assumes phpunit can be invoked.
For test case details, refer tests/CodexHelpHubTest.php.
If you want to create your own converter, follow below steps:
$codex_to = new Codex( 'KoCodex' );
$output_data = $codex_to->convert( $input_data );
Akira Tachibana (http://unofficialtokyo.com)
convert()
handles string input/output.Util
class.TESTRUN
takes filter options.**
sub list support (#9)