Module:Wd/testcases/2: Difference between revisions

Content deleted Content added
No edit summary
convert nil to empty string
 
(4 intermediate revisions by 2 users not shown)
Line 45:
self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifiers|Q55|P2855|P518|format=%p[ (%q)][%s][%r]}}', ({string.gsub(wdib._getValue{'P2855',qid='Q55',qual='P518',linked='false',noicon='true',osd='no',fwd='ALL'}, ' percent', '%%')})[1])
self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifiers|Q55|P2855|P518|sep=_+_|sep%s=|sep%q=_/_|format=%p[ (%q)][%s][%r]}}', ({string.gsub(wdib._getValue{'P2855',qid='Q55',qual='P518',sep='" + "',qsep='" / "',linked='false',noicon='true',osd='no',fwd='ALL'}, ' percent', '%%')})[1])
self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|format=%p[ (%q)][%s][%r]}}', table.concat({({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580,P582',qsep='"; "',linked='false',noicon='true',osd='no',df='dmy',rank='p',fwd='ALL'}, ' – ', '', 1)})[1], ({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580,P582',qsep='"; "',linked='false',noicon='true',osd='no',df='dmy',rank='n',fwd='ALL'}, ' – ', '; ')})[1]}, ', '))
self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|sep%q=_–_|format=%p[ (%q)][%s][%r]}}', table.concat({({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580,P582',qsep='" – "',linked='false',noicon='true',osd='no',df='dmy',rank='p',fwd='ALL'}, ' – ', '', 1)})[1], ({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580,P582',qsep='" – "',linked='false',noicon='true',osd='no',df='dmy',rank='n',fwd='ALL'}, ' – ', ' – ')})[1]}, ', '))
self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|format=%p[ (%q1[ – %q2])][%s][%r]}}', table.concat({({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580,P582',qsep='" – "',linked='false',noicon='true',osd='no',df='dmy',rank='p',fwd='ALL'}, ' – ', '', 1)})[1], ({string.gsub(wdib._getValue{'P35',qid='Q55',qual='P580,P582',qsep='" – "',linked='false',noicon='true',osd='no',df='dmy',rank='n',fwd='ALL'}, ' – ', ' – ')})[1]}, ', '))
self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifier|raw|qualifier|normal+|Q55|P35|Q29574|P580|P582|format=%p[ (%q1[ – %q2])][%s][%r]}}', 'Beatrix of the Netherlands (1980-04-30 – 30 April 2013)')
self:preprocess_equals('{{#invoke:wd/sandbox|properties|qualifiers|normal+|current|Q55|P38|P518|format=%p[ (%q)][%s][%r]}}', ({string.gsub(({string.gsub(table.concat({wdib._getValue{'P38',qid='Q55',qual='P518',linked='false',noicon='true',osd='no',rank='p',fwd='ALL'}, wdib._getValue{'P38',qid='Q55',qual='P518',linked='false',noicon='true',osd='no',rank='n',fwd='ALL'}}, ', '), 'Dutch guilder[^,]*', '', 1)})[1], ', ,', ',', 1)})[1])
Line 56:
self:preprocess_equals('{{#invoke:wd/sandbox|properties|normal+|former|Q55|P38}}', 'Dutch guilder')
self:preprocess_equals('{{#invoke:wd/sandbox|properties|raw|normal+|former|Q55|P38}}', 'Q788472')
self:preprocess_equals('{{#invoke:wd/sandbox|properties|raw|linked|normal+|former|Q55|P38}}', '[[d:Special:EntityPage/Q788472|Q788472]]')
self:preprocess_equals('{{#invoke:wd/sandbox|property|Q55|P1549}}', wdib._getValue{'P1549',qid='Q55',noicon='true',osd='no',rank='best',fwd='ALL'})
self:preprocess_equals('{{#invoke:wd/sandbox|property|multilanguage|Q55|P1549|P407=Q36846}}', wdib.getValueByQual{args={'P1549',qid='Q55',qualID='P407',qvalue='Q36846',noicon='true',osd='no',fwd='ALL'}} or '')
self:preprocess_equals('{{#invoke:wd/sandbox|property|Q55|P2884}}', wdib._getValue{'P2884',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
self:preprocess_equals('{{#invoke:wd/sandbox|property|raw|Q55|P2884}}', wdib._getValue{'P2884',qid='Q55',su='false',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'})
Line 65:
self:preprocess_equals('{{#invoke:wd/sandbox|property|unit|raw|Q55|P2884}}', 'Q25250')
self:preprocess_equals('{{#invoke:wd/sandbox|property|Q55|P625}}', ({string.gsub(({string.gsub(({string.gsub(wdib._getValue{'P625',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, "′", "'", 2)})[1], '″', '"', 2)})[1], ' ', ', ', 1)})[1])
self:preprocess_equals('{{#invoke:wd/sandbox|property|linked|Q55|P625}}', '[https://toolsgeohack.wmflabstoolforge.org/geohack/geohack.php?language=en&params=' .. ({mw.ustring.gsub(wdib._getValue{'P625',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, '[°′″ ]', '_')})[1] .. '_globe:earth ' .. ({string.gsub(({string.gsub(({string.gsub(wdib._getValue{'P625',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, "′", "'", 2)})[1], '″', '"', 2)})[1], ' ', ', ', 1)})[1] .. ']')
self:preprocess_equals('{{#invoke:wd/sandbox|property|raw|Q55|P625}}', ({mw.ustring.gsub(wdib._getValue{'P625',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, '[°′″ ]', '/')})[1])
self:preprocess_equals('{{#invoke:wd/sandbox|property|Q55|coord}}', ({string.gsub(({string.gsub(({string.gsub(wdib._getValue{'P625',qid='Q55',noicon='true',osd='no',rank='best',maxvals='1',fwd='ALL'}, "′", "'", 2)})[1], '″', '"', 2)})[1], ' ', ', ', 1)})[1])
Line 77:
self:preprocess_equals('{{#invoke:wd/sandbox|label|linked|Q4917}}', ({string.gsub(wdib.getLink{args={'Q4917'}}, ':([^|]+)|%1', '%1', 1)})[1])
self:preprocess_equals('{{#invoke:wd/sandbox|label|P38}}', wdib.getLabel{args={'P38'}})
self:preprocess_equals('{{#invoke:wd/sandbox|label|linked|P38}}', '[[d:PropertySpecial:EntityPage/P38|' .. wdib.getLabel{args={'P38'}} .. ']]')
self:preprocess_equals('{{#invoke:wd/sandbox|label|Q776}}', wdib.getLabel{args={'Q776'}})
self:preprocess_equals('{{#invoke:wd/sandbox|label|linked|Q776}}', ({string.gsub(wdib.getLink{args={'Q776'}}, '%[%[:', '[[', 1)})[1])
Line 91:
self:preprocess_equals('{{#invoke:wd/sandbox|label|raw}}', '')
self:preprocess_equals('{{#invoke:wd/sandbox|label|raw|Q776}}', 'Q776')
self:preprocess_equals('{{#invoke:wd/sandbox|label|raw|linked|Q776}}', '[[d:Special:EntityPage/Q776|Q776]]')
self:preprocess_equals('{{#invoke:wd/sandbox|label|P625}}', wdib.getLabel{args={'P625'}})
self:preprocess_equals('{{#invoke:wd/sandbox|label|Property:P625}}', wdib.getLabel{args={'P625'}})
Line 121:
self:preprocess_equals('{{#invoke:wd/sandbox|alias|linked|Q55}}', '[[' .. wdib.getSiteLink{args={qid='Q55'}} .. '|' .. ({string.gsub(wdib.getAliases{args={qid='Q55',noicon='true',fwd='ALL'}}, '^([^,]+).*$', '%1', 1)})[1] .. ']]')
self:preprocess_equals('{{#invoke:wd/sandbox|alias}}', '')
self:preprocess_equals('{{#invoke:wd/sandbox|badges|Q2}}', 'featured article badge')
self:preprocess_equals('{{#invoke:wd/sandbox|badges|raw|Q2}}', 'Q17437796')
self:preprocess_equals('{{#invoke:wd/sandbox|badges}}', '')