Module:Lorebook/Debug: Difference between revisions

Fix mw.smw.ask syntax (use array format), improve containsAny pattern matching, add nowiki wrapping, improve newline formatting, enhance debugging output
Escape curly braces ({/}) in debug output to prevent template invocation
 
(One intermediate revision by the same user not shown)
Line 288: Line 288:
       output = output .. "* " .. t .. "\n"
       output = output .. "* " .. t .. "\n"
     end
     end
     output = output .. "\n'''=== Output ==='''\n"
     output = output .. "\n'''=== Output ==='''\n<pre>\n"
   end
   end
    
    
   -- Wrap result in <nowiki> to preserve formatting and prevent wiki parsing
   -- Escape curly braces and use <pre> tag to preserve formatting
   if result and result ~= '' then
   if result and result ~= '' then
     output = output .. '<nowiki>\n' .. result .. '\n</nowiki>\n'
    result = result:gsub('{', '&#123;'):gsub('}', '&#125;')
     output = output .. result .. '\n</pre>\n'
   else
   else
     output = output .. "(empty output)\n"
     output = output .. "(empty output)\n</pre>\n"
   end
   end