Jump to content
Wikipedia The Free Encyclopedia

Module:IPAc-en/data/sandbox

From Wikipedia, the free encyclopedia
This is the module sandbox page for Module:IPAc-en/data (diff).
Module documentation[view] [edit] [history] [purge]
This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing.
Warning This Lua module is used on approximately 54,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.
[画像:Edit-copy green with red question mark] This module's documentation is missing, inadequate, or does not accurately describe its functionality or the parameters in its code. Please help add, expand, or improve it.
The above documentation is transcluded from Module:IPAc-en/data/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this module.
 -- This module processes data for [[Module:IPAc-en]]. It is intended to be
 -- loaded with mw.loadData.

 localPRONUNCIATION_MODULE='Module:IPAc-en/pronunciation/sandbox'
 localPHONEME_MODULE='Module:IPAc-en/phonemes/sandbox'

 localfunctionmakeData(oldData)
 localnewData={}
 fori,oldinipairs(oldData)do
 localnew={}
 fork,vinpairs(old)do
 ifk~='aliases'andk~='code'then
 new[k]=v
 end
 end
 newData[old.code]=new
 ifold.aliasesthen
 fori,aliasinipairs(old.aliases)do
 newData[alias]=new
 end
 end
 end
 returnnewData
 end

 localfunctionmain()
 localpronunciation=makeData(require(PRONUNCIATION_MODULE))
 localphonemes=makeData(require(PHONEME_MODULE))

 -- Check that no pronunciation keys are also contained in the phonemes
 -- data. This would cause silent, hard-to-debug errors if it went
 -- unchecked, so make it cause a big red error message instead.
 foridinpairs(pronunciation)do
 ifphonemes[id]then
 error(string.format(
 "duplicate ID '%s' found in %s and %s",
 id,
 PRONUNCIATION_MODULE,
 PHONEME_MODULE
 ))
 end
 end

 return{
 pronunciation=pronunciation,
 phonemes=phonemes,
 }
 end

 returnmain()

AltStyle によって変換されたページ (->オリジナル) /