Module:Lorebook/Debug: Difference between revisions

Fix mw.smw.ask usage - use array format with printouts as '?Property=label'
Escape curly braces ({/}) in debug output to prevent template invocation
 
(2 intermediate revisions by the same user not shown)
Line 204: Line 204:
   end
   end
   if #chatChunks > 0 then
   if #chatChunks > 0 then
    if #plistChunks > 0 then
      text = text .. '\n'  -- Add extra newline between plist and chat sections
    end
     text = text .. table.concat(chatChunks, '\n')
     text = text .. table.concat(chatChunks, '\n')
   end
   end
Line 288: Line 291:
   end
   end
    
    
   output = output .. result
   -- Escape curly braces and use <pre> tag to preserve formatting
    
  if result and result ~= '' then
  if DEBUG then
    result = result:gsub('{', '&#123;'):gsub('}', '&#125;')
     output = output .. "\n</pre>\n"
    output = output .. result .. '\n</pre>\n'
   else
     output = output .. "(empty output)\n</pre>\n"
   end
   end