Skip to content

Commit

Permalink
Update inject-css.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
kozyakin committed Nov 20, 2024
1 parent 0b9b1e3 commit d85163d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions html/inject-css.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
filecss = arg[1]
filehtml = arg[2]
local filecss = arg[1]
local filehtml = arg[2]

local function readfile(name)
local f = assert(io.open(name, "r"))
Expand All @@ -14,14 +14,14 @@ local function writefile(name, sum)
f:close()
end

html = readfile(filehtml)
css = readfile(filecss)
local html = readfile(filehtml)
local css = readfile(filecss)
css = css:gsub('%%', '%%%%')

spattern = "<link .*href='" .. filecss .. "'.-/>"
rpattern = "<style type='text/css'>\n\n<!--\n" .. css .. "\n\n-->\n</style>"
local spattern = "<link .*href='" .. filecss .. "'.-/>"
local rpattern = "<style type='text/css'>\n\n<!--\n" .. css .. "\n\n-->\n</style>"

injectedHtml = html:gsub(spattern, rpattern)
local injectedHtml = html:gsub(spattern, rpattern)
injectedHtml = injectedHtml:gsub('%%%%','%%')

if injectedHtml then
Expand Down

0 comments on commit d85163d

Please sign in to comment.