lua2html.lua

changeset 5
71da0b9c138c
parent 2
520a1e0d187e
equal deleted inserted replaced
4:370c51ee7b06 5:71da0b9c138c
85 line = line:gsub("\".-[^\\]\"", "<span class='string'>%1</span>"); 85 line = line:gsub("\".-[^\\]\"", "<span class='string'>%1</span>");
86 if ops[linenum] then 86 if ops[linenum] then
87 for _, op in pairs(ops[linenum]) do 87 for _, op in pairs(ops[linenum]) do
88 if op.comment and #op.comment > 0 and op.name ~= "JMP" then 88 if op.comment and #op.comment > 0 and op.name ~= "JMP" then
89 --print("Replacing "..escape_pattern(op.comment).."("..op.comment..") for "..op.name); 89 --print("Replacing "..escape_pattern(op.comment).."("..op.comment..") for "..op.name);
90 line, sub = line:gsub("([^%w_])("..escape_pattern(op.comment)..")([^%w_])", "%1<span class='"..op.name:lower().."'>"..escape_html(op.comment).."</span>%3"); 90 line, sub = line:gsub("([^%w_.])("..escape_pattern(op.comment)..")([^%w_])", "%1<span class='"..op.name:lower().."'>"..escape_html(op.comment).."</span>%3");
91 if sub == 0 and op.name == "GETTABLE" then 91 if sub == 0 and op.name == "GETTABLE" then
92 --print("Trying again..."); 92 --print("Trying again...");
93 local id = op.comment:match("[%w_]+"); 93 local id = op.comment:match("[%w_]+");
94 if id then 94 if id then
95 --print("Got "..id); 95 --print("Got "..id);

mercurial