Module:R from fictional object multi/sandbox
Appearance
From Wikipedia, the free encyclopedia
This is the module sandbox page for Module:R from fictional object multi (diff).
See also the companion subpage for test cases (run).
See also the companion subpage for test cases (run).
This module depends on the following other modules:
Module:R from fictional object multi is used by {{R from fictional character }}, {{R from fictional element }} and {{R from fictional location }} to handle multiple series tagged with the same redirect.
Usage
[edit ]{{#invoke:R from fictional object multi|main|category=|1=|2=|3=|4=|5=|6=|7=|8=|sort=}}
Parameter list
[edit ]Parameter | Explanation |
---|---|
1...8
|
Positional or numbered parameters for each series name. |
category
|
The redirect category scheme to be used. |
sort
|
An optional sort key for the category. |
The above documentation is transcluded from Module:R from fictional object multi/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Add categories to the /doc subpage. Subpages of this module.
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Add categories to the /doc subpage. Subpages of this module.
require("strict") localp={} localresolveRedir=require("Module:Resolve category redirect").rtarget --[[ Local function which creates the relevent category, either with or without a sort key. --]] localfunctioncreateCategory(categoryScheme,name,sortKey) localcategory=name.." "..categoryScheme category=resolveRedir(category) if(sortKey)then category=category.."|"..sortKey end return"[[Category:"..category.."]]" end --[[ Local function which handles the main process. Parameters: -- |1...8= — required; Positional or numbered parameters for each series name. -- |category= — required; The redirect category scheme to be used. -- |sort= — optinal; A sort key for the category. --]] localfunction_main(args) -- If category wasn't set, return error. if(notargs.category)then returnerror end localcategories="" fori=1,10do if(args[i])then categories=categories..createCategory(args.category,args[i],args["sort"]) end end returncategories end --[[ Entry point. --]] functionp.main(frame) localgetArgs=require("Module:Arguments").getArgs localargs=getArgs(frame) return_main(args) end returnp