X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=resources%2Ftools%2Fpresentation%2Fpal_utils.py;h=3efa00af2cffe5b1abf197bd81aed6fd5d9a4cde;hb=bf31370e5e5fa3b597229a631ca1d58788aae794;hp=f296c6b16cd6081d4ebdec270d4ae7b9f8777d9a;hpb=8fcb84c0495e364daf65745a9b23b0d6f0a1d51e;p=csit.git
diff --git a/resources/tools/presentation/pal_utils.py b/resources/tools/presentation/pal_utils.py
index f296c6b16c..3efa00af2c 100644
--- a/resources/tools/presentation/pal_utils.py
+++ b/resources/tools/presentation/pal_utils.py
@@ -309,7 +309,7 @@ def convert_csv_to_pretty_txt(csv_file_name, txt_file_name, delimiter=u","):
"""
txt_table = None
- with open(csv_file_name, u"rt") as csv_file:
+ with open(csv_file_name, u"rt", encoding='utf-8') as csv_file:
csv_content = csv.reader(csv_file, delimiter=delimiter, quotechar=u'"')
for row in csv_content:
if txt_table is None:
@@ -319,6 +319,29 @@ def convert_csv_to_pretty_txt(csv_file_name, txt_file_name, delimiter=u","):
txt_table.align = u"r"
txt_table.align[u"Test Case"] = u"l"
txt_table.align[u"RCA"] = u"l"
- if txt_table:
- with open(txt_file_name, u"wt") as txt_file:
+ txt_table.align[u"RCA1"] = u"l"
+ txt_table.align[u"RCA2"] = u"l"
+ txt_table.align[u"RCA3"] = u"l"
+
+ if not txt_table:
+ return
+
+ if txt_file_name.endswith(u".txt"):
+ with open(txt_file_name, u"wt", encoding='utf-8') as txt_file:
txt_file.write(str(txt_table))
+ elif txt_file_name.endswith(u".rst"):
+ with open(txt_file_name, u"wt") as txt_file:
+ txt_file.write(
+ u"\n"
+ u".. |br| raw:: html\n\n
\n\n\n"
+ u".. |prein| raw:: html\n\n
\n\n\n" + u".. |preout| raw:: html\n\n\n\n" + ) + txt_file.write( + u"\n.. only:: html\n\n" + u" .. csv-table::\n" + u" :header-rows: 1\n" + u" :widths: auto\n" + u" :align: center\n" + f" :file: {csv_file_name.split(u'/')[-1]}\n" + )