Modul:Italic title: Unterschied zwischen den Versionen
re-add all=yes - I made a mistake with the args logic
(Undid revision 560274954 by Mr. Stradivarius (talk) ok, something went wrong there) |
(re-add all=yes - I made a mistake with the args logic) |
||
Zeile 1: | Zeile 1: | ||
-- This module implements {{italic title}}. | -- This module implements {{italic title}}. | ||
local p = {} | local p = {} | ||
function p.main() | function p.main(frame) | ||
-- Process the arguments. | |||
local args | |||
if frame == mw.getCurrentFrame() then | |||
args = frame:getParent().args | |||
for k, v in pairs(frame.args) do | |||
args = frame.args | |||
break | |||
end | |||
else | |||
args = frame | |||
end | |||
local title = mw.title.getCurrentTitle() -- Get the current page object. | local title = mw.title.getCurrentTitle() -- Get the current page object. | ||
-- Find the parts before and after the disambiguation brackets, if any. | -- Find the parts before and after the disambiguation brackets, if any. | ||
Zeile 10: | Zeile 22: | ||
-- italicise the whole title. | -- italicise the whole title. | ||
local result | local result | ||
if prefix and brackets then | if prefix and brackets and args.all ~= 'yes' then | ||
result = "''" .. prefix .. "'' " .. brackets | result = "''" .. prefix .. "'' " .. brackets | ||
else | else | ||
Zeile 21: | Zeile 33: | ||
-- Call displaytitle with the text we generated. | -- Call displaytitle with the text we generated. | ||
return mw.getCurrentFrame():callParserFunction( 'DISPLAYTITLE', result ) | return mw.getCurrentFrame():callParserFunction( 'DISPLAYTITLE', result ) | ||
end | end | ||
return p | return p |