[TxMt] Customizing Default Bundles

Allan Odgaard throw-away-1 at macromates.com
Sun Mar 19 03:02:03 UTC 2006


On 19/3/2006, at 3:47, Ken Scott wrote:

> [...] If I included PHP to mine, I would then want to modify HTML,  
> and have the same issue.

Yes -- unfortunately there is no good solution to this problem ATM.

One could create both a new PHP and a new HTML (which include the old  
HTML and your new PHP).

So something like:

    // custom PHP
    {  name = "source.php.custom";
       patterns = (
          ... // our rules
          { include = "source.php"; }
       );
    }

    // custom HTML
    {  name = "text.html.custom";
       ... // folding markers and stuff
       patterns = (
          { begin = '<\?php'; end = '\?>';
            include = "source.php.custom"; },
          { include = "text.html.basic"; }
       );
    }

With this approach only the “root” <?php … ?> constructs though would  
get the custom PHP rules. To have it used e.g. also in attribute  
values, one would have to replicate more of the HTML grammar.




More information about the textmate mailing list