it would be nice if mw.wikibase.label() would default to the connected item of a page.
same for mw.wikibase.description() and mw.wikibase.sitelink()
right now, I get "Lua error: id must be of type string, nil given." error.
it would be nice if mw.wikibase.label() would default to the connected item of a page.
same for mw.wikibase.description() and mw.wikibase.sitelink()
right now, I get "Lua error: id must be of type string, nil given." error.
| Subject | Repo | Branch | Lines +/- | |
|---|---|---|---|---|
| Default mw.wikibase.* lua functions to the connected item of a page | mediawiki/extensions/Wikibase | master | +54 -12 |
| Status | Subtype | Assigned | Task | ||
|---|---|---|---|---|---|
| Invalid | None | T112073 Lua in Wikibase (tracking) | |||
| Resolved | aude | T99078 default mw.wikibase.label() to the connected item of a page |
Change 210907 had a related patch set uploaded (by Aude):
Default mw.wikibase.* lua functions to the connected item of a page
right now, a lot of modules have code like:
function getId( id )
if not mw.wikibase then
return "wikibase module not found"
end
if id then return id end
entity = mw.wikibase.getEntityObject()
if not entity then return nil end
return entity.id
end
-- Returns the local page of the data item provided.
function p.page(frame)
id = getId(frame.args[1])
if id == nil then
return "(no element found)"
end
return mw.wikibase.sitelink( id )
endhttp://en.wikivoyage.org/wiki/Module:Wikibase
this would become unnecessary, and is intuiatively how I expected and thought these things worked.
Change 210907 merged by jenkins-bot:
Default mw.wikibase.* lua functions to the connected item of a page