[TextMate] Syntax Question: Including HTML in PHP syntax
Mats Persson
mats at imediatec.co.uk
Thu Oct 14 10:40:59 UTC 2004
Hi Rich & Sune,
> Umm, so what's wrong with the HTML-PHP syntax highlighting that ships
> with TM? Using this syntax, anything outside PHP delimiters is
> considered HTML and highlighted accordingly (albeit in grey), which is
> what you want, right?
Perhaps I didn't make myself clear enough, so let's use some images to
save me a 1000 words. ; )
in BBEdit 8.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic1.tiff
Type: image/tiff
Size: 10046 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20041014/4ad249c9/attachment.tiff>
-------------- next part --------------
in skEdit 3.5b5 with PHP syntax highlighting
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic5.tiff
Type: image/tiff
Size: 7062 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20041014/4ad249c9/attachment-0001.tiff>
-------------- next part --------------
in TextMate with 'HTML (Basic)' syntax highlighting
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic2.tiff
Type: image/tiff
Size: 8944 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20041014/4ad249c9/attachment-0002.tiff>
-------------- next part --------------
in TextMate with 'HTML (PHP)' syntax highlighting
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic3.tiff
Type: image/tiff
Size: 7864 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20041014/4ad249c9/attachment-0003.tiff>
-------------- next part --------------
in TextMate with 'PHP' syntax highlighting: (HTML treated as PHP code)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic4.tiff
Type: image/tiff
Size: 8966 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20041014/4ad249c9/attachment-0004.tiff>
-------------- next part --------------
What I would like is something along the lines of BBEdit & skEdit's and
their dual highlighting capabilities. In other words, when we are in a
.php file and exit php with ?> and then start having HTML code in
there, then the HTML code highlighting should work just as IF we were
using a .html file. And vice versa.
As it is right now, I have a choice of highlighting for HTML or for
PHP, BUT NOT both at the same time.
All my settings and the results thereof:
My HTML syntax file is in a bundle called mxHTML and the syntax file is
named mxHTML.plist and it is a copy of this file:
BASIC HTML DICTIONARY FOR TEXTMATE
==================================
Version 1.0 (Sune Foldager, Justin French, Allan Odgaard)
with the following changes (apart from colour settings):
name = "mxHTML";
/*
* embedded languages -- [SNIP]
*/
{ name = "Embedded PHP";
begin = "<\\?(php|=)?";
end = "\\?>";
patterns = (
{ include = "mxPHP"; }
);
},
My PHP syntax file is in a bundle called mxPHP and the syntax file is
named mxPHP.plist and its a copy of Jason Spahr's Smarty PHP bundle.
with the following changes:
name = "mxPHP";
{ name = "Embedded HTML";
begin = "\\?>";
end = "<\\?(php|=)?";
patterns = (
{ include = "mxHTML"; }
);
},
The same code block rendered with my syntax files:
with mxHTML syntax highlighting:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic6.tiff
Type: image/tiff
Size: 8002 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20041014/4ad249c9/attachment-0005.tiff>
-------------- next part --------------
with mxPHP syntax highlighting:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic7.tiff
Type: image/tiff
Size: 7524 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20041014/4ad249c9/attachment-0006.tiff>
-------------- next part --------------
Apologies for the length and size of this email, but I hope this will
have clarified my position and aid in solving this problem.
IF I am asking for the impossible, then Allan & gang has some more work
to do, else I am doing something wrong, and someone smarter than me
will hopefully point me in the right direction. : )
Kind regards,
Mats
More information about the textmate
mailing list