Sửa đổi Mô đun:Main
Chú ý: Bạn chưa đăng nhập và địa chỉ IP của bạn sẽ hiển thị công khai khi lưu các sửa đổi.
Bạn có thể tham gia như người biên soạn chuyên nghiệp và lâu dài ở Bách khoa Toàn thư Việt Nam, bằng cách đăng ký và đăng nhập - IP của bạn sẽ không bị công khai và có thêm nhiều lợi ích khác.
Các sửa đổi có thể được lùi lại. Xin hãy kiểm tra phần so sánh bên dưới để xác nhận lại những gì bạn muốn làm, sau đó lưu thay đổi ở dưới để hoàn tất việc lùi lại sửa đổi.
Bản hiện tại | Nội dung bạn nhập | ||
Dòng 1: | Dòng 1: | ||
--[[ | --[[ | ||
-- This module produces a link to a main article or articles. It implements the | -- This module produces a link to a main article or articles. It implements the | ||
− | -- | + | -- template {{main}}. |
-- | -- | ||
-- If the module is used in category or category talk space, it produces "The | -- If the module is used in category or category talk space, it produces "The | ||
-- main article for this category is xxx". Otherwise, it produces | -- main article for this category is xxx". Otherwise, it produces | ||
− | -- " | + | -- "Main article: xxx". |
--]] | --]] | ||
Dòng 27: | Dòng 27: | ||
if #pages == 0 and mw.title.getCurrentTitle().namespace == 0 then | if #pages == 0 and mw.title.getCurrentTitle().namespace == 0 then | ||
return mHatnote.makeWikitextError( | return mHatnote.makeWikitextError( | ||
− | ' | + | 'no page names specified', |
− | 'Template: | + | 'Template:Main#Errors', |
args.category | args.category | ||
) | ) | ||
Dòng 45: | Dòng 45: | ||
local firstPage = string.gsub(args[1], '|.*$', '') | local firstPage = string.gsub(args[1], '|.*$', '') | ||
-- Find the pagetype. | -- Find the pagetype. | ||
− | local pageType = mHatnote.findNamespaceId(firstPage) == 0 and ' | + | local pageType = mHatnote.findNamespaceId(firstPage) == 0 and 'article' or 'page' |
-- Make the formatted link text | -- Make the formatted link text | ||
list = mHatlist.andList(args, true) | list = mHatlist.andList(args, true) | ||
Dòng 54: | Dòng 54: | ||
if (curNs == 14) or (curNs == 15) then --category/talk namespaces | if (curNs == 14) or (curNs == 15) then --category/talk namespaces | ||
mainForm = isPlural and | mainForm = isPlural and | ||
− | + | 'The main %ss for this [[Help:Categories|category]] are %s' | |
or | or | ||
− | + | 'The main %s for this [[Help:Categories|category]] is %s' | |
else | else | ||
− | + | mainForm = isPlural and 'Main %ss: %s' or 'Main %s: %s' | |
end | end | ||
local text = string.format(mainForm, pageType, list) | local text = string.format(mainForm, pageType, list) | ||
-- Process the options and pass the text to the _rellink function in | -- Process the options and pass the text to the _rellink function in | ||
− | -- [[ | + | -- [[Mô đun:Hatnote]]. |
options = options or {} | options = options or {} | ||
local hnOptions = { | local hnOptions = { |