diff --git a/program/code/functional_tests/ERRORwrongColumnsNumber/texfilecolumnswrong.tex.html b/program/code/functional_tests/ERRORwrongColumnsNumber/texfilecolumnswrong.tex.html index 33e82118..7ce51b0f 100644 --- a/program/code/functional_tests/ERRORwrongColumnsNumber/texfilecolumnswrong.tex.html +++ b/program/code/functional_tests/ERRORwrongColumnsNumber/texfilecolumnswrong.tex.html @@ -1 +1 @@ -Error! \ No newline at end of file +
1 2 3
\ No newline at end of file diff --git a/program/code/functional_tests/PASScomplicatedTable/texfilelonger.pdf b/program/code/functional_tests/PASScomplicatedTable/texfilelonger.pdf index 0ea7913a..548a103b 100644 Binary files a/program/code/functional_tests/PASScomplicatedTable/texfilelonger.pdf and b/program/code/functional_tests/PASScomplicatedTable/texfilelonger.pdf differ diff --git a/program/code/functional_tests/PASScomplicatedTable/texfilelonger.tex b/program/code/functional_tests/PASScomplicatedTable/texfilelonger.tex index bd0f8e90..781e89ce 100644 --- a/program/code/functional_tests/PASScomplicatedTable/texfilelonger.tex +++ b/program/code/functional_tests/PASScomplicatedTable/texfilelonger.tex @@ -1,10 +1,7 @@ \documentclass{article} \begin{document} \begin{tabular}{ l | c | r } - \hline test & 2 & test \\ -\hline 4 & 5 & 6 \\ -\hline \end{tabular} \end{document} \ No newline at end of file diff --git a/program/code/functional_tests/PASScomplicatedTable/texfilelonger.tex.html b/program/code/functional_tests/PASScomplicatedTable/texfilelonger.tex.html index f3e4ce83..91adcdef 100644 --- a/program/code/functional_tests/PASScomplicatedTable/texfilelonger.tex.html +++ b/program/code/functional_tests/PASScomplicatedTable/texfilelonger.tex.html @@ -1 +1 @@ -Error! \ No newline at end of file +
test 2 test
4 5 6
\ No newline at end of file diff --git a/program/code/functional_tests/PassparametersTable/texfilelonger.pdf b/program/code/functional_tests/PassparametersTable/texfilelonger.pdf new file mode 100644 index 00000000..a820f09f Binary files /dev/null and b/program/code/functional_tests/PassparametersTable/texfilelonger.pdf differ diff --git a/program/code/functional_tests/PassparametersTable/texfilelonger.tex b/program/code/functional_tests/PassparametersTable/texfilelonger.tex new file mode 100644 index 00000000..82045dde --- /dev/null +++ b/program/code/functional_tests/PassparametersTable/texfilelonger.tex @@ -0,0 +1,8 @@ +\documentclass{article} +\usepackage{array} +\begin{document} +\begin{tabular}{ p{1pt} | m{1pt} | b{1pt} } +test & 2 & test \\ +4 & 5 & 6 \\ +\end{tabular} +\end{document} \ No newline at end of file diff --git a/program/code/functional_tests/PassparametersTable/texfilelonger.tex.html b/program/code/functional_tests/PassparametersTable/texfilelonger.tex.html new file mode 100644 index 00000000..22ef8842 --- /dev/null +++ b/program/code/functional_tests/PassparametersTable/texfilelonger.tex.html @@ -0,0 +1 @@ +
test 2 test
4 5 6
\ No newline at end of file diff --git a/program/code/main.py b/program/code/main.py index 78d3d23b..5f366675 100644 --- a/program/code/main.py +++ b/program/code/main.py @@ -319,6 +319,8 @@ def split_columns(table_row, column_count): """ columns = table_row.split("&") if len(columns) != column_count and columns != [""]: + print( + f"Error! extracted columns length: {columns} and columns_count: {column_count} is different!") return "Error!" return columns @@ -327,7 +329,7 @@ def translate_column(latex_column): """ Translate insides of a single latex tabular column to html """ - hline_string_literal = "\\hline" + hline_string_literal = "hline" replaced_hline = latex_column.replace(hline_string_literal, "
") replaced_newline = replaced_hline.replace("\newline", "
") return replaced_newline @@ -338,12 +340,12 @@ def handle_line_strings(line_string, """ Converts lines untill there are no more lines """ - current_style = column_style[column_number] + current_style = column_style[column_number - 1] if current_style == line_string: while current_style == line_string: return_string += line_string column_number += 1 - current_style = column_style[column_number] + current_style = column_style[column_number - 1] return return_string, column_number @@ -374,12 +376,14 @@ def handle_latex_columns(columns, column_style, """ Goes through every column in a row and translates it to html """ - for column in columns: - return_string, column_number = handle_single_column(column, - column_style, - column_number, - line_string, - return_string) + + if columns != "Error!": + for column in columns: + return_string, column_number = handle_single_column(column, + column_style, + column_number, + line_string, + return_string) return return_string, column_number @@ -494,8 +498,7 @@ def handle_table_whole(html_string, data, table_start, table_end): parameters_start_index = data.find( "{", table_start + len(tabular_begin_string)) - - parameters_end_index = data.find("}", parameters_start_index) + parameters_end_index = data.find(" }", parameters_start_index) parameters_string = data[parameters_start_index: parameters_end_index + 1] parameters_array = tabular_required_parameters(parameters_string) inside_table = data[parameters_end_index + 1: table_end] @@ -537,7 +540,7 @@ def main_function(tex_filename): when reading documentclass or begin document""") return "Error" html_string, data = handle_insides(html_string, data) - + html_string = html_string.replace('}', '') return html_string