diff --git a/converter.lua b/converter.lua index 29dcbfb..4b40610 100644 --- a/converter.lua +++ b/converter.lua @@ -41,6 +41,14 @@ function convo_image(string,alt_text) end end +function convo_date(string) + if string then + apply_html("html/convo/header/date/start.html") + print(string) + apply_html("html/convo/header/date/end.html") + end +end + function convo_header_start() if not header then header = true @@ -137,13 +145,24 @@ while p ~= nil do user[current_user] = user[current_user] or {image = nil} if nlp and string.sub(text,nl+1,nl+1) == "i" then user[current_user].image = string.sub(text,nl+3,nlp-1) - skip = 2 + skip = skip + 1 + nl = string.find(text,"\n",nl+1) + nlp = string.find(text,"\n",nlp+1) end convo_image(user[current_user].image) + -- print name apply_html("html/convo/header/name/start.html") print(string.sub(text,p+1,np-1)) apply_html("html/convo/header/name/end.html") + + -- lets check for dates + if nlp and string.sub(text,nl+1,nl+1) == "d" then + convo_date(string.sub(text,nl+3,nlp-1)) + skip = skip + 1 + else + convo_date("") + end header = true end diff --git a/input.txt b/input.txt index 0493abc..3de5843 100644 --- a/input.txt +++ b/input.txt @@ -1,7 +1,8 @@ LU'NYA i lunya.jpeg +d 2022/05/04 nyan'pash! balfur yu e she polika'nya dre? - + ESH'NYUI i eshnyui.png re chu meshu yu polika'nya diff --git a/test.html b/test.html index 6f78f7d..b284eb4 100644 --- a/test.html +++ b/test.html @@ -46,6 +46,10 @@ nil "> LU'NYA + + + +2022/05/04
@@ -54,6 +58,12 @@ nyan'pash! balfur yu e she polika'nya dre?
! ?
++ +
++ +
@@ -92,6 +106,10 @@ nil "> LU'NYA + + + +
@@ -118,6 +136,10 @@ nil "> ESH'NYUI + + + +
@@ -144,6 +166,10 @@ nil "> LU'NYA + + + +
@@ -164,6 +190,10 @@ nil "> ESH'NYUI + + + +
@@ -190,6 +220,10 @@ nil "> LU'NYA + + + +
@@ -222,6 +256,10 @@ nil "> ESH'NYUI + + + +
@@ -248,6 +286,10 @@ nil "> LU'NYA + + + +
@@ -268,6 +310,10 @@ nil "> ESH'NYUI + + + +
@@ -294,6 +340,10 @@ nil "> LU'NYA + + + +
@@ -320,6 +370,10 @@ nil "> ESH'NYUI + + + +
@@ -352,6 +406,10 @@ nil "> LU'NYA + + + +
@@ -378,6 +436,10 @@ nil "> ESH'NYUI + + + +
@@ -410,6 +472,10 @@ nil "> LU'NYA + + + +
@@ -452,6 +518,10 @@ nil "> ESH'NYUI + + + +
@@ -472,6 +542,10 @@ nil "> LU'NYA + + + +