<table><tr><td style="">nibags created this revision.<br />nibags added reviewers: Framework: Syntax Highlighting, dhaumann, cullmann.<br />Herald added projects: Kate, Frameworks.<br />Herald added subscribers: kde-frameworks-devel, kwrite-devel.<br />nibags requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D18951">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>In the <tt style="background: #ebebeb; font-size: 13px;"><script></tt> tag, it will be possible to highlight JSX, TypeScript and Mustache (MustacheJS/HandlebarsJS/RactiveJS) code, according to the "type" attribute.</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"><script type="...">
    ...
</script></pre></div>

<p>For example, in <tt style="background: #ebebeb; font-size: 13px;"><script type="text/typescript"></tt>, TypeScript code will be highlighted; in <tt style="background: #ebebeb; font-size: 13px;"><script type="text/babel"></tt> JavaScript React will be highlighted. These highlights are activated when using the following values in the "type" attribute:</p>

<p><strong>JSX (JavaScript React):</strong></p>

<ul class="remarkup-list">
<li class="remarkup-list-item">text/jsx</li>
<li class="remarkup-list-item">text/babel</li>
</ul>

<p><strong>TypeScript:</strong></p>

<ul class="remarkup-list">
<li class="remarkup-list-item">text/typescript</li>
</ul>

<p><strong>MustacheJS/HandlebarsJS/RactiveJS:</strong></p>

<ul class="remarkup-list">
<li class="remarkup-list-item">x-tmpl-mustache</li>
<li class="remarkup-list-item">text/x-mustache-template</li>
<li class="remarkup-list-item">text/x-handlebars-template</li>
<li class="remarkup-list-item">text/ractive</li>
</ul>

<p>By default, JavaScript highlighting is used.</p>

<p>The absence of highlighting for Mustache templates in HTML is mentioned in the bug #369562. I have created a new hidden language file that adds Mustache variables to JavaScript. [1][2]</p>

<p>Also, I made some modifications to the <strong>data/generators/generate-php.pl</strong> script:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Avoid duplicate attribute "hidden" in the "language" tag.</li>
<li class="remarkup-list-item">Avoid injecting <tt style="background: #ebebeb; font-size: 13px;"><IncludeRules context="FindPHP" /></tt> after <tt style="background: #ebebeb; font-size: 13px;"><context ... /></tt> (replace <tt style="background: #ebebeb; font-size: 13px;">/></tt> with <tt style="background: #ebebeb; font-size: 13px;">><IncludeRules context="FindPHP" /></context></tt>).</li>
</ul>

<p><strong>References:</strong></p>

<ul class="remarkup-list">
<li class="remarkup-list-item">[1] Mustache.js: <a href="https://github.com/janl/mustache.js" class="remarkup-link" target="_blank" rel="noreferrer">https://github.com/janl/mustache.js</a></li>
<li class="remarkup-list-item">[2] Mustache package for Atom: <a href="https://github.com/atom/language-mustache" class="remarkup-link" target="_blank" rel="noreferrer">https://github.com/atom/language-mustache</a></li>
</ul>

<p>BUG: 369562</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R216 Syntax Highlighting</div></div></div><br /><div><strong>BRANCH</strong><div><div>html-script</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D18951">https://phabricator.kde.org/D18951</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/folding/test.htm.fold<br />
autotests/folding/test.markdown.fold<br />
autotests/html/test.htm.html<br />
autotests/input/test.htm<br />
autotests/reference/test.htm.ref<br />
data/CMakeLists.txt<br />
data/generators/generate-php.pl<br />
data/syntax/html.xml<br />
data/syntax/mustache-js.xml</div></div></div><br /><div><strong>To: </strong>nibags, Framework: Syntax Highlighting, dhaumann, cullmann<br /><strong>Cc: </strong>kwrite-devel, kde-frameworks-devel, gennad, michaelh, ngraham, bruns, demsking, cullmann, sars, dhaumann<br /></div>