Home
Random
Log in
Settings
About ARC Technical Repository
Disclaimers
Search
Editing
Module
:
Namespace other
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!
require('strict') local p = {} local getArgs = require('Module:Arguments').getArgs local yesno = require('Module:Yesno') function p._namespace_other(args) local namespace = string.lower(args.demospace or mw.title.getCurrentTitle().nsText) namespace = string.gsub(namespace, ' ', '_') local target = string.lower(args.target or 'main') if yesno(args['include-talk']) then namespace = string.gsub(namespace, '[%s_]*talk', '') end local special_targets = { ['talk'] = function (ns) return mw.title.new(mw.title.getCurrentTitle().rootText, ns).isTalkPage end, ['main'] = function (ns) return ns == '' or ns == 'main' end } if namespace == target or (special_targets[target] and special_targets[target](namespace)) then return args[1] else return args[2] end end function p.namespace_other(frame) return p._namespace_other(getArgs(frame)) end local function _page_index_other(args) local page_entry = args['page index'] or args['page'] or args[1] local index_entry = args['page index'] or args['index'] or args[2] local other_entry = args['other'] or args[3] local namespace = string.lower(args.demospace or mw.title.getCurrentTitle().nsText) namespace = string.gsub(namespace, ' ', '_') namespace = string.gsub(namespace, '[%s_]*talk', '') return (namespace == 'page' and page_entry) or (namespace == 'index' and index_entry) or other_entry end function p.page_index_other(frame) return _page_index_other(getArgs(frame)) end return p
Summary:
Please note that all contributions to ARC Technical Repository 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
TechRepo:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Page included on this page:
Module:Namespace other/doc
(
edit
)