ሞድዩል:Page
Documentation for this module may be created at ሞድዩል:Page/doc
local page = {}
-- External modules and functions
local getArguments = require('Module:ክርክራት').getArguments
local onBoard = require('Module:Tables').on
-- Constants
-- See Module:Citation/CS1/Configuration citation_config.uncategorized_namespaces.
-- Namespaces for which your articles are not automatically categorized
page.spacesNotCategorizable = { 'ተጠቃሚ', 'ተጠቃሚት', 'ምይይጥ', 'User_talk', 'User_Talk', 'Wikipedia_talk', 'File_talk',
'Template_talk', 'Help_talk', 'Category_talk', 'Portal_talk', 'Book_talk', 'Draft', 'Draft_talk', 'Education_Program_talk',
'Module_talk', 'MediaWiki_talk', 'Wikipedia' }
function page.exists(frame)
local article
if not frame then
return
end
if type(frame) == 'string' then
article= frame
else
article= getArguments(frame)[1]
end
if not article then
return
end
local a= mw.title.new(article)
if a and a.exists then
return a.fullText
end
end
function page.categoryExists(frame)
local category
if not frame then
return
end
if type(frame) == 'string' then
category = frame
else
category = getArguments(frame)[1]
end
if not category then
return
end
local a= mw.title.makeTitle(14, category)
if a and a.exists then
return a.fullText
end
end
function page.pageName(options)
pageName = mw.title.getCurrentTitle().text
-- Delete the text in parentheses
if options and options.disambiguate == 'yes' then
pageName = mw.ustring.gsub(pageName,'%s%(.*%)','')
end
return pageName
end
function page.canBeCategorized()
if onBoard(page.spacesNotCategorizable, mw.title.getCurrentTitle().nsText) then
return false
else
return true
end
end
function page.getSubpages(frame)
local arguments = getArguments(frame)
local pageName = arguments['ገጽ'] or arguments['page'] or mw.title.getCurrentTitle().text
local truncate = not (arguments['truncate'] and arguments['truncate'] == 'no')
local truncateParameter = (truncate and '|stripprefix=1') or ''
local list = frame:preprocess('{{Special:PrefixIndex/' .. pageName .. truncateParameter .. '}}')
return list
end
return page