Khác biệt giữa bản sửa đổi của “Mô đun:Labelled list hatnote”

Không có tóm lược sửa đổi
Thẻ: Đã bị lùi lại
n Đã lùi lại sửa đổi của Isaacp (Thảo luận) quay về phiên bản cuối của Pyc1948
Thẻ: Lùi tất cả Đã bị lùi lại
Dòng 7: Dòng 7:
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


local mHatnote = require('Module:Hatnote')
local mHatnote = require('Mô đun:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mHatlist = require('Mô đun:Hatnote list')
local mArguments --initialize lazily
local mArguments --initialize lazily
local p = {}
local p = {}
Dòng 14: Dòng 14:
-- Defaults global to this module
-- Defaults global to this module
local defaults = {
local defaults = {
label = '문서를 참고하십시오', --Final fallback for label argument
label = 'Xem thêm', --Final fallback for label argument
labelForm = '%s %s',
labelForm = '%s: %s',
prefixes = {'label', 'label ', 'l'},
prefixes = {'label', 'label ', 'nhãn', 'nhãn ', 'l'},
template = 'Module:Labelled list hatnote'
template = 'Mô đun:Labelled list hatnote'
}
}


Dòng 45: Dòng 45:
-- The main frame (template definition) takes 1 or 2 arguments, for a singular
-- The main frame (template definition) takes 1 or 2 arguments, for a singular
-- and (optionally) plural label respectively:
-- and (optionally) plural label respectively:
-- * {{#invoke:Labelled list hatnote|labelledList|Singular label|Plural label}}
-- * {{#gọi:Labelled list hatnote|labelledList|Singular label|Plural label}}
-- The resulting template takes pagename & label parameters normally.
-- The resulting template takes pagename & label parameters normally.
function p.labelledList (frame)
function p.labelledList (frame)
mArguments = require('Module:Arguments')
mArguments = require('Mô đun:Arguments')
local labels = {frame.args[1] or defaults.label}
local labels = {frame.args[1] or defaults.label}
labels[2] = frame.args[2] or labels[1]
labels[2] = frame.args[2] or labels[1]
Dòng 58: Dòng 58:
category = args.category,
category = args.category,
selfref = frame.args.selfref or args.selfref,
selfref = frame.args.selfref or args.selfref,
explanation = frame.args['설명'] or args['설명'] or '', -- 한국어 위키백과에서만 사용되는 비표준 변수
template = template
template = template
}
}
if frame.args['설명'] or args['설명'] then
options.explanation = options.explanation .. ' ' -- 한국어 위키백과에서만 사용되는 비표준 변수
end
return p._labelledList(pages, labels, options)
return p._labelledList(pages, labels, options)
end
end
Dòng 71: Dòng 67:
if #pages == 0 then
if #pages == 0 then
return mHatnote.makeWikitextError(
return mHatnote.makeWikitextError(
'문서 이름을 지정하지 않았습니다',
'không có tên trang được chỉ định',
(options.template or defaults.template) .. '#오류',
(options.template or defaults.template) .. '#Các lỗi',
options.category
options.category
)
)
end
end
label = (#pages == 1 and labels[1] or labels[2]) or defaults.label
label = (#pages == 1 and labels[1] or labels[2]) or defaults.label
local text = string.format(
options.labelForm or defaults.labelForm,
label,
mHatlist.andList(pages, true)
)
local hnOptions = {
local hnOptions = {
extraclasses = options.extraclasses,
extraclasses = options.extraclasses,