"मोड्युल: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, {
wrappers = 'Template:Italic title'
})
else▼
if prefix and parentheses and args.all ~= 'yes' then
▲ local title = mw.title.getCurrentTitle() -- Get the current page object.
▲ -- Find the parts before and after the disambiguation parentheses, if any.
result = "''" .. title.text .. "''"
▲ local prefix, parentheses = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$')
▲ -- If parentheses were found, italicise only the part before them. Otherwise
▲ -- italicise the whole title.
▲ local result
▲ result = "''" .. title.text .. "''"
▲ end
▲ -- Add the namespace if it exists.
▲ end
▲ -- Call displaytitle with the text we generated.
▲ return mw.getCurrentFrame():callParserFunction( 'DISPLAYTITLE', result )
end
return p
|