mNo edit summary |
m (Fix title text selection) |
||
Line 34: | Line 34: | ||
local specialCharacters = mw.loadData( 'module:text/special' ) |
local specialCharacters = mw.loadData( 'module:text/special' ) |
||
for c in mw.text.gsplit( args[ 2 ], '' ) do |
for c in mw.text.gsplit( args[ 2 ], '' ) do |
||
− | text = text .. ( c == ' ' and space or intro .. ( specialCharacters[ c ] or c ) .. '.png|' .. math.floor( width[ c ] * scale ) .. outro ) |
+ | text = text .. ( c == ' ' and space or intro .. ( specialCharacters[ c ] or c ) .. '.png|' .. math.floor( width[ c ] * scale ) .. '|alt=' .. c .. outro ) |
end |
end |
||
return text .. '</span>' |
return text .. '</span>' |
Revision as of 22:48, 8 April 2021
The above documentation is transcluded from Module:Text/doc. (edit | history)
local p = {}
local w_frame = require( 'module:frame' )
local w_title = require( 'module:title' )
-- DEPRECATED
p.pageName = w_title.main
p.rootPageName = w_title.root
p.subPageName = w_title.subpage
function p.toNumber( f )
local args = w_frame.args( f )
return tonumber( args[1], args.base or 10 )
end
-- DEPRECATED : Use "template:font" instead
function p.font( f )
local args = w_frame.args( f )
return '<span class="custom-font custom-font-' .. args[ 1 ] .. ( args.title and '" title="' .. args.title or '' ) .. '">' .. args[ 2 ] .. '</span>'
end
function p.title( f )
local args = w_frame.args( f )
local scale = tonumber( args[ 3 ] or 1 )
local space = '</span> ' .. ( scale > 1.5 and ' ' or '' ) .. ' <span style="white-space: nowrap">'
local width = mw.loadData( 'module:text/' .. args[ 1 ] )
local intro = '[[file:font_' .. args[ 1 ] .. '_'
local outro = 'px|link=' .. ( args.link or '' ) .. '|' .. ( args.desc or '' ) .. ']]'
local text = '<span style="white-space:nowrap">'
local specialCharacters = mw.loadData( 'module:text/special' )
for c in mw.text.gsplit( args[ 2 ], '' ) do
text = text .. ( c == ' ' and space or intro .. ( specialCharacters[ c ] or c ) .. '.png|' .. math.floor( width[ c ] * scale ) .. '|alt=' .. c .. outro )
end
return text .. '</span>'
end
return p