Hello,
I noticed that my TextMate updated this morning to Version 1.5.5 (1383). Along with this came a new feature in the HTML Bundle which I have found is causing me some annoyances. The feature I am talking about is in response to ticket 20CC5FF4.
I am using PHP with Smarty as my template engine, and previously I would include <!--{literal}--> in my code to escape Smarty parsing on script blocks. Now when I do this the entire block of code becomes commented out. While this is not a crucial bug it is a new annoyance for me as it is very useful to have syntax highlighting on script blocks.
Here is an example of my code:
<!--{literal}--> <script language="javascript"> function foo() { return "bar"; } </script> <!--{/literal}-->
If you require more information please just let me know. If anyone has any idea how to fix this I would greatly appreciate it.
Thank you.
--- Philip Plante 913-302-9933 mail@pplante.com
Phillip,
On Apr 30, 2007, at 6:58 PM, Philip Plante wrote:
I am using PHP with Smarty as my template engine, and previously I would include <!--{literal}--> in my code to escape Smarty parsing on script blocks. Now when I do this the entire block of code becomes commented out. While this is not a crucial bug it is a new annoyance for me as it is very useful to have syntax highlighting on script blocks.
Here is an example of my code:
<!--{literal}-->
<script language="javascript"> function foo() { return "bar"; } </script>
<!--{/literal}-->
Why do you wish to enclose the smarty {literal} in a html comment (which should be <!-- {literal} --> anyway) ? Smarty will remove the {literal} before the browser sees it.
Roger,
The reason I do this is because previously Textmate would turn off syntax highlighting for anything between {literal} and {/literal}. So I found that if you wrapped it in comments then it canceled out. But now that this new update has come out it has changed that behavior again.
Make sense?
--- Philip Plante 913-302-9933 phil.plante@transmuto.com
On Apr 30, 2007, at 6:36 PM, Roger Roelofs wrote:
Phillip,
On Apr 30, 2007, at 6:58 PM, Philip Plante wrote:
I am using PHP with Smarty as my template engine, and previously I would include <!--{literal}--> in my code to escape Smarty parsing on script blocks. Now when I do this the entire block of code becomes commented out. While this is not a crucial bug it is a new annoyance for me as it is very useful to have syntax highlighting on script blocks.
Here is an example of my code:
<!--{literal}-->
<script language="javascript"> function foo() { return "bar"; } </script>
<!--{/literal}-->
Why do you wish to enclose the smarty {literal} in a html comment (which should be <!-- {literal} --> anyway) ? Smarty will remove the {literal} before the browser sees it.
-- Roger Roelofs
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Philip,
On Apr 30, 2007, at 7:47 PM, Philip Plante wrote:
The reason I do this is because previously Textmate would turn off syntax highlighting for anything between {literal} and {/literal}. So I found that if you wrapped it in comments then it canceled out. But now that this new update has come out it has changed that behavior again.
Here is an example of my code:
<!--{literal}-->
<script language="javascript"> function foo() { return "bar"; } </script>
<!--{/literal}-->
Use this instead (notice the spaces in the commenets) and you will get the same behavior.
<!-- {literal} --> <script language="javascript"> function foo() { return "bar"; } </script> <!-- {/literal} -->
I rarely put script/style elements in my pages (except to reference external documents), so I had never noticed this before. Thanks for helping me see this.
On 1. May 2007, at 01:47, Philip Plante wrote:
The reason I do this is because previously Textmate would turn off syntax highlighting for anything between {literal} and {/literal}. So I found that if you wrapped it in comments then it canceled out. But now that this new update has come out it has changed that behavior again.
Make sense?
So the real problem is with the {literal} rule in the HTML grammar.
What you can do is go to the HTML grammar in the bundle editor, locate this rule, and insert ‘disabled = 1;’. Then you won’t need to put comments around {literal} in your source.
What you really want though (I think) is probably for this rule to include the HTML grammar (between {literal}…{/literal}) *except* for the Smarty part of it (since we only want to disable Smarty in such block) -- this is easy with the forthcoming scope injection, but presently a pain to do (we’d have to restructure things, and it is made further complicated by Smarty not being a grammar which we have enabled by default)…
If there are any Smarty users which have suggestions as what to do with the {literal} rule “out of the box”, I am all ear.
For now I will do as you suggested and disable it while I wait for the forthcoming scope injection you spoke of.
Thanks for the help!
--- Philip Plante 913-302-9933 phil.plante@transmuto.com
On Apr 30, 2007, at 9:01 PM, Allan Odgaard wrote:
On 1. May 2007, at 01:47, Philip Plante wrote:
The reason I do this is because previously Textmate would turn off syntax highlighting for anything between {literal} and {/ literal}. So I found that if you wrapped it in comments then it canceled out. But now that this new update has come out it has changed that behavior again.
Make sense?
So the real problem is with the {literal} rule in the HTML grammar.
What you can do is go to the HTML grammar in the bundle editor, locate this rule, and insert ‘disabled = 1;’. Then you won’t need to put comments around {literal} in your source.
What you really want though (I think) is probably for this rule to include the HTML grammar (between {literal}…{/literal}) *except* for the Smarty part of it (since we only want to disable Smarty in such block) -- this is easy with the forthcoming scope injection, but presently a pain to do (we’d have to restructure things, and it is made further complicated by Smarty not being a grammar which we have enabled by default)…
If there are any Smarty users which have suggestions as what to do with the {literal} rule “out of the box”, I am all ear.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate