##// END OF EJS Templates
require jinja, merge base templates
Matthias BUSSONNIER -
Show More
@@ -2,3 +2,4 b' docutils==0.9.1'
2 markdown
2 markdown
3 -e git://github.com/ipython/ipython.git#egg=IPython
3 -e git://github.com/ipython/ipython.git#egg=IPython
4 pygments
4 pygments
5 Jinja2
@@ -1,13 +1,15 b''
1 {%- extends 'basic.tpl' -%}
2
3 {#
1 {#
4
2
3 DO NOT USE THIS AS A BASE WORK,
4 IF YOU ARE COPY AND PASTING THIS FILE
5 YOU ARE PROBABLY DOING THINGS WRONG.
6
5 Null template, Does nothing except defining a basic structure
7 Null template, Does nothing except defining a basic structure
6 To layout the diferents blocks of a notebook.
8 To layout the diferents blocks of a notebook.
7
9
8 Subtemplates can Override Blocks to define their custom reresentation.
10 Subtemplates can Override Blocks to define their custom reresentation.
9
11
10 If one of the block you do overrite is nt a leave block, consider
12 If one of the block you do overrite is not a leave block, consider
11 calling super.
13 calling super.
12
14
13 {%- block nonLeaveBlock -%}
15 {%- block nonLeaveBlock -%}
@@ -19,37 +21,52 b' calling super.'
19 consider calling super even if block is leave block, we might insert more block later.
21 consider calling super even if block is leave block, we might insert more block later.
20
22
21 #}
23 #}
22
24 {%- block header -%}
23 {%- block codecell scoped -%}
25 {%- endblock header -%}
24 {%- block in_prompt -%}{%- endblock in_prompt -%}
26 {%- block body -%}
25 {%- block input -%}{%- endblock input -%}
27 {%- for worksheet in worksheets -%}
26 {%- if cell.outputs -%}
28 {%- for cell in worksheet.cells -%}
27 {%- block output_prompt -%}{%- endblock output_prompt -%}
29 {%- block any_cell scoped -%}
28 {%- for output in cell.outputs -%}
30 {%- if cell.type in ['code'] -%}
29 {%- if output.output_type in ['pyout']%}
31 {%- block codecell scoped -%}
30 {%- block pyout scoped -%}{%- endblock pyout -%}
32 {%- block in_prompt -%}{%- endblock in_prompt -%}
31 {%- elif output.output_type in ['stream'] -%}
33 {%- block input -%}{%- endblock input -%}
32 {%- block stream scoped -%}{%- endblock stream -%}
34 {%- if cell.outputs -%}
33 {%- elif output.output_type in ['display_data'] -%}
35 {%- block output_prompt -%}{%- endblock output_prompt -%}
34 {%- block display_data scoped -%}{%- endblock display_data -%}
36 {%- for output in cell.outputs -%}
35 {%- elif output.output_type in ['pyerr'] -%}
37 {%- if output.output_type in ['pyout'] -%}
36 {%- block pyerr scoped -%}
38 {%- block pyout scoped -%}{%- endblock pyout -%}
37 {%- for line in output.traceback -%}
39 {%- elif output.output_type in ['stream'] -%}
38 {%- block traceback_line scoped -%}{%- endblock traceback_line -%}
40 {%- block stream scoped -%}{%- endblock stream -%}
39 {%- endfor -%}
41 {%- elif output.output_type in ['display_data'] -%}
40 {%- endblock pyerr -%}
42 {%- block display_data scoped -%}{%- endblock display_data -%}
41 {%- endif -%}
43 {%- elif output.output_type in ['pyerr'] -%}
44 {%- block pyerr scoped -%}
45 {%- for line in output.traceback -%}
46 {%- block traceback_line scoped -%}{%- endblock traceback_line -%}
47 {%- endfor -%}
48 {%- endblock pyerr -%}
49 {%- endif -%}
50 {%- endfor -%}
51 {%- endif -%}
52 {%- endblock codecell -%}
53 {%- elif cell.type in ['markdown'] -%}
54 {%- block markdowncell scoped-%}
55 {%- endblock markdowncell -%}
56 {%- elif cell.type in ['heading'] -%}
57 {%- block headingcell scoped-%}
58 {%- endblock headingcell -%}
59 {%- elif cell.type in ['raw'] -%}
60 {%- block rawcell scoped-%}
61 {%- endblock rawcell -%}
62 {%- else -%}
63 {%- block unknowncell scoped-%}
64 {%- endblock unknowncell -%}
65 {%- endif -%}
66 {%- endblock any_cell -%}
67 {%- endfor -%}
42 {%- endfor -%}
68 {%- endfor -%}
43 {%- endif -%}
69 {%- endblock body -%}
44 {%- endblock codecell -%}
45
46 {%- block markdowncell scoped -%}{%- endblock markdowncell -%}
47
48 {%- block headingcell scoped -%}
49 {%- endblock headingcell -%}
50
51 {%- block rawcell scoped -%}
52 {%- endblock rawcell -%}
53
70
54 {%- block unknowncell scoped -%}
71 {%- block footer -%}
55 {%- endblock unknowncell -%}
72 {%- endblock footer -%}
@@ -10,11 +10,6 b' def test_evens():'
10 'tests/ipynbref/IntroNumPy.orig'
10 'tests/ipynbref/IntroNumPy.orig'
11 ]
11 ]
12
12
13 C = ConverterTemplate(tplfile='basic')
14 C.read('tests/ipynbref/IntroNumPy.orig.ipynb')
15 result = C.convert()
16 nt.assert_equal(result,'')
17
18 # null template should return empty
13 # null template should return empty
19 C = ConverterTemplate(tplfile='null')
14 C = ConverterTemplate(tplfile='null')
20 C.read('tests/ipynbref/IntroNumPy.orig.ipynb')
15 C.read('tests/ipynbref/IntroNumPy.orig.ipynb')
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now