meta & kernel

This commit is contained in:
Vitor Santos Costa
2018-02-01 01:44:34 +00:00
parent aaadd51309
commit 1cafba0529
11 changed files with 1353 additions and 955 deletions

View File

@@ -1,42 +1,18 @@
;(function(window_CodeMirror){
"use strict";
define([
"/kernelspecs/yap_kernel/prolog.js"],function(CodeMirror){
// the `require` namespace for codemirror
CM_PATH = "components/codemirror/";
define(
[
"underscore",
"jquery",
CM_PATH + "lib/codemirror",
"base/js/namespace",
// silent upgrades
"./jshint.js",
CM_PATH + "addon/lint/javascript-lint",
CM_PATH + "addon/hint/javascript-hint",
CM_PATH + "addon/lint/lint",
CM_PATH + "addon/hint/show-hint",
"./prolog.js"
],
function(_, $, CodeMirror, Jupyter){
// the main function
cm_tweak_js = function(cell){
var editor = cell.code_mirror,
opts = {},
meta = ensure_ns(cell),
keys = editor.getOption("extraKeys") || {},
mode = editor.getMode();
// only update editors we care about, reset ones we might have messed
if(!editor){
return;
} else {
editor.setOption("mode", "x-text/prolog");
}
}
}
} // the `define` callback
); // the `define`
).call(this, window.CodeMirror);
var onload = function(){
console.log("I am being loaded");
var cell = Jupyter.notebook.get_selected_cell();
var cm = cell.config;
var patch = {
CodeCell:{
cm_config:{mode: "prolog"} // only change here.
}
};
config.update(patch);
return {onload:onload};
}
}
);

View File

@@ -524,7 +524,6 @@ class YAPRun:
return self.errors
def jupyter_query(self, s):
import pdb; pdb.set_trace()
#
# construct a self.query from a one-line string
# self.q is opaque to Python
@@ -715,7 +714,7 @@ class YAPRun:
mcell = cell.lstrip('%')
txt0 = mcell.split(maxsplit = 2, sep = '\n')
txt = txt0[0].split(maxsplit = 2)
magic = txt[0]
magic = txt[0]
if len(txt) == 2:
line = txt[1]
else: