پودمان:Is article
ظاهر
![]() | این پودمان از پودمانهای زیر استفاده میکند: |
این پودمان برای تشخیص این کاربرد دارد که یک صفحه، مقاله است، تغییرمسیر است، صفحهٔ ابهامزدایی است، موجود نیست یا عنوان آن نامناسب است.
استفاده[ویرایش]
{{#invoke:Is article|main|page_name}}
مقدارهای خروجی[ویرایش]
نتیجه | مقدار خروجی |
---|---|
مقاله است | article |
تغییرمسیر است | redirect |
صفحهٔ ابهامزدایی است | dab |
صفحه موجود نیست | empty |
عنوان نامناسب | badtitle |
فهرست پارامترها[ویرایش]
پارامتر | توضیحات |
---|---|
1
|
پارامتر مکانی یا شمارهگذاریشده؛ عنوان صفحه. |
local p = {}
local disambiguationTemplates = {
"[Dd]isambiguation",
"[Dd]isambig",
"[Dd]isamb",
"[Dd]ab",
"[Ss]urname",
"[Tt]emplate disambiguation",
"ابهامزدایی",
"ابهام زدایی",
"ابهام زدائی",
"ابهام-خرد",
"ابهامزدایی-خرد",
"ابهامزدائی",
"ابهامزدایی",
"رفع ابهام",
"نام خانوادگی",
"ابهامزدایی الگو"
}
function p.main(frame)
local getArgs = require("Module:Arguments").getArgs
local args = getArgs(frame)
local page = mw.title.new(args[1], 0)
if not page then
return "badtitle"
end
if not page.exists then
return "empty"
end
if page.isRedirect then
return "redirect"
end
local content = page:getContent()
if content then
content = mw.ustring.gsub(content, "noinclude", "<!-- noinclude -->")
for _, name in ipairs(disambiguationTemplates) do
if mw.ustring.match(content, "{{%s?" .. name .. "%s?}}") and not mw.ustring.match(content, "{{{%s?" .. name .. "%s?}}}") then -- to disable false positives in parameter names {{{disamb}}}
return "dab"
end
end
end
return "article"
end
return p