Module:User:Wyang/var
Appearance
- This module sandbox lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
local export = {}
function export.do_work(frame)
local m_num = require("Module:User:Wyang/num")
local m_num_var = require("Module:User:Wyang/num_var")
local m_var_num = require("Module:User:Wyang/var_num")
local result = {}
start = (tonumber(mw.title.getCurrentTitle().subpageText) - 1) * 100 + 1
for i = start, start + 99 do
local char_var = {}
local variants = {}
local word = m_num[i]
for ch in mw.text.gsplit(word, "", true) do
table.insert(char_var, (m_var_num[ch] and m_num_var[m_var_num[ch]] or { ch } ) )
end
local test_word = {}
for j = 1, #char_var do
table.insert(test_word, char_var[j][1])
end
for j = 1, #char_var do
for k = 1, #char_var[j] do
test_word[j] = char_var[j][k]
table.insert(variants, (mw.title.new(table.concat(test_word)) or {}).exists and ("[[" .. table.concat(test_word) .. "]]") or nil)
if variants[#variants] == variants[#variants - 1] or variants[#variants] == variants[#variants - 2] then
table.remove(variants, #variants)
end
end
end
if #variants > 1 then
table.insert(result, table.concat(variants, " | "))
end
end
return "<pre>\n" .. table.concat(result, "\n") .. "\n</pre>"
end
function export.summary(frame)
local result = {}
for i = 1, 305 do
table.insert(result, mw.title.new("User:Wyang/test/" .. i):getContent())
end
return "<pre>\n" .. mw.ustring.gsub(table.concat(result), "\n?</?pre>", "") .. "\n</pre>"
end
return export