Module:Pretty-pre

From Coral Island Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Pretty-pre/doc

-- <nowiki>
--------------------------------------------------------------------------------
-- Automatically adds a space before each line. Like the <pre> tag, but allows
-- markup (e.g. bold or italics), transclusions, etc.
--------------------------------------------------------------------------------
local p = {}

function p._main(s)
    return ' ' .. s:gsub('\n$', ''):gsub('\n', '\n ')
end

function p.main(frame)
    return p._main(frame:getParent().args[1] or frame.args[1] or '{{{1}}}')
end

return p

-- </nowiki>
-- (Add categories here.)