##// END OF EJS Templates
prepare ability to convert template for Tex
Matthias BUSSONNIER -
Show More
@@ -0,0 +1,22 b''
1
2
3 all: tex/null.tplx tex/display_priority.tplx
4
5 # convert jinja syntax to tex
6 # cf http://flask.pocoo.org/snippets/55/
7 tex/%.tplx: %.tpl
8 @echo 'generating tex equivalent of $^: $@'
9 @echo '((= autogenerated file do not edit =))' > $@
10 @sed \
11 -e 's/{%/((*/g' \
12 -e 's/%}/*))/g' \
13 -e 's/{{/(((/g' \
14 -e 's/}}/)))/g' \
15 -e 's/{#/((=/g' \
16 -e 's/#}/=))/g' \
17 $^ >> $@
18
19
20 clean:
21 @echo "cleaning generated tplx files..."
22 @rm tex/*
@@ -0,0 +1,46 b''
1 ((= autogenerated file do not edit =))
2 ((*- extends 'null.tpl' -*))
3
4 ((=display data priority=))
5
6
7 ((*- block data_priority scoped -*))
8 ((*- for type in output | filter_data_type -*))
9 ((*- if type in ['pdf']*))
10 ((*- block data_pdf -*))
11 ->> pdf
12 ((*- endblock -*))
13 ((*- endif -*))
14 ((*- if type in ['svg']*))
15 ((*- block data_svg -*))
16 ->> svg
17 ((*- endblock -*))
18 ((*- endif -*))
19 ((*- if type in ['png']*))
20 ((*- block data_png -*))
21 ->> png
22 ((*- endblock -*))
23 ((*- endif -*))
24 ((*- if type in ['html']*))
25 ((*- block data_html -*))
26 ->> html
27 ((*- endblock -*))
28 ((*- endif -*))
29 ((*- if type in ['jpeg']*))
30 ((*- block data_jpg -*))
31 ->> jpg
32 ((*- endblock -*))
33 ((*- endif -*))
34 ((*- if type in ['text']*))
35 ((*- block data_text -*))
36 ->> text
37 ((*- endblock -*))
38 ((*- endif -*))
39
40 ((*- if type in ['latex']*))
41 ((*- block data_latex -*))
42 ->> latext
43 ((*- endblock -*))
44 ((*- endif -*))
45 ((*- endfor -*))
46 ((*- endblock data_priority -*))
@@ -0,0 +1,90 b''
1 ((= autogenerated file do not edit =))
2 ((=
3
4 DO NOT USE THIS AS A BASE WORK,
5 IF YOU ARE COPY AND PASTING THIS FILE
6 YOU ARE PROBABLY DOING THINGS WRONG.
7
8 Null template, Does nothing except defining a basic structure
9 To layout the diferents blocks of a notebook.
10
11 Subtemplates can Override Blocks to define their custom reresentation.
12
13 If one of the block you do overrite is not a leave block, consider
14 calling super.
15
16 ((*- block nonLeaveBlock -*))
17 #add stuff at beginning
18 ((( super() )))
19 #add stuff at end
20 ((*- endblock nonLeaveBlock -*))
21
22 consider calling super even if block is leave block, we might insert more block later.
23
24 =))
25 ((*- block header -*))
26 ((*- endblock header -*))
27 ((*- block body -*))
28 ((*- for worksheet in nb.worksheets -*))
29 ((*- for cell in worksheet.cells -*))
30 ((*- block any_cell scoped -*))
31 ((*- if cell.type in ['code'] -*))
32 ((*- block codecell scoped -*))
33 ((*- block input_group -*))
34 ((*- block in_prompt -*))((*- endblock in_prompt -*))
35 ((*- block input -*))((*- endblock input -*))
36 ((*- endblock input_group -*))
37 ((*- if cell.outputs -*))
38 ((*- block output_group -*))
39 ((*- block output_prompt -*))((*- endblock output_prompt -*))
40 ((*- block outputs -*))
41 ((*- for output in cell.outputs -*))
42 ((*- if output.output_type in ['pyout'] -*))
43 ((*- block pyout scoped -*))((*- endblock pyout -*))
44 ((*- elif output.output_type in ['stream'] -*))
45 ((*- block stream scoped -*))
46 ((*- if output.stream in ['stdout'] -*))
47 ((*- block stream_stdout scoped -*))
48 ((*- endblock stream_stdout -*))
49 ((*- elif output.stream in ['stderr'] -*))
50 ((*- block stream_stderr scoped -*))
51 ((*- endblock stream_stderr -*))
52 ((*- endif -*))
53 ((*- endblock stream -*))
54 ((*- elif output.output_type in ['display_data'] -*))
55 ((*- block display_data scoped -*))
56 ((*- block data_priority scoped -*))
57 ((*- endblock data_priority -*))
58 ((*- endblock display_data -*))
59 ((*- elif output.output_type in ['pyerr'] -*))
60 ((*- block pyerr scoped -*))
61 ((*- for line in output.traceback -*))
62 ((*- block traceback_line scoped -*))((*- endblock traceback_line -*))
63 ((*- endfor -*))
64 ((*- endblock pyerr -*))
65 ((*- endif -*))
66 ((*- endfor -*))
67 ((*- endblock outputs -*))
68 ((*- endblock output_group -*))
69 ((*- endif -*))
70 ((*- endblock codecell -*))
71 ((*- elif cell.type in ['markdown'] -*))
72 ((*- block markdowncell scoped-*))
73 ((*- endblock markdowncell -*))
74 ((*- elif cell.type in ['heading'] -*))
75 ((*- block headingcell scoped-*))
76 ((*- endblock headingcell -*))
77 ((*- elif cell.type in ['raw'] -*))
78 ((*- block rawcell scoped-*))
79 ((*- endblock rawcell -*))
80 ((*- else -*))
81 ((*- block unknowncell scoped-*))
82 ((*- endblock unknowncell -*))
83 ((*- endif -*))
84 ((*- endblock any_cell -*))
85 ((*- endfor -*))
86 ((*- endfor -*))
87 ((*- endblock body -*))
88
89 ((*- block footer -*))
90 ((*- endblock footer -*))
General Comments 0
You need to be logged in to leave comments. Login now