Module:Lorebook: Difference between revisions

Fix mw.smw.ask usage - use array format with printouts as '?Property=label'
Fix mw.smw.ask syntax (use array format), improve containsAny pattern matching, add nowiki wrapping, improve newline formatting
Line 180: Line 180:
   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 197: Line 200:


   local triggered = walkRecursion(rows, idx, start)
   local triggered = walkRecursion(rows, idx, start)
   return buildInjection(rows, triggered)
   local result = buildInjection(rows, triggered)
 
  -- Wrap result in <nowiki><pre> to preserve formatting and prevent wiki parsing
  if result and result ~= '' then
    return '<nowiki>' .. result .. '</nowiki>'
  else
    return ''
  end
end
end