Module:විකිමූලය
Appearance
| Module:විකිමූලය භාවිතා කිරීම හැකිතරම් අඩු කරන්න. ඒ වෙනුවට Module:විකිදත්ත_තොරතුරු හෝ Module:විකිදත්ත භාවිතා කරන්න. |
This module is copied from the example from the module documentation at mw:Extension:Wikibase Client/Lua. It should be kept consistent with that documentation, rather than being adapted further for use on Wikipedia.
භාවිතය
[edit]- id
{{#invoke: විකිමූලය | id }}
- wdurl
{{#invoke: විකිමූලය | wdurl }}{{#invoke: විකිමූලය | wdurl | entity id (Q# or P#) }}
- label
{{#invoke: විකිමූලය | label }}{{#invoke: විකිමූලය | label | entity id (Q# or P#) }}
- description
{{#invoke: විකිමූලය | description }}{{#invoke: විකිමූලය | description | entity id (Q# or P#) }}
- page
{{#invoke: විකිමූලය | page }}{{#invoke: විකිමූලය | page | item id (Q#) }}
- datatype
{{#invoke: විකිමූලය | datatype | property id (P#) }}
උදාහරණ
[edit]id
[edit]{{#invoke:විකිමූලය | id }}→ no entity
wdurl
[edit]{{#invoke:විකිමූලය | wdurl }}→{{#invoke:විකිමූලය | wdurl | Q132689 }}→ https://www.wikidata.org/wiki/Special:EntityPage/Q132689{{#invoke:විකිමූලය | wdurl | P31 }}→ https://www.wikidata.org/wiki/Special:EntityPage/P31
label
[edit]{{#invoke:විකිමූලය | label }}→{{#invoke:විකිමූලය | label | Q132689 }}→ Casablanca{{#invoke:විකිමූලය | label | P31 }}→ instance of
description
[edit]{{#invoke:විකිමූලය | description }}→{{#invoke:විකිමූලය | description | Q132689 }}→ 1942 film directed by Michael Curtiz{{#invoke:විකිමූලය | description | P31 }}→ type to which this subject corresponds/belongs. Different from P279 (subclass of); for example: K2 is an instance of mountain; volcano is a subclass of mountain
page
[edit]{{#invoke:විකිමූලය | page }}→{{#invoke:විකිමූලය | page | Q132689 }}→
datatype
[edit]See also: wikidata:Help:Data type and wikidata:Special:ListDatatypes
Commons media file: Template:Wpl
{{#invoke:විකිමූලය | datatype | P18 }}→ commonsMedia{{#invoke:විකිමූලය | datatype | Property:P18 }}→ commonsMedia
Geographic coordinates: Template:Wpl
{{#invoke:විකිමූලය | datatype | P625 }}→ globe-coordinate{{#invoke:විකිමූලය | datatype | Property:P625 }}→ globe-coordinate
Item: Template:Wpl
{{#invoke:විකිමූලය | datatype | P6 }}→ wikibase-item{{#invoke:විකිමූලය | datatype | Property:P6 }}→ wikibase-item
Property: Template:Wpl
{{#invoke:විකිමූලය | datatype | P1647 }}→ wikibase-property{{#invoke:විකිමූලය | datatype | Property:P1647 }}→ wikibase-property
String: Template:Wpl
{{#invoke:විකිමූලය | datatype | P225 }}→ string{{#invoke:විකිමූලය | datatype | Property:P225 }}→ string
Monolingual text: Template:Wpl
{{#invoke:විකිමූලය | datatype | P1448 }}→ monolingualtext{{#invoke:විකිමූලය | datatype | Property:P1448 }}→ monolingualtext
Quantity: Template:Wpl
{{#invoke:විකිමූලය | datatype | P1082 }}→ quantity{{#invoke:විකිමූලය | datatype | Property:P1082 }}→ quantity
Point in time: Template:Wpl
{{#invoke:විකිමූලය | datatype | P569 }}→ time{{#invoke:විකිමූලය | datatype | Property:P569 }}→ time
URL: Template:Wpl
{{#invoke:විකිමූලය | datatype | P856 }}→ url{{#invoke:විකිමූලය | datatype | Property:P856 }}→ url
Mathematical expression: Template:Wpl
{{#invoke:විකිමූලය | datatype | P2534 }}→ math{{#invoke:විකිමූලය | datatype | Property:P2534 }}→ math
External identifier: Template:Wpl
{{#invoke:විකිමූලය | datatype | P212 }}→ external-id{{#invoke:විකිමූලය | datatype | Property:P212 }}→ external-id
| ඉහත දැක්වෙන උපදෙස්, Module:විකිමූලය/උපදෙස් වෙතින් ගෙනැවිත් ඇත. (සංස්කරණය | ඉතිහාසය) සංස්කාරකවරුන් හට, මෙම සැකිල්ලේ මොඩියුලයේ sandbox (නිර්මාණය | mirror) සහ testcases (නිර්මාණය) පිටු වල අත්හදා බැලීම් කළ හැකිය. ප්රවර්ග, /උපදෙස් උප පිටුව වෙත එක් කිරීමට කාරුණික වන්න. මෙම මොඩියුලය සතු උප පිටු. |
---------- Module:Wikibase ----------------
require('strict')
local p = {}
-- Return the entity ID of the item linked to the current page.
function p.id(frame)
if not mw.wikibase then
return "no mw.wikibase"
end
return mw.wikibase.getEntityIdForCurrentPage() or "no entity"
end
-- Return the URL of an entity given its entity ID
-- or the item linked to the current page if no argument is provided.
function p.wdurl(frame)
return mw.wikibase.getEntityUrl(frame.args[1] and mw.text.trim(frame.args[1])) -- defaults to entity URL of the item linked to the current page
end
-- Return the label of an entity given its entity ID
-- or the item linked to the current page if no argument is provided.
function p.label(frame)
return mw.wikibase.getLabel(frame.args[1] and mw.text.trim(frame.args[1])) -- defaults to label of the item linked to the current page
end
-- Return the description of an entity given its entity ID
-- or the item linked to the current page if no argument is provided.
function p.description(frame)
return mw.wikibase.getDescription(frame.args[1] and mw.text.trim(frame.args[1])) -- defaults to description of the item linked to the current page
end
-- Return the local title of an item given its entity ID
-- or the item linked to the current page if no argument is provided.
function p.page(frame)
local qid = frame.args[1] and mw.text.trim(frame.args[1])
if not qid or qid == '' then
qid = mw.wikibase.getEntityIdForCurrentPage() -- default the item connected to the current page
end
return mw.wikibase.getSitelink(qid or '') -- requires one string arg
end
-- Return the data type of a property given its entity ID.
function p.datatype(frame)
local prop = mw.wikibase.getEntity(frame.args[1] and mw.text.trim(frame.args[1]):upper():gsub('PROPERTY:P', 'P')) -- trim and remove any "Property:" prefix
return prop and prop.datatype
end
return p