<span class="mw-page-title-main">Module:Quote</span>
Elena & Fabrice's Web

local p = {}

function p.processLineBreaks(frame)

   local text = frame.args.text or frame.args[1] or ""
   if text == "" then
       return text
   end
   -- Step 1: Remove single newlines after a hyphen
   local result = text:gsub("%-([^\n]?)\n([^\n])", "%1%2")
   -- Step 2: Replace other single newlines with a space
   result = result:gsub("\n([^\n])", " %1")
   -- Step 3: Replace multiple consecutive newlines with a single newline
   result = result:gsub("\n+", "\n")
   -- Step 4: Restore equal signs from placeholder
   result = result:gsub("__EQUALS__", "=")
   return result

end

return p