From: Stefan <son...@ba...> - 2005-11-29 17:05:18
|
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 Stefan schrieb: > May it's not a good idea but it's part of phpwiki > > InlineParser.php > > 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('font', array('color' => $color), > $body); > } elseif ((substr($color,0,1) == '#') > and > (strspn(substr($color,1),'0123456789ABCDEFabcdef') == > strlen($color)-1)) { > return new HtmlElement('font', array('color' => $color), > $body); > } else { > trigger_error(sprintf(_("unknown color %s ignored"), > $color), E_USER_WARNING); > } > } > } > > Stefan > > Arnaud Fontaine schrieb: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Stefan wrote: >> >> >> >>> The resulting html code looks like this: >>> >>> <p class="tightenable">2<font color="red">2</font> >>> 2</p> >>> >> >> >> OMG !!! >> >> Well ... the font element is not a great idea ... you'd better use span >> with an inline style or a class you define in your css file. >> >> <p class="tightenable">2<span style="color:#f00;">2</span>2</p> >> >> Arnaud >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.2 (GNU/Linux) >> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org >> >> iD8DBQFDjILEyAf3wgFyy1ARAv3bAKDpy4rfEyNNzBc45/qGTi08vgmbjQCgyIlu >> gu1rMhOhaCavnlADsZxv8FQ= >> =41Ay >> -----END PGP SIGNATURE----- >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. Do you grep through >> log files >> for problems? Stop! Download the new AJAX search engine that makes >> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! >> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click >> _______________________________________________ >> Phpwiki-talk mailing list >> Php...@li... >> https://lists.sourceforge.net/lists/listinfo/phpwiki-talk >> >> >> >> > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > _______________________________________________ > Phpwiki-talk mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwiki-talk > > |