Show More
@@ -93,7 +93,7 b' def export(exporter, nb, **kw):' | |||
|
93 | 93 | |
|
94 | 94 | Parameters |
|
95 | 95 | ---------- |
|
96 |
exporter : class:`~ |
|
|
96 | exporter : class:`~jupyter_nbconvert.exporters.exporter.Exporter` class or instance | |
|
97 | 97 | Class type or instance of the exporter that should be used. If the |
|
98 | 98 | method initializes it's own instance of the class, it is ASSUMED that |
|
99 | 99 | the class type provided exposes a constructor (``__init__``) with the same |
@@ -65,15 +65,15 b' class Exporter(LoggingConfigurable):' | |||
|
65 | 65 | |
|
66 | 66 | _preprocessors = List() |
|
67 | 67 | |
|
68 |
default_preprocessors = List([' |
|
|
69 |
' |
|
|
70 |
' |
|
|
71 |
' |
|
|
72 |
' |
|
|
73 |
' |
|
|
74 |
' |
|
|
75 |
' |
|
|
76 |
' |
|
|
68 | default_preprocessors = List(['jupyter_nbconvert.preprocessors.coalesce_streams', | |
|
69 | 'jupyter_nbconvert.preprocessors.SVG2PDFPreprocessor', | |
|
70 | 'jupyter_nbconvert.preprocessors.ExtractOutputPreprocessor', | |
|
71 | 'jupyter_nbconvert.preprocessors.CSSHTMLHeaderPreprocessor', | |
|
72 | 'jupyter_nbconvert.preprocessors.RevealHelpPreprocessor', | |
|
73 | 'jupyter_nbconvert.preprocessors.LatexPreprocessor', | |
|
74 | 'jupyter_nbconvert.preprocessors.ClearOutputPreprocessor', | |
|
75 | 'jupyter_nbconvert.preprocessors.ExecutePreprocessor', | |
|
76 | 'jupyter_nbconvert.preprocessors.HighlightMagicsPreprocessor'], | |
|
77 | 77 | config=True, |
|
78 | 78 | help="""List of preprocessors available by default, by name, namespace, |
|
79 | 79 | instance, or type.""") |
@@ -5,7 +5,7 b'' | |||
|
5 | 5 | |
|
6 | 6 | import os |
|
7 | 7 | |
|
8 |
from |
|
|
8 | from jupyter_nbconvert.filters.highlight import Highlight2HTML | |
|
9 | 9 | from IPython.config import Config |
|
10 | 10 | |
|
11 | 11 | from .templateexporter import TemplateExporter |
@@ -19,7 +19,7 b' import os' | |||
|
19 | 19 | from IPython.utils.traitlets import Unicode |
|
20 | 20 | from IPython.config import Config |
|
21 | 21 | |
|
22 |
from |
|
|
22 | from jupyter_nbconvert.filters.highlight import Highlight2Latex | |
|
23 | 23 | from .templateexporter import TemplateExporter |
|
24 | 24 | |
|
25 | 25 | #----------------------------------------------------------------------------- |
@@ -36,7 +36,7 b' class PDFExporter(LatexExporter):' | |||
|
36 | 36 | help="File extensions of temp files to remove after running." |
|
37 | 37 | ) |
|
38 | 38 | |
|
39 |
writer = Instance(" |
|
|
39 | writer = Instance("jupyter_nbconvert.writers.FilesWriter", args=()) | |
|
40 | 40 | |
|
41 | 41 | def run_command(self, command_list, filename, count, log_function): |
|
42 | 42 | """Run command_list count times. |
@@ -12,7 +12,7 b'' | |||
|
12 | 12 | # Imports |
|
13 | 13 | #----------------------------------------------------------------------------- |
|
14 | 14 | |
|
15 |
from |
|
|
15 | from jupyter_nbconvert import preprocessors | |
|
16 | 16 | from IPython.config import Config |
|
17 | 17 | |
|
18 | 18 | from .html import HTMLExporter |
@@ -27,7 +27,7 b' from IPython.utils.traitlets import MetaHasTraits, Unicode, List, Dict, Any' | |||
|
27 | 27 | from IPython.utils.importstring import import_item |
|
28 | 28 | from IPython.utils import py3compat, text |
|
29 | 29 | |
|
30 |
from |
|
|
30 | from jupyter_nbconvert import filters | |
|
31 | 31 | from .exporter import Exporter |
|
32 | 32 | |
|
33 | 33 | #----------------------------------------------------------------------------- |
@@ -83,7 +83,7 b' class TestExporter(ExportersTestsBase):' | |||
|
83 | 83 | """ |
|
84 | 84 | Can a preprocessor be added to the preprocessors list by dotted object name? |
|
85 | 85 | """ |
|
86 |
config = Config({'Exporter': {'preprocessors': [' |
|
|
86 | config = Config({'Exporter': {'preprocessors': ['jupyter_nbconvert.exporters.tests.cheese.CheesePreprocessor']}}) | |
|
87 | 87 | exporter = self._make_exporter(config=config) |
|
88 | 88 | (output, resources) = exporter.from_filename(self._get_notebook()) |
|
89 | 89 | assert resources is not None |
@@ -10,7 +10,7 b' from within Jinja templates.' | |||
|
10 | 10 | # because errors should be raised at runtime if it's actually needed, |
|
11 | 11 | # not import time, when it may not be needed. |
|
12 | 12 | |
|
13 |
from |
|
|
13 | from jupyter_nbconvert.utils.base import NbConvertBase | |
|
14 | 14 | from warnings import warn |
|
15 | 15 | |
|
16 | 16 | MULTILINE_OUTPUTS = ['text', 'html', 'svg', 'latex', 'javascript', 'json'] |
@@ -21,8 +21,8 b' except ImportError as e:' | |||
|
21 | 21 | """mistune is unavailable, raise ImportError""" |
|
22 | 22 | raise ImportError("markdown2html requires mistune: %s" % _mistune_import_error) |
|
23 | 23 | |
|
24 |
from |
|
|
25 |
from |
|
|
24 | from jupyter_nbconvert.utils.pandoc import pandoc | |
|
25 | from jupyter_nbconvert.utils.exceptions import ConversionException | |
|
26 | 26 | from IPython.utils.process import get_output_error_code |
|
27 | 27 | from IPython.utils.py3compat import cast_bytes |
|
28 | 28 | from IPython.utils.version import check_version |
@@ -16,8 +16,8 b' from pygments.lexers import get_lexer_by_name' | |||
|
16 | 16 | from pygments.formatters import HtmlFormatter |
|
17 | 17 | from pygments.util import ClassNotFound |
|
18 | 18 | |
|
19 |
from |
|
|
20 |
from |
|
|
19 | from jupyter_nbconvert.filters.strings import add_anchor | |
|
20 | from jupyter_nbconvert.utils.exceptions import ConversionException | |
|
21 | 21 | from IPython.utils.decorators import undoc |
|
22 | 22 | |
|
23 | 23 |
@@ -23,7 +23,7 b' from IPython.utils.traitlets import (' | |||
|
23 | 23 | from IPython.utils.importstring import import_item |
|
24 | 24 | |
|
25 | 25 | from .exporters.export import get_export_names, exporter_map |
|
26 |
from |
|
|
26 | from jupyter_nbconvert import exporters, preprocessors, writers, postprocessors | |
|
27 | 27 | from .utils.base import NbConvertBase |
|
28 | 28 | from .utils.exceptions import ConversionException |
|
29 | 29 | |
@@ -159,15 +159,15 b' class NbConvertApp(BaseIPythonApplication):' | |||
|
159 | 159 | """.format(get_export_names())) |
|
160 | 160 | |
|
161 | 161 | # Writer specific variables |
|
162 |
writer = Instance(' |
|
|
162 | writer = Instance('jupyter_nbconvert.writers.base.WriterBase', | |
|
163 | 163 | help="""Instance of the writer class used to write the |
|
164 | 164 | results of the conversion.""") |
|
165 | 165 | writer_class = DottedObjectName('FilesWriter', config=True, |
|
166 | 166 | help="""Writer class used to write the |
|
167 | 167 | results of the conversion""") |
|
168 |
writer_aliases = {'fileswriter': ' |
|
|
169 |
'debugwriter': ' |
|
|
170 |
'stdoutwriter': ' |
|
|
168 | writer_aliases = {'fileswriter': 'jupyter_nbconvert.writers.files.FilesWriter', | |
|
169 | 'debugwriter': 'jupyter_nbconvert.writers.debug.DebugWriter', | |
|
170 | 'stdoutwriter': 'jupyter_nbconvert.writers.stdout.StdoutWriter'} | |
|
171 | 171 | writer_factory = Type() |
|
172 | 172 | |
|
173 | 173 | def _writer_class_changed(self, name, old, new): |
@@ -176,14 +176,14 b' class NbConvertApp(BaseIPythonApplication):' | |||
|
176 | 176 | self.writer_factory = import_item(new) |
|
177 | 177 | |
|
178 | 178 | # Post-processor specific variables |
|
179 |
postprocessor = Instance(' |
|
|
179 | postprocessor = Instance('jupyter_nbconvert.postprocessors.base.PostProcessorBase', | |
|
180 | 180 | help="""Instance of the PostProcessor class used to write the |
|
181 | 181 | results of the conversion.""") |
|
182 | 182 | |
|
183 | 183 | postprocessor_class = DottedOrNone(config=True, |
|
184 | 184 | help="""PostProcessor class used to write the |
|
185 | 185 | results of the conversion""") |
|
186 |
postprocessor_aliases = {'serve': ' |
|
|
186 | postprocessor_aliases = {'serve': 'jupyter_nbconvert.postprocessors.serve.ServePostProcessor'} | |
|
187 | 187 | postprocessor_factory = Type() |
|
188 | 188 | |
|
189 | 189 | def _postprocessor_class_changed(self, name, old, new): |
@@ -21,7 +21,7 b' from IPython import nbformat' | |||
|
21 | 21 | from .base import PreprocessorTestsBase |
|
22 | 22 | from ..execute import ExecutePreprocessor |
|
23 | 23 | |
|
24 |
from |
|
|
24 | from jupyter_nbconvert.filters import strip_ansi | |
|
25 | 25 | from nose.tools import assert_raises |
|
26 | 26 | |
|
27 | 27 | addr_pat = re.compile(r'0x[0-9a-f]{7,9}') |
@@ -1,4 +1,4 b'' | |||
|
1 |
from |
|
|
1 | from jupyter_nbconvert.writers.base import WriterBase | |
|
2 | 2 | |
|
3 | 3 | class HelloWriter(WriterBase): |
|
4 | 4 |
@@ -87,7 +87,7 b' class TestNbConvertApp(TestsBase):' | |||
|
87 | 87 | """Do post processors work?""" |
|
88 | 88 | with self.create_temp_cwd(['notebook1.ipynb']): |
|
89 | 89 | out, err = self.call('nbconvert --log-level 0 --to python notebook1 ' |
|
90 |
'--post |
|
|
90 | '--post jupyter_nbconvert.tests.test_nbconvertapp.DummyPost') | |
|
91 | 91 | self.assertIn('Dummy:notebook1.py', out) |
|
92 | 92 | |
|
93 | 93 | @dec.onlyif_cmds_exist('pandoc') |
@@ -11,7 +11,7 b'' | |||
|
11 | 11 | #----------------------------------------------------------------------------- |
|
12 | 12 | from pygments.token import Token |
|
13 | 13 | |
|
14 |
from |
|
|
14 | from jupyter_nbconvert.tests.base import TestsBase | |
|
15 | 15 | from .. import lexers |
|
16 | 16 | |
|
17 | 17 |
@@ -14,7 +14,7 b' import warnings' | |||
|
14 | 14 | |
|
15 | 15 | from IPython.testing import decorators as dec |
|
16 | 16 | |
|
17 |
from |
|
|
17 | from jupyter_nbconvert.tests.base import TestsBase | |
|
18 | 18 | from .. import pandoc |
|
19 | 19 | |
|
20 | 20 | #----------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now