Home Download Buy Blog Forum Support

Custom Coloration within values of PHP-Arrays

Custom Coloration within values of PHP-Arrays

Postby adrianzeitblom on Fri Dec 28, 2012 2:10 pm

Hi,

it would be great, if anybody could help me:
I write a lot of php-arrays in which I use a custom syntax, delimited with "{{" and "}}".
Here is an example:

Code: Select all
array  (
    "text" =>
    "Ubi ea {{dies||dies (im fem!)||festgesetzter Tag}} venit, Carnutes Gutuatro et Conconnetodumno");

At the moment the whole text has the same (brown) colour. In cases of long texts it's really difficult and inconvenient to distinguish text from parentheses.
How can I choose another colour for the area between the brackets?

(I am using the "Pastels on Dark"-Theme.)

Thanks a lot in advance!
adrianzeitblom
 
Posts: 2
Joined: Fri Dec 28, 2012 1:51 pm

Re: Custom Coloration within values of PHP-Arrays

Postby agibsonsw on Fri Dec 28, 2012 8:36 pm

The double-braces are also embedded in a string, so I think it will be very tricky to re-write the PHP syntax to target these.

I think you might be better served by investigating the BracketHighlighter package, although I am unable to confirm whether this will work for braces within strings :?: Edited: The package readme says YES!
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Custom Coloration within values of PHP-Arrays

Postby FichteFoll on Sat Dec 29, 2012 2:37 am

You can create your own syntax definition using regexps as shown here. Then you just need to edit the existing PHP definition and add some "include": "your.new.syntax.scope" (or as xml <key>include</key><string>the.new.syntax.scope</string>).

pr0 tip would be to copy the PHP-definition (into your User dir), rename it (also change the "name" key in the file itself) and do the stuff above with that copy. This way you can choose between the normal and your modified syntax.
FichteFoll
 
Posts: 313
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: Custom Coloration within values of PHP-Arrays

Postby adrianzeitblom on Wed Jan 02, 2013 2:50 pm

The BracketHighlighter package indeed provides some help, but I will also give the second advise a try.
Thanks a lot for your help!
adrianzeitblom
 
Posts: 2
Joined: Fri Dec 28, 2012 1:51 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 19 guests

cron