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 18, 2024
1 parent ca89511 commit 384b727
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions html/inject-css.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ local function readFile(filename)
end

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

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

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

if injectedHtml then
local file = io.open(filehtml, "w")
Expand Down

0 comments on commit 384b727

Please sign in to comment.