mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 16:43:12 +02:00
chore: cleaning
This commit is contained in:
parent
515d8ff320
commit
ceed76f6ed
9
program/README.md
Normal file
9
program/README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
To run unit tests:
|
||||||
|
Enter project environment:
|
||||||
|
|
||||||
|
source /ecote/bin/activate
|
||||||
|
|
||||||
|
Run tests:
|
||||||
|
|
||||||
|
python -m pytest unit_tests
|
||||||
|
|
||||||
15
program/code/functional_tests/texfile.tex
Normal file
15
program/code/functional_tests/texfile.tex
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
\documentclass{article}
|
||||||
|
\begin{document}
|
||||||
|
some random text
|
||||||
|
\begin{tabular}{c}
|
||||||
|
inside table
|
||||||
|
\end{tabular}
|
||||||
|
some random text 2
|
||||||
|
\begin{tabular}{c}
|
||||||
|
inside table2
|
||||||
|
\end{tabular}
|
||||||
|
|
||||||
|
\begin{tabular}{c}
|
||||||
|
inside table3
|
||||||
|
\end{tabular}
|
||||||
|
\end{document}
|
||||||
1
program/code/functional_tests/texfile.tex.html
Normal file
1
program/code/functional_tests/texfile.tex.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html>some random text<html> <table><tr><td align='center'> inside table</td></tr> </table> </html>some random text 2<html> <table><tr><td align='center'> inside table2</td></tr> </table> </html><html> <table><tr><td align='center'> inside table3</td></tr> </table> </html>
|
||||||
7
program/code/functional_tests/texfilecolumnswrong.tex
Normal file
7
program/code/functional_tests/texfilecolumnswrong.tex
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
\documentclass{class}
|
||||||
|
\begin{document}
|
||||||
|
\begin{tabular}{ l c r }
|
||||||
|
1 & 2 & 3 \\
|
||||||
|
4 & 5 6 \\
|
||||||
|
\end{tabular}
|
||||||
|
\end{document}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html>Error!
|
||||||
9
program/code/functional_tests/texfilelonger.tex
Normal file
9
program/code/functional_tests/texfilelonger.tex
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
\documentclass{class}
|
||||||
|
\begin{document}
|
||||||
|
\begin{tabular}{ l | c | r }
|
||||||
|
test & 2 & test \\
|
||||||
|
4 & 5 & 6 \\
|
||||||
|
\end{tabular}
|
||||||
|
\end{document}
|
||||||
|
\end{lstlisting}&
|
||||||
|
\begin{lstlisting}
|
||||||
1
program/code/functional_tests/texfilelonger.tex.html
Normal file
1
program/code/functional_tests/texfilelonger.tex.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html><html> <table><tr><td align='left'>test </td><td style='border-left: 1px solid black'align='center'> 2 </td><td style='border-left: 1px solid black'align='right'> test </td></tr><tr><td align='left'></td></tr><tr><td align='left'>4 </td><td style='border-left: 1px solid black'align='center'> 5 </td><td style='border-left: 1px solid black'align='right'> 6 </td></tr><tr><td align='left'></td></tr><tr><td align='left'></td></tr> </table> </html>
|
||||||
@ -1,30 +0,0 @@
|
|||||||
"""
|
|
||||||
Holds an array of all classes from https://ctan.org/topic/class
|
|
||||||
"""
|
|
||||||
classes = [
|
|
||||||
"article",
|
|
||||||
"report",
|
|
||||||
"book",
|
|
||||||
"beamer",
|
|
||||||
"letter",
|
|
||||||
"memoir",
|
|
||||||
"slides",
|
|
||||||
"IEEEtran",
|
|
||||||
"exam",
|
|
||||||
"amsart",
|
|
||||||
"amsbook",
|
|
||||||
"tufte-book",
|
|
||||||
"scrartcl",
|
|
||||||
"scrreprt",
|
|
||||||
"moderncv",
|
|
||||||
"cv",
|
|
||||||
"res",
|
|
||||||
"elsarticle",
|
|
||||||
"acm_proc_article-sp",
|
|
||||||
"scrbook",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def return_latex_classes():
|
|
||||||
"""Returns latex classes array"""
|
|
||||||
return classes
|
|
||||||
@ -217,6 +217,10 @@ def translate_inside_to_html(latex_table_inside, column_style):
|
|||||||
column_number = 0
|
column_number = 0
|
||||||
for column in columns:
|
for column in columns:
|
||||||
return_string += "<td "
|
return_string += "<td "
|
||||||
|
if column_number >= len(column_style):
|
||||||
|
print(
|
||||||
|
f"Error! column_number index: {column_number} is out of length of column_style: {column_style}")
|
||||||
|
return "Error!"
|
||||||
current_style = column_style[column_number]
|
current_style = column_style[column_number]
|
||||||
while current_style == line_string:
|
while current_style == line_string:
|
||||||
return_string += line_string
|
return_string += line_string
|
||||||
@ -315,8 +319,7 @@ def handle_insides(html_string, data):
|
|||||||
return html_string, data
|
return html_string, data
|
||||||
|
|
||||||
|
|
||||||
def main_function():
|
def main_function(tex_filename):
|
||||||
tex_filename = "texfile.tex"
|
|
||||||
data = read_file(tex_filename)
|
data = read_file(tex_filename)
|
||||||
html_string = ""
|
html_string = ""
|
||||||
html_string, data = read_start(html_string, data)
|
html_string, data = read_start(html_string, data)
|
||||||
@ -329,4 +332,7 @@ def main_function():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(main_function())
|
tex_filename = "texfile.tex"
|
||||||
|
final_html = main_function(tex_filename)
|
||||||
|
f = open(tex_filename + ".html", "w")
|
||||||
|
f.write(final_html)
|
||||||
|
|||||||
Binary file not shown.
1
program/code/texfile.tex.html
Normal file
1
program/code/texfile.tex.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html>some random text<html> <table><tr><td align='center'> inside table</td></tr> </table> </html>some random text 2<html> <table><tr><td align='center'> inside table2</td></tr> </table> </html><html> <table><tr><td align='center'> inside table3</td></tr> </table> </html>
|
||||||
Loading…
Reference in New Issue
Block a user