Jump to content
Wikimedia Meta-Wiki

Module:Community Wishlist data

From Meta, a Wikimedia project coordination wiki
Module documentation


Extracted data for {{Community Wishlist link}}, now superseded by the parser function {{#CommunityRequests:data}} after T406537.


The above documentation is transcluded from Module:Community Wishlist data/doc. (edit | history)
Editors can experiment in this module’s sandbox (create | mirror) and testcases (create) pages.
Please add categories to the /doc subpage. Subpages of this module.

 require('strict')
 localp={}

 localfunctionmakeError(s)
 return'<span class="error">&#91;'..s..'&#93;</span>'
 end

 functionp._(frame)
 returnmw.text.jsonEncode(frame.args)
 end

 functionp.main(frame)
 localid=frame.args.id
 localpageType=idand(id:find('^W[1-9]%d*$')and'wish'
 orid:find('^FA[1-9]%d*$')and'focus area')
 ifnotpageTypethen
 returnmakeError('not a valid wish or focus area ID')
 end
 localprop=frame.args.propor'title'
 ifprop=='votecount'then
 localcontent=mw.title.new('Community Wishlist/'..id..'/Votes').content
 ifnotcontentthen
 returnmw.title.new('Community Wishlist/'..id).existsand0
 ormakeError(pageType..' not found')
 end
 localcount=0
 for_incontent:gmatch('{{#CommunityRequests:%s*vote%s*|')do
 count=count+1
 end
 returncount
 end
 locallang=frame.args.langor'en'
 localcontent=mw.title.new('Community Wishlist/'..id..'/'..lang).content
 orlang~='en'andmw.title.new('Community Wishlist/'..id..'/en').content
 ormw.title.new('Community Wishlist/'..id).content
 ifnotcontentthen
 returnmakeError(pageType..' not found')
 end
 localnewCont=content:gsub('^{{#CommunityRequests:[^|]+','{{#invoke:Community Wishlist data|_')
 localdata=mw.text.jsonDecode(frame:preprocess(newCont))[prop]
 ifnotdatathen
 returnmakeError('data not found')
 end
 returnmw.text.trim(data:gsub('</?translate>',''):gsub('<translate%s[^>]*>',''))
 end

 returnp

AltStyle によって変換されたページ (->オリジナル) /