From: Reini U. <ru...@x-...> - 2005-11-30 21:25:49
|
Stefan schrieb: > Ihave changed the code as following and made it with span > > class Markup_color extends BalancedMarkup { > // %color=blue% blue text %% and back to normal > var $_start_regexp = "%color=(?: [^%]*)%"; > var $_end_regexp = "%%"; > function markup ($match, $body) { > $color = substr($match, 7, -1); > if (strlen($color) != 7 > and in_array($color, array('red', 'blue', 'grey', 'black', > 'green', 'yellow', 'darkgreen', 'darkblue'))) { > // must be a name > return new HtmlElement('span', array('style' => > 'color:'.$color), $body); > } elseif ((substr($color,0,1) == '#') > and (strspn(substr($color,1),'0123456789ABCDEFabcdef') > == strlen($color)-1)) { > return new HtmlElement('span', array('style' => > 'color:'.$color), $body); > } else { > trigger_error(sprintf(_("unknown color %s ignored"), $color), > E_USER_WARNING); > } > } > } > > now it works thank you for the tip Ah, Stefan's first useful patch! Will be added. Thanks. |