|
Posted by Kristian Hellquist on 01/31/05 01:46
The expression that I found won't work anymore is an own pseudo-lang
markup that renders into html-lists.
Expression for grabbing a list, Example:
[lista] some text [/lista]
@\[\s*(lista)\s*(sq|o|\*|#|a|i)?\s*\]([^\x00]*?)\[/\s*\1\s*\]@i
$3 is then treated separated into html list-items <li>.
List-items are created by a pseudotag [punkt] or linebreaks. Its one
way, you can't mix them both here.
// Explode the string into an array
$hits = preg_split('#(\[\s*punkt\s*\][^\x00]*?\[/\s*\punkt\s*\])#',
$matches[3], -1, PREG_SPLIT_DELIM_CAPTURE);
$textarray=array();
foreach($hits as $index=>$element){
if( ($index%2)==0){
// strings
$element = preg_split('/\s*\r+
\s*/', trim($element), -1, PREG_SPLIT_NO_EMTPY);
foreach($element as $val){
// Replace innerstyles
if(strlen(trim
($val))>0){
// Replace
nestled lists
//$val=$this-
>search_and_replace($val, $this->_reg_search['lista'] );
$val=$this-
>_check_content($val , $matches[1] );
// Add list
element
array_push
($textarray, '<li '.$list_style.'>'.$val.'</li>');
}
}
}else{
// [punkt]
$element=preg_replace('#
\[\s*punkt\s*\]([^\x00]*?)\[/\s*\punkt\s*\]#', '$1',$element);
// replace linebreaks
$element = preg_replace('/\r/',
'<br />', $element);
// Replace innerstyles
// Replace nestled lists
//$val=$this->search_and_replace
($val, $this->_reg_search['lista'] );
$element=$this->_check_content
($element , $matches[1] );
// Add list element
array_push($textarray, '<li
'.$list_style.'>'.$element.'</li>');
}
}
> Kristian Hellquist wrote:
> > Hi!
> >
> > I had a script for parsing text into html, similar to phpBB. Everything
> > has been working fine until now. Some of my 'pseudotags' like [b] are
> > still recognized (parsed into <b>) but some more advanced pattern
> > matching is not. I haven't changed the code, but the php-version on the
> > server has changed from "default" on debian-woody to php-4.3.10. I
> > haven't made the upgrade myself.
> >
> > The users of the site reported the bug to me this week, but the users
> > aren't active so I don't really know when then bug was created. Because
> > I know it has worked before.
> >
> > Does any of you have a clue or experience of this? Or has my code been
> > mysterious altered on the server?
>
> An example of the expressions?
Navigation:
[Reply to this message]
|