From cc58721ccdd32c18a17109c9f89d5762508fd5f5 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Sun, 13 Nov 2022 21:02:45 -0600 Subject: [PATCH 1/3] give span tags to injection syntax for styling --- client/homebrew/editor/editor.jsx | 18 ++++++++++++++++++ client/homebrew/editor/editor.less | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index d05d5cc0d..947ae7b7f 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -137,6 +137,24 @@ const Editor = createClass({ codeMirror.addLineClass(lineNumber, 'text', 'columnSplit'); } + + if(line.includes('{') && line.includes('}')){ + const regex = /{(?:(?=(:(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*))\1)*}/g; + let match; + let blockCount = 0; + while ((match = regex.exec(line)) != null) { + if(match[0].startsWith('{')) { + blockCount += 1; + } else { + blockCount -= 1; + } + if(blockCount < 0) { + blockCount = 0; + continue; + } + codeMirror.markText({ line: lineNumber, ch: match.index }, { line: lineNumber, ch: match.index + match[0].length }, { className: 'injection' }); + } + } // Highlight inline spans {{content}} if(line.includes('{{') && line.includes('}}')){ const regex = /{{(?:(?=(:(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*))\1)*|}}/g; diff --git a/client/homebrew/editor/editor.less b/client/homebrew/editor/editor.less index 810ee1710..b8f978ba3 100644 --- a/client/homebrew/editor/editor.less +++ b/client/homebrew/editor/editor.less @@ -29,6 +29,10 @@ font-weight : bold; //font-style: italic; } + .injection{ + color : green; + font-weight : bold; + } } .brewJump{ From 24debfc75ca09d3e68a7dfb80429523ff06fd259 Mon Sep 17 00:00:00 2001 From: Gazook89 <58999374+Gazook89@users.noreply.github.com> Date: Tue, 15 Nov 2022 11:09:27 -0600 Subject: [PATCH 2/3] fix regexp to not include inside of curly spans --- client/homebrew/editor/editor.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index 698a4bb7e..e80751bb9 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -139,7 +139,7 @@ const Editor = createClass({ if(line.includes('{') && line.includes('}')){ - const regex = /{(?:(?=(:(?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':{}\s]*))\1)*}/g; + const regex = /(? Date: Wed, 16 Nov 2022 15:42:45 -0500 Subject: [PATCH 3/3] Remove end/start bracket tracking for injectors --- client/homebrew/editor/editor.jsx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/client/homebrew/editor/editor.jsx b/client/homebrew/editor/editor.jsx index e80751bb9..965b42873 100644 --- a/client/homebrew/editor/editor.jsx +++ b/client/homebrew/editor/editor.jsx @@ -137,21 +137,11 @@ const Editor = createClass({ codeMirror.addLineClass(lineNumber, 'text', 'columnSplit'); } - + // Highlight injectors {style} if(line.includes('{') && line.includes('}')){ const regex = /(?