IntelliLang and John Resig's js micro templating

I'm using John Resig's Javascript Micro Templating in my current project. The template language is standard HTML with injected JavaScript between <# #> and <#= #>tags, and can be parsed from a string or the body of any DOM element. By convention we use a <script> element with its type set to text/html, like this:

<script type="text/html">
  <table id="menu-entries-table" >
    <thead>
      <th>Name</th>
      <th>URL</th>
    </thead>
    <tbody>
    <# for (var idx = 0; idx < entries.length; idx++) {#>
      <tr>
        <td><#= entries[idx].name #></td>
        <td><#= entries[idx].url #></td>
      </tr>
    <# } #>
    </tbody>
  </table>
</script>



So I need IDEA to recognized that the body of a <script type="text/html"> tag is HTML content, except for text delimited by <# #> or <#= #>, which should be parsed as JavaScript code. Failing that, at least I'd like IDEA to leave the body of a script tag alone. How can I do that?
0

This is not possible at the moment, lets start from YouTrack ticket :)

On 22.12.2010 20:12, Marcus Brito wrote:

I'm using John http://ejohn.org/blog/javascript-micro-templating/ in my current project. The template language is standard HTML with injected JavaScript between<# #>  and<#= #>tags, and can be parsed from a string or the body of any DOM element. By convention we use a<script>  element with its type set to text/html, like this:

>

<script type="text/html">
   <table id="menu-entries-table" >
     <thead>
       <th>Name</th>
       <th>URL</th>
     </thead>
     <tbody>
     <# for (var idx = 0; idx<  entries.length; idx++) {#>
       <tr>
         <td><#= entries[idx].name #></td>
         <td><#= entries[idx].url #></td>
       </tr>
     <# } #>
     </tbody>
   </table>
</script>

>

So I need IDEA to recognized that the body of a<script type="text/html">  tag is HTML content, except for text delimited by<# #>  or<#= #>, which should be parsed as JavaScript code. Failing that, at least I'd like IDEA to leave the body of a script tag alone. How can I do that?

>

---
Original message URL: http://devnet.jetbrains.net/message/5281547#5281547



--
Best regards,
   Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

There is already http://youtrack.jetbrains.net/issue/IDEA-63610 to disable regular JavaScript language checking inside such tags.

0

I've added IDEA-6311 describing the ideal situation, where the template is correctly parsed instead of ignored.

0

请先登录再写评论。