meta & kernel
This commit is contained in:
@@ -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};
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user