|
|
((= Black&white ipython input/output style =))
|
|
|
|
|
|
((*- extends 'base.tplx' -*))
|
|
|
|
|
|
%===============================================================================
|
|
|
% Input
|
|
|
%===============================================================================
|
|
|
|
|
|
((* block input scoped *))
|
|
|
((( add_prompt(cell.input, cell, 'In ') )))
|
|
|
((* endblock input *))
|
|
|
|
|
|
|
|
|
%===============================================================================
|
|
|
% Output
|
|
|
%===============================================================================
|
|
|
|
|
|
((* block pyout scoped *))
|
|
|
((*- for type in output | filter_data_type -*))
|
|
|
((*- if type in ['text']*))
|
|
|
((( add_prompt(output.text, cell, 'Out') )))
|
|
|
((*- else -*))
|
|
|
\verb+Out[((( cell.prompt_number )))]:+((( super() )))
|
|
|
((*- endif -*))
|
|
|
((*- endfor -*))
|
|
|
((* endblock pyout *))
|
|
|
|
|
|
|
|
|
%==============================================================================
|
|
|
% Support Macros
|
|
|
%==============================================================================
|
|
|
|
|
|
% Name: draw_prompt
|
|
|
% Purpose: Renders an output/input prompt
|
|
|
((* macro add_prompt(text, cell, prompt) -*))
|
|
|
((*- set prompt_number = "" ~ cell.prompt_number -*))
|
|
|
((*- set indentation = " " * (prompt_number | length + 7) -*))
|
|
|
\begin{verbatim}
|
|
|
(((- text | add_prompts(first=prompt ~ '[' ~ prompt_number ~ ']: ', cont=indentation) -)))
|
|
|
\end{verbatim}
|
|
|
((*- endmacro *))
|
|
|
|