##// END OF EJS Templates
Decoupled cell_index from widget model code.
Decoupled cell_index from widget model code.

File last commit:

r12864:ba77f89f
r14317:3e89d639
Show More
latex.py
47 lines | 1.7 KiB | text/x-python | PythonLexer
Jonathan Frederic
Cleanup and refactor, transformers
r10674 """Module that allows latex output notebooks to be conditioned before
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776 they are converted.
"""
Jonathan Frederic
Transformer refactor
r10436 #-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776
Jonathan Frederic
Transformer refactor
r10436 #-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
Jonathan Frederic
Cleanup and refactor, transformers
r10674
Jonathan Frederic
Transformer refactor
r10436 from __future__ import print_function, absolute_import
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776
MinRK
remove strip_math_space...
r12864 from .base import Preprocessor
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776
Jonathan Frederic
Transformer refactor
r10436 #-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
Jonathan Frederic
Cleanup and refactor, transformers
r10674
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 class LatexPreprocessor(Preprocessor):
MinRK
remove strip_math_space...
r12864 """Preprocessor for latex destined documents.
Mainly populates the `latex` key in the resources dict,
adding definitions for pygments highlight styles.
Matthias BUSSONNIER
fix remove math space
r9882 """
Jonathan Frederic
Unecessary re-coding, inherits from base now.
r9779
Jonathan Frederic
Move the pygments definition importing logic from the...
r12659 def preprocess(self, nb, resources):
MinRK
remove strip_math_space...
r12864 """Preprocessing to apply on each notebook.
Jonathan Frederic
Move the pygments definition importing logic from the...
r12659
Parameters
----------
nb : NotebookNode
Notebook being converted
resources : dictionary
Additional resources used in the conversion process. Allows
preprocessors to pass variables into the Jinja engine.
"""
MinRK
remove strip_math_space...
r12864 # Generate Pygments definitions for Latex
from pygments.formatters import LatexFormatter
Jonathan Frederic
Added spaces between comments.
r10476
MinRK
remove strip_math_space...
r12864 resources.setdefault("latex", {})
resources["latex"].setdefault("pygments_definitions", LatexFormatter().get_style_defs())
return nb, resources