aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_ejs.lua
diff options
context:
space:
mode:
authorAziz Mazouz Jaber <52936496+kemzops@users.noreply.github.com>2024-02-13 00:00:30 +0200
committerjgmdev <jgmdev@gmail.com>2024-02-26 16:24:45 -0400
commit00a5915b3c089d2221e082511c2039ea86f06cbd (patch)
treeae6f50c2f51529a3d98cd6836e1ada77df99e8ba /plugins/language_ejs.lua
parentd6b0ece410860e3368839b3f0681fe8c362028c4 (diff)
downloadpragtical-plugins-00a5915b3c089d2221e082511c2039ea86f06cbd.tar.gz
pragtical-plugins-00a5915b3c089d2221e082511c2039ea86f06cbd.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.lua51
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 = {},
+}