Module:For and Template:Tag: Difference between pages

From ZeldaMods (Breath of the Wild)
(Difference between pages)
Jump to navigation Jump to search
imported>Leoetlino
m (1 revision imported)
 
(These are called attributes; no one who does HTML calls them "parameters".)
 
Line 1: Line 1:
local mArguments --initialize lazily
<code class="{{#ifeq:{{{wrap|}}}|yes|wrap|nowrap}}" style="{{#ifeq:{{{style|}}}|plain|border:none;background:transparent;|{{{style|}}}}}"><!--
local mHatlist = require('Module:Hatnote list')
Opening tag
local mHatnote = require('Module:Hatnote')
-->{{#switch:{{{2|pair}}}
local yesNo = require('Module:Yesno')
  |c|close =
local p = {}
  |e|empty|s|single|v|void
 
  |o|open
--Implements {{For}} from the frame
  |p|pair = &lt;{{#if:{{{link|}}}|[[HTML element#{{{1|tag}}}|{{{1|tag}}}]]|{{{1|tag}}}}}{{#if:{{{params|{{{attribs|}}}}}}|&#32;{{{params|{{{attribs}}}}}}}}
--uses capitalized "For" to avoid collision with Lua reserved word "for"
}}<!--
function p.For (frame)
Content between tags
mArguments = require('Module:Arguments')
-->{{#switch:{{{2|pair}}}
return p._For(mArguments.getArgs(frame))
  |c|close = {{{content|}}}
end
  |e|empty|s|single|v|void = &#32;&#47;&gt;
 
  |o|open = &gt;{{{content|}}}
--Implements {{For}} but takes a manual arguments table
  |p|pair = {{#ifeq:{{{1|tag}}}|!--||&gt;}}{{{content|...}}}
function p._For (args)
}}<!--
local use = args[1]
Closing tag
if (not use) then
-->{{#switch:{{{2|pair}}}
return mHatnote.makeWikitextError(
  |e|empty|s|single|v|void
'no context parameter provided. Use {{other uses}} for "other uses" hatnotes.',
  |o|open =
'Template:For#Errors',
  |c|close
args.category
  |p|pair = {{#ifeq:{{{1|tag}}}|!--|--&gt;|&lt;&#47;{{{1|tag}}}&gt;}}
)
}}<!--
end
--></code><noinclude>
local pages = {}
{{Documentation}}
function two (a, b) return a, b, 1 end --lets us run ipairs from 2
</noinclude>
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

Revision as of 17:17, 26 July 2018

<tag>...</tag>

Template documentation[create]