From 4111112ff394f9c0f3c3d45584b0ac045f3e3eb8 Mon Sep 17 00:00:00 2001 From: UndeadMaelys Date: Tue, 10 May 2022 17:29:20 +0200 Subject: [PATCH] fixed submodules to include heonian ime and QTC separatedly. Also fixed a bug on the converter (now renamed to generator) so it detects formal possesivess --- .gitmodules | 6 + generator.lua | 533 +++++++++++++++++++++++++++++++++++ heonian-ime | 1 + ime.html | 2 +- quick-terminal-customization | 1 + test.html | 52 +--- 6 files changed, 554 insertions(+), 41 deletions(-) create mode 100644 generator.lua create mode 160000 heonian-ime create mode 160000 quick-terminal-customization diff --git a/.gitmodules b/.gitmodules index e3abbda..52873e1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,9 @@ [submodule "heonian-content"] path = heonian-content url = https://git.succubi.services/lustlion/heonian-content +[submodule "heonian-ime"] + path = heonian-ime + url = git@ssh.succubi.services:remi/heonian-ime.git +[submodule "quick-terminal-customization"] + path = quick-terminal-customization + url = git@ssh.succubi.services:lustlion/quick-terminal-customization.git diff --git a/generator.lua b/generator.lua new file mode 100644 index 0000000..6214dd0 --- /dev/null +++ b/generator.lua @@ -0,0 +1,533 @@ +require "r2h2_modified" +require "quick-terminal-customization" + +words = dofile("heonian-content/words.lua") + +input = arg[1] or "input.txt" + +function apply(text) + print(text) +end + +function printD(...) + io.stderr:write( + string.effect( + TERMINAL_EFFECT.Bold, + string.color( + TERMINAL_COLOR.HighPurple, + "\tDEBUG:\t" + ) + ) .. + string.color( + TERMINAL_COLOR.HighPurple, + table.unpack({...}) , "\n" + ) + ) +end + +function printW(...) + io.stderr:write( + string.effect( + TERMINAL_EFFECT.Bold, + string.color( + TERMINAL_COLOR.HighYellow, + "\t WARN:\t" + ) + ) .. + string.color( + TERMINAL_COLOR.HighYellow, + table.unpack({...}) .. "\n" + ) + ) +end + +function printE(...) + io.stderr:write( + string.effect( + TERMINAL_EFFECT.Bold, + string.color( + TERMINAL_COLOR.HighRed, + "\tERROR:\t" + ) + ) .. + string.color( + TERMINAL_COLOR.HighRed, + table.unpack({...}) .. "\n" + ) + ) +end + +function process_content(content) + content = content .. " " + for i=1, 2 do + if i == 1 then + apply_html("html/convo/text/start_roman.html") + else + apply_html("html/convo/text/start_heonian.html") + + end + + local ac = check_symbol(content) + while string.find(ac, " ") do + local new_word = string.sub(ac, 0, string.find(ac, " ")-1) + local indicators = {} + + if i == 1 then + print_text = new_word + else + print_text = mod_convertToHeonian(new_word) + end + + new_word = strip_symbols(new_word) + new_word, indicators = revert_verbs(new_word, indicators) + new_word, indicators = revert_nouns(new_word,indicators) + new_word, indicators = categorize_word(new_word,indicators) + add_word(new_word) + + local html_stuff = [[ + + REPLACE_PRINT + + ]] + + local REPLACE_PRINT = print_text + while string.find(html_stuff, "REPLACE_PRINT") do + html_stuff = string.gsub(html_stuff, "REPLACE_PRINT", REPLACE_PRINT) + end + + local REPLACE_WORD = strip_symbols(print_text) + while string.find(REPLACE_WORD, "%\'") do + REPLACE_WORD = string.gsub(REPLACE_WORD, "%\'", "$") + end + while string.find(REPLACE_WORD, "%$") do + REPLACE_WORD = string.gsub(REPLACE_WORD, "%$", "\\\'") + end + while string.find(html_stuff, "REPLACE_WORD") do + html_stuff = string.gsub(html_stuff, "REPLACE_WORD", REPLACE_WORD) + end + + local REPLACE_SEARCH = new_word + while string.find(html_stuff, "REPLACE_SEARCH") do + html_stuff = string.gsub(html_stuff, "REPLACE_SEARCH", REPLACE_SEARCH) + end + + local REPLACE_DATA = "" + local k = 0 + for _, v in pairs(indicators) do + if k > 0 then + REPLACE_DATA = REPLACE_DATA .. " " + end + REPLACE_DATA = REPLACE_DATA .. v + k = k + 1 + end + + if REPLACE_DATA and REPLACE_DATA ~= "" then + while string.find(REPLACE_DATA, "\t") do + REPLACE_DATA = string.gsub(REPLACE_DATA, "\t", " ") + end + while string.find(html_stuff, "REPLACE_DATA") do + html_stuff = string.gsub(html_stuff, "REPLACE_DATA", REPLACE_DATA) + end + else + html_stuff = string.gsub(html_stuff, ",'REPLACE_DATA'","") + end + apply(html_stuff) + + ac = string.sub(ac, string.find(ac, " ")+1) + + -- now we print the thing with teh appropiate indicators. + -- printD(print_text, table.unpack(indicators)) + end + apply_html("html/convo/text/end.html") + end +end + +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 + if v == str then + add = false + end + end + if add then + table.insert(word_list,str) + if not in_dictionary(str) then printW("\"" .. str .. "\" is not known") end + 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 = "'~()!?:> 0 do + p = string.find(text,"\n",p+1) + skip = skip - 1 + end + else + break + end +end + +convo_end() + +-- 3.5 separation +apply_html("html/spacer.html") + +-- fourth lets make word lists +-- process contents + +-- lets print the words +apply_html("html/spacer.html") +apply_html("html/words/start.html") +for i=1, #word_list do + 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") diff --git a/heonian-ime b/heonian-ime new file mode 160000 index 0000000..c8157f5 --- /dev/null +++ b/heonian-ime @@ -0,0 +1 @@ +Subproject commit c8157f53b1e7eaccfbf80071f3bc159f0529d9cc diff --git a/ime.html b/ime.html index 382a9ce..e81bd1f 100644 --- a/ime.html +++ b/ime.html @@ -23,6 +23,6 @@ - + \ No newline at end of file diff --git a/quick-terminal-customization b/quick-terminal-customization new file mode 160000 index 0000000..5224963 --- /dev/null +++ b/quick-terminal-customization @@ -0,0 +1 @@ +Subproject commit 5224963a649a4affbfe5e35076b758ede7ff20be diff --git a/test.html b/test.html index c55cc2f..67804ee 100644 --- a/test.html +++ b/test.html @@ -974,8 +974,8 @@ LU'NYA

relfurla @@ -1032,8 +1032,8 @@ LU'NYA

î€ħ @@ -1090,8 +1090,8 @@ LU'NYA

balfurla @@ -1116,8 +1116,8 @@ LU'NYA

î€ħ @@ -1160,8 +1160,8 @@ ESH'NYUI

relfurla @@ -1234,8 +1234,8 @@ ESH'NYUI

î€ħ @@ -3661,20 +3661,6 @@ noun color - - - - -î€ħ - - -relfur - - -??? - - -??? @@ -3689,20 +3675,6 @@ noun, modifier red - - - - -î€ħ - - -balfur - - -??? - - -???