Difference between revisions of "Module:Sandbox/Erutuon/random"

From blackwiki
Jump to navigation Jump to search
blackwiki>Erutuon
m (cut off processing if <big> is found)
blackwiki>Erutuon
Line 2: Line 2:
  
 
local p = {}
 
local p = {}
 
local count_scripts = require("Module:Language/scripts").countScripts
 
  
 
function p.show(frame)
 
function p.show(frame)
local content = mw.title.new("Help:IPA/Ukrainian"):getContent()
+
local content = mw.title.new
 +
"Template:ISO 15924 script codes and related Unicode data"
 +
:getContent()
 
 
content = content:gsub("(\n| *([^\n]+))",
+
local Unicode_script_codes = {}
function(whole_match, cell_content)
+
local i = 0
whole_match = "\n| " .. cell_content
+
for script_code in content:gmatch("{{ISO 15924[^|]+|([^}]+)") do
if cell_content:sub(1, 1) == "/" then -- IPA
+
i = i + 1
return whole_match:gsub("/[^/]+/", "{{IPA|%0}}")
+
Unicode_script_codes[i] = script_code
end
+
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{
+
return require "Module:dump"._dump(Unicode_script_codes)
name = "syntaxhighlight",
 
content = content,
 
}
 
 
end
 
end
  
 
return p
 
return p

Revision as of 07:47, 26 January 2018

Test

  • Lua error in package.lua at line 80: module 'Module:dump' not found.



require("Module:No globals")

local p = {}

function p.show(frame)
	local content = mw.title.new
		"Template:ISO 15924 script codes and related Unicode data"
		:getContent()
	
	local Unicode_script_codes = {}
	local i = 0
	for script_code in content:gmatch("{{ISO 15924[^|]+|([^}]+)") do
		i = i + 1
		Unicode_script_codes[i] = script_code
	end
	
	return require "Module:dump"._dump(Unicode_script_codes)
end

return p