Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Veliti committed Sep 7, 2023
1 parent 91c7056 commit ba8d98a
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@ local input_pattern = jsdoc:querySelector("#input-pattern")
local input_text = jsdoc:querySelector("#input-text")
local text_highlighted = jsdoc:querySelector("#text-highlighted")

local inspect = function(t)
for key, value in ipairs(t) do
print(key, " -> ", value)
end
end

local mark_wrap = function(s, classes)
return string.format('<mark class="%s">%s</mark>', classes, s)
end

---@param text string
---@param pattern string
local highlight_lines = function(text, pattern)
-- lua pattern moment need to wrap pattern in capture else it stop capturing xD
-- lua pattern moment: need to wrap pattern in capture else it stop capturing itself
pattern = "(" .. pattern .. ")"
local result = text:gsub(pattern, function(...)
local captures = { ... }
Expand Down Expand Up @@ -47,7 +41,6 @@ local update_scroll = function()
end

input_pattern:addEventListener("input", update)

input_text:addEventListener("selectionchange", update)
input_text:addEventListener("scroll", update_scroll)

Expand Down

0 comments on commit ba8d98a

Please sign in to comment.