##// END OF EJS Templates
Merge pull request #6045 from minrk/nbformat4...
Merge pull request #6045 from minrk/nbformat4 nbformat v4

File last commit:

r18589:135227ac
r18617:482c7bd6 merge
Show More
style_ipython.tplx
58 lines | 2.0 KiB | text/plain | TextLexer
Jonathan Frederic
Fixed doc comment
r12719 ((= IPython input/output style =))
Jonathan Frederic
Add colored ipython style
r12718
Thomas Kluyver
Remove magic for loading templates from module names
r13925 ((*- extends 'base.tplx' -*))
Jonathan Frederic
Add colored ipython style
r12718
% Custom definitions
((* block definitions *))
((( super() )))
% Pygments definitions
Jonathan Frederic
s/pygment/pygments
r12742 ((( resources.latex.pygments_definitions )))
Jonathan Frederic
Add colored ipython style
r12718
Jonathan Frederic
Finishing up results of in person review
r12734 % Exact colors from NB
\definecolor{incolor}{rgb}{0.0, 0.0, 0.5}
\definecolor{outcolor}{rgb}{0.545, 0.0, 0.0}
Jonathan Frederic
Add colored ipython style
r12718 ((* endblock definitions *))
%===============================================================================
% Input
%===============================================================================
((* block input scoped *))
MinRK
update nbconvert to nbformat 4
r18580 ((( add_prompt(cell.source | highlight_code(strip_verbatim=True), cell, 'In ', 'incolor') )))
Jonathan Frederic
Add colored ipython style
r12718 ((* endblock input *))
%===============================================================================
% Output
%===============================================================================
MinRK
update nbconvert to nbformat 4
r18580 ((* block execute_result scoped *))
MinRK
move mime-bundle data to rich output.data...
r18589 ((*- for type in output.data | filter_data_type -*))
((*- if type in ['text/plain']*))
((( add_prompt(output.data['text/plain'] | escape_latex, cell, 'Out', 'outcolor') )))
Jonathan Frederic
Add colored ipython style
r12718 ((* else -*))
MinRK
s/prompt_number/execution_count in nbformat 4
r18587 \texttt{\color{outcolor}Out[{\color{outcolor}((( cell.execution_count )))}]:}((( super() )))
Jonathan Frederic
Add colored ipython style
r12718 ((*- endif -*))
((*- endfor -*))
MinRK
update nbconvert to nbformat 4
r18580 ((* endblock execute_result *))
Jonathan Frederic
Add colored ipython style
r12718
%==============================================================================
% Support Macros
%==============================================================================
% Name: draw_prompt
% Purpose: Renders an output/input prompt
((* macro add_prompt(text, cell, prompt, prompt_color) -*))
MinRK
s/prompt_number/execution_count in nbformat 4
r18587 ((*- if cell.execution_count is defined -*))
((*- set execution_count = "" ~ (cell.execution_count | replace(None, " ")) -*))
Jessica B. Hamrick
Handle case where prompt number is not defined in latex templates
r18345 ((*- else -*))
MinRK
s/prompt_number/execution_count in nbformat 4
r18587 ((*- set execution_count = " " -*))
Jessica B. Hamrick
Handle case where prompt number is not defined in latex templates
r18345 ((*- endif -*))
MinRK
s/prompt_number/execution_count in nbformat 4
r18587 ((*- set indention = " " * (execution_count | length + 7) -*))
Jonathan Frederic
Add colored ipython style
r12718 \begin{Verbatim}[commandchars=\\\{\}]
MinRK
s/prompt_number/execution_count in nbformat 4
r18587 ((( text | add_prompts(first='{\color{' ~ prompt_color ~ '}' ~ prompt ~ '[{\\color{' ~ prompt_color ~ '}' ~ execution_count ~ '}]:} ', cont=indention) )))
Jonathan Frederic
Add colored ipython style
r12718 \end{Verbatim}
((*- endmacro *))