Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Swpb/wrong-namespace
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
--Implement Wrong namespace template local p={} function p.wrongns(frame) --Get arguments and context local content = frame.args[1] local yes = frame.args['yes'] local no = frame.args['no'] local show = frame.args['show'] local nowarn = frame.args['nowarn'] local nstext = mw.title.getCurrentTitle().nsText local nsnum = mw.title.getCurrentTitle().namespace --Internal variables local istalk = math.fmod(nsnum,2) local isok = 0 --Check if namespace is ok if yes then for space in mw.ustring.gmatch( yes, "[%s%d]+" ) do if space==nstext or space==nsnum then isok = 1 break end end end if no and not isok then for space in mw.ustring.gmatch( no, "[%s%d]+" ) do if space == nstext or space == nsnum then isok = 0 break elseif space=='notalk' then if istalk then isok = 0 end elseif space=='talkonly' then if istalk then isok = 1 end end end end --Generate output local output = '' if isok==1 then output = content else if show=='yes' or show=='1' then output = content end if not (nowarn=='yes' or nowarn=='1') then output = output .. frame:expandTemplate{ title = 'error', args = { 'Error: This content is not intended for use in this [[Wikipedia:Namespace|namespace]]' } } end end return output end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Swpb/wrong-namespace/doc
(
edit
)