diff options
author | Sathish Manohar <sathish.design11@gmail.com> | 2022-10-15 02:32:08 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-14 23:02:08 +0200 |
commit | 8cb47944fffceedadd5a51065851be719d4f015b (patch) | |
tree | b21b542d194243ea963b2586e88c0230d3c35eed | |
parent | 1de38871e5f9143d4cc0b9f66686c9be9f8cc32d (diff) | |
download | lite-xl-plugins-8cb47944fffceedadd5a51065851be719d4f015b.tar.gz lite-xl-plugins-8cb47944fffceedadd5a51065851be719d4f015b.zip |
Add language plugin for ERB files (#130)
* Add language plugin for ERB files
erb files typically has filename.html.erb extension they contain
html markup and embedded ruby code this file should properly
syntax highlight both html and ruby parts
* merge html/htm in filetype check
-rw-r--r-- | plugins/language_erb.lua | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/plugins/language_erb.lua b/plugins/language_erb.lua new file mode 100644 index 0000000..d55b48c --- /dev/null +++ b/plugins/language_erb.lua @@ -0,0 +1,55 @@ +-- mod-version:3 +local syntax = require "core.syntax" + +syntax.add { + name = "html-eruby", + files = { "%.html?%.erb$", "%.erb$" }, + block_comment = { "<!--", "-->" }, + patterns = { + { + 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 = { + "<%%", + "%%>" + }, + syntax = ".rb", + type = "function" + }, + { + pattern = { + "<%%=", + "%%>" + }, + syntax = ".rb", + 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 = {}, +} |