Module:Convert/tester: Difference between revisions

Content deleted Content added
fiddle so output with disp=table works in a table cell
another attempt to escape stuff in table cell while keeping piped link
Line 95:
end
local function safe_cell(text, multiline)
-- This is possibly adequate forFor testing {{convert}} where, want wikitext like '[[kilogram|kg]]' to be
-- like '[[kilogram|kg]]' to be unchanged so the link works and so the rendered text is short.
--text rendered= text:gsub('(%[%[[^%[%]]-)|(.-%]%])', is'%1\0%2') short, but-- needreplace morepipe workin ifpiped wantlink towith usea thiszero modulebyte
text = text:gsub('{', '{'):gsub('|', '|'):gsub('%z', '|') -- restore pipe in piped link
-- to test arbitrary templates.
text = text:gsub('{', '{')
if text:find('align%s*=') then
-- This makes text like 'align="right"|12.3' safe for display in a table cell,
-- while leaving text like '[[kilogram|kg]]' unchanged.
text = text:gsub('|', '|')
end
if multiline then
text = text:gsub('\\n', '<br />')