ill continue tomorrow
This commit is contained in:
@@ -1,3 +1,24 @@
|
||||
|
||||
function strip_symbols(str)
|
||||
local symbol_table = " ~()!?:></.\t"
|
||||
for i=1, #symbol_table do
|
||||
while string.find(str, "%"..string.sub(symbol_table,i,i)) do
|
||||
str = string.gsub(str, "%"..string.sub(symbol_table,i,i),"")
|
||||
end
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
function reverse_verbs(str)
|
||||
while string.find(str, "kanya") do
|
||||
str = string.gsub(str, "kanya","ku")
|
||||
end
|
||||
while string.find(str, "kome") do
|
||||
str = string.gsub(str, "kome","ku")
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
function apply_html(path)
|
||||
-- copy
|
||||
local file = io.open(path,"r")
|
||||
@@ -35,6 +56,7 @@ file:close()
|
||||
|
||||
-- first analyze text
|
||||
-- (this is the fun part)
|
||||
local content = ""
|
||||
local p = 0
|
||||
local s = 0
|
||||
local convo = false
|
||||
@@ -53,25 +75,26 @@ while p ~= nil do
|
||||
convo_start()
|
||||
apply_html("html/convo/text/start.html")
|
||||
print(string.sub(text,p+2,np-1))
|
||||
content = content .. " " .. reverse_verbs(strip_symbols(string.sub(text,p+2,np-1)))
|
||||
apply_html("html/convo/text/end.html")
|
||||
apply_html("html/convo/text/start.html")
|
||||
print("\n"..reverse_verbs(strip_symbols(string.sub(text,p+2,np-1))))
|
||||
apply_html("html/convo/text/end.html")
|
||||
else
|
||||
-- new user name
|
||||
convo_end()
|
||||
if green then
|
||||
green = false
|
||||
green = false
|
||||
else
|
||||
green = true
|
||||
end
|
||||
convo_start(green)
|
||||
apply_html("html/convo/header/start.html")
|
||||
apply_html("html/convo/header/name/start.html")
|
||||
print(string.sub(text,p+1,np-1))
|
||||
print(string.sub(text,p+1,np-1))
|
||||
apply_html("html/convo/header/name/end.html")
|
||||
apply_html("html/convo/header/end.html")
|
||||
--print(s,string.sub(text,p+1,np))
|
||||
end
|
||||
else
|
||||
--print(s,string.sub(text,p+1))
|
||||
end
|
||||
end
|
||||
p = string.find(text,"\n",p+1)
|
||||
else
|
||||
@@ -85,3 +108,6 @@ apply_html("html/convo/end.html")
|
||||
|
||||
-- lets end the html
|
||||
apply_html("html/end.html")
|
||||
|
||||
|
||||
-- print(content)
|
||||
Reference in New Issue
Block a user