|
|
Line 4: |
Line 4: |
|
| |
|
| function p._main(args, frame, title) | | function p._main(args, frame, title) |
| args = args or {}
| | args = args or {} |
| frame = frame or mw.getCurrentFrame()
| | frame = frame or mw.getCurrentFrame() |
| title = title or mw.title.getCurrentTitle()
| | title = title or mw.title.getCurrentTitle() |
| local prefix, parentheses = mw.ustring.match(title.text, '^(.+) %(([^%(%)]+)%)$')
| | local prefix, parentheses = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$') |
| local result
| | local result |
| if prefix and parentheses and args.all ~= 'yes' then
| | if prefix and parentheses and args.all ~= 'yes' then |
| result = string.format("<span class='italic-title'>%s</span> (<span class='parenthetical-title'>%s</span>)", prefix, parentheses)
| | result = string.format("<i>%s</i> %s", prefix, parentheses) |
| else
| | else |
| result = string.format("<i>%s</i>", title.text)
| | result = string.format("<i>%s</i>", title.text) |
| end
| | end |
| if title.namespace ~= 0 then
| | if title.namespace ~= 0 then |
| result = title.nsText:gsub('_', ' ') .. ':' .. result
| | result = title.nsText:gsub('_', ' ') .. ':' .. result |
| end
| | end |
| return frame:callParserFunction('DISPLAYTITLE', result, args[1])
| | return frame:callParserFunction('DISPLAYTITLE', result, args[1]) |
| end | | end |
|
| |
|
| function p.main(frame) | | function p.main(frame) |
| local args = require('Module:Arguments').getArgs(frame, {
| | local args = require('Module:Arguments').getArgs(frame, { |
| wrappers = 'Template:Italic title'
| | wrappers = 'Template:Italic title' |
| })
| | }) |
| return p._main(args, frame)
| | return p._main(args, frame) |
| end | | end |
|
| |
|
| return p | | return p |
-- This module implements .
local p = {}
function p._main(args, frame, title)
args = args or {}
frame = frame or mw.getCurrentFrame()
title = title or mw.title.getCurrentTitle()
local prefix, parentheses = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$')
local result
if prefix and parentheses and args.all ~= 'yes' then
result = string.format("%s %s", prefix, parentheses)
else
result = string.format("%s", title.text)
end
if title.namespace ~= 0 then
result = title.nsText:gsub('_', ' ') .. ':' .. result
end
return frame:callParserFunction('DISPLAYTITLE', result, args[1])
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Italic title'
})
return p._main(args, frame)
end
return p