4 * A simple commandline tool to render some DokuWiki syntax with a given
7 * This may not work for plugins that expect a certain environment to be
8 * set up before rendering, but should work for most or even all standard
12 * @author Andreas Gohr <andi@splitbrain.org>
14 if ('cli' != php_sapi_name()) die();
16 ini_set('memory_limit','128M');
17 if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
18 define('NOSESSION',1);
19 require_once(DOKU_INC.'inc/init.php');
20 require_once(DOKU_INC.'inc/common.php');
21 require_once(DOKU_INC.'inc/parserutils.php');
22 require_once(DOKU_INC.'inc/cliopts.php');
26 $long_opts = array('help','renderer:');
27 $OPTS = Doku_Cli_Opts::getOptions(__FILE__,$short_opts,$long_opts);
28 if ( $OPTS->isError() ) {
29 fwrite( STDERR, $OPTS->getMessage() . "\n");
34 foreach ($OPTS->options as $key => $val) {
48 $source = stream_get_contents(STDIN);
50 $result = p_render($RENDERER,p_get_instructions($source),$info);
51 if(is_null($result)) die("No such renderer $RENDERER\n");
58 print "Usage: render.php <options>
60 Reads DokuWiki syntax from STDIN and renders it with the given renderer
64 -h, --help show this help and exit
65 -r, --renderer <renderer> the render mode (default: xhtml)