##// END OF EJS Templates
Post code-review, extended refactor.
Post code-review, extended refactor.

File last commit:

r10485:1de3574b
r10485:1de3574b
Show More
latex.py
42 lines | 1.5 KiB | text/x-python | PythonLexer
Jonathan Frederic
Transformer refactor
r10436 """Latex transformer.
Matthias BUSSONNIER
fix remove math space
r9882 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
#-----------------------------------------------------------------------------
from __future__ import print_function, absolute_import
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776
Jonathan Frederic
Transformer refactor
r10436 # Our own imports
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776 # Needed to override transformer
Jonathan Frederic
Transformer refactor
r10436 from .transformers import (ActivatableTransformer) #TODO
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776
Jonathan Frederic
Transformer refactor
r10436 #-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776 class LatexTransformer(ActivatableTransformer):
"""
Converter for latex destined documents.
Matthias BUSSONNIER
fix remove math space
r9882 """
Jonathan Frederic
Unecessary re-coding, inherits from base now.
r9779
def cell_transform(self, cell, other, index):
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776 """
Jonathan Frederic
Unecessary re-coding, inherits from base now.
r9779 Apply a transformation on each cell,
receive the current cell, the resource dict and the index of current cell as parameter.
Returns modified cell and resource dict.
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776 """
Jonathan Frederic
Added spaces between comments.
r10476
Jonathan Frederic
Unecessary re-coding, inherits from base now.
r9779 if hasattr(cell, "source") and cell.cell_type == "markdown":
Jonathan Frederic
Renamed remove_math_space to rm_math_space...
r9953 cell.source = rm_math_space(cell.source)
Jonathan Frederic
Unecessary re-coding, inherits from base now.
r9779 return cell, other