No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
function p.generateHtml(frame) | function p.generateHtml(frame) | ||
local commands = frame.args | local commands = frame.args | ||
local html = "" | 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">' | ||
table.remove(commands, 1) | |||
for i, command in ipairs(commands) do | for i, command in ipairs(commands) do | ||
if i % 2 == 0 then | if i % 2 == 0 then | ||
Line 13: | Line 13: | ||
end | end | ||
end | end | ||
html = html .. '</div></div></div>' | |||
return html | return html | ||
end | end | ||
return p | return p |
Revision as of 04:00, 7 October 2023
Documentation for this module may be created at Module:TerminalCommandGenerator/doc
local p = {}
function p.generateHtml(frame)
local commands = frame.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">'
table.remove(commands, 1)
for i, command in ipairs(commands) do
if i % 2 == 0 then
html = html .. '<p class="term-output">' .. command .. '</p>\n'
else
html = html .. '<p class="term-command">' .. command .. '</p>\n'
end
end
html = html .. '</div></div></div>'
return html
end
return p