"मोड्युल:Italic title" का संशोधनहरू बिचको अन्तर

Content deleted Content added
imported>Paine Ellsworth
per edit request on talk page
use mw.site.namespaces to get the namespace name without underscores; also use Module:Arguments and convert whitespace to tabs
पङ्क्ति १:
-- This module implements {{italic title}}.
 
local p = {}
 
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
-- Process the arguments.
wrappers = 'Template:Italic title'
local args
})
if frame == mw.getCurrentFrame() then
local title = mw.title.getCurrentTitle() -- Get the current page object.
args = frame:getParent().args
 
for k, v in pairs(frame.args) do
-- Find the parts before and after the disambiguation parentheses, if any.
args = frame.args
local prefix, parentheses = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$')
break
 
end
-- If parentheses were found, italicise only the part before them. Otherwise
else
-- italicise the whole title.
args = frame
local result
end
if prefix and parentheses and args.all ~= 'yes' then
result = "''" .. title.textprefix .. "'' " .. parentheses
local title = mw.title.getCurrentTitle() -- Get the current page object.
else
-- Find the parts before and after the disambiguation parentheses, if any.
result = "''" .. title.text .. "''"
local prefix, parentheses = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$')
end
-- If parentheses were found, italicise only the part before them. Otherwise
 
-- italicise the whole title.
-- Add the namespace if itwe're not in existsmainspace.
local result
if prefix and parentheses and argstitle.allnamespace ~= 'yes'0 then
result = "''" mw.site. prefixnamespaces[title.namespace].name .. "':' " .. parenthesesresult
end
else
 
result = "''" .. title.text .. "''"
-- Call displaytitle with the text we generated.
end
return mw.getCurrentFrame():callParserFunction( 'DISPLAYTITLE', result )
-- Add the namespace if it exists.
if title.nsText and title.nsText ~= "" then
result = title.nsText:gsub('_', ' ') .. ':' .. result
end
-- Call displaytitle with the text we generated.
return mw.getCurrentFrame():callParserFunction( 'DISPLAYTITLE', result )
end
 
return p
"https://ne.wikipedia.org/wiki/मोड्युल:Italic_title" बाट अनुप्रेषित