Home Download Buy Blog Forum Support

Html Syntax inside of a <script tag...>

Html Syntax inside of a <script tag...>

Postby jfromaniello on Fri Dec 09, 2011 2:42 pm

Hi everyone, I was wondering if there is a way to have html syntax inside an <script tag...
I have things like:

Code: Select all
<script id="FooBar" type="text/x-jquery-tmpl">



inside htmls files.
As you can see this is a jquery template (the type attribute). Right now I guess that sublime thinks that everything inside an <script> tag (whatever the type is) is javascript.

So, for instance if I try to comment a block of code with ctrl+/ it will do it as javascript instead of html.

On the other hand I can't use html snippets.


Thank you very much folks.
jfromaniello
 
Posts: 14
Joined: Tue Sep 27, 2011 2:48 pm

Re: Html Syntax inside of a <script tag...>

Postby jfromaniello on Mon Jan 16, 2012 8:25 pm

After some time i found the solution in an old stackoverflow thread:
http://stackoverflow.com/questions/5578 ... n-textmate

The solution for me was to modify the HTML.tmLanguage instead of:

Code: Select all
<string>(?:^\s+)?(&lt;)((?i:script))\b(?![^&gt;]*/&gt;)</string>


i changed to:

Code: Select all
<string>(?:^\s+)?(&lt;)((?i:script))\b(?!([^&gt;]*text/x-jquery-tmpl[^&gt;]*|[^&gt;]*/&gt;))</string>
jfromaniello
 
Posts: 14
Joined: Tue Sep 27, 2011 2:48 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], jama and 20 guests