<?php
// PukiWiki - Yet another WikiWikiWeb clone.あ
// $Id: deputy.inc.php,v 1.0 2011/12/11 00:00:00 K.Yamasaki Exp $
//
// Showing Deputy Page functions for Pukiwiki plugin.
// expan.php and xxxx.inc.php are needed.
// License: GPL v2 or (at your option) any later version
// Usage : #deputy(PageName) {{ Wiki Statements }}

function plugin_deputy_convert() {
	$arg_num = func_num_args();
	$args = func_get_args();
	$page=$args[0];
	$obj = new expan_session();
	if (!$obj->check()) {
		if ( $arg_num <= 1 ) {
			return;
		}
		else {
			$lines = get_source($page);
			if ( $lines[0] == '') {
				return '<p> deputy: The given wiki page[' . $page . '] does not exist. </p>';
			}
			$source = implode('', $lines);
			return convert_html($source);
		}
	}
	else {
		if ( $arg_num == 0 ) {
			return;
		}
		$text = $args[$arg_num - 1];
		$lines = mbsplit("\r" ,$text);
		return convert_html($lines);
	}
}

?>
