Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:IPA
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} local match = mw.ustring.match local gsub = mw.ustring.gsub local U = mw.ustring.char local function IPAspan(text) return '<span title="Representation in the International Phonetic Alphabet (IPA)" class="IPA">' .. text .. '</span>' end local function ine(text) if text == "" then return nil else return text end end function p.tag(frame) local linkHelpPage = require('Module:Yesno')(frame.args.link, false) local args = frame:getParent().args[1] and frame:getParent().args or frame.args local namespace = mw.title.getCurrentTitle().nsText local text, lang local err = {} local trackingCategories = {} local IPApage -- Tracks incorrect characters. local function track(text) -- non-IPA g if mw.ustring.find(text, U(0x67)) then mw.log("Incorrect character g found in " .. text) table.insert(trackingCategories, "[[Category:IPA templates with incorrect characters]]") end end if linkHelpPage then text = ine(args[2]) lang = ine(args[1]) if lang then IPApage = mw.loadData("Module:IPA/data")[lang] if not IPApage then table.insert(err, "[No IPA key for the language code " .. lang.."]") end else table.insert(err, "[language code?]") end else text = ine(args[1]) end local output = "" if text then workingString = text -- Remove targets of wikilinks. workingString = gsub(workingString, "%[%[([^|]+|)", "") -- Remove HTML tags. workingString = gsub(workingString, "<[^>]+>", "") track(workingString) text = IPAspan(text) if IPApage then output = "[[" .. IPApage .. "|" .. text .. "]]" elseif text then output = text end else table.insert(err, "[IPA symbols?]") end if #err > 0 then err = "<sup>" .. table.concat(err) .. "</sup>" else err = "" end -- Makes the error message show only in preview mode. if frame:preprocess("{{REVISIONID}}") == "" then output = output .. err end return output .. table.concat(trackingCategories) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Module:Arguments
(
edit
)
Module:IPA
(
edit
)
Module:IPA/data
(
edit
)
Module:IPA/doc
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Yesno
(
edit
)