Module:Italic title: Difference between revisions
From Sapiens
Jump to navigationJump to search
mtg>Corveroth (Created page with "-- This module implements {{italic title}}. local p = {} function p._main(args, frame, title) args = args or {} frame = frame or mw.getCurrentFrame() title = title or mw....") |
m (1 revision imported) |
| (One intermediate revision by one other user not shown) | |
(No difference)
| |
Latest revision as of 20:32, 11 March 2023
| File:OOjs UI icon alert-warning.svg | This Lua module is used on approximately approximately 844,000 pages. To avoid large-scale disruption and unnecessary server load, any changes to this module should first be tested in its /sandbox or /testcases subpages. The tested changes can then be added to this page in one single edit. Please consider discussing any changes on the talk page before implementing them. |
| File:Full-protection-shackle.svg | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
| File:Lua-Logo.svg | This module depends on the following other modules: |
This module implements {{italic title}} and {{italic dab}}. Please see the template pages for documentation.
-- This module implements {{italic title}}.
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("<i>%s</i> %s", prefix, parentheses)
else
result = string.format("<i>%s</i>", title.text)
end
if title.namespace ~= 0 then
result = title.nsText .. ':' .. 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