Show More
@@ -1,45 +1,64 b'' | |||||
1 | """ |
|
1 | """ | |
2 | Exporter for exporting notebooks to Sphinx 'HowTo' style latex. Latex |
|
2 | Exporter for exporting notebooks to Sphinx 'HowTo' style latex. Latex | |
3 | formatted for use with PDFLatex. |
|
3 | formatted for use with PDFLatex. | |
4 | """ |
|
4 | """ | |
5 | #----------------------------------------------------------------------------- |
|
5 | #----------------------------------------------------------------------------- | |
6 | # Copyright (c) 2013, the IPython Development Team. |
|
6 | # Copyright (c) 2013, the IPython Development Team. | |
7 | # |
|
7 | # | |
8 | # Distributed under the terms of the Modified BSD License. |
|
8 | # Distributed under the terms of the Modified BSD License. | |
9 | # |
|
9 | # | |
10 | # The full license is in the file COPYING.txt, distributed with this software. |
|
10 | # The full license is in the file COPYING.txt, distributed with this software. | |
11 | #----------------------------------------------------------------------------- |
|
11 | #----------------------------------------------------------------------------- | |
12 |
|
12 | |||
13 | #----------------------------------------------------------------------------- |
|
13 | #----------------------------------------------------------------------------- | |
14 | # Imports |
|
14 | # Imports | |
15 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
16 |
|
16 | |||
17 | from IPython.utils.traitlets import Unicode |
|
17 | from IPython.utils.traitlets import Unicode | |
|
18 | from IPython.config import Config | |||
18 |
|
19 | |||
19 | # local import |
|
20 | # local import | |
20 | import latex |
|
21 | import latex | |
21 |
|
22 | |||
22 | from nbconvert.transformers.sphinx import SphinxTransformer |
|
23 | from nbconvert.transformers.sphinx import SphinxTransformer | |
23 |
|
24 | |||
24 | #----------------------------------------------------------------------------- |
|
25 | #----------------------------------------------------------------------------- | |
25 | # Classes |
|
26 | # Classes | |
26 | #----------------------------------------------------------------------------- |
|
27 | #----------------------------------------------------------------------------- | |
27 |
|
28 | |||
28 | class SphinxHowtoExporter(latex.LatexExporter): |
|
29 | class SphinxHowtoExporter(latex.LatexExporter): | |
29 | """ |
|
30 | """ | |
30 | Exports Sphinx "HowTo" LaTeX documents. The Sphinx "HowTo" exporter |
|
31 | Exports Sphinx "HowTo" LaTeX documents. The Sphinx "HowTo" exporter | |
31 | produces short document format latex for use with PDFLatex. |
|
32 | produces short document format latex for use with PDFLatex. | |
32 | """ |
|
33 | """ | |
33 |
|
34 | |||
34 | template_file = Unicode( |
|
35 | template_file = Unicode( | |
35 | 'sphinx_howto', config=True, |
|
36 | 'sphinx_howto', config=True, | |
36 | help="Name of the template file to use") |
|
37 | help="Name of the template file to use") | |
37 |
|
38 | |||
|
39 | _default_config = Config({ | |||
|
40 | 'SphinxTransformer': {'enabled':True} | |||
|
41 | }) | |||
|
42 | ||||
|
43 | def __init__(self, transformers=None, filters=None, config=None, **kw): | |||
|
44 | ||||
|
45 | c = self.default_config | |||
|
46 | if config: | |||
|
47 | c.merge(config) | |||
|
48 | ||||
|
49 | super(SphinxHowtoExporter, self).__init__( | |||
|
50 | transformers=transformers, | |||
|
51 | filters=filters, | |||
|
52 | config=c, | |||
|
53 | **kw) | |||
|
54 | ||||
|
55 | ||||
|
56 | ||||
38 | def _register_transformers(self): |
|
57 | def _register_transformers(self): | |
39 |
|
58 | |||
40 | #Register the transformers of the base class. |
|
59 | #Register the transformers of the base class. | |
41 | super(SphinxHowtoExporter, self)._register_transformers() |
|
60 | super(SphinxHowtoExporter, self)._register_transformers() | |
42 |
|
61 | |||
43 | #Register sphinx latex transformer |
|
62 | #Register sphinx latex transformer | |
44 | self.register_transformer(SphinxTransformer) |
|
63 | self.register_transformer(SphinxTransformer) | |
45 |
|
64 |
General Comments 0
You need to be logged in to leave comments.
Login now