https://tdwg-cd.wikibase.cloud/w/index.php?title=Module:Wikibase&feed=atom&action=historyModule:Wikibase - Revision history2024-03-28T17:36:48ZRevision history for this page on the wikiMediaWiki 1.39.6https://tdwg-cd.wikibase.cloud/w/index.php?title=Module:Wikibase&diff=650&oldid=prevMtrekels: Created page with "---------- Module:Wikibase ---------------- local p = {} -- Return the item ID of the item linked to the current page. function p.id(frame) if not mw.wikibase then return..."2020-05-12T20:01:31Z<p>Created page with "---------- Module:Wikibase ---------------- local p = {} -- Return the item ID of the item linked to the current page. function p.id(frame) if not mw.wikibase then return..."</p>
<p><b>New page</b></p><div>---------- Module:Wikibase ----------------<br />
local p = {}<br />
<br />
-- Return the item ID of the item linked to the current page.<br />
function p.id(frame)<br />
if not mw.wikibase then<br />
return "no mw.wikibase"<br />
end<br />
entity = mw.wikibase.getEntityObject()<br />
<br />
if entity == nil then<br />
return "no entity"<br />
end<br />
return entity.id<br />
end<br />
<br />
-- Return the WD entity URL of a given data item, or of connected page<br />
-- if no argument is provided to this method.<br />
function p.wdurl(frame)<br />
if frame.args[1] == nil then<br />
entity = mw.wikibase.getEntityObject()<br />
if not entity then return nil end<br />
id = entity.id<br />
else<br />
id = mw.text.trim(frame.args[1])<br />
end<br />
return mw.wikibase.getEntityUrl( id )<br />
end<br />
<br />
-- Return the label of a given data item, or of connected page<br />
-- if no argument is provided to this method.<br />
function p.label(frame)<br />
if frame.args[1] == nil then<br />
entity = mw.wikibase.getEntityObject()<br />
if not entity then return nil end<br />
id = entity.id<br />
else<br />
id = mw.text.trim(frame.args[1])<br />
end<br />
return mw.wikibase.label( id )<br />
end<br />
<br />
-- Return the description of a given data item, or of connected page<br />
-- if no argument is provided to this method.<br />
function p.description(frame)<br />
if frame.args[1] == nil then<br />
entity = mw.wikibase.getEntityObject()<br />
if not entity then return nil end<br />
id = entity.id<br />
else<br />
id = mw.text.trim(frame.args[1])<br />
end<br />
return mw.wikibase.description( id )<br />
end<br />
<br />
-- Return the local page about a given data item, or of connected page<br />
-- if id is not specified.<br />
function p.page(frame)<br />
if frame.args[1] == nil then<br />
entity = mw.wikibase.getEntityObject()<br />
if not entity then return nil end<br />
id = entity.id<br />
else<br />
id = mw.text.trim(frame.args[1])<br />
end<br />
return mw.wikibase.sitelink( id )<br />
end<br />
<br />
-- Return the data type of a property<br />
function p.datatype(frame)<br />
if frame.args[1] and string.find(frame.args[1], "Property:P") then<br />
if mw.wikibase.getEntityObject(string.gsub(frame.args[1], "Property:P", "P")) then<br />
return mw.wikibase.getEntityObject(string.gsub(frame.args[1], "Property:P", "P") ).datatype<br />
end<br />
elseif frame.args[1] and string.find(frame.args[1], "P") then<br />
if mw.wikibase.getEntityObject(frame.args[1]) then<br />
return mw.wikibase.getEntityObject(frame.args[1]).datatype<br />
end<br />
end<br />
end<br />
<br />
return p</div>Mtrekels