[TextMate] Syntax Question: Including HTML in PHP syntax
Allan Odgaard
allan at macromates.com
Thu Oct 14 11:07:18 UTC 2004
On 14. Oct 2004, at 12:40, Mats Persson wrote:
> 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.
No, the "HTML (PHP)" does do this. But the colors of HTML is toned down
significantly.
> with the following changes:
>
> name = "mxPHP";
>
> { name = "Embedded HTML";
> begin = "\\?>";
> end = "<\\?(php|=)?";
> patterns = (
> { include = "mxHTML"; }
> );
> },
But as Sune said, HTML is not embedded in the file. HTML _is_ the file.
So either make the mxHTML include mxPHP or do a "wrapper" for both like
this:
name = "mxHTML + PHP";
...
patterns = (
{ name = "Embedded PHP"; begin = "<\\?(php|=)?"; end = "\\?>";
patterns = ( { include = "mxPHP"; } );
},
{ include = "mxHTML"; }
);
This will use the mxPHP patterhs for everything inside the PHP tags,
and for the rest, it'll use the mxHTML patterns.
I didn't test this, but it I think it should work. However, the wrapper
is sort of redundant, unless you want to re-use the mxHTML patterns
without the PHP inclusion.
Kind regards Allan
More information about the textmate
mailing list