m (Try this) |
m (Hm) |
||
Line 10: | Line 10: | ||
else | else | ||
if i % 2 == 0 then | if i % 2 == 0 then | ||
html = html .. '<p class="term-command">' .. | html = html .. '<p class="term-command">' ..mw.text.nowiki(command):gsub('\n', '<br>'):gsub(' ', ' ') .. '</p>\n' | ||
else | else | ||
html = html .. '<p class="term-output">' .. | html = html .. '<p class="term-output">' .. mw.text.nowiki(command):gsub('\n', '<br>'):gsub(' ', ' ') .. '</p>\n' | ||
end | end | ||
end | end |
Revision as of 13:59, 7 October 2023
Documentation for this module may be created at Module:TerminalCommandGenerator/doc
local p = {}
function p.generateHtml(frame)
local commands = frame:getParent().args
local html = '<div class="terminal-' .. commands[1] .. '"><div class="term-bar"><div class="term-red"></div><span class="term-yellow"></span><span class="term-green"></span></div><div class="term-screen"><div class="term-commands">'
for i, command in ipairs(commands) do
if i == 1 then
html = html
else
if i % 2 == 0 then
html = html .. '<p class="term-command">' ..mw.text.nowiki(command):gsub('\n', '<br>'):gsub(' ', ' ') .. '</p>\n'
else
html = html .. '<p class="term-output">' .. mw.text.nowiki(command):gsub('\n', '<br>'):gsub(' ', ' ') .. '</p>\n'
end
end
end
html = html .. '</div></div></div>'
return html
end
return p