sphinx_howto.py
53 lines
| 1.9 KiB
| text/x-python
|
PythonLexer
Jonathan Frederic
|
r10677 | """ | ||
Exporter for exporting notebooks to Sphinx 'HowTo' style latex. Latex | ||||
formatted for use with PDFLatex. | ||||
""" | ||||
Jonathan Frederic
|
r10588 | #----------------------------------------------------------------------------- | ||
# 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
|
r11383 | from IPython.utils.traitlets import Unicode, List | ||
Bussonnier Matthias
|
r10880 | from IPython.config import Config | ||
Jonathan Frederic
|
r10677 | |||
Jonathan Frederic
|
r10588 | # local import | ||
Brian E. Granger
|
r11089 | from .latex import LatexExporter | ||
Jonathan Frederic
|
r10677 | |||
Brian E. Granger
|
r11089 | from IPython.nbconvert import transformers | ||
Jonathan Frederic
|
r10677 | |||
Jonathan Frederic
|
r10588 | #----------------------------------------------------------------------------- | ||
# Classes | ||||
#----------------------------------------------------------------------------- | ||||
Brian E. Granger
|
r11089 | class SphinxHowtoExporter(LatexExporter): | ||
Jonathan Frederic
|
r10677 | """ | ||
Exports Sphinx "HowTo" LaTeX documents. The Sphinx "HowTo" exporter | ||||
produces short document format latex for use with PDFLatex. | ||||
""" | ||||
Jonathan Frederic
|
r10624 | template_file = Unicode( | ||
Jonathan Frederic
|
r10630 | 'sphinx_howto', config=True, | ||
Jonathan Frederic
|
r10624 | help="Name of the template file to use") | ||
Bussonnier Matthias
|
r10880 | |||
Jonathan Frederic
|
r11383 | default_transformers = List([transformers.Svg2PdfTransformer, | ||
transformers.ExtractFigureTransformer, | ||||
transformers.CSSHTMLHeaderTransformer, | ||||
transformers.LatexTransformer, | ||||
transformers.SphinxTransformer], | ||||
config=True, | ||||
help="""List of transformers available by default, by name, namespace, | ||||
instance, or type.""") | ||||
@property | ||||
def default_config(self): | ||||
c = Config({'SphinxTransformer': {'enabled':True}}) | ||||
c.merge(super(SphinxHowtoExporter,self).default_config) | ||||
return c | ||||