local export = {}
local titleObj = mw.title.getCurrentTitle()
local fullpagename = titleObj.fullText
local pagename = titleObj.text
local namespace = titleObj.nsText
local get_script_by_code = require("Module:scripts").getByCode
local Jpan = get_script_by_code("Jpan")
-- local katakana_script = get_script_by_code("Kana")
local hiragana_script = get_script_by_code("Hira")
local ja = require("Module:languages").getByCode("ja")
local module_ja = require("Module:ja") -- USED
local find = mw.ustring.find
local match = mw.ustring.match
local gmatch = mw.ustring.gmatch
local gsub = mw.ustring.gsub
local split = mw.text.split
function export.show(frame)
local args = frame.args
local yomi_data = require("Module:User:QFQ/jouyou-list/data").yomi
local t1 = {}
table.insert(t1, [=[{| class="sortable wikitable" style="font-family:'游ゴシック体','YuGothic','游ゴシック Medium','Yu Gothic Medium','ヒラギノ角ゴ ProN W3','Hiragino Kaku Gothic ProN W3','ヒラギノ角ゴ ProN','Hiragino Kaku Gothic ProN','源ノ角ゴシック JP Normal','Source Han Sans JP Normal','Noto Sans CJK JP DemiLight','源ノ角ゴシック JP','Source Han Sans JP','Noto Sans CJK JP','メイリオ','Meiryo','MS Pゴシック','MS PGothic';"
|- style="line-height:1.4em"
! <br />
! style="white-space:nowrap" | 漢字<br />
! 音讀<br />
! 訓讀<br />]=])
local i = 0
for k, t in pairs(yomi_data) do
i = i + 1
table.insert(t1, string.format('|-\n|%d<span id="%d"></span>|| ]<span id="%s"></span>', i, i, k, k, k))
--table.sort(t, function(x, y) return bit32.bxor(x, 1) < bit32.bxor(y, 1) end)
local ton, tkun = {}, {}
for sk, v in pairs(t) do
sk = module_ja.kata_to_hira(sk)
sk, _ = mw.ustring.gsub(sk, '(*)%-(*)', ']' )
sk, _ = mw.ustring.gsub(sk, '|(*)%-%]%]', '|%1]]<sup>]</sup>' )
if v > 2 then
sk = '<span style="background-color:#E0FFFF;">' .. sk .. '</span>'
end
if v % 2 == 1 then
table.insert(ton, sk)
else
table.insert(tkun, sk)
end
end
table.insert(t1, '||' .. table.concat(ton, ', '))
table.insert(t1, '||' .. table.concat(tkun, ', '))
end
table.insert(t1, '|}')
return table.concat(t1, '\n')
end
return export