Show More
@@ -72,7 +72,7 b' class Converter(object):' | |||||
72 | files_dir = str() |
|
72 | files_dir = str() | |
73 | with_preamble = True |
|
73 | with_preamble = True | |
74 | user_preamble = None |
|
74 | user_preamble = None | |
75 |
output = |
|
75 | output = unicode() | |
76 | raw_as_verbatim = False |
|
76 | raw_as_verbatim = False | |
77 |
|
77 | |||
78 | def __init__(self, infile): |
|
78 | def __init__(self, infile): | |
@@ -140,6 +140,7 b' class Converter(object):' | |||||
140 | if not hasattr(self, 'nb'): |
|
140 | if not hasattr(self, 'nb'): | |
141 | self.read() |
|
141 | self.read() | |
142 | self.output = self.convert() |
|
142 | self.output = self.convert() | |
|
143 | assert(type(self.output) == unicode) | |||
143 | return self.save() |
|
144 | return self.save() | |
144 |
|
145 | |||
145 | def read(self): |
|
146 | def read(self): |
@@ -1,4 +1,5 b'' | |||||
1 | from converters.base import Converter |
|
1 | from converters.base import Converter | |
|
2 | from converters.utils import cell_to_lines | |||
2 | from shutil import rmtree |
|
3 | from shutil import rmtree | |
3 | import json |
|
4 | import json | |
4 |
|
5 | |||
@@ -23,7 +24,7 b' class ConverterNotebook(Converter):' | |||||
23 | rmtree(self.files_dir) |
|
24 | rmtree(self.files_dir) | |
24 |
|
25 | |||
25 | def convert(self): |
|
26 | def convert(self): | |
26 | return json.dumps(json.loads(Converter.convert(self, ',')), indent=1, sort_keys=True) |
|
27 | return unicode(json.dumps(json.loads(Converter.convert(self, ',')), indent=1, sort_keys=True)) | |
27 |
|
28 | |||
28 | def optional_header(self): |
|
29 | def optional_header(self): | |
29 | s = \ |
|
30 | s = \ |
@@ -1,8 +1,14 b'' | |||||
1 | from __future__ import print_function |
|
1 | from __future__ import print_function | |
2 | from lexers import IPythonLexer |
|
2 | from lexers import IPythonLexer | |
|
3 | ||||
3 | import subprocess |
|
4 | import subprocess | |
|
5 | import copy | |||
|
6 | import json | |||
4 | import re |
|
7 | import re | |
|
8 | ||||
5 | from IPython.utils.text import indent |
|
9 | from IPython.utils.text import indent | |
|
10 | from IPython.utils import path, py3compat | |||
|
11 | from IPython.nbformat.v3.nbjson import BytesEncoder | |||
6 |
|
12 | |||
7 | #----------------------------------------------------------------------------- |
|
13 | #----------------------------------------------------------------------------- | |
8 | # Utility functions |
|
14 | # Utility functions |
General Comments 0
You need to be logged in to leave comments.
Login now