Re: Update to Zend Highlighter
| From: | Justin Martin | Date: | Thu, 02 Apr 2009 17:49:59 +0000 |
| Subject: | Re: Update to Zend Highlighter | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-43609@lists.php.net to get a copy of this message | ||
I do like using the same INI setting name which depends on the
use_external_styles setting.
However, no stylesheet should be automatically included. The highlight
functions do not produce a whole page, except in the case of a .phps
(PHP Source file). It should be up to the user to manage how they want
their stylesheet included.
Thanks,
Justin
Davey Shafik wrote:
> Why not just re-use the same highlight.*, they can be colors or classes...
>
> <span class="%highlight.comment%"> or <span style="color:
> %highlight.comment">
>
> you switch this based on "highlight.use_external_styles". You could also
> add a: "highlight.add_stylesheet"
> to add a default stylesheet created by PHP...
>
> - Davey
>
> Lewis Wright wrote:
>> Why not allow a class prefix as an option to the function?
>>
>> Eg:
>>
>> 'php-highlighted-' as the prefix would produce things like
>> 'php-highlighted-keyword'.
>>
>> That way there's no risk of collision and there's no need to
>> over-complicated things.
>>
>> 2009/4/2 Robert Cummings<robert@interjinn.com>:
>>
>>> On Thu, 2009-04-02 at 09:13 -0700, Chris Stockton wrote:
>>>
>>>> On Thu, Apr 2, 2009 at 8:02 AM, Robert
>>>> Cummings<robert@interjinn.com> wrote:
>>>>
>>>>> Wrap the whole highlighted block in a div with a class:
>>>>>
>>>>> <div class="php-highlighted-code">
>>>>> </div>
>>>>>
>>>>> Add one more INI setting to change that class. Let users leverage
>>>>> hierarchical CSS rules:
>>>>>
>>>>> div.php-highlighted-code span.keyword { color: red; }
>>>>>
>>>> I like that, and would further elaborate instead of INI changes etc,
>>>> allow a key-value pair array to be passed as a third argument. Perhaps
>>>> ini changes could be the "default" names.
>>>>
>>>> mixed highlight_file (string $filename [, bool $return= false [, array
>>>> $class_names]]);
>>>>
>>>> comment|default|keyword|html|string)
>>>>
>>>> Array(
>>>> 'div_wrapper' => 'xyz-cms-div-wrapper',
>>>> 'default' => 'xyz-cms-default',
>>>> 'etc' => 'xyz-cms-etc',
>>>> );
>>>>
>>>> The good thing about this as well, is for some odd or logical reason
>>>> if your using highlighting multiple times, you can change the class
>>>> names of each highlight without something like ini_set.
>>>>
>>> To be honest I don't think it's necessary, and on further reflection I
>>> don't think you even need to offer an INI setting to change the class
>>> name since if you want different styling you can merely wrap the the
>>> main div in your own div and use another hierarchical level:
>>>
>>> <div class="alt-highlighting">
>>> <div class="php-highlighted-code">
>>> </div>
>>> </div>
>>>
>>> And the css:
>>>
>>> div.alt-highlighting div.php-highlighted-code span.keyword
>>> {
>>> color: blue;
>>> }
>>>
>>> So being able to change the outer class name seems redundant.
>>>
>>> Cheers,
>>> Rob.
>>> --
>>> http://www.interjinn.com
>>> Application and Templating Framework for PHP
>>>
>>>
>>> --
>>> PHP Internals - PHP Runtime Development Mailing List
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>
>>
>>
>