Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
{{{yomi}}}
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
non-hiragana input Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
too many readings Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
disparate number of yomi designations and readings Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
weird parentheses Lua error at line 75: attempt to call field 'findBestScript' (a nil value) Lua error at line 75: attempt to call field 'findBestScript' (a nil value) Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
non-kana input Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
invalid yomi types Lua error at line 75: attempt to call field 'findBestScript' (a nil value)
-- is "tab" short for "table"?
local export = {}
local m_languages = require("Module:languages")
local m_scripts = require("Module:scripts")
local m_links = require("Module:links")
local gsub = mw.ustring.gsub
local upper = mw.ustring.upper
local hanzi_local_name = {
ja = 'kanji',
ko = 'hanja',
vi = 'Hán tự',
}
local iteration_marks = {
ja = '々',
vi = 'ヌ',
}
local elements = {}
elements.table = function(data)
return mw.html.create('table')
:addClass('wikitable')
:css('text-align', 'center')
:css('font-size', 'small')
:done()
end
elements.table_head = function(data)
return mw.html.create('tr')
:tag('th')
:attr('colspan', data.colspan)
:css('font-weight', 'normal')
:wikitext(data.title)
:done()
:done()
end
elements.table_row_a = function(data)
return mw.html.create('tr')
:attr('lang', data.lang:getCode())
:addClass(data.sc:getCode())
:css('font-size', '2em')
:css('background', 'white')
:css('line-height', '1')
:done()
end
elements.table_row_a_cell = function(data)
return mw.html.create('td')
:css('padding', '0.5em')
:wikitext(m_links.language_link({ lang = data.lang, term = data.char }))
:done()
end
function export.show(frame)
local params = {
= { required = true, default = "und" },
-- ja
= { list = true, allow_holes = true },
yomi = { },
-- testing用
x_pagename = { },
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = m_languages.getByCode(args)
local chars = args.x_pagename or mw.title.getCurrentTitle().text
local sc = m_scripts.findBestScript(chars, lang)
local hani_tab
local hani_tab_row_a
local categories
if iteration_marks then
chars = gsub(chars, '(.)' .. iteration_marks, '%1%1') -- change "時々" to "時時"
end
chars = gsub(chars, '', '') -- remove non-Hani characters
chars = mw.text.split(chars, '')
hani_tab = elements.table()
:node(elements.table_head({ colspan = #chars, title = ' .. '|' .. gsub(hanzi_local_name, '^.', upper) .. ']] in this term' }))
:done()
hani_tab_row_a = elements.table_row_a({ lang = lang, sc = sc })
:done()
for _, char in ipairs(chars) do
hani_tab_row_a
:node(elements.table_row_a_cell({ lang = lang, char = char }))
:done()
end
hani_tab
:node(hani_tab_row_a)
:done()
if lang:getCode() == 'ja' and (table.maxn(args) ~= 0 or args.yomi) then
hani_tab, categories = require('Module:User:Suzukaze-c/Hani-tab/ja').main({ hani_tab = hani_tab, chars = chars, readings = args, yomi = args.yomi })
elseif lang:getCode() == 'ko' then
hani_tab = require('Module:User:Suzukaze-c/Hani-tab/ko').main({ hani_tab = hani_tab, chars = chars })
end
if categories then
-- categories = require("Module:utilities").format_categories(categories)
for i, category in ipairs(categories) do
categories = ''
end
categories = table.concat(categories)
end
return tostring(hani_tab) .. (categories or '')
end
return export