Module:User script table row
Appearance
From Wikipedia, the free encyclopedia
Implements {{user script table row }} used in Wikipedia:User scripts/List. /data interprets Wikipedia:User scripts/Most imported scripts and formats the data in a table.
The above documentation is transcluded from Module:User script table row/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.
localdata=mw.loadData('Module:User script table row/data') localp={} functionp._main(args) localcode=args.code localdoc=args.doc localname=args.name localdesc=args.desc ifnotcodeandnotdocthen returnmw.html.create('tr'):tag('td'):attr('colspan',4) :tag('span') :addClass('error') :wikitext('Error: <code>|code=</code> or <code>|doc=</code> must be specified') :allDone() end ifnotcodethen code=doc..'.js' end ifnotdocthen localtitle=code:match('^(.+)%.[CJcj][Ss][Ss]?$') iftitlethen title=mw.title.new(title) ifnottitle.isExternalandtitle.existsthen doc=title.fullText end end end ifnotnamethen name=docandmw.ustring.match(doc,'[^/]+$')or mw.ustring.match(code,'([^/]+)%.[CJcj][Ss][Ss]?$') end localrow=mw.html.create('tr') do localcell=mw.html.create('td') :wikitext(docandstring.format('[[:%s|%s]]',doc,name)orname) ifargs.indentandargs.indent:find('^%d+$')then cell:css('padding-left',args.indent..'em') end ifcode~='none'then cell :wikitext(' ') :tag('span') :addClass('userscripttable-sourcelink') :wikitext(string.format('([[:%s|source]])',code)) :done() :tag('span') :addClass('scriptInstallerLink') :attr('id',code) :done() end row:node(cell) end row:tag('td') :wikitext(desc) :done() localstats=codeanddata[code]or{total='N/A',active='N/A'} row :tag('td'):wikitext(stats.total):done() :tag('td'):wikitext(stats.active) returnrow end functionp.main(frame) localargs={} fork,vinpairs(frame:getParent().args)do ifvandv~=''then args[k]=v end end returnp._main(args) end returnp