Module:TNT: Difference between revisions
Content added Content deleted
m (Fix) Tags: Undo Mobile edit Mobile web edit |
m (Fix) Tags: Reverted Mobile edit Mobile web edit |
||
Line 20: | Line 20: | ||
-- |
-- |
||
-- {{#invoke:TNT | msg |
-- {{#invoke:TNT | msg |
||
-- | I18n/Template:Graphs.tab <!-- https://commons. |
-- | I18n/Template:Graphs.tab <!-- https://commons.miraheze.org/wiki/Data:I18n/Template:Graphs.tab --> |
||
-- | source-table <!-- uses a translation message with id = "source-table" --> |
-- | source-table <!-- uses a translation message with id = "source-table" --> |
||
-- | param1 }} <!-- optional parameter --> |
-- | param1 }} <!-- optional parameter --> |
||
Line 30: | Line 30: | ||
-- |
-- |
||
-- {{#invoke:TNT | doc | Graph:Lines }} |
-- {{#invoke:TNT | doc | Graph:Lines }} |
||
-- uses https://commons. |
-- uses https://commons.miraheze.org/wiki/Data:Templatedata/Graph:Lines.tab |
||
-- if the current page is Template:Graph:Lines/doc |
-- if the current page is Template:Graph:Lines/doc |
||
-- |
-- |
||
Line 80: | Line 80: | ||
end |
end |
||
-- Obsolete function that adds a ' |
-- Obsolete function that adds a 'commons:' prefix to the first param. |
||
-- "Sandbox/Sample.tab" -> ' |
-- "Sandbox/Sample.tab" -> 'commons:Data:Sandbox/Sample.tab' |
||
function p.link(frame) |
function p.link(frame) |
||
return link(frame.args[1]) |
return link(frame.args[1]) |
||
Line 157: | Line 157: | ||
-- Give helpful error to thirdparties who try and copy this module. |
-- Give helpful error to thirdparties who try and copy this module. |
||
if not mw.ext or not mw.ext.data or not mw.ext.data.get then |
if not mw.ext or not mw.ext.data or not mw.ext.data.get then |
||
error('Missing JsonConfig extension; Cannot load https://commons. |
error('Missing JsonConfig extension; Cannot load https://commons.miraheze.org/wiki/Data:' .. dataset) |
||
end |
end |
||
Line 175: | Line 175: | ||
-- Given a dataset name, convert it to a title with the 'commons:data:' prefix |
-- Given a dataset name, convert it to a title with the 'commons:data:' prefix |
||
link = function(dataset) |
link = function(dataset) |
||
return ' |
return 'commons:Data:' .. mw.text.trim(dataset or '') |
||
end |
end |
||