Show More
@@ -69,6 +69,7 b' def coalesce_streams(cell, resources, index):' | |||
|
69 | 69 | last.text += output.text |
|
70 | 70 | else: |
|
71 | 71 | new_outputs.append(output) |
|
72 | last = output | |
|
72 | 73 | |
|
73 | 74 | cell.outputs = new_outputs |
|
74 | 75 | return cell, resources |
@@ -56,7 +56,7 b' class CSSHTMLHeaderTransformer(Transformer):' | |||
|
56 | 56 | self._regen_header() |
|
57 | 57 | |
|
58 | 58 | |
|
59 |
def |
|
|
59 | def call(self, nb, resources): | |
|
60 | 60 | """Fetch and add CSS to the resource dictionary |
|
61 | 61 | |
|
62 | 62 | Fetch CSS from IPython and Pygments to add at the beginning |
@@ -31,7 +31,7 b' class ExtractOutputTransformer(Transformer):' | |||
|
31 | 31 | outputs are returned in the 'resources' dictionary. |
|
32 | 32 | """ |
|
33 | 33 | |
|
34 |
|
|
|
34 | output_filename_template = Unicode( | |
|
35 | 35 | "{unique_key}_{cell_index}_{index}.{extension}", config=True) |
|
36 | 36 | |
|
37 | 37 | |
@@ -51,9 +51,9 b' class ExtractOutputTransformer(Transformer):' | |||
|
51 | 51 | """ |
|
52 | 52 | |
|
53 | 53 | #Get the unique key from the resource dict if it exists. If it does not |
|
54 |
#exist, use ' |
|
|
54 | #exist, use 'output' as the default. Also, get files directory if it | |
|
55 | 55 | #has been specified |
|
56 |
unique_key = resources.get('unique_key', ' |
|
|
56 | unique_key = resources.get('unique_key', 'output') | |
|
57 | 57 | output_files_dir = resources.get('output_files_dir', None) |
|
58 | 58 | |
|
59 | 59 | #Make sure outputs key exists |
@@ -79,8 +79,8 b' class ExtractOutputTransformer(Transformer):' | |||
|
79 | 79 | else: |
|
80 | 80 | data = data.encode("UTF-8") |
|
81 | 81 | |
|
82 |
#Build a |
|
|
83 |
filename = self. |
|
|
82 | #Build an output name | |
|
83 | filename = self.output_filename_template.format( | |
|
84 | 84 | unique_key=unique_key, |
|
85 | 85 | cell_index=cell_index, |
|
86 | 86 | index=index, |
@@ -36,7 +36,7 b' class DebugWriter(WriterBase):' | |||
|
36 | 36 | if 'outputs' in resources: |
|
37 | 37 | print("outputs extracted from %s" % notebook_name) |
|
38 | 38 | print('-' * 80) |
|
39 |
|
|
|
39 | pprint(resources['outputs'], indent=2, width=70) | |
|
40 | 40 | else: |
|
41 |
print(" |
|
|
41 | print("no outputs extracted from %s" % notebook_name) | |
|
42 | 42 | print('=' * 80) |
@@ -48,7 +48,7 b' class FilesWriter(WriterBase):' | |||
|
48 | 48 | |
|
49 | 49 | def _makedir(self, path): |
|
50 | 50 | """Make a directory if it doesn't already exist""" |
|
51 | if not os.path.isdir(path): | |
|
51 | if path and not os.path.isdir(path): | |
|
52 | 52 | self.log.info("Making directory %s", path) |
|
53 | 53 | os.makedirs(path) |
|
54 | 54 | |
@@ -61,8 +61,12 b' class FilesWriter(WriterBase):' | |||
|
61 | 61 | See base for more... |
|
62 | 62 | """ |
|
63 | 63 | |
|
64 | # Verify that a notebook name is provided. | |
|
65 | if notebook_name is None: | |
|
66 | raise TypeError('notebook_name') | |
|
67 | ||
|
64 | 68 | # Pull the extension and subdir from the resources dict. |
|
65 |
output_extension = resources |
|
|
69 | output_extension = resources.get('output_extension', None) | |
|
66 | 70 | |
|
67 | 71 | # Write all of the extracted resources to the destination directory. |
|
68 | 72 | # NOTE: WE WRITE EVERYTHING AS-IF IT'S BINARY. THE EXTRACT FIG |
@@ -97,7 +101,10 b' class FilesWriter(WriterBase):' | |||
|
97 | 101 | link_or_copy(matching_filename, dest) |
|
98 | 102 | |
|
99 | 103 | # Determine where to write conversion results. |
|
100 | dest = notebook_name + '.' + output_extension | |
|
104 | if output_extension is not None: | |
|
105 | dest = notebook_name + '.' + output_extension | |
|
106 | else: | |
|
107 | dest = notebook_name | |
|
101 | 108 | if self.build_directory: |
|
102 | 109 | dest = os.path.join(self.build_directory, dest) |
|
103 | 110 |
General Comments 0
You need to be logged in to leave comments.
Login now