local Arguments = require('Module:Arguments')
local Disambiguation = require('Module: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
local notices = {
blp_notice = function(page)
local content = page:getContent()
local living1 = "%[%[%s*[Cc]ategory:%s*살아있는[ _]사람%s*%]%]"
local living2 = "%[%[%s*분류:%s*살아있는[ _]사람%s*%]%]"
local possiblyLiving1 = "%[%[%s*[Cc]ategory:%s*생사[ _]불명%s*%]%]"
local possiblyLiving2 = "%[%[%s*분류:%s*생사[ _]불명%s*%]%]"
if content and (content:find(living1) or content:find(living2) or content:find(possiblyLiving1) or content:find(possiblyLiving2)) then
return "틀:BLP_편집_안내"
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