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
769a6262
Commit
769a6262
authored
Mar 03, 2015
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing profile
parent
1c232f17
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
5 additions
and
574 deletions
+5
-574
Setup.hs
Setup.hs
+1
-24
custom.css
html/custom.css
+0
-0
custom.js
html/custom.js
+0
-18
logo-64x64.png
html/logo-64x64.png
+0
-0
ihaskell.cabal
ihaskell.cabal
+3
-1
.profile_version
profile/.profile_version
+0
-1
ipython_config.py
profile/ipython_config.py
+0
-13
ipython_console_config.py
profile/ipython_console_config.py
+0
-4
ipython_notebook_config.py
profile/ipython_notebook_config.py
+0
-2
ipython_qtconsole_config.py
profile/ipython_qtconsole_config.py
+0
-6
ipynblogo.png
profile/static/base/images/ipynblogo.png
+0
-0
conceal.js
profile/static/custom/conceal/conceal.js
+0
-177
hide_input.js
profile/static/custom/hide_input.js
+0
-166
ihaskell-basic.tpl
profile/templates/ihaskell-basic.tpl
+0
-1
ihaskell.tpl
profile/templates/ihaskell.tpl
+0
-161
Main.hs
src/Main.hs
+1
-0
No files found.
Setup.hs
View file @
769a6262
import
Distribution.Simple
import
Distribution.Simple
main
=
defaultMain
import
Control.Applicative
((
<$>
))
import
Data.List
(
isInfixOf
)
import
Codec.Archive.Tar
(
create
)
import
System.Directory
(
getDirectoryContents
)
-- This is currently *not used*. build-type is Simple.
-- This is because it breaks installing from Hackage.
main
=
defaultMainWithHooks
simpleUserHooks
{
preBuild
=
makeProfileTar
}
makeProfileTar
args
flags
=
do
putStrLn
"Building profile.tar."
let
profileDir
=
"profile"
tarFile
=
profileDir
++
"/profile.tar"
files
<-
filter
realFile
<$>
filter
notProfileTar
<$>
getDirectoryContents
profileDir
print
files
create
tarFile
profileDir
files
preBuild
simpleUserHooks
args
flags
where
notProfileTar
str
=
not
$
"profile.tar"
`
isInfixOf
`
str
realFile
str
=
str
/=
"."
&&
str
/=
".."
profile/static/custom
/custom.css
→
html
/custom.css
View file @
769a6262
File moved
profile/static/custom
/custom.js
→
html
/custom.js
View file @
769a6262
$
([
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
(){
$
([
IPython
.
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
...
@@ -53,17 +40,12 @@ $([IPython.events]).on('app_initialized.NotebookApp', function(){
...
@@ -53,17 +40,12 @@ $([IPython.events]).on('app_initialized.NotebookApp', function(){
c
.
auto_highlight
()
c
.
auto_highlight
()
}
}
}
}
// We can only load the conceal scripts once all cells have mode 'haskell'
require
([
'/static/custom/conceal/conceal.js'
]);
});
});
// Prevent the pager from surrounding everything with a <pre>
// Prevent the pager from surrounding everything with a <pre>
IPython
.
Pager
.
prototype
.
append_text
=
function
(
text
)
{
IPython
.
Pager
.
prototype
.
append_text
=
function
(
text
)
{
this
.
pager_element
.
find
(
".container"
).
append
(
$
(
'<div/>'
).
html
(
IPython
.
utils
.
autoLinkUrls
(
text
)));
this
.
pager_element
.
find
(
".container"
).
append
(
$
(
'<div/>'
).
html
(
IPython
.
utils
.
autoLinkUrls
(
text
)));
};
};
require
([
'/static/custom/hide_input.js'
]);
});
});
$
([
IPython
.
events
]).
on
(
'shell_reply.Kernel'
,
function
()
{
$
([
IPython
.
events
]).
on
(
'shell_reply.Kernel'
,
function
()
{
...
...
html/logo-64x64.png
0 → 100644
View file @
769a6262
2.86 KB
ihaskell.cabal
View file @
769a6262
...
@@ -43,7 +43,9 @@ build-type: Simple
...
@@ -43,7 +43,9 @@ build-type: Simple
cabal-version: >=1.16
cabal-version: >=1.16
data-files:
data-files:
profile/profile.tar
html/custom.css
html/custom.js
html/logo-64x64.png
library
library
hs-source-dirs: src
hs-source-dirs: src
...
...
profile/.profile_version
deleted
100644 → 0
View file @
1c232f17
0.4.2.0
profile/ipython_config.py
deleted
100644 → 0
View file @
1c232f17
# Available Variables:
# exe: Path to IHaskell kernel.
c
=
get_config
()
c
.
KernelManager
.
kernel_cmd
=
[
exe
,
'kernel'
,
'{connection_file}'
]
c
.
Session
.
key
=
b
''
c
.
Session
.
keyfile
=
b
''
# Syntax highlight properly in Haskell notebooks.
c
.
NbConvertBase
.
default_language
=
"haskell"
# Where to look for templates.
template_path
=
"/"
.
join
(
__file__
.
split
(
"/"
)[:
-
1
]
+
[
"templates"
])
c
.
TemplateExporter
.
template_path
=
[
template_path
]
profile/ipython_console_config.py
deleted
100644 → 0
View file @
1c232f17
# Empty.
c
=
get_config
()
c
.
TerminalIPythonApp
.
display_banner
=
False
c
.
TerminalInteractiveShell
.
confirm_exit
=
False
profile/ipython_notebook_config.py
deleted
100644 → 0
View file @
1c232f17
c
=
get_config
()
c
.
NotebookApp
.
port
=
8778
profile/ipython_qtconsole_config.py
deleted
100644 → 0
View file @
1c232f17
c
=
get_config
()
# QtConsole try to guess base on Python lexing when the input is done to auto
# execute. This Fails on Haskell, and while it is not possible to do the
# lexing in the kernel just deactivate functionality
c
.
IPythonWidget
.
execute_on_complete_input
=
False
profile/static/base/images/ipynblogo.png
deleted
100644 → 0
View file @
1c232f17
39 KB
profile/static/custom/conceal/conceal.js
deleted
100644 → 0
View file @
1c232f17
// Implement Haskell-Conceal for IPython notebook with IHaskell.
"using strict"
;
var
concealExtension
=
(
function
()
{
var
Pos
=
CodeMirror
.
Pos
;
// Concealable elements
var
conceals
=
{
"
\
\"
: "
λ
",
"
.
": "
∘
",
"
/=
": "
≠
",
"
::
": "
∷
",
"
>>
": "
»
",
"
<<
": "
«
",
"
->
": "
→
",
"
<-
": "
←
",
"
<>
": "
•
",
"
!!
": "
‼
",
"
=>
": "
⇒
",
"
>>=
": "
>>=
",
"
forall
": "
∀
",
"
<=
": "
≤
",
"
>=
": "
≥
",
};
// Concealable infix elements
var infixConceals = {
"
intersect
": "
∩
",
"
intersection
": "
∩
",
"
union
": "
∪
",
"
elem
": "
∈
",
"
notElem
": "
∉
",
};
// Return the previous CodeMirror token
function prevToken(editor, token, line) {
var before = editor.getTokenAt(Pos(line, token.start));
return before;
};
// Return the next CodeMirror token
function nextToken(editor, token, line) {
var after = editor.getTokenAt(Pos(line, token.end + 1));
return after;
};
// Create a DOM element for a given conceal element
function concealDOM(data) {
var span = document.createElement("
span
");
span.innerHTML = data;
return span;
}
// Process a non-infix conceal token.
function markNonInfixToken(editor, line, token) {
// We have a special case for the dot operator. We only want to
// convert it to a fancy composition if there is a space before it.
// This preserves things like [1..1000] which CodeMirror parses
// incorrectly and also lets you write with lenses as record^.a.b.c,
// which looks better.
if (token.string == "
.
") {
var handle = editor.getLineHandle(line);
var ch = token.start;
if (handle.text[ch - 1] != ' ') {
return false;
}
}
// Check if this is a normal concealable element. (non-infix)
for (var str in conceals) {
if (conceals.hasOwnProperty(str)) {
if (token.string == str) {
editor.markText(Pos(line, token.start), Pos(line, token.end), {
replacedWith: concealDOM(conceals[str]),
});
return true;
}
}
}
return false;
}
function markInfixToken(editor, line, prev, token, next) {
if (prev.string != "`" || next.string != "`") {
return false;
}
for (var str in infixConceals) {
if (infixConceals.hasOwnProperty(str)) {
if (token.string == str) {
editor.markText(Pos(line, prev.start), Pos(line, next.end), {
replacedWith: concealDOM(infixConceals[str]),
});
return true;
}
}
}
return true;
}
// Mark a token if necessary (mark means change how it looks).
function markToken(editor, line, token) {
// If it's a backtick, it might be the end of an infix conceal.
if (token.string == "`") {
var prev = prevToken(editor, token, line);
var prev2 = prevToken(editor, prev, line);
return markInfixToken(editor, line, prev2, prev, token);
}
// Otherwise, try it as a normal non-infix token
// Or as the center of an infix token.
else {
var marked = markNonInfixToken(editor, line, token);
if (marked) {
return true;
}
// Try it as the middle of an infix set
var prev = prevToken(editor, token, line);
var next = nextToken(editor, token, line);
return markInfixToken(editor, line, prev, token, next);
}
}
/**
* Activate conceal in CodeMirror options, don't overwrite other settings
*/
function concealCell(editor) {
// Initialize all tokens. Just look at the token at every character.
editor.eachLine(function (handle) {
var l = editor.getLineNumber(handle);
for (var c = 0; c < handle.text.length; c++) {
var token = editor.getTokenAt(Pos(l, c), true);
markToken(editor, l, token);
}
});
editor.on("change", function() {
var cursor = editor.getCursor();
var token = editor.getTokenAt(cursor, true);
markToken(editor, cursor.line, token);
});
}
/**
* Add conceal to new cell
*
*/
createCell = function (event,nbcell,nbindex) {
var cell = nbcell.cell;
if ((cell instanceof IPython.CodeCell)) {
var editor = cell.code_mirror;
concealCell(editor)
}
};
/**
* Add conceal to existing cells
*/
initExtension = function(event) {
var cells = IPython.notebook.get_cells();
for(var i in cells){
var cell = cells[i];
if ((cell instanceof IPython.CodeCell)) {
var editor = cell.code_mirror;
concealCell(editor);
}
}
$([IPython.events]).on('create.Cell',createCell);
}
IPython.concealCell = concealCell;
require([], initExtension);
})();
profile/static/custom/hide_input.js
deleted
100644 → 0
View file @
1c232f17
// This is an extension that enables hiding input cells. It adds a button to
// the cell toolbars to hide and unhide cells, as well as command-mode
// keybindings to left and right arrow keys. Whether or not a cell is hidden is
// stored in the metadata and thus is saved in the notebook. A custom template
// which checks for the "hidden" field in cell metadata could be used to have
// nbconvert ignore hidden cells.
"using strict"
;
var
hideInputCellExtension
=
(
function
(){
var
Pos
=
CodeMirror
.
Pos
;
// What text to show for hidden cells. This has to be created every time,
// otherwise you wouldn't be able to hide more than one cell.
var
createHiding
=
function
()
{
var
hiding
=
document
.
createElement
(
"span"
);
hiding
.
innerHTML
=
"…"
;
return
hiding
;
}
// UI Generator for a simple toggle button. The model for this code is
// taken from IPython.CellToolbar.utils.checkbox_ui_Generator.
IPython
.
CellToolbar
.
utils
.
button_ui_generator
=
function
(
name
,
handler
,
textfun
){
return
function
(
div
,
cell
,
celltoolbar
)
{
var
button_container
=
$
(
div
);
var
initText
=
textfun
(
cell
);
var
button
=
$
(
'<input/>'
).
attr
(
'type'
,
'button'
)
.
attr
(
'value'
,
initText
)
.
css
(
'height'
,
'1.1em'
)
.
css
(
'font-size'
,
20
);
var
lbl
=
$
(
'<label/>'
).
append
(
$
(
'<span/>'
).
text
(
name
));
lbl
.
append
(
button
);
button
.
click
(
function
()
{
handler
(
cell
);
var
newText
=
textfun
(
cell
);
button
.
attr
(
'value'
,
newText
);
});
cell
.
hide_button
=
button
;
cell
.
button_container
=
button_container
;
button_container
.
append
(
$
(
'<div/>'
).
append
(
lbl
));
};
};
// Ensure a cell has the metadata object. Sometimes they don't for unknown reasons.
// Might have something to do with ordering of cell initialization, so this is a hack.
var
requireMetadata
=
function
(
cell
)
{
if
(
cell
.
metadata
===
undefined
)
{
cell
.
metadata
=
{};
cell
.
metadata
.
hidden
=
false
;
}
}
// Return the text to show in the button for this cell.
var
textToShow
=
function
(
cell
)
{
// What text to show on buttons when concealed or shown.
var
concealedButton
=
"⇦"
;
var
shownButton
=
"⇩"
;
requireMetadata
(
cell
);
if
(
cell
.
metadata
.
hidden
)
{
return
concealedButton
;
}
else
{
return
shownButton
;
}
};
// Update whether a cell is visible.
var
updateCellVisibility
=
function
(
cell
,
visible
)
{
cell
.
metadata
.
hidden
=
visible
;
if
(
cell
.
metadata
.
hidden
)
{
if
(
cell
.
mark
===
undefined
)
{
var
editor
=
cell
.
code_mirror
;
var
nLines
=
editor
.
lineCount
();
var
firstLineLen
=
editor
.
getLine
(
0
).
length
;
var
lastLineLen
=
editor
.
getLine
(
nLines
-
1
).
length
;
var
mark
=
editor
.
markText
(
Pos
(
0
,
firstLineLen
),
Pos
(
nLines
,
lastLineLen
+
1
),
{
replacedWith
:
createHiding
(),
});
cell
.
mark
=
mark
;
}
}
else
if
(
cell
.
mark
!==
undefined
)
{
cell
.
mark
.
clear
();
cell
.
mark
=
undefined
;
}
cell
.
hide_button
.
attr
(
'value'
,
textToShow
(
cell
));
}
// Create and register the method that creates the hide arrow.
var
flag_name
=
'hide_input'
;
var
cell_flag_init
=
IPython
.
CellToolbar
.
utils
.
button_ui_generator
(
""
,
function
(
cell
)
{
// Toggle cell visibility.
updateCellVisibility
(
cell
,
!
cell
.
metadata
.
hidden
);
},
textToShow
);
IPython
.
CellToolbar
.
register_callback
(
flag_name
,
cell_flag_init
);
// Create and register the toolbar with IPython.
IPython
.
CellToolbar
.
register_preset
(
'Hiding'
,
[
flag_name
]);
var
updateCellToolbar
=
function
(
cell
)
{
var
type
=
cell
.
cell_type
;
if
(
type
!=
'code'
)
{
// Set cell to visible.
updateCellVisibility
(
cell
,
false
);
// Hide the toolbar on Markdown and other non-code cells.
cell
.
celltoolbar
.
hide
();
}
else
{
// Show toolbar on code cells.
cell
.
celltoolbar
.
show
();
}
};
var
initExtension
=
function
(
event
)
{
IPython
.
CellToolbar
.
activate_preset
(
"Hiding"
);
IPython
.
keyboard_manager
.
command_shortcuts
.
add_shortcuts
({
"left"
:
{
help
:
"Hide an input cell."
,
help_index
:
"zz"
,
handler
:
function
(
event
)
{
var
cell
=
IPython
.
notebook
.
get_selected_cell
();
updateCellVisibility
(
cell
,
true
);
}
},
"right"
:
{
help
:
"Unhide an input cell."
,
help_index
:
"zz"
,
handler
:
function
(
event
)
{
var
cell
=
IPython
.
notebook
.
get_selected_cell
();
updateCellVisibility
(
cell
,
false
);
}
}
});
var
cells
=
IPython
.
notebook
.
get_cells
();
for
(
var
i
in
cells
){
var
cell
=
cells
[
i
];
if
((
cell
instanceof
IPython
.
CodeCell
))
{
updateCellVisibility
(
cell
);
}
updateCellToolbar
(
cell
);
}
$
([
IPython
.
events
]).
on
(
'create.Cell'
,
requireMetadata
);
}
// When enetering edit mode, unhide the current cell so you can edit it.
$
([
IPython
.
events
]).
on
(
'edit_mode.Cell'
,
function
()
{
var
cell
=
IPython
.
notebook
.
get_selected_cell
();
if
(
cell
.
cell_type
!=
"markdown"
)
{
updateCellVisibility
(
cell
,
false
);
}
});
require
([],
initExtension
);
$
([
IPython
.
events
]).
on
(
'selected_cell_type_changed.Notebook'
,
function
(
event
,
data
)
{
var
cell
=
IPython
.
notebook
.
get_selected_cell
();
updateCellToolbar
(
cell
);
});
console
.
log
(
"Loaded input cell hiding extension."
)
})();
profile/templates/ihaskell-basic.tpl
deleted
100644 → 0
View file @
1c232f17
{
%-
extends
'basic.tpl'
-%
}
profile/templates/ihaskell.tpl
deleted
100644 → 0
View file @
1c232f17
{
%-
extends
'full.tpl'
-%
}
{%- block header -%}
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
/>
<title>
{
{
resources
[
'metadata'
][
'name'
]
}
}
</title>
{% for css in resources.inlining.css -%}
<style
type=
"text/css"
>
{
{
css
}
}
</style>
{% endfor %}
<style
type=
"text/css"
>
/* Overrides of notebook CSS for static HTML export */
body
{
overflow
:
visible
;
padding
:
8px
;
}
.input_area
{
padding
:
0.2em
;
}
pre
{
padding
:
0.2em
;
border
:
none
;
margin
:
0px
;
font-size
:
13px
;
}
</style>
<!-- Our custom CSS -->
<style
type=
"text/css"
>
/*
Custom IHaskell CSS.
*/
/* Styles used for the Hoogle display in the pager */
.hoogle-doc
{
display
:
block
;
padding-bottom
:
1.3em
;
padding-left
:
0.4em
;
}
.hoogle-code
{
display
:
block
;
font-family
:
monospace
;
white-space
:
pre
;
}
.hoogle-text
{
display
:
block
;
}
.hoogle-name
{
color
:
green
;
font-weight
:
bold
;
}
.hoogle-head
{
font-weight
:
bold
;
}
.hoogle-sub
{
display
:
block
;
margin-left
:
0.4em
;
}
.hoogle-package
{
font-weight
:
bold
;
font-style
:
italic
;
}
.hoogle-module
{
font-weight
:
bold
;
}
/* Styles used for basic displays */
.get-type
{
color
:
green
;
font-weight
:
bold
;
font-family
:
monospace
;
display
:
block
;
white-space
:
pre
;
}
.show-type
{
color
:
green
;
font-weight
:
bold
;
font-family
:
monospace
;
margin-left
:
1em
;
}
.mono
{
font-family
:
monospace
;
display
:
block
;
}
.err-msg
{
color
:
red
;
font-style
:
italic
;
font-family
:
monospace
;
white-space
:
pre
;
display
:
block
;
}
#unshowable
{
color
:
red
;
font-weight
:
bold
;
}
.err-msg.in.collapse
{
padding-top
:
0.7em
;
}
/* Code that will get highlighted before it is highlighted */
.highlight-code
{
white-space
:
pre
;
font-family
:
monospace
;
}
/* Hlint styles */
.suggestion-warning
{
font-weight
:
bold
;
color
:
rgb
(
200
,
130
,
0
);
}
.suggestion-error
{
font-weight
:
bold
;
color
:
red
;
}
.suggestion-name
{
font-weight
:
bold
;
}
</style>
<script
src=
"https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"
type=
"text/javascript"
></script>
<script
type=
"text/javascript"
>
init_mathjax
=
function
()
{
if
(
window
.
MathJax
)
{
// MathJax loaded
MathJax
.
Hub
.
Config
({
tex2jax
:
{
inlineMath
:
[
[
'$'
,
'$'
],
[
"
\\
("
,
"
\\
)"
]
],
displayMath
:
[
[
'$$'
,
'$$'
],
[
"
\\
["
,
"
\\
]"
]
]
},
displayAlign
:
'left'
,
// Change this to 'center' to center equations.
"HTML-CSS"
:
{
styles
:
{
'.MathJax_Display'
:
{
"margin"
:
0
}}
}
});
MathJax
.
Hub
.
Queue
([
"Typeset"
,
MathJax
.
Hub
]);
}
}
init_mathjax
();
</script>
</head>
{%- endblock header -%}
{% block body %}
<body>
{{ super() }}
</body>
{%- endblock body %}
src/Main.hs
View file @
769a6262
...
@@ -65,6 +65,7 @@ ihaskell (Args Console flags) = showingHelp Console flags $ do
...
@@ -65,6 +65,7 @@ ihaskell (Args Console flags) = showingHelp Console flags $ do
withIPython
$
do
withIPython
$
do
flags
<-
addDefaultConfFile
flags
flags
<-
addDefaultConfFile
flags
info
<-
initInfo
IPythonConsole
flags
info
<-
initInfo
IPythonConsole
flags
putStrLn
"Noo"
runConsole
info
runConsole
info
ihaskell
(
Args
mode
@
(
View
(
Just
fmt
)
(
Just
name
))
args
)
=
showingHelp
mode
args
$
withIPython
$
ihaskell
(
Args
mode
@
(
View
(
Just
fmt
)
(
Just
name
))
args
)
=
showingHelp
mode
args
$
withIPython
$
nbconvert
fmt
name
nbconvert
fmt
name
...
...
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