Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- kan={}
- for line in io.lines("kanjidic.utf8") do
- if string.sub(line,1,1)~="#" then
- a=string.find(line,' G')
- if a then
- b=string.find(line,' ',a+1)
- if b then
- no=tonumber(string.sub(line,a+2,b))
- if no then
- if not kan[no] then
- kan[no]={}
- end
- table.insert(kan[no],string.sub(line,1,3))
- end
- end
- end
- end
- end
- for i,v in pairs(kan) do
- print(i,#v)
- out=io.open("/tmp/grade"..i..".html","w")
- out:write("<html><head>"..'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'.."</head><body><h1>Grade "..i.."</h1><font size=5>\n")
- count=0
- for _,k in pairs(v) do
- count=count+1
- out:write("<a target=\"jisho\" href=\"http://www.jisho.org/kanji/details/"..k..'">'..k.."</a><font size=1><a target=\"jisho\" href=\"http://www.jisho.org/sentences?jap="..k..'">(ex)</a></font> ')
- if count>=13 then
- count=0
- out:write("\n")
- end
- end
- out:write("\n</font></body></html>")
- out:close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement