Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
b2dfd0e4
Commit
b2dfd0e4
authored
Mar 03, 2015
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing pager Javascript
parent
f0ab4668
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
49 deletions
+47
-49
kernel.js
html/kernel.js
+47
-49
No files found.
html/kernel.js
View file @
b2dfd0e4
...
@@ -10,55 +10,53 @@ define(['require',
...
@@ -10,55 +10,53 @@ define(['require',
var
onload
=
function
(){
var
onload
=
function
(){
console
.
log
(
'Kernel haskell kernel.js is loading.'
);
console
.
log
(
'Kernel haskell kernel.js is loading.'
);
events
.
on
(
'app_initialized.NotebookApp'
,
function
(){
// add here logic that shoudl be run once per **page load**
// add here logic that shoudl be run once per **page load**
// like adding specific UI, or changing the default value
// like adding specific UI, or changing the default value
// of codecell highlight.
// of codecell highlight.
// Set tooltips to be triggered after 800ms
// Set tooltips to be triggered after 800ms
IPython
.
tooltip
.
time_before_tooltip
=
800
;
IPython
.
tooltip
.
time_before_tooltip
=
800
;
// IPython keycodes.
// IPython keycodes.
var
space
=
32
;
var
space
=
32
;
var
downArrow
=
40
;
var
downArrow
=
40
;
IPython
.
keyboard
.
keycodes
.
down
=
downArrow
;
// space
IPython
.
keyboard
.
keycodes
.
down
=
downArrow
;
// space
IPython
.
CodeCell
.
options_default
[
'cm_config'
][
'mode'
]
=
'haskell'
;
IPython
.
CodeCell
.
options_default
[
'cm_config'
][
'mode'
]
=
'haskell'
;
utils
.
requireCodeMirrorMode
(
'haskell'
,
function
(){
utils
.
requireCodeMirrorMode
(
'haskell'
,
function
(){
// Create a multiplexing mode that uses Haskell highlighting by default but
// Create a multiplexing mode that uses Haskell highlighting by default but
// doesn't highlight command-line directives.
// doesn't highlight command-line directives.
CodeMirror
.
defineMode
(
"ihaskell"
,
function
(
config
)
{
CodeMirror
.
defineMode
(
"ihaskell"
,
function
(
config
)
{
return
CodeMirror
.
multiplexingMode
(
return
CodeMirror
.
multiplexingMode
(
CodeMirror
.
getMode
(
config
,
"haskell"
),
CodeMirror
.
getMode
(
config
,
"haskell"
),
{
{
open
:
/:
(?=
!
)
/
,
// Matches : followed by !, but doesn't consume !
open
:
/:
(?=
!
)
/
,
// Matches : followed by !, but doesn't consume !
close
:
/^
(?!
!
)
/
,
// Matches start of line not followed by !, doesn't consume character
close
:
/^
(?!
!
)
/
,
// Matches start of line not followed by !, doesn't consume character
mode
:
CodeMirror
.
getMode
(
config
,
"text/plain"
),
mode
:
CodeMirror
.
getMode
(
config
,
"text/plain"
),
delimStyle
:
"delimit"
delimStyle
:
"delimit"
}
);
});
cells
=
IPython
.
notebook
.
get_cells
();
for
(
var
i
in
cells
){
c
=
cells
[
i
];
if
(
c
.
cell_type
===
'code'
)
{
// Force the mode to be Haskell
// This is necessary, otherwise sometimes highlighting just doesn't happen.
// This may be an IPython bug.
c
.
code_mirror
.
setOption
(
'mode'
,
'ihaskell'
);
c
.
auto_highlight
();
}
}
}
);
});
});
// Prevent the pager from surrounding everything with a <pre>
cells
=
IPython
.
notebook
.
get_cells
();
IPython
.
Pager
.
prototype
.
append_text
=
function
(
text
)
{
for
(
var
i
in
cells
){
this
.
pager_element
.
find
(
".container"
).
append
(
$
(
'<div/>'
).
html
(
IPython
.
utils
.
autoLinkUrls
(
text
)));
c
=
cells
[
i
];
};
if
(
c
.
cell_type
===
'code'
)
{
// Force the mode to be Haskell
// This is necessary, otherwise sometimes highlighting just doesn't happen.
// This may be an IPython bug.
c
.
code_mirror
.
setOption
(
'mode'
,
'ihaskell'
);
c
.
auto_highlight
();
}
}
});
});
// Prevent the pager from surrounding everything with a <pre>
IPython
.
Pager
.
prototype
.
append_text
=
function
(
text
)
{
this
.
pager_element
.
find
(
".container"
).
append
(
$
(
'<div/>'
).
html
(
IPython
.
utils
.
autoLinkUrls
(
text
)));
};
events
.
on
(
'shell_reply.Kernel'
,
function
()
{
events
.
on
(
'shell_reply.Kernel'
,
function
()
{
// Add logic here that should be run once per reply.
// Add logic here that should be run once per reply.
...
@@ -69,17 +67,17 @@ define(['require',
...
@@ -69,17 +67,17 @@ define(['require',
$code
=
$this
.
html
(),
$code
=
$this
.
html
(),
$unescaped
=
$
(
'<div/>'
).
html
(
$code
).
text
();
$unescaped
=
$
(
'<div/>'
).
html
(
$code
).
text
();
$this
.
empty
();
$this
.
empty
();
// Never highlight this block again.
// Never highlight this block again.
this
.
className
=
""
;
this
.
className
=
""
;
CodeMirror
(
this
,
{
CodeMirror
(
this
,
{
value
:
$unescaped
,
value
:
$unescaped
,
mode
:
this
.
id
,
mode
:
this
.
id
,
lineNumbers
:
false
,
lineNumbers
:
false
,
readOnly
:
true
readOnly
:
true
});
});
});
});
});
});
console
.
log
(
'IHaskell kernel.js should have been loaded.'
)
console
.
log
(
'IHaskell kernel.js should have been loaded.'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment