##// END OF EJS Templates
Typo fix
Typo fix

File last commit:

r12689:bd330c82
r12749:1a8b383a
Show More
sphinx.py
50 lines | 1.8 KiB | text/x-python | PythonLexer
Jonathan Frederic
Transformer refactor
r10436 """Module that allows custom Sphinx parameters to be set on the notebook and
Jonathan Frederic
Cleanup and refactor, transformers
r10674 on the 'other' object passed into Jinja. Called prior to Jinja conversion
process.
Jonathan Frederic
Added Sphinx transformer....
r9772 """
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.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
Jonathan Frederic
Cleanup and refactor, transformers
r10674
Jonathan Frederic
Transformer refactor
r10436 from __future__ import print_function, absolute_import
Jonathan Frederic
Simplify sphinx preprocessor
r12689 import os
import sphinx
from .base import Preprocessor
Jonathan Frederic
Cleanup and refactor, transformers
r10674
Jonathan Frederic
Transformer refactor
r10436 #-----------------------------------------------------------------------------
# Classes and functions
#-----------------------------------------------------------------------------
Jonathan Frederic
Cleanup and refactor, transformers
r10674
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 class SphinxPreprocessor(Preprocessor):
Jonathan Frederic
Added Sphinx transformer....
r9772 """
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 Sphinx utility preprocessor.
Jonathan Frederic
Added Sphinx transformer....
r9772
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 This preprocessor is used to set variables needed by the latex to build
Jonathan Frederic
Added Sphinx transformer....
r9772 Sphinx stylized templates.
"""
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 def preprocess(self, nb, resources):
Jonathan Frederic
Changed SphinxTransformer to inherit...
r9775 """
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 Sphinx preprocessing to apply on each notebook.
Jonathan Frederic
Cleanup and refactor, transformers
r10674
Parameters
----------
nb : NotebookNode
Notebook being converted
resources : dictionary
Additional resources used in the conversion process. Allows
Paul Ivanov
replace 'transformer' with 'preprocessor'
r12219 preprocessors to pass variables into the Jinja engine.
Jonathan Frederic
Changed SphinxTransformer to inherit...
r9775 """
Jonathan Frederic
Simplify sphinx preprocessor
r12689
Jonathan Frederic
Added Sphinx transformer....
r9772 # Find and pass in the path to the Sphinx dependencies.
Jonathan Frederic
Simplify sphinx preprocessor
r12689 resources["sphinx"] = {}
MinRK
use sphinx.package_dir to find texinputs...
r12055 resources["sphinx"]["texinputs"] = os.path.realpath(os.path.join(sphinx.package_dir, "texinputs"))
Jonathan Frederic
Cleanup and refactor, transformers
r10674 return nb, resources