Khác biệt giữa bản sửa đổi của “Mô đun:Characters”
Một thế giới nơi chỉ có đam mê, niềm vui và sắc màu...
Nội dung được thêm vào Nội dung được xóa
Không có tóm lược sửa đổi |
Không có tóm lược sửa đổi |
||
(không hiển thị 8 phiên bản ở giữa của cùng người dùng) | |||
Dòng 1: | Dòng 1: | ||
--- Mô đun cho hộp thông tin Nhân vật |
|||
--- |
|||
--- @param frame table |
|||
--- @return string |
|||
local p = {} |
local p = {} |
||
local metatable = {} |
|||
local methodtable = {} |
|||
metatable.__index = methodtable |
|||
metatable.__tostring = function( self ) |
|||
⚫ | |||
end |
|||
function p.main() |
function p.main() |
||
local libraryUtil = require( 'libraryUtil' ) |
local libraryUtil = require( 'libraryUtil' ) |
||
local |
local instance = require( 'Module:InfoboxNeue' ) |
||
local args = require( 'Module:Arguments' ).getArgs( frame ) |
local args = require( 'Module:Arguments' ).getArgs( frame ) |
||
Dòng 18: | Dòng 25: | ||
if args[ 'image' ] then |
if args[ 'image' ] then |
||
instance:renderImage( args[ 'image' ] ) |
|||
end |
end |
||
if args[ 'indicator' ] then |
if args[ 'indicator' ] then |
||
instance:renderIndicator( { |
|||
data = args[ 'indicator' ], |
data = args[ 'indicator' ], |
||
desc = args[ 'indicatorDesc' ], |
desc = args[ 'indicatorDesc' ], |
||
Dòng 30: | Dòng 37: | ||
if args[ 'title' ] then |
if args[ 'title' ] then |
||
instance:renderHeader( { |
|||
title = args[ 'title' ], |
title = args[ 'title' ], |
||
subtitle = args[ 'subtitle' ], |
subtitle = args[ 'subtitle' ], |
||
Dòng 51: | Dòng 58: | ||
if args[ 'label' .. i ] and args[ 'content' .. i ] then |
if args[ 'label' .. i ] and args[ 'content' .. i ] then |
||
table.insert( sections[ sectionMap[ ( currentSection or 'default' ) ] ].content, |
table.insert( sections[ sectionMap[ ( currentSection or 'default' ) ] ].content, instance:renderItem( args[ 'label' .. i ], args[ 'content' .. i ] ) ) |
||
end |
end |
||
end |
end |
||
for _, section in ipairs( sections ) do |
for _, section in ipairs( sections ) do |
||
instance:renderSection( { |
|||
title = section.title, |
title = section.title, |
||
subtitle = section.subtitle, |
subtitle = section.subtitle, |
||
Dòng 63: | Dòng 70: | ||
} ) |
} ) |
||
end |
end |
||
⚫ | |||
end |
end |
||
Bản mới nhất lúc 02:47, ngày 4 tháng 6 năm 2024
Lỗi Lua trong package.lua tại dòng 80: module 'Module:Module toc' not found.
Sự thật thú vị:
Characters
Characters
1234567890
Thành viên của
1st section's subtitle
1st item's label
item's content
2nd section
2nd section's subtitle
1st item's label
1st item's content
2nd item's label
2nd item's content
local p = {}
local metatable = {}
local methodtable = {}
metatable.__index = methodtable
metatable.__tostring = function( self )
return tostring( self:renderInfobox() )
end
function p.main()
local libraryUtil = require( 'libraryUtil' )
local instance = require( 'Module:InfoboxNeue' )
local args = require( 'Module:Arguments' ).getArgs( frame )
local sections = {
{ content = {}, col = args[ 'col' ] or 2 }
}
local sectionMap = { default = 1 }
local currentSection
if args[ 'image' ] then
instance:renderImage( args[ 'image' ] )
end
if args[ 'indicator' ] then
instance:renderIndicator( {
data = args[ 'indicator' ],
desc = args[ 'indicatorDesc' ],
class = args[ 'indicatorClass' ]
} )
end
if args[ 'title' ] then
instance:renderHeader( {
title = args[ 'title' ],
subtitle = args[ 'subtitle' ],
} )
end
for i = 1, 50, 1 do
if args[ 'section' .. i ] then
currentSection = args[ 'section' .. i ]
table.insert( sections, {
title = currentSection,
subtitle = args[ 'section-subtitle' .. i ],
col = args[ 'section-col' .. i ] or args[ 'col' ] or 2,
content = {}
} )
sectionMap[ currentSection ] = #sections
end
if args[ 'label' .. i ] and args[ 'content' .. i ] then
table.insert( sections[ sectionMap[ ( currentSection or 'default' ) ] ].content, instance:renderItem( args[ 'label' .. i ], args[ 'content' .. i ] ) )
end
end
for _, section in ipairs( sections ) do
instance:renderSection( {
title = section.title,
subtitle = section.subtitle,
col = section.col,
content = section.content,
} )
end
end
return p