3 if(!defined('DOKU_INC')) define('DOKU_INC', realpath(dirname(__FILE__
).'/../').'/');
4 define('NOSESSION', 1);
5 require_once(DOKU_INC
.'inc/init.php');
9 * A simple commandline tool to render some DokuWiki syntax with a given
12 * This may not work for plugins that expect a certain environment to be
13 * set up before rendering, but should work for most or even all standard
17 * @author Andreas Gohr <andi@splitbrain.org>
19 class RenderCLI
extends DokuCLI
{
22 * Register options and arguments on the given $options object
24 * @param DokuCLI_Options $options
27 protected function setup(DokuCLI_Options
$options) {
29 'A simple commandline tool to render some DokuWiki syntax with a given renderer.'.
31 'This may not work for plugins that expect a certain environment to be '.
32 'set up before rendering, but should work for most or even all standard '.
35 $options->registerOption('renderer', 'The renderer mode to use. Defaults to xhtml', 'r', 'mode');
41 * Arguments and options have been parsed when this is run
43 * @param DokuCLI_Options $options
44 * @throws DokuCLI_Exception
47 protected function main(DokuCLI_Options
$options) {
48 $renderer = $options->getOpt('renderer', 'xhtml');
51 $source = stream_get_contents(STDIN
);
53 $result = p_render($renderer, p_get_instructions($source), $info);
54 if(is_null($result)) throw new DokuCLI_Exception("No such renderer $renderer");
60 $cli = new RenderCLI();