From: Arnaud F. <ar...@cr...> - 2005-11-29 18:07:35
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Great ! Adding a class 'red' to the span or, better, a more semantic name like 'essential', 'important', defining the class in the css file might be an even better solution. Stefan a =E9crit : > Ihave changed the code as following and made it with span > > class Markup_color extends BalancedMarkup { // %color=3Dblue% blue > text %% and back to normal var $_start_regexp =3D "%color=3D(?: > [^%]*)%"; var $_end_regexp =3D "%%"; function markup ($match, $body) > { $color =3D substr($match, 7, -1); if (strlen($color) !=3D 7 and > in_array($color, array('red', 'blue', 'grey', 'black', 'green', > 'yellow', 'darkgreen', 'darkblue'))) { // must be a name return new > HtmlElement('span', array('style' =3D> 'color:'.$color), $body); } > elseif ((substr($color,0,1) =3D=3D '#') and > (strspn(substr($color,1),'0123456789ABCDEFabcdef') =3D=3D > strlen($color)-1)) { return new HtmlElement('span', array('style' > =3D> '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=3Dblue% blue >> text %% and back to normal var $_start_regexp =3D "%color=3D(?: >> [^%]*)%"; var $_end_regexp =3D "%%"; function markup ($match, >> $body) { $color =3D substr($match, 7, -1); if (strlen($color) !=3D 7 >> and in_array($color, array('red', 'blue', 'grey', 'black', >> 'green', 'yellow', 'darkgreen', 'darkblue'))) { // must be a name >> return new HtmlElement('font', array('color' =3D> $color), $body); >> } elseif ((substr($color,0,1) =3D=3D '#') and >> (strspn(substr($color,1),'0123456789ABCDEFabcdef') =3D=3D >> strlen($color)-1)) { return new HtmlElement('font', array('color' >> =3D> $color), $body); } else { trigger_error(sprintf(_("unknown >> color %s ignored"), $color), E_USER_WARNING); } } } >> >> Stefan >> >> Arnaud Fontaine schrieb: >> > Stefan wrote: > > > >>>>> The resulting html code looks like this: >>>>> >>>>> <p class=3D"tightenable">2<font color=3D"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=3D"tightenable">2<span style=3D"color:#f00;">2</span>2</p> > > Arnaud >>> >>> - ------------------------------------------------------- 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=3D7637&alloc_id=3D16865&op=3Dclick _______________________________________________ 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=3D7637&alloc_id=3D16865&op=3Dclick >> _______________________________________________ Phpwiki-talk >> mailing list Php...@li... >> https://lists.sourceforge.net/lists/listinfo/phpwiki-talk >> >> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDjJjbyAf3wgFyy1ARAiLYAKCs6km8KbSwojtZhMZgt3Bu0LXFVwCgm2rC r/L/MGpJm1NYXVIgncJ6PZg=3D =3DwCXi -----END PGP SIGNATURE----- |