Module:IPAc-nl: Difference between revisions

Content deleted Content added
Created page with '-- This module implements Template:IPAc-nl. local data = mw.loadData('Module:IPAc-nl/data') local p = {} -- Global container for tracking categories local...'
 
No edit summary
Line 31:
end
 
local function makeTooltipmakeAudioLink(labelfile)
categories["Articles including recorded pronunciations"] = true
local span = mw.html.create('span')
span
:addClass('noexcerpt')
:wikitext(string.format(
'[[File:Speaker IconSpeakerlink-new.svg|13px11px|link=%s|Listen]] ',
getFilepath(file)
))
:tag('spansup')
:tag('span')
:css('color', '#00e')
:css('font', 'bold 80% sans-serif')
:css('padding', '0 .1em')
:addClass('IPA')
:wikitext(string.format(('[[:File:%s|listeni]]'), file))
return tostring(span)
end
 
-- This adds a tooltip icon to a label. It implements [[Template:H:title]].
local function makeTooltip(label, tooltip)
local span = mw.html.create('span')
:attr('title', tooltip)
:wikitext(label)
return tostring(span)
Line 40 ⟶ 61:
if #phonemes > 0 then
local span = mw.html.create('span')
:addClass('IPA')
:wikitext(table.concat(phonemes))
return tostring(span)
Line 96 ⟶ 116:
-- underline the phoneme groups, not the separators.
local words = {}
words[#words + 1] = '[/' -- Opening slash
i = i - 1 -- Set up i again as it was changed in the pronunciation loop
local id
Line 141 ⟶ 161:
end
until not id
words[#words + 1] = ']/' -- Closing slash
 
-- Wrap the words in a link to IPA help.
Line 161 ⟶ 181:
 
return ret
end
 
local function makeAudioLink(file)
categories["Articles including recorded pronunciations"] = true
local span = mw.html.create('span')
span
:addClass('noexcerpt')
:wikitext(string.format(
'[[File:Speaker Icon.svg|13px|link=%s|Listen]] ',
getFilepath(file)
))
:tag('span')
:wikitext(string.format(('[[:File:%s|listen]]'), file))
return tostring(span)
end