Show More
@@ -1,148 +1,144 b'' | |||
|
1 | 1 | {%- extends 'display_priority.tpl' -%} |
|
2 | 2 | |
|
3 | 3 | |
|
4 | 4 | {% block codecell %} |
|
5 | 5 | <div class="cell border-box-sizing code_cell"> |
|
6 | 6 | {{ super() }} |
|
7 | 7 | </div> |
|
8 | 8 | {%- endblock codecell %} |
|
9 | 9 | |
|
10 | 10 | {% block input_group -%} |
|
11 | 11 | <div class="input"> |
|
12 | 12 | {{ super() }} |
|
13 | 13 | </div> |
|
14 | 14 | {% endblock input_group %} |
|
15 | 15 | |
|
16 | 16 | {% block output_group %} |
|
17 | 17 | <div class="output_wrapper"> |
|
18 | 18 | <div class="output"> |
|
19 | 19 | {{ super() }} |
|
20 | 20 | </div> |
|
21 | 21 | </div> |
|
22 | 22 | {% endblock output_group %} |
|
23 | 23 | |
|
24 | 24 | {% block in_prompt -%} |
|
25 | 25 | <div class="prompt input_prompt"> |
|
26 | 26 | In [{{ cell.prompt_number }}]: |
|
27 | 27 | </div> |
|
28 | 28 | {%- endblock in_prompt %} |
|
29 | 29 | |
|
30 | 30 | {# |
|
31 | 31 | output_prompt doesn't do anything in HTML, |
|
32 | 32 | because there is a prompt div in each output area (see output block) |
|
33 | 33 | #} |
|
34 | 34 | {% block output_prompt %} |
|
35 | 35 | {% endblock output_prompt %} |
|
36 | 36 | |
|
37 | 37 | {% block input %} |
|
38 | 38 | <div class="input_area box-flex1"> |
|
39 | 39 | {{ cell.input | highlight2html(metadata=cell.metadata) }} |
|
40 | 40 | </div> |
|
41 | 41 | {%- endblock input %} |
|
42 | 42 | |
|
43 | 43 | {% block output %} |
|
44 | 44 | <div class="output_area"> |
|
45 | 45 | {%- if output.output_type == 'pyout' -%} |
|
46 | 46 | <div class="prompt output_prompt"> |
|
47 | 47 | Out[{{ cell.prompt_number }}]: |
|
48 | 48 | {%- else -%} |
|
49 | 49 | <div class="prompt"> |
|
50 | 50 | {%- endif -%} |
|
51 | 51 | </div> |
|
52 | 52 | {{ super() }} |
|
53 | 53 | </div> |
|
54 | 54 | {% endblock output %} |
|
55 | 55 | |
|
56 | 56 | {% block markdowncell scoped %} |
|
57 | 57 | <div class="text_cell_render border-box-sizing rendered_html"> |
|
58 | 58 | {{ cell.source | markdown2html | strip_files_prefix }} |
|
59 | 59 | </div> |
|
60 | 60 | {%- endblock markdowncell %} |
|
61 | 61 | |
|
62 | 62 | {% block headingcell scoped %} |
|
63 | 63 | <div class="text_cell_render border-box-sizing rendered_html"> |
|
64 | 64 | {{ ("#" * cell.level + cell.source) | replace('\n', ' ') | markdown2html | strip_files_prefix | add_anchor }} |
|
65 | 65 | </div> |
|
66 | 66 | {% endblock headingcell %} |
|
67 | 67 | |
|
68 | {% block rawcell scoped %} | |
|
69 | {{ cell.source }} | |
|
70 | {% endblock rawcell %} | |
|
71 | ||
|
72 | 68 | {% block unknowncell scoped %} |
|
73 | 69 | unknown type {{ cell.type }} |
|
74 | 70 | {% endblock unknowncell %} |
|
75 | 71 | |
|
76 | 72 | {% block pyout -%} |
|
77 | 73 | <div class="box-flex1 output_subarea output_pyout"> |
|
78 | 74 | {% block data_priority scoped %} |
|
79 | 75 | {{ super() }} |
|
80 | 76 | {% endblock %} |
|
81 | 77 | </div> |
|
82 | 78 | {%- endblock pyout %} |
|
83 | 79 | |
|
84 | 80 | {% block stream_stdout -%} |
|
85 | 81 | <div class="box-flex1 output_subarea output_stream output_stdout"> |
|
86 | 82 | <pre> |
|
87 | 83 | {{ output.text | ansi2html }} |
|
88 | 84 | </pre> |
|
89 | 85 | </div> |
|
90 | 86 | {%- endblock stream_stdout %} |
|
91 | 87 | |
|
92 | 88 | {% block stream_stderr -%} |
|
93 | 89 | <div class="box-flex1 output_subarea output_stream output_stderr"> |
|
94 | 90 | <pre> |
|
95 | 91 | {{ output.text | ansi2html }} |
|
96 | 92 | </pre> |
|
97 | 93 | </div> |
|
98 | 94 | {%- endblock stream_stderr %} |
|
99 | 95 | |
|
100 | 96 | {% block data_svg -%} |
|
101 | 97 | {{ output.svg }} |
|
102 | 98 | {%- endblock data_svg %} |
|
103 | 99 | |
|
104 | 100 | {% block data_html -%} |
|
105 | 101 | <div class="output_html rendered_html"> |
|
106 | 102 | {{ output.html }} |
|
107 | 103 | </div> |
|
108 | 104 | {%- endblock data_html %} |
|
109 | 105 | |
|
110 | 106 | {% block data_png %} |
|
111 | 107 | <img src="data:image/png;base64,{{ output.png }}"> |
|
112 | 108 | {%- endblock data_png %} |
|
113 | 109 | |
|
114 | 110 | {% block data_jpg %} |
|
115 | 111 | <img src="data:image/jpeg;base64,{{ output.jpeg }}"> |
|
116 | 112 | {%- endblock data_jpg %} |
|
117 | 113 | |
|
118 | 114 | {% block data_latex %} |
|
119 | 115 | {{ output.latex }} |
|
120 | 116 | {%- endblock data_latex %} |
|
121 | 117 | |
|
122 | 118 | {% block pyerr -%} |
|
123 | 119 | <div class="box-flex1 output_subarea output_pyerr"> |
|
124 | 120 | <pre>{{ super() }}</pre> |
|
125 | 121 | </div> |
|
126 | 122 | {%- endblock pyerr %} |
|
127 | 123 | |
|
128 | 124 | {%- block traceback_line %} |
|
129 | 125 | {{ line | ansi2html }} |
|
130 | 126 | {%- endblock traceback_line %} |
|
131 | 127 | |
|
132 | 128 | {%- block data_text %} |
|
133 | 129 | <pre> |
|
134 | 130 | {{ output.text | ansi2html }} |
|
135 | 131 | </pre> |
|
136 | 132 | {%- endblock -%} |
|
137 | 133 | |
|
138 | 134 | {%- block data_javascript %} |
|
139 | 135 | <script type="text/javascript"> |
|
140 | 136 | {{ output.javascript }} |
|
141 | 137 | </script> |
|
142 | 138 | {%- endblock -%} |
|
143 | 139 | |
|
144 | 140 | {%- block display_data scoped -%} |
|
145 | 141 | <div class="box-flex1 output_subarea output_display_data"> |
|
146 | 142 | {{ super() }} |
|
147 | 143 | </div> |
|
148 | 144 | {%- endblock display_data -%} |
@@ -1,228 +1,223 b'' | |||
|
1 | 1 | ((= Latex base template (must inherit) |
|
2 | 2 | This template builds upon the abstract template, adding common latex output |
|
3 | 3 | functions. Figures, data_text, |
|
4 | 4 | This template does not define a docclass, the inheriting class must define this.=)) |
|
5 | 5 | |
|
6 | 6 | ((*- extends 'display_priority.tplx' -*)) |
|
7 | 7 | |
|
8 | 8 | %=============================================================================== |
|
9 | 9 | % Abstract overrides |
|
10 | 10 | %=============================================================================== |
|
11 | 11 | |
|
12 | 12 | ((* block header *)) |
|
13 | 13 | ((* block docclass *))((* endblock docclass *)) |
|
14 | 14 | |
|
15 | 15 | ((* block packages *)) |
|
16 | 16 | \usepackage{graphicx} % Used to insert images |
|
17 | 17 | \usepackage{adjustbox} % Used to constrain images to a maximum size |
|
18 | 18 | \usepackage{color} % Allow colors to be defined |
|
19 | 19 | \usepackage{enumerate} % Needed for markdown enumerations to work |
|
20 | 20 | \usepackage{geometry} % Used to adjust the document margins |
|
21 | 21 | \usepackage{amsmath} % Equations |
|
22 | 22 | \usepackage{amssymb} % Equations |
|
23 | 23 | \usepackage[utf8]{inputenc} % Allow utf-8 characters in the tex document |
|
24 | 24 | \usepackage[mathletters]{ucs} % Extended unicode (utf-8) support |
|
25 | 25 | \usepackage{fancyvrb} % verbatim replacement that allows latex |
|
26 | 26 | \usepackage{grffile} % extends the file name processing of package graphics |
|
27 | 27 | % to support a larger range |
|
28 | 28 | % The hyperref package gives us a pdf with properly built |
|
29 | 29 | % internal navigation ('pdf bookmarks' for the table of contents, |
|
30 | 30 | % internal cross-reference links, web links for URLs, etc.) |
|
31 | 31 | \usepackage{hyperref} |
|
32 | 32 | \usepackage{longtable} % longtable support required by pandoc >1.10 |
|
33 | 33 | ((* endblock packages *)) |
|
34 | 34 | |
|
35 | 35 | ((* block definitions *)) |
|
36 | 36 | \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} |
|
37 | 37 | \definecolor{darkorange}{rgb}{.71,0.21,0.01} |
|
38 | 38 | \definecolor{darkgreen}{rgb}{.12,.54,.11} |
|
39 | 39 | \definecolor{myteal}{rgb}{.26, .44, .56} |
|
40 | 40 | \definecolor{gray}{gray}{0.45} |
|
41 | 41 | \definecolor{lightgray}{gray}{.95} |
|
42 | 42 | \definecolor{mediumgray}{gray}{.8} |
|
43 | 43 | \definecolor{inputbackground}{rgb}{.95, .95, .85} |
|
44 | 44 | \definecolor{outputbackground}{rgb}{.95, .95, .95} |
|
45 | 45 | \definecolor{traceback}{rgb}{1, .95, .95} |
|
46 | 46 | % ansi colors |
|
47 | 47 | \definecolor{red}{rgb}{.6,0,0} |
|
48 | 48 | \definecolor{green}{rgb}{0,.65,0} |
|
49 | 49 | \definecolor{brown}{rgb}{0.6,0.6,0} |
|
50 | 50 | \definecolor{blue}{rgb}{0,.145,.698} |
|
51 | 51 | \definecolor{purple}{rgb}{.698,.145,.698} |
|
52 | 52 | \definecolor{cyan}{rgb}{0,.698,.698} |
|
53 | 53 | \definecolor{lightgray}{gray}{0.5} |
|
54 | 54 | |
|
55 | 55 | % bright ansi colors |
|
56 | 56 | \definecolor{darkgray}{gray}{0.25} |
|
57 | 57 | \definecolor{lightred}{rgb}{1.0,0.39,0.28} |
|
58 | 58 | \definecolor{lightgreen}{rgb}{0.48,0.99,0.0} |
|
59 | 59 | \definecolor{lightblue}{rgb}{0.53,0.81,0.92} |
|
60 | 60 | \definecolor{lightpurple}{rgb}{0.87,0.63,0.87} |
|
61 | 61 | \definecolor{lightcyan}{rgb}{0.5,1.0,0.83} |
|
62 | 62 | |
|
63 | 63 | % commands and environments needed by pandoc snippets |
|
64 | 64 | % extracted from the output of `pandoc -s` |
|
65 | 65 | |
|
66 | 66 | \DefineShortVerb[commandchars=\\\{\}]{\|} |
|
67 | 67 | \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} |
|
68 | 68 | % Add ',fontsize=\small' for more characters per line |
|
69 | 69 | \newenvironment{Shaded}{}{} |
|
70 | 70 | \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} |
|
71 | 71 | \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}} |
|
72 | 72 | \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} |
|
73 | 73 | \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} |
|
74 | 74 | \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} |
|
75 | 75 | \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} |
|
76 | 76 | \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} |
|
77 | 77 | \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}} |
|
78 | 78 | \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}} |
|
79 | 79 | \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} |
|
80 | 80 | \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}} |
|
81 | 81 | \newcommand{\RegionMarkerTok}[1]{{#1}} |
|
82 | 82 | \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} |
|
83 | 83 | \newcommand{\NormalTok}[1]{{#1}} |
|
84 | 84 | |
|
85 | 85 | % Define a nice break command that doesn't care if a line doesn't already |
|
86 | 86 | % exist. |
|
87 | 87 | \def\br{\hspace*{\fill} \\* } |
|
88 | 88 | % Math Jax compatability definitions |
|
89 | 89 | \def\gt{>} |
|
90 | 90 | \def\lt{<} |
|
91 | 91 | % Document parameters |
|
92 | 92 | ((* block title *))\title{((( resources.metadata.name | escape_latex )))}((* endblock title *)) |
|
93 | 93 | ((* block date *))((* endblock date *)) |
|
94 | 94 | ((* block author *))((* endblock author *)) |
|
95 | 95 | ((* endblock definitions *)) |
|
96 | 96 | |
|
97 | 97 | ((* block commands *)) |
|
98 | 98 | % Prevent overflowing lines due to hard-to-break entities |
|
99 | 99 | \sloppy |
|
100 | 100 | % Setup hyperref package |
|
101 | 101 | \hypersetup{ |
|
102 | 102 | breaklinks=true, % so long urls are correctly broken across lines |
|
103 | 103 | colorlinks=true, |
|
104 | 104 | urlcolor=blue, |
|
105 | 105 | linkcolor=darkorange, |
|
106 | 106 | citecolor=darkgreen, |
|
107 | 107 | } |
|
108 | 108 | % Slightly bigger margins than the latex defaults |
|
109 | 109 | ((* block margins *)) |
|
110 | 110 | \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} |
|
111 | 111 | ((* endblock margins *)) |
|
112 | 112 | ((* endblock commands *)) |
|
113 | 113 | ((* endblock header *)) |
|
114 | 114 | |
|
115 | 115 | ((* block body *)) |
|
116 | 116 | \begin{document} |
|
117 | 117 | |
|
118 | 118 | ((* block predoc *)) |
|
119 | 119 | ((* block maketitle *))\maketitle((* endblock maketitle *)) |
|
120 | 120 | ((* block abstract *))((* endblock abstract *)) |
|
121 | 121 | ((* endblock predoc *)) |
|
122 | 122 | |
|
123 | 123 | ((( super() ))) |
|
124 | 124 | |
|
125 | 125 | % Add a bibliography block to the postdoc |
|
126 | 126 | ((* block postdoc *)) |
|
127 | 127 | ((* block bibliography *))((* endblock bibliography *)) |
|
128 | 128 | ((* endblock postdoc *)) |
|
129 | 129 | \end{document} |
|
130 | 130 | ((* endblock body *)) |
|
131 | 131 | |
|
132 | 132 | %=============================================================================== |
|
133 | 133 | % Support blocks |
|
134 | 134 | %=============================================================================== |
|
135 | 135 | |
|
136 | 136 | % Displaying simple data text |
|
137 | 137 | ((* block data_text *)) |
|
138 | 138 | \begin{verbatim} |
|
139 | 139 | ((( output.text ))) |
|
140 | 140 | \end{verbatim} |
|
141 | 141 | ((* endblock data_text *)) |
|
142 | 142 | |
|
143 | 143 | % Display python error text as-is |
|
144 | 144 | ((* block pyerr *)) |
|
145 | 145 | \begin{Verbatim}[commandchars=\\\{\}] |
|
146 | 146 | ((( super() ))) |
|
147 | 147 | \end{Verbatim} |
|
148 | 148 | ((* endblock pyerr *)) |
|
149 | 149 | ((* block traceback_line *)) |
|
150 | 150 | ((( line | indent | strip_ansi | escape_latex ))) |
|
151 | 151 | ((* endblock traceback_line *)) |
|
152 | 152 | |
|
153 | 153 | % Display stream ouput with coloring |
|
154 | 154 | ((* block stream *)) |
|
155 | 155 | \begin{Verbatim}[commandchars=\\\{\}] |
|
156 | 156 | ((( output.text | escape_latex | ansi2latex ))) |
|
157 | 157 | \end{Verbatim} |
|
158 | 158 | ((* endblock stream *)) |
|
159 | 159 | |
|
160 | 160 | % Display latex |
|
161 | 161 | ((* block data_latex -*)) |
|
162 | 162 | ((*- if output.latex.startswith('$'): -*)) |
|
163 | 163 | ((= Replace $ symbols with more explicit, equation block. =)) |
|
164 | 164 | \begin{equation*} |
|
165 | 165 | ((( output.latex | strip_dollars ))) |
|
166 | 166 | \end{equation*} |
|
167 | 167 | ((*- else -*)) |
|
168 | 168 | ((( output.latex ))) |
|
169 | 169 | ((*- endif *)) |
|
170 | 170 | ((* endblock data_latex *)) |
|
171 | 171 | |
|
172 | 172 | % Default mechanism for rendering figures |
|
173 | 173 | ((*- block data_png -*))((( draw_figure(output.png_filename) )))((*- endblock -*)) |
|
174 | 174 | ((*- block data_jpg -*))((( draw_figure(output.jpeg_filename) )))((*- endblock -*)) |
|
175 | 175 | ((*- block data_svg -*))((( draw_figure(output.svg_filename) )))((*- endblock -*)) |
|
176 | 176 | ((*- block data_pdf -*))((( draw_figure(output.pdf_filename) )))((*- endblock -*)) |
|
177 | 177 | |
|
178 | 178 | % Draw a figure using the graphicx package. |
|
179 | 179 | ((* macro draw_figure(filename) -*)) |
|
180 | 180 | ((* set filename = filename | posix_path *)) |
|
181 | 181 | ((*- block figure scoped -*)) |
|
182 | 182 | \begin{center} |
|
183 | 183 | \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{((( filename )))} |
|
184 | 184 | \end{center} |
|
185 | 185 | { \hspace*{\fill} \\} |
|
186 | 186 | ((*- endblock figure -*)) |
|
187 | 187 | ((*- endmacro *)) |
|
188 | 188 | |
|
189 | 189 | % Draw heading cell. Explicitly map different cell levels. |
|
190 | 190 | ((* block headingcell scoped *)) |
|
191 | 191 | |
|
192 | 192 | ((* if cell.level == 1 -*)) |
|
193 | 193 | ((* block h1 -*))\section((* endblock h1 -*)) |
|
194 | 194 | ((* elif cell.level == 2 -*)) |
|
195 | 195 | ((* block h2 -*))\subsection((* endblock h2 -*)) |
|
196 | 196 | ((* elif cell.level == 3 -*)) |
|
197 | 197 | ((* block h3 -*))\subsubsection((* endblock h3 -*)) |
|
198 | 198 | ((* elif cell.level == 4 -*)) |
|
199 | 199 | ((* block h4 -*))\paragraph((* endblock h4 -*)) |
|
200 | 200 | ((* elif cell.level == 5 -*)) |
|
201 | 201 | ((* block h5 -*))\subparagraph((* endblock h5 -*)) |
|
202 | 202 | ((* elif cell.level == 6 -*)) |
|
203 | 203 | ((* block h6 -*))\\*\textit((* endblock h6 -*)) |
|
204 | 204 | ((*- endif -*)) |
|
205 | 205 | {((( cell.source | replace('\n', ' ') | citation2latex | markdown2latex )))} |
|
206 | 206 | |
|
207 | 207 | ((* endblock headingcell *)) |
|
208 | 208 | |
|
209 | 209 | % Redirect pyout to display data priority. |
|
210 | 210 | ((* block pyout scoped *)) |
|
211 | 211 | ((* block data_priority scoped *)) |
|
212 | 212 | ((( super() ))) |
|
213 | 213 | ((* endblock *)) |
|
214 | 214 | ((* endblock pyout *)) |
|
215 | 215 | |
|
216 | 216 | % Render markdown |
|
217 | 217 | ((* block markdowncell scoped *)) |
|
218 | 218 | ((( cell.source | citation2latex | markdown2latex ))) |
|
219 | 219 | ((* endblock markdowncell *)) |
|
220 | 220 | |
|
221 | % Spit out the contents of raw cells unmodified | |
|
222 | ((* block rawcell scoped *)) | |
|
223 | ((( cell.source ))) | |
|
224 | ((* endblock rawcell *)) | |
|
225 | ||
|
226 | 221 | % Don't display unknown types |
|
227 | 222 | ((* block unknowncell scoped *)) |
|
228 | 223 | ((* endblock unknowncell *)) |
@@ -1,95 +1,98 b'' | |||
|
1 | 1 | ((= Auto-generated template file, DO NOT edit directly! |
|
2 | 2 | To edit this file, please refer to ../../skeleton/README.md =)) |
|
3 | 3 | |
|
4 | 4 | |
|
5 | 5 | ((= |
|
6 | 6 | |
|
7 | 7 | DO NOT USE THIS AS A BASE, |
|
8 | 8 | IF YOU ARE COPY AND PASTING THIS FILE |
|
9 | 9 | YOU ARE PROBABLY DOING THINGS INCORRECTLY. |
|
10 | 10 | |
|
11 | 11 | Null template, does nothing except defining a basic structure |
|
12 | 12 | To layout the different blocks of a notebook. |
|
13 | 13 | |
|
14 | 14 | Subtemplates can override blocks to define their custom representation. |
|
15 | 15 | |
|
16 | 16 | If one of the block you do overwrite is not a leave block, consider |
|
17 | 17 | calling super. |
|
18 | 18 | |
|
19 | 19 | ((*- block nonLeaveBlock -*)) |
|
20 | 20 | #add stuff at beginning |
|
21 | 21 | ((( super() ))) |
|
22 | 22 | #add stuff at end |
|
23 | 23 | ((*- endblock nonLeaveBlock -*)) |
|
24 | 24 | |
|
25 | 25 | consider calling super even if it is a leave block, we might insert more blocks later. |
|
26 | 26 | |
|
27 | 27 | =)) |
|
28 | 28 | ((*- block header -*)) |
|
29 | 29 | ((*- endblock header -*)) |
|
30 | 30 | ((*- block body -*)) |
|
31 | 31 | ((*- for worksheet in nb.worksheets -*)) |
|
32 | 32 | ((*- for cell in worksheet.cells -*)) |
|
33 | 33 | ((*- block any_cell scoped -*)) |
|
34 | 34 | ((*- if cell.cell_type in ['code'] -*)) |
|
35 | 35 | ((*- block codecell scoped -*)) |
|
36 | 36 | ((*- block input_group -*)) |
|
37 | 37 | ((*- block in_prompt -*))((*- endblock in_prompt -*)) |
|
38 | 38 | ((*- block input -*))((*- endblock input -*)) |
|
39 | 39 | ((*- endblock input_group -*)) |
|
40 | 40 | ((*- if cell.outputs -*)) |
|
41 | 41 | ((*- block output_group -*)) |
|
42 | 42 | ((*- block output_prompt -*))((*- endblock output_prompt -*)) |
|
43 | 43 | ((*- block outputs scoped -*)) |
|
44 | 44 | ((*- for output in cell.outputs -*)) |
|
45 | 45 | ((*- block output scoped -*)) |
|
46 | 46 | ((*- if output.output_type in ['pyout'] -*)) |
|
47 | 47 | ((*- block pyout scoped -*))((*- endblock pyout -*)) |
|
48 | 48 | ((*- elif output.output_type in ['stream'] -*)) |
|
49 | 49 | ((*- block stream scoped -*)) |
|
50 | 50 | ((*- if output.stream in ['stdout'] -*)) |
|
51 | 51 | ((*- block stream_stdout scoped -*)) |
|
52 | 52 | ((*- endblock stream_stdout -*)) |
|
53 | 53 | ((*- elif output.stream in ['stderr'] -*)) |
|
54 | 54 | ((*- block stream_stderr scoped -*)) |
|
55 | 55 | ((*- endblock stream_stderr -*)) |
|
56 | 56 | ((*- endif -*)) |
|
57 | 57 | ((*- endblock stream -*)) |
|
58 | 58 | ((*- elif output.output_type in ['display_data'] -*)) |
|
59 | 59 | ((*- block display_data scoped -*)) |
|
60 | 60 | ((*- block data_priority scoped -*)) |
|
61 | 61 | ((*- endblock data_priority -*)) |
|
62 | 62 | ((*- endblock display_data -*)) |
|
63 | 63 | ((*- elif output.output_type in ['pyerr'] -*)) |
|
64 | 64 | ((*- block pyerr scoped -*)) |
|
65 | 65 | ((*- for line in output.traceback -*)) |
|
66 | 66 | ((*- block traceback_line scoped -*))((*- endblock traceback_line -*)) |
|
67 | 67 | ((*- endfor -*)) |
|
68 | 68 | ((*- endblock pyerr -*)) |
|
69 | 69 | ((*- endif -*)) |
|
70 | 70 | ((*- endblock output -*)) |
|
71 | 71 | ((*- endfor -*)) |
|
72 | 72 | ((*- endblock outputs -*)) |
|
73 | 73 | ((*- endblock output_group -*)) |
|
74 | 74 | ((*- endif -*)) |
|
75 | 75 | ((*- endblock codecell -*)) |
|
76 | 76 | ((*- elif cell.cell_type in ['markdown'] -*)) |
|
77 | 77 | ((*- block markdowncell scoped-*)) |
|
78 | 78 | ((*- endblock markdowncell -*)) |
|
79 | 79 | ((*- elif cell.cell_type in ['heading'] -*)) |
|
80 | 80 | ((*- block headingcell scoped-*)) |
|
81 | 81 | ((*- endblock headingcell -*)) |
|
82 | 82 | ((*- elif cell.cell_type in ['raw'] -*)) |
|
83 | ((*- block rawcell scoped-*)) | |
|
83 | ((*- block rawcell scoped -*)) | |
|
84 | ((* if cell.metadata.get('raw_format', resources.get('raw_format')) == resources.get('raw_format') *)) | |
|
85 | ((( cell.source ))) | |
|
86 | ((* endif *)) | |
|
84 | 87 | ((*- endblock rawcell -*)) |
|
85 | 88 | ((*- else -*)) |
|
86 | 89 | ((*- block unknowncell scoped-*)) |
|
87 | 90 | ((*- endblock unknowncell -*)) |
|
88 | 91 | ((*- endif -*)) |
|
89 | 92 | ((*- endblock any_cell -*)) |
|
90 | 93 | ((*- endfor -*)) |
|
91 | 94 | ((*- endfor -*)) |
|
92 | 95 | ((*- endblock body -*)) |
|
93 | 96 | |
|
94 | 97 | ((*- block footer -*)) |
|
95 | 98 | ((*- endblock footer -*)) |
@@ -1,72 +1,68 b'' | |||
|
1 | 1 | {% extends 'display_priority.tpl' %} |
|
2 | 2 | |
|
3 | 3 | |
|
4 | 4 | {% block in_prompt %} |
|
5 | 5 | {% endblock in_prompt %} |
|
6 | 6 | |
|
7 | 7 | {% block output_prompt %} |
|
8 | 8 | {%- endblock output_prompt %} |
|
9 | 9 | |
|
10 | 10 | {% block input %} |
|
11 | 11 | {{ cell.input | indent(4)}} |
|
12 | 12 | {% endblock input %} |
|
13 | 13 | |
|
14 | 14 | {% block pyerr %} |
|
15 | 15 | {{ super() }} |
|
16 | 16 | {% endblock pyerr %} |
|
17 | 17 | |
|
18 | 18 | {% block traceback_line %} |
|
19 | 19 | {{ line | indent | strip_ansi }} |
|
20 | 20 | {% endblock traceback_line %} |
|
21 | 21 | |
|
22 | 22 | {% block pyout %} |
|
23 | 23 | |
|
24 | 24 | {% block data_priority scoped %} |
|
25 | 25 | {{ super() }} |
|
26 | 26 | {% endblock %} |
|
27 | 27 | {% endblock pyout %} |
|
28 | 28 | |
|
29 | 29 | {% block stream %} |
|
30 | 30 | {{ output.text | indent }} |
|
31 | 31 | {% endblock stream %} |
|
32 | 32 | |
|
33 | 33 | {% block data_svg %} |
|
34 | 34 | ![svg]({{ output.svg_filename | path2url }}) |
|
35 | 35 | {% endblock data_svg %} |
|
36 | 36 | |
|
37 | 37 | {% block data_png %} |
|
38 | 38 | ![png]({{ output.png_filename | path2url }}) |
|
39 | 39 | {% endblock data_png %} |
|
40 | 40 | |
|
41 | 41 | {% block data_jpg %} |
|
42 | 42 | ![jpeg]({{ output.jpeg_filename | path2url }}) |
|
43 | 43 | {% endblock data_jpg %} |
|
44 | 44 | |
|
45 | 45 | {% block data_latex %} |
|
46 | 46 | {{ output.latex }} |
|
47 | 47 | {% endblock data_latex %} |
|
48 | 48 | |
|
49 | 49 | {% block data_html scoped %} |
|
50 | 50 | {{ output.html }} |
|
51 | 51 | {% endblock data_html %} |
|
52 | 52 | |
|
53 | 53 | {% block data_text scoped %} |
|
54 | 54 | {{ output.text | indent }} |
|
55 | 55 | {% endblock data_text %} |
|
56 | 56 | |
|
57 | 57 | {% block markdowncell scoped %} |
|
58 | 58 | {{ cell.source | wrap_text(80) }} |
|
59 | 59 | {% endblock markdowncell %} |
|
60 | 60 | |
|
61 | 61 | |
|
62 | 62 | {% block headingcell scoped %} |
|
63 | 63 | {{ '#' * cell.level }} {{ cell.source | replace('\n', ' ') }} |
|
64 | 64 | {% endblock headingcell %} |
|
65 | 65 | |
|
66 | {% block rawcell scoped %} | |
|
67 | {{ cell.source }} | |
|
68 | {% endblock rawcell %} | |
|
69 | ||
|
70 | 66 | {% block unknowncell scoped %} |
|
71 | 67 | unknown type {{ cell.type }} |
|
72 | 68 | {% endblock unknowncell %} No newline at end of file |
@@ -1,55 +1,51 b'' | |||
|
1 | 1 | {%- extends 'null.tpl' -%} |
|
2 | 2 | |
|
3 | 3 | |
|
4 | 4 | {% block in_prompt %} |
|
5 | 5 | # In[{{ cell.prompt_number if cell.prompt_number else ' ' }}]: |
|
6 | 6 | {% endblock in_prompt %} |
|
7 | 7 | |
|
8 | 8 | {% block output_prompt %} |
|
9 | 9 | # Out[{{ cell.prompt_number }}]: |
|
10 | 10 | {% endblock output_prompt %} |
|
11 | 11 | |
|
12 | 12 | {% block input %} |
|
13 | 13 | {{ cell.input | ipython2python }} |
|
14 | 14 | {% endblock input %} |
|
15 | 15 | |
|
16 | 16 | {# Those Two are for error displaying |
|
17 | 17 | even if the first one seem to do nothing, |
|
18 | 18 | it introduces a new line |
|
19 | 19 | #} |
|
20 | 20 | {% block pyerr %} |
|
21 | 21 | {{ super() }} |
|
22 | 22 | {% endblock pyerr %} |
|
23 | 23 | |
|
24 | 24 | {% block traceback_line %} |
|
25 | 25 | {{ line | indent | strip_ansi }} |
|
26 | 26 | {% endblock traceback_line %} |
|
27 | 27 | {# .... #} |
|
28 | 28 | |
|
29 | 29 | {% block pyout %} |
|
30 | 30 | {{ output.text | indent | comment_lines }} |
|
31 | 31 | {% endblock pyout %} |
|
32 | 32 | |
|
33 | 33 | {% block stream %} |
|
34 | 34 | {{ output.text | indent | comment_lines }} |
|
35 | 35 | {% endblock stream %} |
|
36 | 36 | |
|
37 | 37 | {% block display_data scoped %} |
|
38 | 38 | # image file: |
|
39 | 39 | {% endblock display_data %} |
|
40 | 40 | |
|
41 | 41 | {% block markdowncell scoped %} |
|
42 | 42 | {{ cell.source | comment_lines }} |
|
43 | 43 | {% endblock markdowncell %} |
|
44 | 44 | |
|
45 | 45 | {% block headingcell scoped %} |
|
46 | 46 | {{ '#' * cell.level }}{{ cell.source | replace('\n', ' ') | comment_lines }} |
|
47 | 47 | {% endblock headingcell %} |
|
48 | 48 | |
|
49 | {% block rawcell scoped %} | |
|
50 | {{ cell.source | comment_lines }} | |
|
51 | {% endblock rawcell %} | |
|
52 | ||
|
53 | 49 | {% block unknowncell scoped %} |
|
54 | 50 | unknown type {{ cell.type }} |
|
55 | 51 | {% endblock unknowncell %} No newline at end of file |
@@ -1,84 +1,80 b'' | |||
|
1 | 1 | {%- extends 'display_priority.tpl' -%} |
|
2 | 2 | |
|
3 | 3 | |
|
4 | 4 | {% block in_prompt %} |
|
5 | 5 | {% endblock in_prompt %} |
|
6 | 6 | |
|
7 | 7 | {% block output_prompt %} |
|
8 | 8 | {% endblock output_prompt %} |
|
9 | 9 | |
|
10 | 10 | {% block input %} |
|
11 | 11 | {%- if not cell.input.isspace() -%} |
|
12 | 12 | .. code:: python |
|
13 | 13 | |
|
14 | 14 | {{ cell.input | indent}} |
|
15 | 15 | {%- endif -%} |
|
16 | 16 | {% endblock input %} |
|
17 | 17 | |
|
18 | 18 | {% block pyerr %} |
|
19 | 19 | :: |
|
20 | 20 | |
|
21 | 21 | {{ super() }} |
|
22 | 22 | {% endblock pyerr %} |
|
23 | 23 | |
|
24 | 24 | {% block traceback_line %} |
|
25 | 25 | {{ line | indent | strip_ansi }} |
|
26 | 26 | {% endblock traceback_line %} |
|
27 | 27 | |
|
28 | 28 | {% block pyout %} |
|
29 | 29 | {% block data_priority scoped %} |
|
30 | 30 | {{ super() }} |
|
31 | 31 | {% endblock %} |
|
32 | 32 | {% endblock pyout %} |
|
33 | 33 | |
|
34 | 34 | {% block stream %} |
|
35 | 35 | .. parsed-literal:: |
|
36 | 36 | |
|
37 | 37 | {{ output.text | indent }} |
|
38 | 38 | {% endblock stream %} |
|
39 | 39 | |
|
40 | 40 | {% block data_svg %} |
|
41 | 41 | .. image:: {{ output.svg_filename }} |
|
42 | 42 | {% endblock data_svg %} |
|
43 | 43 | |
|
44 | 44 | {% block data_png %} |
|
45 | 45 | .. image:: {{ output.png_filename }} |
|
46 | 46 | {% endblock data_png %} |
|
47 | 47 | |
|
48 | 48 | {% block data_jpg %} |
|
49 | 49 | .. image:: {{ output.jpeg_filename }} |
|
50 | 50 | {% endblock data_jpg %} |
|
51 | 51 | |
|
52 | 52 | {% block data_latex %} |
|
53 | 53 | .. math:: |
|
54 | 54 | |
|
55 | 55 | {{ output.latex | strip_dollars | indent }} |
|
56 | 56 | {% endblock data_latex %} |
|
57 | 57 | |
|
58 | 58 | {% block data_text scoped %} |
|
59 | 59 | .. parsed-literal:: |
|
60 | 60 | |
|
61 | 61 | {{ output.text | indent }} |
|
62 | 62 | {% endblock data_text %} |
|
63 | 63 | |
|
64 | 64 | {% block data_html scoped %} |
|
65 | 65 | .. raw:: html |
|
66 | 66 | |
|
67 | 67 | {{ output.html | indent }} |
|
68 | 68 | {% endblock data_html %} |
|
69 | 69 | |
|
70 | 70 | {% block markdowncell scoped %} |
|
71 | 71 | {{ cell.source | markdown2rst }} |
|
72 | 72 | {% endblock markdowncell %} |
|
73 | 73 | |
|
74 | 74 | {% block headingcell scoped %} |
|
75 | 75 | {{ ("#" * cell.level + cell.source) | replace('\n', ' ') | markdown2rst }} |
|
76 | 76 | {% endblock headingcell %} |
|
77 | 77 | |
|
78 | {% block rawcell scoped %} | |
|
79 | {{ cell.source }} | |
|
80 | {% endblock rawcell %} | |
|
81 | ||
|
82 | 78 | {% block unknowncell scoped %} |
|
83 | 79 | unknown type {{cell.type}} |
|
84 | 80 | {% endblock unknowncell %} |
@@ -1,91 +1,94 b'' | |||
|
1 | 1 | {# |
|
2 | 2 | |
|
3 | 3 | DO NOT USE THIS AS A BASE, |
|
4 | 4 | IF YOU ARE COPY AND PASTING THIS FILE |
|
5 | 5 | YOU ARE PROBABLY DOING THINGS INCORRECTLY. |
|
6 | 6 | |
|
7 | 7 | Null template, does nothing except defining a basic structure |
|
8 | 8 | To layout the different blocks of a notebook. |
|
9 | 9 | |
|
10 | 10 | Subtemplates can override blocks to define their custom representation. |
|
11 | 11 | |
|
12 | 12 | If one of the block you do overwrite is not a leave block, consider |
|
13 | 13 | calling super. |
|
14 | 14 | |
|
15 | 15 | {%- block nonLeaveBlock -%} |
|
16 | 16 | #add stuff at beginning |
|
17 | 17 | {{ super() }} |
|
18 | 18 | #add stuff at end |
|
19 | 19 | {%- endblock nonLeaveBlock -%} |
|
20 | 20 | |
|
21 | 21 | consider calling super even if it is a leave block, we might insert more blocks later. |
|
22 | 22 | |
|
23 | 23 | #} |
|
24 | 24 | {%- block header -%} |
|
25 | 25 | {%- endblock header -%} |
|
26 | 26 | {%- block body -%} |
|
27 | 27 | {%- for worksheet in nb.worksheets -%} |
|
28 | 28 | {%- for cell in worksheet.cells -%} |
|
29 | 29 | {%- block any_cell scoped -%} |
|
30 | 30 | {%- if cell.cell_type in ['code'] -%} |
|
31 | 31 | {%- block codecell scoped -%} |
|
32 | 32 | {%- block input_group -%} |
|
33 | 33 | {%- block in_prompt -%}{%- endblock in_prompt -%} |
|
34 | 34 | {%- block input -%}{%- endblock input -%} |
|
35 | 35 | {%- endblock input_group -%} |
|
36 | 36 | {%- if cell.outputs -%} |
|
37 | 37 | {%- block output_group -%} |
|
38 | 38 | {%- block output_prompt -%}{%- endblock output_prompt -%} |
|
39 | 39 | {%- block outputs scoped -%} |
|
40 | 40 | {%- for output in cell.outputs -%} |
|
41 | 41 | {%- block output scoped -%} |
|
42 | 42 | {%- if output.output_type in ['pyout'] -%} |
|
43 | 43 | {%- block pyout scoped -%}{%- endblock pyout -%} |
|
44 | 44 | {%- elif output.output_type in ['stream'] -%} |
|
45 | 45 | {%- block stream scoped -%} |
|
46 | 46 | {%- if output.stream in ['stdout'] -%} |
|
47 | 47 | {%- block stream_stdout scoped -%} |
|
48 | 48 | {%- endblock stream_stdout -%} |
|
49 | 49 | {%- elif output.stream in ['stderr'] -%} |
|
50 | 50 | {%- block stream_stderr scoped -%} |
|
51 | 51 | {%- endblock stream_stderr -%} |
|
52 | 52 | {%- endif -%} |
|
53 | 53 | {%- endblock stream -%} |
|
54 | 54 | {%- elif output.output_type in ['display_data'] -%} |
|
55 | 55 | {%- block display_data scoped -%} |
|
56 | 56 | {%- block data_priority scoped -%} |
|
57 | 57 | {%- endblock data_priority -%} |
|
58 | 58 | {%- endblock display_data -%} |
|
59 | 59 | {%- elif output.output_type in ['pyerr'] -%} |
|
60 | 60 | {%- block pyerr scoped -%} |
|
61 | 61 | {%- for line in output.traceback -%} |
|
62 | 62 | {%- block traceback_line scoped -%}{%- endblock traceback_line -%} |
|
63 | 63 | {%- endfor -%} |
|
64 | 64 | {%- endblock pyerr -%} |
|
65 | 65 | {%- endif -%} |
|
66 | 66 | {%- endblock output -%} |
|
67 | 67 | {%- endfor -%} |
|
68 | 68 | {%- endblock outputs -%} |
|
69 | 69 | {%- endblock output_group -%} |
|
70 | 70 | {%- endif -%} |
|
71 | 71 | {%- endblock codecell -%} |
|
72 | 72 | {%- elif cell.cell_type in ['markdown'] -%} |
|
73 | 73 | {%- block markdowncell scoped-%} |
|
74 | 74 | {%- endblock markdowncell -%} |
|
75 | 75 | {%- elif cell.cell_type in ['heading'] -%} |
|
76 | 76 | {%- block headingcell scoped-%} |
|
77 | 77 | {%- endblock headingcell -%} |
|
78 | 78 | {%- elif cell.cell_type in ['raw'] -%} |
|
79 | {%- block rawcell scoped-%} | |
|
79 | {%- block rawcell scoped -%} | |
|
80 | {% if cell.metadata.get('raw_format', resources.get('raw_format', '')).lower() in resources.get('raw_formats', ['']) %} | |
|
81 | {{ cell.source }} | |
|
82 | {% endif %} | |
|
80 | 83 | {%- endblock rawcell -%} |
|
81 | 84 | {%- else -%} |
|
82 | 85 | {%- block unknowncell scoped-%} |
|
83 | 86 | {%- endblock unknowncell -%} |
|
84 | 87 | {%- endif -%} |
|
85 | 88 | {%- endblock any_cell -%} |
|
86 | 89 | {%- endfor -%} |
|
87 | 90 | {%- endfor -%} |
|
88 | 91 | {%- endblock body -%} |
|
89 | 92 | |
|
90 | 93 | {%- block footer -%} |
|
91 | 94 | {%- endblock footer -%} |
General Comments 0
You need to be logged in to leave comments.
Login now