solution for proper highlighting of script/style tags
Submitted by Wednesday, 17 May, 2006 - 01:37
on
Hey all, I was always bothered by how SCRIPT and STYLE tags in HTML or PHP mode look kind of ugly because of how those modes have to delegate their contents to the right ruleset. This may have been discovered already but I've found a pretty simple solution. I'm not sure if I should release it to the files section though, as my mode files are pretty customized in other ways too (customized OCD style ).
Basically, my new rules highlight any occurences of '<script' or '<style' as 'MARKUP', along with their matching closing tags, and delegate everything between them to a 'mediating' ruleset, which imports the rules from the TAGS ruleset (so any attributes of the style or script tag are highlighted properly), but adds a rule to delegate anything after '>' to either CSS mode or Javascript mode. Doesn't sound as simple as I thought.
Anyway, I can't get HTML to show up on this forum, so if you want to see what the rules look like in html.xml, look at this file:
http://www.flowingcreativity.net/jedit-better-rules.txt
Basically, my new rules highlight any occurences of '<script' or '<style' as 'MARKUP', along with their matching closing tags, and delegate everything between them to a 'mediating' ruleset, which imports the rules from the TAGS ruleset (so any attributes of the style or script tag are highlighted properly), but adds a rule to delegate anything after '>' to either CSS mode or Javascript mode. Doesn't sound as simple as I thought.
Anyway, I can't get HTML to show up on this forum, so if you want to see what the rules look like in html.xml, look at this file:
http://www.flowingcreativity.net/jedit-better-rules.txt