Module:User:Erutuon/show data

local export = {}

local pattern_escape = require "Module:utilities".pattern_escape

local function get_module(code) if require "Module:families/data"[code] then return "Module:families/data" elseif require "Module:etymology languages/data"[code] then return "Module:etymology languages/data" else local name = require "Module:languages".getDataModuleName(code) if name then return "Module:" .. name end end end

function export.get_data(codes) local data_module_content = require "Module:array" for _, code in ipairs(codes) do		local module = get_module(code) if not module then return "-- No module for code " .. code .. "."		end local module_text = mw.title.new(module):getContent if not module_text then return "-- Module " .. module .. " has no content." end local data = module_text:match('m%["' .. pattern_escape(code) .. '"%]%s*=%s*%b{}') if not data then return "-- Code " .. code .. " not found in " .. module .. "."		end data_module_content:insert(data) end return data_module_content:concat("\n\n") end

function export.main(frame) local codes = frame.args return require "Module:debug".highlight(export.get_data(codes)) end

return export