aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAziz Mazouz Jaber <52936496+kemzops@users.noreply.github.com>2024-02-13 00:00:30 +0200
committerGitHub <noreply@github.com>2024-02-12 23:00:30 +0100
commit9af1b96f0f1cc574c001f4951704a1733ee32e6c (patch)
treeb90d4db5165891517d2b9a7d4d19c681a80c0c47
parentd96e87eb49da58bcc75d7411a8e43072c5419e65 (diff)
downloadlite-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
-rw-r--r--README.md1
-rw-r--r--manifest.json9
-rw-r--r--plugins/language_ejs.lua51
3 files changed, 61 insertions, 0 deletions
diff --git a/README.md b/README.md
index 4db0b19..b42d339 100644
--- a/README.md
+++ b/README.md
@@ -267,6 +267,7 @@ but only with a `url` must provide a `checksum` that matches the existing plugin
| [`language_wren`](plugins/language_wren.lua?raw=1) | Syntax for the [Wren](http://wren.io/) programming language |
| [`language_yaml`](plugins/language_yaml.lua?raw=1) | Syntax for [YAML](https://yaml.org/) serialization language |
| [`language_zig`](plugins/language_zig.lua?raw=1) | Syntax for the [Zig](https://ziglang.org/) programming language |
+| [`language_ejs`](plugins/language_ejs.lua?raw=1) | Syntax for the [EJS](https://ejs.co/) javascript template engine |
## Libraries
diff --git a/manifest.json b/manifest.json
index 2d6762d..e06c513 100644
--- a/manifest.json
+++ b/manifest.json
@@ -84,6 +84,7 @@
"language_dart": {},
"language_diff": {},
"language_edp": {},
+ "language_ejs": {},
"language_elixir": {},
"language_elm": {},
"language_env": {},
@@ -699,6 +700,14 @@
"tags": ["language"]
},
{
+ "description": "Syntax for the [EJS](https://ejs.co/) javascript template engine",
+ "version": "0.1",
+ "path": "plugins/language_ejs.lua",
+ "id": "language_ejs",
+ "mod_version": "3",
+ "tags": ["language"]
+ },
+ {
"description": "Syntax for the [Elixir](https://elixir-lang.org) programming language",
"version": "0.2",
"path": "plugins/language_elixir.lua",
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 = {},
+}