diff options
author | Tibor Frank <tifrank@cisco.com> | 2017-10-12 12:47:56 +0200 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2017-10-18 14:39:27 +0000 |
commit | 9a89069be33f11879f8307e5b774c6e1e7afa398 (patch) | |
tree | c45f5bf8cd7c3277b6d70c353d03f445a34a9848 /resources/tools | |
parent | 59eb880b002cc73cc6e8834814c2da34b2ddfd54 (diff) |
CSIT-836: PDF format: Improvements in pdf layout
CSIT-837: Scope of pdf version
Change-Id: Idfc9c04274c6635fbef14f87147665d31cfd7352
Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools')
-rw-r--r-- | resources/tools/presentation/conf.py | 2 | ||||
-rw-r--r-- | resources/tools/presentation/generator_files.py | 23 | ||||
-rw-r--r-- | resources/tools/presentation/generator_report.py | 2 |
3 files changed, 19 insertions, 8 deletions
diff --git a/resources/tools/presentation/conf.py b/resources/tools/presentation/conf.py index 2c942c45a8..6cc024033d 100644 --- a/resources/tools/presentation/conf.py +++ b/resources/tools/presentation/conf.py @@ -157,6 +157,8 @@ latex_elements = { \usepackage[defaultsans]{lato} \usepackage{inconsolata} \usepackage{csvsimple} + \usepackage{longtable} + \usepackage{booktabs} ''', # Latex figure (float) alignment diff --git a/resources/tools/presentation/generator_files.py b/resources/tools/presentation/generator_files.py index 0989fc76c0..dd70c70ce7 100644 --- a/resources/tools/presentation/generator_files.py +++ b/resources/tools/presentation/generator_files.py @@ -68,15 +68,20 @@ def file_test_results(file_spec, input_data): file_name = "{0}{1}".format(file_spec["output-file"], file_spec["output-file-ext"]) rst_header = file_spec["file-header"] - rst_include_table = ("\n.. csv-table::\n" - " :header-rows: 1\n" - " :widths: auto\n" - " :align: center\n" - " :file: {file}\n\n") + + rst_include_table = ("\n.. only:: html\n\n" + " .. csv-table::\n" + " :header-rows: 1\n" + " :widths: auto\n" + " :align: center\n" + " :file: {file_html}\n" + "\n.. only:: latex\n\n" + "\n .. raw:: latex\n\n" + " \csvautolongtable{{{file_latex}}}\n\n") logging.info(" Generating the file {0} ...".format(file_name)) - table_lst = get_files(file_spec["dir-tables"], ".csv", full_path=False) + table_lst = get_files(file_spec["dir-tables"], ".csv", full_path=True) if len(table_lst) == 0: logging.error(" No tables to include in '{0}'. Skipping.". format(file_spec["dir-tables"])) @@ -103,7 +108,9 @@ def file_test_results(file_spec, input_data): if tests_in_suite(suite_name, input_data.tests(job, build)): for tbl_file in table_lst: if suite_name in tbl_file: - file_handler.write(rst_include_table. - format(file=tbl_file)) + file_handler.write( + rst_include_table.format( + file_latex=tbl_file, + file_html=tbl_file.split("/")[-1])) logging.info(" Done.") diff --git a/resources/tools/presentation/generator_report.py b/resources/tools/presentation/generator_report.py index 8a3f8334a7..55aa24b02f 100644 --- a/resources/tools/presentation/generator_report.py +++ b/resources/tools/presentation/generator_report.py @@ -50,6 +50,7 @@ THEME_OVERRIDES = """/* override table width restrictions */ # Command to build the html format of the report HTML_BUILDER = 'sphinx-build -v -c . -a ' \ '-b html -E ' \ + '-t html ' \ '-D release={release} ' \ '-D version="{release} report - {date}" ' \ '{working_dir} ' \ @@ -58,6 +59,7 @@ HTML_BUILDER = 'sphinx-build -v -c . -a ' \ # Command to build the pdf format of the report PDF_BUILDER = 'sphinx-build -v -c . -a ' \ '-b latex -E ' \ + '-t latex ' \ '-D release={release} ' \ '-D version="{release} report - {date}" ' \ '{working_dir} ' \ |