|
@@ -14,12 +14,12 @@ define("STACK_DEEP",8);
|
|
|
class MdRender{
|
|
class MdRender{
|
|
|
|
|
|
|
|
public static function tplSplit($tpl){
|
|
public static function tplSplit($tpl){
|
|
|
- $before = strstr($tpl,'{{',true);
|
|
|
|
|
- if(empty($before)){
|
|
|
|
|
|
|
+ $before = strpos($tpl,'{{');
|
|
|
|
|
+ if($before === FALSE){
|
|
|
//未找到
|
|
//未找到
|
|
|
return ['data'=>[$tpl,'',''],'error'=>0];
|
|
return ['data'=>[$tpl,'',''],'error'=>0];
|
|
|
}else{
|
|
}else{
|
|
|
- $pointer = strlen($before);
|
|
|
|
|
|
|
+ $pointer = $before;
|
|
|
$stack = array();
|
|
$stack = array();
|
|
|
$stack[] = $pointer;
|
|
$stack[] = $pointer;
|
|
|
$after = substr($tpl,$pointer+2) ;
|
|
$after = substr($tpl,$pointer+2) ;
|
|
@@ -60,8 +60,8 @@ class MdRender{
|
|
|
}else{
|
|
}else{
|
|
|
return ['data'=>
|
|
return ['data'=>
|
|
|
[
|
|
[
|
|
|
- $before,
|
|
|
|
|
- substr($tpl,strlen($before),$pointer-strlen($before)+2),
|
|
|
|
|
|
|
+ substr($tpl,0,$before),
|
|
|
|
|
+ substr($tpl,$before,$pointer-$before+2),
|
|
|
substr($tpl,$pointer+2)
|
|
substr($tpl,$pointer+2)
|
|
|
],
|
|
],
|
|
|
'error'=>0
|
|
'error'=>0
|