diff --git a/profile/test/display_priority.py b/profile/test/display_priority.py new file mode 100644 index 0000000..a50c60a --- /dev/null +++ b/profile/test/display_priority.py @@ -0,0 +1,5 @@ +c = get_config() + +load_subconfig('null.py') + +c.ConverterTemplate.template_file='display_priority' diff --git a/profile/test/null.py b/profile/test/null.py new file mode 100644 index 0000000..02d32fe --- /dev/null +++ b/profile/test/null.py @@ -0,0 +1,8 @@ +c = get_config() + + +c.ConverterTemplate.extract_figures=False +c.ConverterTemplate.template_file='null' +c.ConverterTemplate.tex_environement=False + +c.ExtractFigureTransformer.enabled = False diff --git a/templates/skeleton/display_priority.tpl b/templates/skeleton/display_priority.tpl index 56832dd..f237e55 100644 --- a/templates/skeleton/display_priority.tpl +++ b/templates/skeleton/display_priority.tpl @@ -7,38 +7,31 @@ {%- for type in output | filter_data_type -%} {%- if type in ['pdf']%} {%- block data_pdf -%} - ->> pdf {%- endblock -%} {%- endif -%} {%- if type in ['svg']%} {%- block data_svg -%} - ->> svg {%- endblock -%} {%- endif -%} {%- if type in ['png']%} {%- block data_png -%} - ->> png {%- endblock -%} {%- endif -%} {%- if type in ['html']%} {%- block data_html -%} - ->> html {%- endblock -%} {%- endif -%} {%- if type in ['jpeg']%} {%- block data_jpg -%} - ->> jpg {%- endblock -%} {%- endif -%} {%- if type in ['text']%} {%- block data_text -%} - ->> text {%- endblock -%} {%- endif -%} {%- if type in ['latex']%} {%- block data_latex -%} - ->> latext {%- endblock -%} {%- endif -%} {%- endfor -%} diff --git a/templates/skeleton/tex/display_priority.tplx b/templates/skeleton/tex/display_priority.tplx index 78cd12a..d4a88ee 100644 --- a/templates/skeleton/tex/display_priority.tplx +++ b/templates/skeleton/tex/display_priority.tplx @@ -8,38 +8,31 @@ ((*- for type in output | filter_data_type -*)) ((*- if type in ['pdf']*)) ((*- block data_pdf -*)) - ->> pdf ((*- endblock -*)) ((*- endif -*)) ((*- if type in ['svg']*)) ((*- block data_svg -*)) - ->> svg ((*- endblock -*)) ((*- endif -*)) ((*- if type in ['png']*)) ((*- block data_png -*)) - ->> png ((*- endblock -*)) ((*- endif -*)) ((*- if type in ['html']*)) ((*- block data_html -*)) - ->> html ((*- endblock -*)) ((*- endif -*)) ((*- if type in ['jpeg']*)) ((*- block data_jpg -*)) - ->> jpg ((*- endblock -*)) ((*- endif -*)) ((*- if type in ['text']*)) ((*- block data_text -*)) - ->> text ((*- endblock -*)) ((*- endif -*)) ((*- if type in ['latex']*)) ((*- block data_latex -*)) - ->> latext ((*- endblock -*)) ((*- endif -*)) ((*- endfor -*)) diff --git a/tests/test_templates.py b/tests/test_templates.py index b391816..52a32b3 100644 --- a/tests/test_templates.py +++ b/tests/test_templates.py @@ -3,6 +3,9 @@ import nose.tools as nt import os from nose.tools import nottest from converters.template import ConverterTemplate +from IPython.config.loader import PyFileConfigLoader + + def test_evens(): @@ -10,9 +13,15 @@ def test_evens(): 'tests/ipynbref/IntroNumPy.orig' ] - # null template should return empty - C = ConverterTemplate() - C.read('tests/ipynbref/IntroNumPy.orig.ipynb') - result,_ = C.convert() - nt.assert_equal(result,'') + test_profiles = [prof for prof in os.listdir('profile/test/') if prof.endswith('.py')] + + ### null template should return empty + for profile in test_profiles: + loader = PyFileConfigLoader(profile, path=[os.path.join(os.getcwdu(),'profile/test')]) + config = loader.load_config() + C = ConverterTemplate(config=config) + C.read('tests/ipynbref/IntroNumPy.orig.ipynb') + result,_ = C.convert() + nt.assert_equal(result,'') + ### end null test