Module:About: रिवीजन सभ के बीचा में अंतर

Content deleted Content added
छो Case-sensitivity fail.
Switched _forSee to new Module:Hatnote list, added some options (migrated most strings from hard-coded to default options), and added comments
लाइन 1:
local mArguments --initialize lazily
local mHatnote = require('Module:Hatnote/sandbox') --sandbox since we use mHatnote._forSee(). Blocks removing from alpha.
local mHatList = require('Module:Hatnote list')
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local p = {}
 
--A passthrough that gets args from the frame and all
function p.about (frame)
-- A passthrough that gets args from the frame and all
 
mArguments = require('Module:Arguments')
args = mArguments.getArgs(frame)
Line 12 ⟶ 14:
end
 
 
--Produces "about" hatnote. No options or defaults yet, but the machinery's there.
function p._about (args, options)
-- Produces "about" hatnote.
 
-- Type checks and defaults
checkType('_about', 1, args, 'table', true)
args = args or {}
Line 19 ⟶ 24:
options = options or {}
local defaultOptions = {
aboutForm = 'This %s is about %s. ',
--whatever
defaultPageType = 'page',
local pageTypeStrings = {
[0] = 'article',
[14] = 'category'
},
sectionString = 'section'
}
for k, v in pairs(defaultOptions) do
Line 25 ⟶ 36:
end
 
-- Set initial "about" string
local pageTypeStrings = {
local pageType = (args.section and 'section'options.sectionString) or
[0] = 'article',
options.pageTypeStrings[mw.title.getCurrentTitle().namespace] or
[14] = 'category'
options.defaultPageType
}
local pageType = (args.section and 'section') or
pageTypeStrings[mw.title.getCurrentTitle().namespace] or
'page'
 
local about = ''
if args[1] then
about = string.format('This %s is about %soptions. 'aboutForm, pageType, args[1])
end
 
-- Set for-see list
local forSee = mHatnotemHatList._forSee(args, 2)
 
-- Concatenate and return
return mHatnote._hatnote(about .. forSee)
end
"https://bh.wikipedia.org/wiki/Module:About" से लिहल गइल