The highlighting between <script> tags is wrong when coding with template engines such as MustacheJs or Handlebars. Reproducible: Always Steps to Reproduce: 1. Create new PHP or HTML file. 2. Create the <script> tag 3. Write inside the <script> tag the template to be rendered by Handlebars or Mustache Actual Results: The hightlighting is wrong and messes up all the following markup.
Git commit 33ad9cdec824f3ac7dc0086149a28f4f0e097a14 by Christoph Cullmann, on behalf of Nibaldo González. Committed on 12/02/2019 at 19:43. Pushed by cullmann into branch 'master'. HTML: highlight JSX, TypeScript & MustacheJS code in the <script> tag Summary: In the `<script>` tag, it will be possible to highlight JSX, TypeScript and Mustache (MustacheJS/HandlebarsJS/RactiveJS) code, according to the "type" attribute. For example, in `<script type="text/typescript">`, TypeScript code will be highlighted; in `<script type="text/babel">` JavaScript React will be highlighted. These highlights are activated when using the following values in the "type" attribute: **JSX (JavaScript React):** * text/jsx * text/babel **TypeScript:** * text/typescript **MustacheJS/HandlebarsJS/RactiveJS:** * x-tmpl-mustache * text/x-mustache-template * text/x-handlebars-template * text/ractive By default, JavaScript highlighting is used. 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] Also, I made some modifications to the **data/generators/generate-php.pl** script: * Avoid duplicate attribute "hidden" in the "language" tag. * Avoid injecting `<IncludeRules context="FindPHP" />` after `<context ... />` (replace `/>` with `><IncludeRules context="FindPHP" /></context>`). **References:** * [1] Mustache.js: https://github.com/janl/mustache.js * [2] Mustache package for Atom: https://github.com/atom/language-mustache Reviewers: #framework_syntax_highlighting, dhaumann, cullmann Reviewed By: #framework_syntax_highlighting, cullmann Subscribers: kwrite-devel, kde-frameworks-devel Tags: #kate, #frameworks Differential Revision: https://phabricator.kde.org/D18951 M +46 -0 autotests/folding/test.htm.fold M +1 -1 autotests/folding/test.markdown.fold M +46 -0 autotests/html/test.htm.html M +46 -0 autotests/input/test.htm M +46 -0 autotests/reference/test.htm.ref M +6 -0 data/CMakeLists.txt M +10 -2 data/generators/generate-php.pl M +65 -3 data/syntax/html.xml A +326 -0 data/syntax/mustache-js.xml https://commits.kde.org/syntax-highlighting/33ad9cdec824f3ac7dc0086149a28f4f0e097a14
I corrected the Mustache highlighter. Also, the support to template files is added, commonly with *.mustache extension (in the menu: Markup -> Mustache/Handlebars (HTML)). Patch: https://phabricator.kde.org/D19328