Commit 669d0fb4 authored by Boxiang Sun's avatar Boxiang Sun

erp5_notebook: small fixing

parent cf0731f9
...@@ -80,9 +80,10 @@ ...@@ -80,9 +80,10 @@
function pushNewCell() { function pushNewCell() {
if (current_type !== undefined) { if (current_type !== undefined) {
option = current_header.slice(current_type[0].length); option = current_header.slice(current_type[0].length);
if (option !== '') { if (option === '') {
option = JSON.parse(option); option = '{}';
} }
option = JSON.parse(option);
cell_list.push(new JSMDCell(current_type[1], cell_list.push(new JSMDCell(current_type[1],
current_text_list, option)); current_text_list, option));
...@@ -263,12 +264,12 @@ ...@@ -263,12 +264,12 @@
}); });
} }
function executeCodeCell(line_list, language) { function executeCodeCell(line_list, option) {
if (language === 'py') { if (option.language === 'py') {
console.log(line_list); console.log(line_list);
console.log("We are processing Python code!!!"); console.log("We are processing Python code!!!");
} else { } else {
throw new Error('Unsupported code language: ' + language); throw new Error('Unsupported code language: ' + option.language);
} }
} }
...@@ -293,7 +294,7 @@ ...@@ -293,7 +294,7 @@
return executeCssCell(cell._line_list); return executeCssCell(cell._line_list);
} }
if (cell._type === 'code') { if (cell._type === 'code') {
return executeCodeCell(cell._line_list, cell._option.language); return executeCodeCell(cell._line_list, cell._option);
} }
return executeUnknownCellType(cell); return executeUnknownCellType(cell);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment