diff options
author | Aziz Mazouz Jaber <52936496+kemzops@users.noreply.github.com> | 2024-02-13 00:00:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-12 23:00:30 +0100 |
commit | 9af1b96f0f1cc574c001f4951704a1733ee32e6c (patch) | |
tree | b90d4db5165891517d2b9a7d4d19c681a80c0c47 /plugins/language_ejs.lua | |
parent | d96e87eb49da58bcc75d7411a8e43072c5419e65 (diff) | |
download | lite-xl-plugins-9af1b96f0f1cc574c001f4951704a1733ee32e6c.tar.gz lite-xl-plugins-9af1b96f0f1cc574c001f4951704a1733ee32e6c.zip |
Embedded JavaScript templating syntax support (#363)
* Embedded JavaScript templating syntax support
language_ejs.lua file, fork of language_html.lua to support .ejs files.
* Update README.md
* Update manifest.json
* Update manifest.json
* Pattern for ejs tags <%%>
`<%%>` now uses javascript syntax without any problems.
* Update language_ejs.lua
function instead of operator (i was testing something and uploaded without saving :)
* Update language_ejs.lua
Diffstat (limited to 'plugins/language_ejs.lua')
-rw-r--r-- | plugins/language_ejs.lua | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/plugins/language_ejs.lua b/plugins/language_ejs.lua new file mode 100644 index 0000000..f303bad --- /dev/null +++ b/plugins/language_ejs.lua @@ -0,0 +1,51 @@ +-- mod-version:3 + +-- Embedded JavaScript templating +-- provides .ejs syntax support (fork of language_html.lua). + +local syntax = require "core.syntax" + +syntax.add { + name = "EJS", + files = { "%.ejs$" }, + block_comment = { "<!--", "-->" }, + patterns = { + { + pattern = { + "<%%", + "%%>" + }, + syntax = '.js', + type = "function" + }, + { + pattern = { + "<%s*[sS][cC][rR][iI][pP][tT]%f[%s>].->", + "<%s*/%s*[sS][cC][rR][iI][pP][tT]%s*>" + }, + syntax = ".js", + type = "function" + }, + { + pattern = { + "<%s*[sS][tT][yY][lL][eE]%f[%s>].->", + "<%s*/%s*[sS][tT][yY][lL][eE]%s*>" + }, + syntax = ".css", + type = "function" + }, + { pattern = { "<!%-%-", "%-%->" }, type = "comment" }, + { pattern = { '%f[^>][^<]', '%f[<]' }, type = "normal" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = "0x[%da-fA-F]+", type = "number" }, + { pattern = "-?%d+[%d%.]*f?", type = "number" }, + { pattern = "-?%.?%d+f?", type = "number" }, + { pattern = "%f[^<]![%a_][%w_]*", type = "keyword2" }, + { pattern = "%f[^<][%a_][%w_]*", type = "function" }, + { pattern = "%f[^<]/[%a_][%w_]*", type = "function" }, + { pattern = "[%a_][%w_]*", type = "keyword" }, + { pattern = "[/<>=]", type = "operator" }, + }, + symbols = {}, +} |