|
|
@@ -79,7 +79,7 @@ class MdRender{
|
|
|
}
|
|
|
return $output;
|
|
|
}
|
|
|
- public static function xml2tpl(string $xml, $channelId=""):string{
|
|
|
+ public static function xml2tpl(string $xml, $channelId="",$mode='read'):string{
|
|
|
/**
|
|
|
* 解析xml
|
|
|
* 获取模版参数
|
|
|
@@ -114,7 +114,7 @@ class MdRender{
|
|
|
/**
|
|
|
* 生成模版参数
|
|
|
*/
|
|
|
- $tplRender = new TemplateRender($props,$channelId,'edit');
|
|
|
+ $tplRender = new TemplateRender($props,$channelId,$mode);
|
|
|
$tplProps = $tplRender->render($tpl_name);
|
|
|
if($tplProps){
|
|
|
$tpl->addAttribute("props",$tplProps['props']);
|
|
|
@@ -127,13 +127,13 @@ class MdRender{
|
|
|
return $html;
|
|
|
}
|
|
|
|
|
|
- public static function render2($markdown,$channelId='',$queryId=null){
|
|
|
+ public static function render2($markdown,$channelId='',$queryId=null,$mode='read'){
|
|
|
$wiki = MdRender::markdown2wiki($markdown);
|
|
|
$html = MdRender::wiki2xml($wiki);
|
|
|
if(!is_null($queryId)){
|
|
|
$html = MdRender::xmlQueryId($html, $queryId);
|
|
|
}
|
|
|
- $tpl = MdRender::xml2tpl($html,$channelId);
|
|
|
+ $tpl = MdRender::xml2tpl($html,$channelId,$mode);
|
|
|
return $tpl;
|
|
|
}
|
|
|
public static function markdown2wiki(string $markdown): string{
|
|
|
@@ -170,8 +170,8 @@ class MdRender{
|
|
|
/**
|
|
|
*
|
|
|
*/
|
|
|
- public static function render($markdown,$channelId,$queryId=null){
|
|
|
- return MdRender::render2($markdown,$channelId,$queryId);
|
|
|
+ public static function render($markdown,$channelId,$queryId=null,$mode='read'){
|
|
|
+ return MdRender::render2($markdown,$channelId,$queryId,$mode);
|
|
|
|
|
|
$html = MdRender::markdown2wiki($markdown);
|
|
|
|