##// END OF EJS Templates
Backport PR #5803: unify visual line handling...
Backport PR #5803: unify visual line handling Extra change on top of @ivanov pr #5768 to have more consistent handling of visual lines. In a long wrapped line End/Cmd-Right will go to the end of the visual line which seem more logical. Cmd-Left beginning of line. I did note rebind Ctrl-Left because there is already custom logic in code mirror for "smart" beginning of line.

File last commit:

r12864:ba77f89f
r17150:ee375e02
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