CoffeeScript: fix templates in embedded JavaScript code & add escapes

Authored by nibags on Aug 3 2018, 6:47 AM.

Description

CoffeeScript: fix templates in embedded JavaScript code & add escapes

Summary:
In CoffeeScript, the character ` (grave accent) is used to insert JavaScript code, but in JavaScript that same character is used for templates. The templantes in embedded JavaScript code are done by prefixing backslashes, as mentioned in the CoffeeScript documentation [1].

Therefore, the syntax highlighting would look like this:

To do this I had to overwrite some JavaScript rules, since some contexts of javascript.xml contain <IncludeRules context="Normal"/> , where you can also insert templates.

Also, the following is added:

  • The JavaScript code embedding using 3 backticks [1].
  • The escapes supported by CoffeeScript, which are the same as JavaScript [2], with the exception of the octal escapes.

All changes were tested using the CoffeeScript playground [3].

References:

Reviewers: dhaumann, cullmann, Framework: Syntax Highlighting, Kate

Reviewed By: dhaumann, Framework: Syntax Highlighting, Kate

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: Kate, Frameworks

Differential Revision: https://phabricator.kde.org/D14270