モジュール:サンドボックス/Funa-enpitu/mwmd-code
表示
local p = {}
function p.main(frame)
-- code = string.gsub(code, '', '')
local code = frame.args[1]
code = string.gsub(code, '<(.-)>(.-)</(.-)>', '<<span style="color:#008000; font-weight:bold;">%1</span>>%2</<span style="color:#008000; font-weight:bold;">%3</span>>')
code = string.gsub(code, "%[%[(.-)%]%]", '<span style="color:#008000; font-weight:bold;">[[</span><span style="color:#008000;">%1</span><span style="color:#008000; font-weight:bold;">]]</span>')
code = string.gsub(code, "'''(.-)'''", '<span style="color:#3D7B7B;">'''<span style="font-weight:bold;">%1</span>'''</span>')
code = string.gsub(code, "''(.-)''", '<span style="color:#3D7B7B;">''<span style="font-style:italic;">%1</span>''</span>') return '<div class="mw-code">'..code..'</div>'
end
return p