Module:IPAc-en/sandbox: Difference between revisions

Content deleted Content added
No edit summary
apparently the rest of the module relies on the padding being added, so how about padding with the empty string?
 
(17 intermediate revisions by 4 users not shown)
Line 31:
-- This adds a tooltip icon to a label. It implements [[Template:H:title]].
local function makeTooltip(label, tooltip)
local span =-- mw.html.create( doesn't properly escape 'span|')
return string.format(
:addClass('rt-commentedText')
:attr('<span title="%s">%s</span>', tooltip)
mw.text.encode(tooltip, '|'),
:wikitext(label)
label
return tostring(span)
)
end
 
Line 77 ⟶ 78:
if pronItem then
pron[#pron + 1] = pronItem
pron[#pronif + 1]pronItem ~= '' 'then
pron[#pron + 1] = ' '
else
pron[#pron + 1] = ''
end
else
break
Line 83 ⟶ 88:
end
if #pron > 0 then
ret[#ret + 1] = mw.getCurrentFrame():extensionTag({
name = 'templatestyles',
args = { src = 'Module:IPA/styles.css' }
})
ret[#ret + 1] = string.format(
'<span class="IPA-label IPA-label-small">%s</smallspan>',
table.concat(pron)
)
Line 150 ⟶ 159:
-- Suppress Navigation popups and Page Previews (aka Hovercards)
:addClass('IPA nopopups noexcerpt')
:attr('lang', 'en-fonipa')
:wikitext(string.format(
'[[Help:IPA/English|%s]]',
Line 162 ⟶ 172:
local file = args.audio and trim(args.audio)
if file and file ~= '' then
categories["Pages including recorded pronunciations (English)"] = true
if args[1] and string.lower(trim(args[1])) == 'uk' then
categories["Pages including recorded pronunciations (UK English)"] = true
elseif args[1] and string.lower(trim(args[1])) == 'us' then
categories["Pages including recorded pronunciations (US English)"] = true
else
categories["Pages including recorded pronunciations (English)"] = true
end
ret[#ret + 1] = mw.getCurrentFrame():expandTemplate{
title = 'Template:IPA audio link', args = { file } }