Jump to content
Wikimedia Meta-Wiki

Module:Reply to

From Meta, a Wikimedia project coordination wiki
Module documentation
TNT This module should use Module:TNT for localisation.
This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing.

Implements {{reply to}}.

Usage

{{#invoke:Reply to|replyto}}

The above documentation is transcluded from Module:Reply to/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.

 localp={}
 localhtmlerror=require('Module:Error').error

 functionp.replyto(frame)
 localorigArgs=frame:getParent().args
 localargs={}
 localmaxArg=0
 fork,vinpairs(origArgs)do
 iftype(k)=='number'then
 ifv:match('%S')then
 ifk>maxArgthenmaxArg=kend
 localtitle=mw.title.new(v)
 ifnottitlethen
 returnhtmlerror{'Error in [[Template:Reply to]]: Input contains forbidden characters.'}
 end
 args[k]=title.baseText
 end
 else
 args[k]=v
 end
 end

 ifmaxArg==0then
 ifframe.args.examplethenargs[1]=frame.args.exampleelsereturnhtmlerror{'Error in [[Template:Reply to]]: Username not given.'}end
 end

 ifmaxArg>(tonumber(frame.args.max)or50)then
 returnhtmlerror{'Error in [[Template:Reply to]]: More than '..tostring(frame.args.maxor50)..' names specified.'}
 else
 localoutStr='<span class="template-ping">'..(args['prefix']or'@')..'[[:User:'..args[1]..'|'..((args['label1']orargs['label'])orargs[1])..']]'
 fori=2,maxArgdo
 if((maxArg>2)or((maxArg==2)and(args['c']=='')))thenoutStr=outStr..","end
 ifi==maxArgthenoutStr=outStr.." "..(args['c']or"and")end
 outStr=outStr.." [[:User:"..args[i].."|"..(args['label'..tostring(i)]orargs[i]).."]]"
 end
 outStr=outStr..(args['p']or":").."</span>"
 returnoutStr
 end
 end

 returnp

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