Difference between revisions of "Module:Sandbox/Erutuon/random"
< Module:Sandbox | Erutuon
Jump to navigation
Jump to search
blackwiki>Erutuon m (don't add IPA template if it's already present) |
blackwiki>Erutuon m (cut off processing if <big> is found) |
||
| Line 15: | Line 15: | ||
end | end | ||
| − | if cell_content:find("<big>") | + | if cell_content:find("<big>") then |
| − | + | if 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 | ||
end | end | ||
Revision as of 03:03, 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>") then
if 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
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