Module:Sandbox: Difference between revisions

No edit summary
No edit summary
Line 32: Line 32:
local function process_newlines(text)
local function process_newlines(text)
     if not text then return text end
     if not text then return text end
     -- First replace the \"n with a special marker
     -- Replace "n with newline character
     text = text:gsub('\\"n', 'NEWLINE_MARKER')
     text = text:gsub('"n', '\n')
    -- Then replace the marker with <br>
    text = text:gsub('NEWLINE_MARKER', '<br>')
     return text
     return text
end
end