Difference between revisions of "Module:Sandbox/Erutuon/random"
< Module:Sandbox | Erutuon
Jump to navigation
Jump to search
blackwiki>Erutuon (several palatalized consonants aren't supported by Template:IPA link) |
blackwiki>Erutuon m (don't add IPA template if it's already present) |
||
| Line 15: | Line 15: | ||
end | end | ||
| − | if cell_content:find("<big>") then | + | if cell_content:find("<big>") and not cell_content:find("{{IPA") then |
return whole_match:gsub("<big>([^<]+)</big>", | return whole_match:gsub("<big>([^<]+)</big>", | ||
function(symbol) | function(symbol) | ||
| Line 30: | Line 30: | ||
local scripts = count_scripts(cell_content) | local scripts = count_scripts(cell_content) | ||
if scripts.Cyrl and not scripts.Latn then | if scripts.Cyrl and not scripts.Latn then | ||
| − | return whole_match:gsub("[^ | + | return whole_match:gsub("[^ |,]+", "{{lang|uk|%0}}") |
end | end | ||
end) | end) | ||
Revision as of 02:52, 27 November 2017
Test
- Lua error at line 10: attempt to index local 'content' (a nil value).
require("Module:No globals")
local p = {}
local count_scripts = require("Module:Language/scripts").countScripts
function p.show(frame)
local content = mw.title.new("Help:IPA/Ukrainian"):getContent()
content = content:gsub("(\n| *([^\n]+))",
function(whole_match, cell_content)
whole_match = "\n| " .. cell_content
if cell_content:sub(1, 1) == "/" then -- IPA
return whole_match:gsub("/[^/]+/", "{{IPA|%0}}")
end
if cell_content:find("<big>") and not cell_content:find("{{IPA") then
return whole_match:gsub("<big>([^<]+)</big>",
function(symbol)
local template
if symbol:find("ʲ") then
template = "IPA"
else
template = "IPA link"
end
return "<big>{{" .. template .. "|" .. symbol .. "}}</big>"
end)
end
local scripts = count_scripts(cell_content)
if scripts.Cyrl and not scripts.Latn then
return whole_match:gsub("[^ |,]+", "{{lang|uk|%0}}")
end
end)
return frame:extensionTag{
name = "syntaxhighlight",
content = content,
}
end
return p