From: Stefan <son...@ba...> - 2005-11-29 18:42:14
|
I use this to add all different kind of styles to my phpwiki you can have a look here ... i don't know if it is usefull to make=20 classes for all the styles ... The syntax to use it is not really easy but we only need it very rarely. http://www.mineralienatlas.de/lexikon/index.php/Hilfe%20und%20Information= /Styles Thank you again Stefan Arnaud Fontaine schrieb: >-----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 : > > =20 > >>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: >> >> =20 >> >>>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: >>> >>> =20 >>> > > =20 > >>Stefan wrote: >> >> >> >> =20 >> >>>>>>The resulting html code looks like this: >>>>>> >>>>>><p class=3D"tightenable">2<font color=3D"red">2</font> 2</p> >>>>>> >>>>>> =20 >>>>>> >> >>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 >> =20 >> > > =20 > >>>> =20 >>>> >- ------------------------------------------------------- >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 > =20 > >>>> =20 >>>> > > =20 > >>> >>>------------------------------------------------------- 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 >>> >>> >>> =20 >>> > > >-----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----- > > > >------------------------------------------------------- >This SF.net email is sponsored by: Splunk Inc. Do you grep through log f= iles >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_idv37&alloc_id=16865&op=3Dclick >_______________________________________________ >Phpwiki-talk mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phpwiki-talk > > > =20 > |