Module:Pretty-pre

From The Satanic Wiki
Revision as of 02:24, 30 April 2021 by WikiGOD (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.)