imported>Leoetlino |
imported>BravelyPeculiar |
Line 1: |
Line 1: |
| local mArguments --initialize lazily
| | <h2>{{#vardefine: path_middle |{{#titleparts: {{PAGENAME}} | -1 | 2 }}}} |
| local mHatlist = require('Module:Hatnote list')
| | {{#vardefine: link_text |{{{archive|Content}}}/{{#var: path_middle}}}} |
| local mHatnote = require('Module:Hatnote')
| | {{#if: {{#var: path_middle}} | [[Content/{{#var: path_middle}}#{{#var: link_text}}|{{#var: link_text}}]]|[[{{{archive|Content}}}]]}}/{{SUBPAGENAME}}</h2> |
| local yesNo = require('Module:Yesno')
| | <noinclude> |
| local p = {}
| | <templatedata> |
| | | { |
| --Implements {{For}} from the frame
| | "params": { |
| --uses capitalized "For" to avoid collision with Lua reserved word "for"
| | "1": { |
| function p.For (frame)
| | "label": "Archive", |
| mArguments = require('Module:Arguments')
| | "description": "Don't include for unpacked files", |
| return p._For(mArguments.getArgs(frame))
| | "type": "string" |
| end
| | } |
| | | } |
| --Implements {{For}} but takes a manual arguments table
| | } |
| function p._For (args)
| | </templatedata> |
| local use = args[1]
| | [[Category: ZeldaMods templates]] |
| if (not use) then
| | </noinclude> |
| return mHatnote.makeWikitextError(
| |
| 'no context parameter provided. Use {{other uses}} for "other uses" hatnotes.',
| |
| 'Template:For#Errors',
| |
| args.category
| |
| )
| |
| end | |
| local pages = {}
| |
| function two (a, b) return a, b, 1 end --lets us run ipairs from 2
| |
| for k, v in two(ipairs(args)) do table.insert(pages, v) end
| |
| return mHatnote._hatnote(
| |
| mHatlist.forSeeTableToString({{use = use, pages = pages}}),
| |
| {selfref = args.selfref}
| |
| ) .. (
| |
| (use == 'other uses') and yesNo(args.category) and
| |
| '[[Category:Hatnote templates using unusual parameters]]' or ''
| |
| )
| |
| end
| |
| | |
| return p
| |