「モジュール:箇条書き3列」の版間の差分
ナビゲーションに移動
検索に移動
ja>Nami-ja |
(相違点なし)
|
2017年11月21日 (火) 00:09時点における版
このモジュールについての説明文ページを モジュール:箇条書き3列/doc に作成できます
local p = {} function p.main( frame ) local template_name = frame:getParent():getTitle() local args = require('Module:Arguments').getArgs(frame, { wrappers = template_name, removeBlanks = false }) local t1 = '' -- 1枠目 local t2 = '' -- 2枠目 local t3 = '' -- 3枠目 local style = args.style or '' local number = args.number or '' local line = '' local temp = '' local j = args.start or '' if j == '' then j = 1 end for i = 1, 2000, 3 do t1 = args[i] or '' t2 = args[i + 1] or '' t3 = args[i + 2] or '' temp = t1 ..t2 ..t3 if temp == '' then break end temp = '<tr>' if number ~= '' then temp = temp ..'<td style="text-align: right;"><span style="margin-left: 10px;">' .. j ..'.</span></td>' else temp = temp ..'<td><ul><li> </li></ul></td>' end if t2 ~= '' then temp = temp ..'<td class="nowrap" style="padding-left: 2px; border-bottom: 1px solid #aaa;">' ..t1 ..'</td>' ..'<td> - </td><td class="nowrap" style="border-bottom: 1px solid #aaa;">' ..t2 ..'</td>' else temp = temp ..'<td class="nowrap" style="padding-left: 2px; border-bottom: 1px solid #aaa;">' ..t1 ..'</td>' ..'<td></td><td></td>' end if t3 ~= '' then temp = temp ..'<td> - </td><td style=" border-bottom: 1px solid #aaa;">' ..t3 ..'</td>' else temp = temp ..'<td></td><td></td>' end line = line ..temp ..'</tr>' temp = '' j = j + 1 end -- 目次行判定 local toc = args.toc or '' -- 目次1-3枠目 local toc1 = args.toc1 or '' -- 目次1枠目 local toc2 = args.toc2 or '' -- 目次2枠目 local toc3 = args.toc3 or '' -- 目次3枠目 if toc ~= '' then temp = temp ..'<tr style="font-weight: bold; background: #eef;"><td></td>' ..'<td colspan="5">' ..toc ..'</td></tr>' line = temp ..line elseif toc1 ~= '' or toc2 ~= '' or toc3 ~= '' then temp = temp ..'<tr style="font-weight: bold; background: #eef;"><td></td>' ..'<td>' ..toc1 ..'</td>' ..'<td></td><td>' ..toc2 ..'</td>' ..'<td></td><td>' ..toc3 ..'</td></tr>' line = temp ..line end -- キャプション判定 local caption = args.caption or '' if caption ~= '' then temp = '<caption><span style="font-weight: bold;">' ..caption ..'</span></caption>' line = temp ..line end return '<table style="' ..style ..'; margin: 5px; padding: 2px;">' ..line ..'</table>' end return p