Minecraft Wiki
잔글편집 요약 없음
잔글편집 요약 없음
 
(같은 사용자의 중간 판 2개는 보이지 않습니다)
5번째 줄: 5번째 줄:
 
local args = f
 
local args = f
 
if f == mw.getCurrentFrame() then
 
if f == mw.getCurrentFrame() then
args = require( 'Module:ProcessArgs' ).merge( true )
+
args = require( '모듈:ProcessArgs' ).merge( true )
 
end
 
end
 
local version = mw.text.trim( args[1] or '' )
 
local version = mw.text.trim( args[1] or '' )
 
 
 
-- load the values from the submodule
 
-- load the values from the submodule
local version_data = mw.loadData( 'Module:Protocol version/Versions' ).versions[version]
+
local version_data = mw.loadData( '모듈:Protocol version/Versions' ).versions[version]
  +
 
local category = ''
 
local category = ''
 
local value
 
local value
 
local title = mw.title.getCurrentTitle()
  +
 
if version_data then
 
if version_data then
value = version_data.protocol
+
if version_data.protocol then
  +
if version_data.protocol == 'Unknown' then
  +
value = '[[틀:Protocol version#알 수 없는 버전|알 수 없음]]'
  +
if not args.nocat and title.namespace == 0 and not title.isSubpage then
  +
category = '[[분류:알 수 없는 프로토콜 버전]]'
  +
end
  +
else
  +
value = version_data.protocol
  +
end
  +
else
  +
value = 'N/A'
  +
end
 
else
 
else
value = '[[Template:Protocol version#Unknown version|]]'
+
value = '[[:Protocol version# 수 없는 버전|Pending]]'
local title = mw.title.getCurrentTitle()
 
 
if not args.nocat and title.namespace == 0 and not title.isSubpage then
 
if not args.nocat and title.namespace == 0 and not title.isSubpage then
category = '[[Category:Unknown Protocol version]]'
+
category = '[[분류:Pending protocol version]]'
 
end
 
end
 
end
 
end
29번째 줄: 42번째 줄:
 
local args = f
 
local args = f
 
if f == mw.getCurrentFrame() then
 
if f == mw.getCurrentFrame() then
args = require( 'Module:ProcessArgs' ).merge( true )
+
args = require( '모듈:ProcessArgs' ).merge( true )
 
end
 
end
 
local version = mw.text.trim( args[1] or '' )
 
local version = mw.text.trim( args[1] or '' )
 
 
 
-- load the values from the submodule
 
-- load the values from the submodule
local version_data = mw.loadData( 'Module:Protocol version/Versions' ).versions[version]
+
local version_data = mw.loadData( '모듈:Protocol version/Versions' ).versions[version]
  +
 
local category = ''
 
local category = ''
 
local value
 
local value
 
local title = mw.title.getCurrentTitle()
  +
 
if version_data then
 
if version_data then
 
if version_data.data then
 
if version_data.data then
value = version_data.data
+
if version_data.data == 'Unknown' then
  +
value = '[[틀:Data version#알 수 없는 버전|알 수 없음]]'
  +
if not args.nocat and title.namespace == 0 and not title.isSubpage then
  +
category = '[[분류:알 수 없는 데이터 버전]]'
  +
end
  +
else
  +
value = version_data.data
  +
end
 
else
 
else
value = "N/A"
+
value = 'N/A'
 
end
 
end
 
else
 
else
value = '[[Template:Data version#Unknown version|]]'
+
value = '[[:Data version# 수 없는 버전|Pending]]'
local title = mw.title.getCurrentTitle()
 
 
if not args.nocat and title.namespace == 0 and not title.isSubpage then
 
if not args.nocat and title.namespace == 0 and not title.isSubpage then
category = '[[Category:Unknown Data version]]'
+
category = '[[분류:Pending data version]]'
 
end
 
end
 
end
 
end
57번째 줄: 79번째 줄:
 
local args = f
 
local args = f
 
if f == mw.getCurrentFrame() then
 
if f == mw.getCurrentFrame() then
args = require( 'Module:ProcessArgs' ).merge( true )
+
args = require( '모듈:ProcessArgs' ).merge( true )
 
end
 
end
 
 
 
local html = {}
 
local html = {}
local groups = mw.loadData( 'Module:Protocol version/Versions' ).groups
+
local groups = mw.loadData( '모듈:Protocol version/Versions' ).groups
   
 
for _, group in ipairs(groups) do
 
for _, group in ipairs(groups) do
84번째 줄: 106번째 줄:
 
table.insert( html, "<table class='wikitable sortable jquery-tablesorter'>\n" )
 
table.insert( html, "<table class='wikitable sortable jquery-tablesorter'>\n" )
 
table.insert( html, '<tr>\n' )
 
table.insert( html, '<tr>\n' )
table.insert( html, '<th>Client version</th>\n' )
+
table.insert( html, '<th>클라이언트 버전</th>\n' )
table.insert( html, '<th>[[Protocol version]]</th>\n' )
+
table.insert( html, '<th>[[프로토콜 버전]]</th>\n' )
 
if group.has_data_versions then
 
if group.has_data_versions then
table.insert( html, '<th>[[Data version]]</th>\n' )
+
table.insert( html, '<th>[[데이터 버전]]</th>\n' )
 
end
 
end
 
table.insert( html, '</tr>\n' )
 
table.insert( html, '</tr>\n' )

2020년 10월 2일 (금) 05:32 기준 최신판

[만들기 | 역사 | 캐시 제거]설명문서
이 모듈의 설명문서가 없습니다. 이 모듈의 사용 방법을 안다면, 설명문서를 만들어 주십시오.
local p = {}

-- {{Protocol version}}
function p.protocol_version( f )
    local args = f
    if f == mw.getCurrentFrame() then 
        args = require( '모듈:ProcessArgs' ).merge( true )
    end
    local version = mw.text.trim( args[1] or '' )
    
    -- load the values from the submodule
    local version_data = mw.loadData( '모듈:Protocol version/Versions' ).versions[version]
    
    local category = ''
    local value
    local title = mw.title.getCurrentTitle()
    
    if version_data then
        if version_data.protocol then
    		if version_data.protocol == 'Unknown' then
    			value = '[[틀:Protocol version#알 수 없는 버전|알 수 없음]]'
    			if not args.nocat and title.namespace == 0 and not title.isSubpage then
					category = '[[분류:알 수 없는 프로토콜 버전]]'
				end
    		else
    	 	value = version_data.protocol
			end
        else
            value = 'N/A'
        end
    else
        value = '[[틀:Protocol version#알 수 없는 버전|Pending]]'
        if not args.nocat and title.namespace == 0 and not title.isSubpage then
            category = '[[분류:Pending protocol version]]'
        end
    end
    return value .. category
end

-- {{Data version}}
function p.data_version( f )
    local args = f
    if f == mw.getCurrentFrame() then 
        args = require( '모듈:ProcessArgs' ).merge( true )
    end
    local version = mw.text.trim( args[1] or '' )
    
    -- load the values from the submodule
    local version_data = mw.loadData( '모듈:Protocol version/Versions' ).versions[version]
    
    local category = ''
    local value
    local title = mw.title.getCurrentTitle()
    
    if version_data then
        if version_data.data then
            if version_data.data == 'Unknown' then
    			value = '[[틀:Data version#알 수 없는 버전|알 수 없음]]'
    			if not args.nocat and title.namespace == 0 and not title.isSubpage then
					category = '[[분류:알 수 없는 데이터 버전]]'
				end
			else
				value = version_data.data
			end
        else
            value = 'N/A'
        end
    else
        value = '[[틀:Data version#알 수 없는 버전|Pending]]'
        if not args.nocat and title.namespace == 0 and not title.isSubpage then
            category = '[[분류:Pending data 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( '모듈:ProcessArgs' ).merge( true )
    end
    
    local html = {}
    local groups = mw.loadData( '모듈:Protocol version/Versions' ).groups

    for _, group in ipairs(groups) do
    	local include = true
    	if #args ~= 0 then
    		include = nil
    		for __, name in ipairs(args) do
    			if name == group.name then
    				include = true
    				break
				end
			end
		end

		if include then
                if not args.notitle then
	            table.insert( html, "=== [[" .. group.link .. '|' .. group.name .. "]] ===\n" )
                end
	        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>클라이언트 버전</th>\n' )
	        table.insert( html, '<th>[[프로토콜 버전]]</th>\n' )
	        if group.has_data_versions then
	            table.insert( html, '<th>[[데이터 버전]]</th>\n' )
	        end
	        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>\n' )
	            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>\n' )
	                protocol_row = #html
	            else
	                num_same_protocol = num_same_protocol + 1
	                html[protocol_row] = '<td rowspan="' .. num_same_protocol .. '">' .. version.protocol .. '</td>\n'
	            end
	            if group.has_data_versions then
	                if version.data then
	                    table.insert( html, '<td>' .. version.data .. '</td>\n' )
	                else
	                    table.insert( html, '<td>—</td>\n' )
	                end
	            end
	            table.insert( html, '</tr>\n' )
	        end
	
	        table.insert( html, '</table>\n' )
        end
    end

    return table.concat( html )
end

return p