Revision as of 15:58, 1 July 2015 view sourceIzkala (talk | contribs)Autopatrolled, Extended confirmed users, Pending changes reviewers, Rollbackers29,341 edits Mediawiki talk:Common.css#Alignment of infobox labels← Previous edit | Revision as of 16:36, 1 July 2015 view source Izkala (talk | contribs)Autopatrolled, Extended confirmed users, Pending changes reviewers, Rollbackers29,341 edits Restore default line-heightNext edit → | ||
Line 20: | Line 20: | ||
<th style="text-align:center; background:]=] .. frame:expandTemplate{title = 'Infobox album/color', args = {args.Type}} .. ] from '']=] .. (args.Name or mw.title.getCurrentTitle().prefixedText) .. [=[''</th> | <th style="text-align:center; background:]=] .. frame:expandTemplate{title = 'Infobox album/color', args = {args.Type}} .. ] from '']=] .. (args.Name or mw.title.getCurrentTitle().prefixedText) .. [=[''</th> | ||
</tr> | </tr> | ||
<tr style="text-align:left; vertical-align:top |
<tr style="text-align:left; vertical-align:top;"> | ||
<td colspan="3">]=] | <td colspan="3">]=] | ||
local nums = getArgNums(args, 'ingle ') | local nums = getArgNums(args, 'ingle ') |
Revision as of 16:36, 1 July 2015
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(args, 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(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 args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Singles'}) local out = [=[<tr> <th style="text-align:center; background:]=] .. frame:expandTemplate{title = 'Infobox album/color', args = {args.Type}} .. ] from '']=] .. (args.Name or mw.title.getCurrentTitle().prefixedText) .. [=[''</th> </tr> <tr style="text-align:left; vertical-align:top;"> <td colspan="3">]=] local nums = getArgNums(args, 'ingle ') for _, num in ipairs(nums) do out = out .. '\n# <span class="item"><span class="fn">"' .. (args or args) .. '"</span>' local date = args or args if date then out = out .. '<br />Released: ' .. date end out = out .. '</span>' end out = out .. [=[</td> </tr>]=] return out end return p