Module:Pretty-pre

From Coral Island Wiki
Revision as of 03:10, 4 August 2023 by Admin coral island (talk | contribs) (Created page with "-- <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 fram...")
(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.)