<: words work

This commit is contained in:
UndeadMaelys
2022-05-05 13:16:22 +02:00
parent e40bdc2a39
commit afca6cb0c9
10 changed files with 1013 additions and 3 deletions

View File

@@ -1,5 +1,29 @@
require "r2h2_modified"
words = dofile("heonian-content/words.lua")
function cell_builder(...)
arg = {...}
for i=1, #arg do
apply_html("html/words/definition/cell_start.html")
apply(arg[i])
apply_html("html/words/definition/cell_end.html")
end
end
function print_word_stuff(word)
apply_html("html/words/definition/start.html")
local exit = false
for _, v in pairs(words) do
if strip_symbols(v[1]) == strip_spaces(word) then
cell_builder(mod_convertToHeonian(word),v[1],v[3],v[2])
exit = true
end
end
if not exit then cell_builder(mod_convertToHeonian(word),word, "???","???") end
apply_html("html/words/definition/end.html")
end
function add_word(str)
local add = true
for _, v in pairs(word_list) do
@@ -12,6 +36,12 @@ function add_word(str)
end
end
function strip_spaces(str)
while string.find(str, "% ") do
str = string.gsub(str, " ","")
end
return str
end
function strip_symbols(str)
local symbol_table = "'~()!?:></.,\t"
@@ -234,7 +264,10 @@ while p ~= nil do
end
end
apply_html("html/convo/end.html")
convo_end()
-- 3.5 separation
apply_html("html/spacer.html")
-- fourth lets make word lists
-- process contents
@@ -249,9 +282,14 @@ while string.find(content, " ") do
--print(string.find(content, " "))
end
-- lets print the words
apply_html("html/spacer.html")
apply_html("html/words/start.html")
for i=1, #word_list do
--print(word_list[i])
print_word_stuff(word_list[i])
end
apply_html("html/words/end.html")
-- pop up
apply_html("html/pop_up.html")
-- lets end the html
apply_html("html/end.html")