Module:IPAc-en/data: Difference between revisions
Appearance
Content deleted Content added
write tooltip-data-processing code |
process pronunciation data as well |
||
Line 2: | Line 2: | ||
-- loaded with mw.loadData. |
-- loaded with mw.loadData. |
||
local function |
local function makeData(oldData) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
local new = {} |
local new = {} |
||
⚫ | |||
new.label = old.label |
|||
if k ~= 'aliases' then |
|||
new.tooltip = old.tooltip |
|||
new[k] = v |
|||
⚫ | |||
⚫ | |||
end |
|||
⚫ | |||
newData[id] = new |
|||
⚫ | |||
if old.aliases then |
|||
for i, alias in ipairs(old.aliases) do |
|||
⚫ | |||
end |
|||
end |
|||
end |
end |
||
return |
return newData |
||
end |
end |
||
return { |
return { |
||
pronunciation = makeData(require('Module:IPAc-en/pronunciation')), |
|||
⚫ | |||
} |
Revision as of 06:28, 17 June 2015
![]() | This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
![]() | 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. |
![]() | This Lua module is used on approximately 53,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
![]() | This module's documentation is missing, inadequate, or does not accurately describe its functionality or the parameters in its code. Please help to expand and improve it. |
-- This module processes data for [[Module:IPAc-en]]. It is intended to be
-- loaded with mw.loadData.
local function makeData(oldData)
local newData = {}
for id, old in pairs(oldData) do
local new = {}
for k, v in pairs(old) do
if k ~= 'aliases' then
new[k] = v
end
end
newData[id] = new
if old.aliases then
for i, alias in ipairs(old.aliases) do
newData[alias] = new
end
end
end
return newData
end
return {
pronunciation = makeData(require('Module:IPAc-en/pronunciation')),
tooltips = makeData(require('Module:IPAc-en/tooltips'))
}