Mô đun:Multi-section link
Tài liệu mô đun[tạo]
-- This module creates a section link with multiple section names.
local p = {}
local function normalizePageName(page)
local title = mw.title.new(page)
if not title then
error(string.format("'%s' không phải là một tên trang hợp lệ", page), 3)
elseif title.namespace == 6 or title.namespace == 14 then
return ':' .. title.prefixedText
else
return title.prefixedText
end
end
function p._main(args)
local displayParts = {}
for i, v in ipairs(args) do
displayParts[i] = v
end
local nParts = #displayParts
if nParts < 1 then
error('không có tên trang được tìm thấy trong thông số |1=', 2)
elseif nParts == 1 then
return string.format('[[%s]]', normalizePageName(displayParts[1]))
else
local display = {}
for i, s in ipairs(displayParts) do
table.insert(display, s)
if i ~= nParts then
table.insert(display, ' ')
table.insert(display, string.rep('§', i))
table.insert(display, ' ')
end
end
display = table.concat(display)
local page = normalizePageName(displayParts[1])
local fragment = displayParts[nParts]
return string.format('[[%s#%s|%s]]', page, fragment, display)
end
end
function p.main(frame)
local args = require('Mô đun:Arguments').getArgs(frame, {
wrappers = 'Bản mẫu:Multi-section link'
})
return p._main(args)
end
return p
Wiki - Keonhacai copa chuyên cung cấp kiến thức thể thao, keonhacai tỷ lệ kèo, bóng đá, khoa học, kiến thức hằng ngày được chúng tôi cập nhật mỗi ngày mà bạn có thể tìm kiếm tại đây có nguồn bài viết: https://vi.wikipedia.org/wiki/M%C3%B4_%C4%91un:Multi-section_link