From 5b438332437a27b908abc502927077470f807a20 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Wed, 20 Jun 2018 15:52:02 -0500 Subject: [PATCH] Move template files to templates directory under source #89 --- src/sos_notebook/converter.py | 10 ++++------ src/sos_notebook/{ => templates}/sos-full.tpl | 0 src/sos_notebook/{ => templates}/sos-report.tpl | 0 3 files changed, 4 insertions(+), 6 deletions(-) rename src/sos_notebook/{ => templates}/sos-full.tpl (100%) rename src/sos_notebook/{ => templates}/sos-report.tpl (100%) diff --git a/src/sos_notebook/converter.py b/src/sos_notebook/converter.py index d8a3617..c223118 100755 --- a/src/sos_notebook/converter.py +++ b/src/sos_notebook/converter.py @@ -390,12 +390,10 @@ def notebook_to_html(notebook_file, output_file, sargs=None, unknown_args=None): import os if unknown_args is None: unknown_args = [] - if sargs.template and sargs.template.startswith('sos') and not os.path.isfile(sargs.template): - # use the default sos template - unknown_args = ['--template', os.path.join(os.path.split(__file__)[0], sargs.template + ( - '' if sargs.template.endswith('.tpl') else '.tpl'))] + unknown_args - elif sargs.template: - unknown_args = ['--template', sargs.template] + unknown_args + if sargs.template: + sos_template = os.path.join(os.path.split(os.path.abspath(__file__))[0], + 'templates', sargs.template + ('' if sargs.template.endswith('.tpl') else '.tpl')) + unknown_args = ['--template', sos_template if os.path.isfile(sos_template) else sargs.template] + unknown_args export_notebook(HTMLExporter, 'html', notebook_file, output_file, unknown_args, view=sargs.view) diff --git a/src/sos_notebook/sos-full.tpl b/src/sos_notebook/templates/sos-full.tpl similarity index 100% rename from src/sos_notebook/sos-full.tpl rename to src/sos_notebook/templates/sos-full.tpl diff --git a/src/sos_notebook/sos-report.tpl b/src/sos_notebook/templates/sos-report.tpl similarity index 100% rename from src/sos_notebook/sos-report.tpl rename to src/sos_notebook/templates/sos-report.tpl