type = 'list';
$this->regexp = "/^([\*#-]+)(.*)/";
}
function open()
{
$this->_previousTag = $this->_detectMatch[1];
$this->_firstTagLen = strlen($this->_previousTag);
$this->_firstItem=true;
if(substr($this->_previousTag,-1,1) == '#')
return "
\n";
else
return "\n";
}
function close()
{
$t=$this->_previousTag;
$str='';
for($i=strlen($t); $i >= $this->_firstTagLen; $i--) {
$str.=($t{$i-1}== '#'?"
\n":"\n");
}
return $str;
}
function getRenderedLine()
{
$t=$this->_previousTag;
$d=strlen($t) - strlen($this->_detectMatch[1]);
$str='';
if( $d > 0 ){ // on remonte d'un ou plusieurs cran dans la hierarchie...
$l=strlen($this->_detectMatch[1]);
for($i=strlen($t); $i>$l; $i--){
$str.=($t{$i-1}== '#'?"\n":"\n");
}
$str.="\n";
$this->_previousTag=substr($this->_previousTag,0,-$d); // pour ĂȘtre sur...
}
elseif( $d < 0 ) { // un niveau de plus
$c=substr($this->_detectMatch[1],-1,1);
$this->_previousTag.=$c;
$str=($c == '#'?"\n- ":"
\n- ");
}
else {
$str=($this->_firstItem ? '
- ':'
- ');
}
$this->_firstItem=false;
return $str.$this->_renderInlineTag($this->_detectMatch[2]);
}
}