##// END OF EJS Templates
Merge pull request #3834 from ivanov/nbconvert-better-tests...
Merge pull request #3834 from ivanov/nbconvert-better-tests This PR fixes a few issues with nbconvert tests The code for testing 'ipython nbconvert' prior to this PR did not work as intended, and simply swallowed errors when pandoc wasn't installed, for example. This PR adds a new get_output_error_code utility for easier checking of error (looking at return code as opposed to the contents of stdout for the word 'error'). This new machinery is leveraged when calling nbconvert during tests.

File last commit:

r11685:1f458eea
r11892:fdb8764a merge
Show More
latex.py
53 lines | 2.0 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
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
MinRK
s/ConfigurableTransformer/Transformer/
r11452 from .base import (Transformer)
Brian E. Granger
Fixing import for nbconvert.
r11089 from IPython.nbconvert import filters
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
MinRK
s/ConfigurableTransformer/Transformer/
r11452 class LatexTransformer(Transformer):
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776 """
Converter for latex destined documents.
Matthias BUSSONNIER
fix remove math space
r9882 """
Jonathan Frederic
Unecessary re-coding, inherits from base now.
r9779
Jonathan Frederic
Added writers and supporting code.
r11367 def transform_cell(self, cell, resources, 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,
Jonathan Frederic
Cleanup and refactor, transformers
r10674
Parameters
----------
cell : NotebookNode cell
Notebook cell being processed
resources : dictionary
Additional resources used in the conversion process. Allows
transformers to pass variables into the Jinja engine.
index : int
Modified index of the cell being processed (see base.py)
Jonathan Frederic
Added code to fix the math $ in the notebook so it...
r9776 """
Jonathan Frederic
Added spaces between comments.
r10476
Jonathan Frederic
Cleanup and refactor, transformers
r10674 #If the cell is a markdown cell, preprocess the ampersands used to
#remove the space between them and their contents. Latex will complain
#if spaces exist between the ampersands and the math content.
#See filters.latex.rm_math_space for more information.
Jonathan Frederic
Unecessary re-coding, inherits from base now.
r9779 if hasattr(cell, "source") and cell.cell_type == "markdown":
Jonathan Frederic
Filter names cleanup
r11685 cell.source = filters.strip_math_space(cell.source)
Jonathan Frederic
Cleanup and refactor, transformers
r10674 return cell, resources