Movatterモバイル変換


[0]ホーム

URL:


Jump to content
Wikipedia
Khangela

Module:SDcat

Livela

Documentation for this module may be created atModule:SDcat/doc

--[[SDcatModule to check whether local short description matches that on Wikidata--]]localp={}---------------------------------------------------------------------------------[[setCat has the qid of a Wikidata entity passed as |qid=(it defaults to the associated qid of the current article if omitted)and the local short description passed as |sd=It returns a category if there is an associated Wikidata entity.It returns one of the following tracking categories, as appropriate:* Category:Short description matches Wikidata (case-insensitive)* Category:Short description is different from Wikidata* Category:Short description with empty Wikidata descriptionFor testing purposes, a link prefix |lp= may be set to ":" to make the categories visible.--]]-- function exported for use in other modules-- (local short description, Wikidata entity-ID, link prefix)p._setCat=function(sdesc,itemID,lp)ifnotmw.wikibasethenreturnnilendifitemID==""thenitemID=nilend-- Wikidata description fieldlocalwdesc=(mw.wikibase.getDescription(itemID)or""):lower()ifwdesc==""thenreturn"[["..lp.."Category:Short description with empty Wikidata description]]"elseifwdesc==sdescthenreturn"[["..lp.."Category:Short description matches Wikidata]]"elsereturn"[["..lp.."Category:Short description is different from Wikidata]]"endend-- function exported for call from #invokep.setCat=function(frame)localargsifframe.args.sdthenargs=frame.argselseargs=frame:getParent().argsend-- local short descriptionlocalsdesc=mw.text.trim(args.sdor""):lower()-- Wikidata entity-IDlocalitemID=mw.text.trim(args.qidor"")-- link prefix, strip quoteslocallp=mw.text.trim(args.lpor""):gsub('"','')returnp._setCat(sdesc,itemID,lp)endreturnp
uthathwe kwi-https://xh.wikipedia.org/w/index.php?title=Module:SDcat&oldid=39043

[8]ページ先頭

©2009-2025 Movatter.jp