Module:TerminalCommandGenerator: Difference between revisions

From iPhone Development Wiki
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 outputs = {}
     local html = ""
     local html = ""


     for i, command in ipairs(commands) do
     for i, command in ipairs(commands) do
         if i % 2 == 0 then
         if i % 2 == 0 then
             html = html .. '<p class="term-output">' .. output .. '</p>\n'
             html = html .. '<p class="term-output">' .. command .. '</p>\n'
         else
         else
             html = html .. '<p class="term-command">' .. command .. '</p>\n'
             html = html .. '<p class="term-command">' .. command .. '</p>\n'

Revision as of 03:01, 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 = ""

    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

    return html
end

return p