Revision as of 23:17, 30 January 2014 view sourceJackmcbarn (talk | contribs)31,380 edits see if this works← Previous edit | Revision as of 23:18, 30 January 2014 view source Jackmcbarn (talk | contribs)31,380 edits fix errorNext edit → | ||
Line 22: | Line 22: | ||
<td colspan="3">]=] | <td colspan="3">]=] | ||
local nums = getArgNums(frame, 'ingle ') | local nums = getArgNums(frame, 'ingle ') | ||
for num in nums do | for x,num in pairs(nums) do | ||
out = out .. '# <span class="item"><span class="fn">"' .. (args or args) .. '"</span>' | out = out .. '# <span class="item"><span class="fn">"' .. (args or args) .. '"</span>' | ||
end | end |
Revision as of 23:18, 30 January 2014
Module documentation[view] [edit] [history] [purge]This module implements the {{Singles}} template. Please see the template page for usage instructions.
The above documentation is transcluded from Module:Singles/doc. (edit | history)Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Subpages of this module.
local p = {} -- Ripped from Module:Infobox. TODO: Make a utility module that can do this kind of thing local function getArgNums(frame, prefix) -- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local nums = {} for k, v in pairs(frame.args) do local num = tostring(k):match('^' .. prefix .. '(%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end function p.main(frame) local out = [=[<tr style="text-align:center;"> <th style="background:{{Template:Infobox album/color|{{{Type|}}}}};" colspan="3">] from \'\'{{{Name}}}\'\'</th> </tr> <tr style="text-align:left; vertical-align:top; line-height:11px;"> <td colspan="3">]=] local nums = getArgNums(frame, 'ingle ') for x,num in pairs(nums) do out = out .. '# <span class="item"><span class="fn">"' .. (args or args) .. '"</span>' end out = out .. [=[</td> </tr>]=] return out end return p