title: Thymeleaf Unescaped JavaScript Inlining
body: <p>How can I get <strong>unescaped</strong> JavaScript inlining output with Thymeleaf 3.0.x? Escaped inlining works just fine. Example:</p>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.thymeleaf&lt;/groupId&gt;
    &lt;artifactId&gt;thymeleaf-spring3&lt;/artifactId&gt;
    &lt;version&gt;3.0.3.RELEASE&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>servelet:</p>
  
  <pre><code>model.addAttribute("test", "testing...");
  </code></pre>
  
  <p>html template:</p>
  
  <pre><code>&lt;script th:inline="javascript"&gt;
  /*&lt;![CDATA[*/
    [[${test}]]
    [(${test})]
  /*]]&gt;*/
  &lt;/script&gt;
  </code></pre>
  
  <p>generated output:</p>
  
  <pre><code>&lt;script&gt;
  /*&lt;![CDATA[*/
    'testing...'
    [(${test})]
  /*]]&gt;*/
  &lt;/script&gt;
  </code></pre>
  
  <p>So, escaped expression <code>[[ ]]</code> works, but unescaped expression <code>[( )]</code> doesn't. I have a need to generate js conditionally, and there's no "easy" workaround, so this would've been very helpful. Has anyone been able to get this to work? Any help much appreciated!</p>