-- Được nhập về từ [[:en:Special:Permalink/1205469555]]
local Arguments = require('Module:Arguments')
local Disambiguation = require('Module:Sandbox/Disambiguation')
local p = {}
p.main = function(frame)
local args = Arguments.getArgs(frame)
return p.core(args.page and mw.title.new(args.page) or mw.title.getCurrentTitle(), frame)
end
-- Bắt đầu lọc trang để đặt thông báo
local notices = {
-- TSNDS
blp_notice = function(page)
local content = page:getContent()
-- Nếu trang có chứa [[Thể loại:Nhân vật còn sống]] hoặc [[Thể loại:Nhân vật có thể còn sống]],
-- thì coi đó là bài viết về người còn sống, kích hoạt thông báo sửa đổi.
-- local living = "%[%[%s*[Tt]hể[ _][Ll]oại:%s*[Nn]hân[ _]vật[ _]còn[ _]sống%s*%]%]"
-- local possiblyLiving = "%[%[%s*[Tt]hể[ _][Ll]oại:%s*[N]hân[ _]vật[ _]có[ _]thể[ _]còn[ _]sống%s*%]%]"
local x1 = "%[%[%s*[Tt]hể[ _][Ll]oại:%s*[Xx]1%s*%]%]"
-- if content and (content:find(living) or content:find(possiblyLiving)) then
if content and (content:find(x1)) then
return "BLP editintro" -- Sẽ đổi tên bản mẫu này nếu được triển khai để nó đúng chức năng
end
end,
disambig_notice = function(page, ctx)
if ctx.isDisambigPage then
return "Disambig editintro"
end
end,
}
p.core = function(page, frame)
-- Context object to store values that are expensive to compute and required
-- in multiple places
local context = {
isDisambigPage = Disambiguation._isDisambiguationPage(page.fullText)
}
local text = ''
for _, getNotice in pairs(notices) do
local template = getNotice(page, context)
text = text .. (template and frame:expandTemplate{ title = template } or '')
end
return text
end
return p