mNo edit summary |
m (<ref> and templates don't work in modules it seems) |
||
Line 50: | Line 50: | ||
local last_protocol = -1 |
local last_protocol = -1 |
||
local protocol_row |
local protocol_row |
||
− | |||
− | local add_notelist = false |
||
for __, version in ipairs(group.values) do |
for __, version in ipairs(group.values) do |
||
table.insert( html, '<tr>' ) |
table.insert( html, '<tr>' ) |
||
− | + | table.insert( html, '<td>[[' .. version.name .. ']]</td>' ) |
|
− | table.insert( html, '<td>[[' .. version.name .. ']]<ref group="' .. group.name .. '">' .. version.note .. '</ref></td>' ) |
||
− | add_notelist = true |
||
− | else |
||
− | table.insert( html, '<td>[[' .. version.name .. ']]</td>' ) |
||
− | end |
||
if version.protocol ~= last_protocol or version.force_split then |
if version.protocol ~= last_protocol or version.force_split then |
||
last_protocol = version.protocol |
last_protocol = version.protocol |
||
Line 74: | Line 67: | ||
table.insert( html, '</table>\n' ) |
table.insert( html, '</table>\n' ) |
||
− | |||
− | if add_notelist then |
||
− | table.insert( html, '{{notelist|' .. group.name .. '}}\n' ) |
||
− | end |
||
end |
end |
||
Revision as of 03:56, 27 January 2018
This module implements {{Protocol version}}
, {{Data version}}
, and {{Protocol version/Table}}
.
The actual data used by this module is stored in Module:Protocol version/Versions.
See also
{{Protocol version}}
{{Protocol version/Table}}
{{Data version}}
- Module:Protocol version
[view | edit | history | purge]The above documentation is transcluded from Module:Protocol version/doc.
local p = {}
-- {{Protocol version}}
function p.value( f )
local args = f
if f == mw.getCurrentFrame() then
args = require( 'Module:ProcessArgs' ).merge( true )
end
local version = mw.text.trim( args[1] or '' )
local type = args.type
-- load the values from the submodule
local version = mw.loadData( 'Module:Pokechu22/Sandbox/Versions' ).all[version]
local category = ''
local value
if version then
value = version.protocol
else
value = '[[Template:Protocol version#Unknown version|—]]'
local title = mw.title.getCurrentTitle()
if not args.nocat and title.namespace == 0 and not title.isSubpage then
category = '[[Category:Unknown Protocol version]]'
end
end
return value .. category
end
-- Version table ({{Protocol version/table}})
function p.table( f )
local args = f
if f == mw.getCurrentFrame() then
args = require( 'Module:ProcessArgs' ).merge( true )
end
local html = {}
local groups = mw.loadData( 'Module:Pokechu22/Sandbox/Versions' ).groups
for _, group in ipairs(groups) do
table.insert( html, "=== [[" .. group.link .. '|' .. group.name .. "]] ===\n" )
if group.desc ~= nil then
table.insert( html, group.desc .. '\n')
end
table.insert( html, "<table class='wikitable sortable jquery-tablesorter'>\n" )
table.insert( html, '<tr>\n' )
table.insert( html, '<th>Version</th>\n' )
table.insert( html, '<th>Protocol Version Number</th>\n' )
table.insert( html, '</tr>\n' )
local num_same_protocol
local last_protocol = -1
local protocol_row
for __, version in ipairs(group.values) do
table.insert( html, '<tr>' )
table.insert( html, '<td>[[' .. version.name .. ']]</td>' )
if version.protocol ~= last_protocol or version.force_split then
last_protocol = version.protocol
num_same_protocol = 1
table.insert( html, '<td>' .. version.protocol .. '</td>' )
protocol_row = #html
else
num_same_protocol = num_same_protocol + 1
html[protocol_row] = '<td rowspan="' .. num_same_protocol .. '">' .. version.protocol .. '</td>'
end
table.insert( html, '</tr>' )
end
table.insert( html, '</table>\n' )
end
return table.concat( html )
end
return p