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
3ddaf0e5
Commit
3ddaf0e5
authored
Oct 28, 2013
by
Matthias BUSSONNIER
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add custom.js file for notebook customisation
parent
0b63c0ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
1 deletion
+88
-1
Config.hs
IHaskell/Config.hs
+4
-1
IPython.hs
IHaskell/IPython.hs
+1
-0
custom.js
config/custom.js
+83
-0
No files found.
IHaskell/Config.hs
View file @
3ddaf0e5
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE QuasiQuotes #-}
module
IHaskell.Config
(
ipython
,
notebook
,
console
,
qtconsole
)
where
module
IHaskell.Config
(
ipython
,
notebook
,
console
,
qtconsole
,
customjs
)
where
import
Data.String.Here
import
Data.String.Here
import
ClassyPrelude
import
ClassyPrelude
...
@@ -15,3 +15,6 @@ console = [template|config/ipython_console_config.py|]
...
@@ -15,3 +15,6 @@ console = [template|config/ipython_console_config.py|]
qtconsole
::
String
qtconsole
::
String
qtconsole
=
[
template
|
config/ipython_qtconsole_config.py
|]
qtconsole
=
[
template
|
config/ipython_qtconsole_config.py
|]
customjs
::
String
customjs
=
[
template
|
config/custom.js
|]
IHaskell/IPython.hs
View file @
3ddaf0e5
...
@@ -87,6 +87,7 @@ writeConfigFilesTo profileDir ihaskellPath = do
...
@@ -87,6 +87,7 @@ writeConfigFilesTo profileDir ihaskellPath = do
writeFile
(
conf
"ipython_notebook_config.py"
)
Config
.
notebook
writeFile
(
conf
"ipython_notebook_config.py"
)
Config
.
notebook
writeFile
(
conf
"ipython_console_config.py"
)
Config
.
console
writeFile
(
conf
"ipython_console_config.py"
)
Config
.
console
writeFile
(
conf
"ipython_qtconsole_config.py"
)
Config
.
qtconsole
writeFile
(
conf
"ipython_qtconsole_config.py"
)
Config
.
qtconsole
writeFile
(
conf
"static/custom/custom.js"
)
Config
.
customjs
where
where
conf
filename
=
fromText
$
profileDir
++
filename
conf
filename
=
fromText
$
profileDir
++
filename
...
...
config/custom.js
0 → 100644
View file @
3ddaf0e5
// leave at least 2 line with only a star on it below, or doc generation fails
/**
*
*
* Placeholder for custom user javascript
* mainly to be overridden in profile/static/js/custom.js
* This will always be an empty file in IPython
*
* User could add any javascript in the `profile/static/js/custom.js` file
* (and should create it if it does not exist).
* It will be executed by the ipython notebook at load time.
*
* Same thing with `profile/static/css/custom.css` to inject custom css into the notebook.
*
* Example :
*
* Create a custom button in toolbar that execute `%qtconsole` in kernel
* and hence open a qtconsole attached to the same kernel as the current notebook
*
* $([IPython.events]).on('notebook_loaded.Notebook', function(){
* IPython.toolbar.add_buttons_group([
* {
* 'label' : 'run qtconsole',
* 'icon' : 'ui-icon-calculator', // select your icon from http://jqueryui.com/themeroller/
* 'callback': function(){IPython.notebook.kernel.execute('%qtconsole')}
* }
* // add more button here if needed.
* ]);
* });
*
* Example :
*
* Use `jQuery.getScript(url [, success(script, textStatus, jqXHR)] );`
* to load custom script into the notebook.
*
* // to load the metadata ui extension example.
* $.getScript('/static/js/celltoolbarpresets/example.js');
* // or
* // to load the metadata ui extension to control slideshow mode / reveal js for nbconvert
* $.getScript('/static/js/celltoolbarpresets/slideshow.js');
*
*
* @module IPython
* @namespace IPython
* @class customjs
* @static
*/
// end of IPython unmodified version
$
([
IPython
.
events
]).
on
(
'notebook_loaded.Notebook'
,
function
(){
// add here logic that should be run once per **notebook load**
// (!= page load), like restarting a checkpoint
var
md
=
IPython
.
notebook
.
metadata
if
(
md
.
language
){
console
.
log
(
'language already defined and is :'
,
md
.
language
);
}
else
{
md
.
language
=
'haskell'
;
console
.
log
(
'add metadata hint that language is haskell...'
);
}
});
$
([
IPython
.
events
]).
on
(
'app_initialized.NotebookApp'
,
function
(){
// add here logic that shoudl be run once per **page load**
// like adding specific UI, or changing the default value
// of codecell highlight.
CodeMirror
.
requireMode
(
'haskell'
,
function
(){
cells
=
IPython
.
notebook
.
get_cells
();
for
(
var
i
in
cells
){
c
=
cells
[
i
];
if
(
c
.
cell_type
===
'code'
){
c
.
auto_highlight
()
}
}
})
IPython
.
CodeCell
.
options_default
[
'cm_config'
][
'mode'
]
=
'haskell'
;
});
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