diff --git a/nbconvert/exporters/script.py b/nbconvert/exporters/script.py index d44301ded..c9986289d 100644 --- a/nbconvert/exporters/script.py +++ b/nbconvert/exporters/script.py @@ -18,7 +18,7 @@ class ScriptExporter(TemplateExporter): @default('template_file') def _template_file_default(self): - return 'script.tpl' + return 'script.j2' @default('template_name') def _template_name_default(self): diff --git a/nbconvert/exporters/tests/test_latex.py b/nbconvert/exporters/tests/test_latex.py index 445d23f47..b9f5ab64c 100644 --- a/nbconvert/exporters/tests/test_latex.py +++ b/nbconvert/exporters/tests/test_latex.py @@ -53,23 +53,6 @@ def test_export_book(self): assert len(output) > 0 - @onlyif_cmds_exist('pandoc') - def test_export_basic(self): - """ - Can a LatexExporter export using 'article' template? - """ - (output, resources) = LatexExporter(template_file='article').from_filename(self._get_notebook()) - assert len(output) > 0 - - - @onlyif_cmds_exist('pandoc') - def test_export_article(self): - """ - Can a LatexExporter export using 'article' template? - """ - (output, resources) = LatexExporter(template_file='article').from_filename(self._get_notebook()) - assert len(output) > 0 - @onlyif_cmds_exist('pandoc') def test_very_long_cells(self): """ @@ -104,7 +87,7 @@ def test_very_long_cells(self): with open(nbfile, 'w') as f: write(nb, f, 4) - (output, resources) = LatexExporter(template_file='article').from_filename(nbfile) + (output, resources) = LatexExporter().from_filename(nbfile) assert len(output) > 0 @onlyif_cmds_exist('pandoc') @@ -133,7 +116,7 @@ def test_prompt_number_color_ipython(self): """ my_loader_tplx = DictLoader({'my_template': """ - ((* extends 'style_ipython.tplx' *)) + ((* extends 'style_ipython.tex' *)) ((* block docclass *)) \documentclass[11pt]{article} @@ -184,7 +167,7 @@ def test_in_memory_template_tplx(self): # Loads in an in memory latex template (.tplx) using jinja2.DictLoader # creates a class that uses this template with the template_file argument # converts an empty notebook using this mechanism - my_loader_tplx = DictLoader({'my_template': "{%- extends 'article' -%}"}) + my_loader_tplx = DictLoader({'my_template': "{%- extends 'index' -%}"}) class MyExporter(LatexExporter): template_file = 'my_template' diff --git a/share/jupyter/nbconvert/templates/asciidoc/index.asciidoc b/share/jupyter/nbconvert/templates/asciidoc/index.asciidoc index 8f32c4a6e..1512a2daa 100644 --- a/share/jupyter/nbconvert/templates/asciidoc/index.asciidoc +++ b/share/jupyter/nbconvert/templates/asciidoc/index.asciidoc @@ -1,4 +1,4 @@ -{% extends 'display_priority.tpl' %} +{% extends 'display_priority.j2' %} {% block input %} diff --git a/share/jupyter/nbconvert/templates/base/base.html b/share/jupyter/nbconvert/templates/base/base.html index 8da1d7a21..d428c1aac 100644 --- a/share/jupyter/nbconvert/templates/base/base.html +++ b/share/jupyter/nbconvert/templates/base/base.html @@ -1,4 +1,4 @@ -{%- extends 'display_priority.tpl' -%} +{%- extends 'display_priority.j2' -%} {% block codecell %} diff --git a/share/jupyter/nbconvert/templates/base/display_priority.tpl b/share/jupyter/nbconvert/templates/base/display_priority.j2 similarity index 98% rename from share/jupyter/nbconvert/templates/base/display_priority.tpl rename to share/jupyter/nbconvert/templates/base/display_priority.j2 index ec4d58a87..beaa196a5 100644 --- a/share/jupyter/nbconvert/templates/base/display_priority.tpl +++ b/share/jupyter/nbconvert/templates/base/display_priority.j2 @@ -1,4 +1,4 @@ -{%- extends 'null.tpl' -%} +{%- extends 'null.j2' -%} {#display data priority#} diff --git a/share/jupyter/nbconvert/templates/base/null.tpl b/share/jupyter/nbconvert/templates/base/null.j2 similarity index 100% rename from share/jupyter/nbconvert/templates/base/null.tpl rename to share/jupyter/nbconvert/templates/base/null.j2 diff --git a/share/jupyter/nbconvert/templates/lab/base.html b/share/jupyter/nbconvert/templates/lab/base.html index 4becfce0e..7bcc13358 100644 --- a/share/jupyter/nbconvert/templates/lab/base.html +++ b/share/jupyter/nbconvert/templates/lab/base.html @@ -1,4 +1,4 @@ -{%- extends 'display_priority.tpl' -%} +{%- extends 'display_priority.j2' -%} {% block codecell %} {%- if not cell.outputs -%} diff --git a/share/jupyter/nbconvert/templates/latex/article.tex b/share/jupyter/nbconvert/templates/latex/article.tex deleted file mode 100644 index 8588c850c..000000000 --- a/share/jupyter/nbconvert/templates/latex/article.tex +++ /dev/null @@ -1,17 +0,0 @@ - -((=- Default to the notebook output style -=)) -((* if not cell_style is defined *)) - ((* set cell_style = 'style_jupyter.tplx' *)) -((* endif *)) - -((=- Inherit from the specified cell style. -=)) -((* extends cell_style *)) - - -%=============================================================================== -% Latex Article -%=============================================================================== - -((* block docclass *)) -\documentclass[11pt]{article} -((* endblock docclass *)) diff --git a/share/jupyter/nbconvert/templates/latex/base.tex b/share/jupyter/nbconvert/templates/latex/base.tex index 74cd65e84..b39dbee18 100644 --- a/share/jupyter/nbconvert/templates/latex/base.tex +++ b/share/jupyter/nbconvert/templates/latex/base.tex @@ -3,7 +3,7 @@ functions. Figures, data_text, This template does not define a docclass, the inheriting class must define this.=)) -((*- extends 'document_contents.tplx' -*)) +((*- extends 'document_contents.tex' -*)) %=============================================================================== % Abstract overrides diff --git a/share/jupyter/nbconvert/templates/latex/display_priority.tplx b/share/jupyter/nbconvert/templates/latex/display_priority.j2 similarity index 98% rename from share/jupyter/nbconvert/templates/latex/display_priority.tplx rename to share/jupyter/nbconvert/templates/latex/display_priority.j2 index 3b9f7001d..9f33a74e1 100644 --- a/share/jupyter/nbconvert/templates/latex/display_priority.tplx +++ b/share/jupyter/nbconvert/templates/latex/display_priority.j2 @@ -2,7 +2,7 @@ To edit this file, please refer to ../../skeleton/README.md =)) -((*- extends 'null.tplx' -*)) +((*- extends 'null.j2' -*)) ((=display data priority=)) diff --git a/share/jupyter/nbconvert/templates/latex/document_contents.tplx b/share/jupyter/nbconvert/templates/latex/document_contents.tex similarity index 98% rename from share/jupyter/nbconvert/templates/latex/document_contents.tplx rename to share/jupyter/nbconvert/templates/latex/document_contents.tex index 24f969596..5e0fa7881 100644 --- a/share/jupyter/nbconvert/templates/latex/document_contents.tplx +++ b/share/jupyter/nbconvert/templates/latex/document_contents.tex @@ -1,4 +1,4 @@ -((*- extends 'display_priority.tplx' -*)) +((*- extends 'display_priority.j2' -*)) %=============================================================================== % Support blocks diff --git a/share/jupyter/nbconvert/templates/latex/index.tex b/share/jupyter/nbconvert/templates/latex/index.tex index 1edecbf30..e01e6ada2 100644 --- a/share/jupyter/nbconvert/templates/latex/index.tex +++ b/share/jupyter/nbconvert/templates/latex/index.tex @@ -1 +1,17 @@ -((* extends 'article.tex' *)) + +((=- Default to the notebook output style -=)) +((* if not cell_style is defined *)) + ((* set cell_style = 'style_jupyter.tex' *)) +((* endif *)) + +((=- Inherit from the specified cell style. -=)) +((* extends cell_style *)) + + +%=============================================================================== +% Latex Article +%=============================================================================== + +((* block docclass *)) +\documentclass[11pt]{article} +((* endblock docclass *)) diff --git a/share/jupyter/nbconvert/templates/latex/null.tplx b/share/jupyter/nbconvert/templates/latex/null.j2 similarity index 100% rename from share/jupyter/nbconvert/templates/latex/null.tplx rename to share/jupyter/nbconvert/templates/latex/null.j2 diff --git a/share/jupyter/nbconvert/templates/latex/report.tex b/share/jupyter/nbconvert/templates/latex/report.tex index 1ade514c5..3ddcc7b7c 100644 --- a/share/jupyter/nbconvert/templates/latex/report.tex +++ b/share/jupyter/nbconvert/templates/latex/report.tex @@ -1,7 +1,7 @@ % Default to the notebook output style ((* if not cell_style is defined *)) - ((* set cell_style = 'style_ipython.tplx' *)) + ((* set cell_style = 'style_ipython.tex' *)) ((* endif *)) % Inherit from the specified cell style. diff --git a/share/jupyter/nbconvert/templates/latex/style_bw_ipython.tplx b/share/jupyter/nbconvert/templates/latex/style_bw_ipython.tex similarity index 100% rename from share/jupyter/nbconvert/templates/latex/style_bw_ipython.tplx rename to share/jupyter/nbconvert/templates/latex/style_bw_ipython.tex diff --git a/share/jupyter/nbconvert/templates/latex/style_bw_python.tplx b/share/jupyter/nbconvert/templates/latex/style_bw_python.tex similarity index 100% rename from share/jupyter/nbconvert/templates/latex/style_bw_python.tplx rename to share/jupyter/nbconvert/templates/latex/style_bw_python.tex diff --git a/share/jupyter/nbconvert/templates/latex/style_ipython.tplx b/share/jupyter/nbconvert/templates/latex/style_ipython.tex similarity index 100% rename from share/jupyter/nbconvert/templates/latex/style_ipython.tplx rename to share/jupyter/nbconvert/templates/latex/style_ipython.tex diff --git a/share/jupyter/nbconvert/templates/latex/style_jupyter.tplx b/share/jupyter/nbconvert/templates/latex/style_jupyter.tex similarity index 100% rename from share/jupyter/nbconvert/templates/latex/style_jupyter.tplx rename to share/jupyter/nbconvert/templates/latex/style_jupyter.tex diff --git a/share/jupyter/nbconvert/templates/latex/style_python.tplx b/share/jupyter/nbconvert/templates/latex/style_python.tex similarity index 100% rename from share/jupyter/nbconvert/templates/latex/style_python.tplx rename to share/jupyter/nbconvert/templates/latex/style_python.tex diff --git a/share/jupyter/nbconvert/templates/markdown/index.md b/share/jupyter/nbconvert/templates/markdown/index.md index ce694d710..8906eff87 100644 --- a/share/jupyter/nbconvert/templates/markdown/index.md +++ b/share/jupyter/nbconvert/templates/markdown/index.md @@ -1,4 +1,4 @@ -{% extends 'display_priority.tpl' %} +{% extends 'display_priority.j2' %} {% block in_prompt %} diff --git a/share/jupyter/nbconvert/templates/python/index.py b/share/jupyter/nbconvert/templates/python/index.py index eed2f923f..a09fe9d1f 100644 --- a/share/jupyter/nbconvert/templates/python/index.py +++ b/share/jupyter/nbconvert/templates/python/index.py @@ -1,4 +1,4 @@ -{%- extends 'null.tpl' -%} +{%- extends 'null.j2' -%} {%- block header -%} #!/usr/bin/env python diff --git a/share/jupyter/nbconvert/templates/rst/index.rst b/share/jupyter/nbconvert/templates/rst/index.rst index bf070c1b9..bda5c5fb9 100644 --- a/share/jupyter/nbconvert/templates/rst/index.rst +++ b/share/jupyter/nbconvert/templates/rst/index.rst @@ -1,4 +1,4 @@ -{%- extends 'display_priority.tpl' -%} +{%- extends 'display_priority.j2' -%} {% block in_prompt %} diff --git a/share/jupyter/nbconvert/templates/script/script.tpl b/share/jupyter/nbconvert/templates/script/script.j2 similarity index 68% rename from share/jupyter/nbconvert/templates/script/script.tpl rename to share/jupyter/nbconvert/templates/script/script.j2 index cbd971d06..3b30ea89e 100644 --- a/share/jupyter/nbconvert/templates/script/script.tpl +++ b/share/jupyter/nbconvert/templates/script/script.j2 @@ -1,4 +1,4 @@ -{%- extends 'null.tpl' -%} +{%- extends 'null.j2' -%} {% block input %} {{ cell.source }}