This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected.
localp={}localmatch=mw.ustring.matchlocalgsub=mw.ustring.gsublocalU=mw.ustring.charlocalfunctionIPAspan(text)return'<span title="Representation in the International Phonetic Alphabet (IPA)" class="IPA">'..text..'</span>'endlocalfunctionine(text)iftext==""thenreturnnilelsereturntextendendfunctionp.tag(frame)locallinkHelpPage=require('Module:Yesno')(frame.args.link,false)localargs=frame:getParent().args[1]andframe:getParent().argsorframe.argslocalnamespace=mw.title.getCurrentTitle().nsTextlocaltext,langlocalerr={}localtrackingCategories={}localIPApage-- Tracks incorrect characters.localfunctiontrack(text)-- non-IPA gifmw.ustring.find(text,U(0x67))thenmw.log("Incorrect character g found in "..text)table.insert(trackingCategories,"[[Category:IPA templates with incorrect characters]]")endendiflinkHelpPagethentext=ine(args[2])lang=ine(args[1])iflangthenIPApage=mw.loadData("Module:IPA/data")[lang]ifnotIPApagethentable.insert(err,"[No IPA key for the language code "..lang.."]")endelsetable.insert(err,"[language code?]")endelsetext=ine(args[1])endlocaloutput=""iftextthenworkingString=text-- Remove targets of wikilinks.workingString=gsub(workingString,"%[%[([^|]+|)","")-- Remove HTML tags.workingString=gsub(workingString,"<[^>]+>","")track(workingString)text=IPAspan(text)ifIPApagethenoutput="[["..IPApage.."|"..text.."]]"elseiftextthenoutput=textendelsetable.insert(err,"[IPA symbols?]")endif#err>0thenerr="<sup>"..table.concat(err).."</sup>"elseerr=""end-- Makes the error message show only in preview mode.ifframe:preprocess("{{REVISIONID}}")==""thenoutput=output..errendreturnoutput..table.concat(trackingCategories)endreturnp