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
bb907baf
Commit
bb907baf
authored
Mar 03, 2015
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Emitting custom.css on each cell evaluation
parent
769a6262
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
5 deletions
+15
-5
kernel.js
html/kernel.js
+0
-0
ihaskell.cabal
ihaskell.cabal
+2
-2
IPython.hs
src/IHaskell/IPython.hs
+4
-0
Main.hs
src/Main.hs
+9
-3
No files found.
html/
custom
.js
→
html/
kernel
.js
View file @
bb907baf
File moved
ihaskell.cabal
View file @
bb907baf
...
@@ -43,8 +43,7 @@ build-type: Simple
...
@@ -43,8 +43,7 @@ build-type: Simple
cabal-version: >=1.16
cabal-version: >=1.16
data-files:
data-files:
html/custom.css
html/kernel.js
html/custom.js
html/logo-64x64.png
html/logo-64x64.png
library
library
...
@@ -136,6 +135,7 @@ executable IHaskell
...
@@ -136,6 +135,7 @@ executable IHaskell
ghc ==7.6.* || == 7.8.*,
ghc ==7.6.* || == 7.8.*,
ihaskell -any,
ihaskell -any,
MissingH >=1.2,
MissingH >=1.2,
here ==1.2.*,
text -any,
text -any,
ipython-kernel >= 0.2,
ipython-kernel >= 0.2,
unix >= 2.6
unix >= 2.6
...
...
src/IHaskell/IPython.hs
View file @
bb907baf
...
@@ -185,6 +185,10 @@ installKernelspec = void $ do
...
@@ -185,6 +185,10 @@ installKernelspec = void $ do
mkdir_p
kernelDir
mkdir_p
kernelDir
writefile
filename
$
toStrict
$
toLazyText
$
encodeToTextBuilder
$
toJSON
kernelSpec
writefile
filename
$
toStrict
$
toLazyText
$
encodeToTextBuilder
$
toJSON
kernelSpec
let
files
=
[
"kernel.js"
,
"logo-64x64.png"
]
forM_
files
$
\
file
->
do
src
<-
liftIO
$
Paths
.
getDataFileName
$
"html/"
++
file
cp
(
fpFromString
src
)
(
tmp
</>
kernelName
</>
fpFromString
file
)
Just
ipython
<-
which
"ipython"
Just
ipython
<-
which
"ipython"
silently
$
run
ipython
[
"kernelspec"
,
"install"
,
"--user"
,
fpToText
kernelDir
]
silently
$
run
ipython
[
"kernelspec"
,
"install"
,
"--user"
,
fpToText
kernelDir
]
...
...
src/Main.hs
View file @
bb907baf
{-# LANGUAGE NoImplicitPrelude, CPP, OverloadedStrings, ScopedTypeVariables #-}
{-# LANGUAGE NoImplicitPrelude, CPP, OverloadedStrings, ScopedTypeVariables
, QuasiQuotes
#-}
-- | Description : Argument parsing and basic messaging loop, using Haskell
-- | Description : Argument parsing and basic messaging loop, using Haskell
-- Chans to communicate with the ZeroMQ sockets.
-- Chans to communicate with the ZeroMQ sockets.
module
Main
where
module
Main
where
...
@@ -17,6 +17,7 @@ import System.Exit (exitSuccess)
...
@@ -17,6 +17,7 @@ import System.Exit (exitSuccess)
import
Text.Printf
import
Text.Printf
import
System.Posix.Signals
import
System.Posix.Signals
import
qualified
Data.Map
as
Map
import
qualified
Data.Map
as
Map
import
Data.String.Here
(
hereFile
)
-- IHaskell imports.
-- IHaskell imports.
import
IHaskell.Convert
(
convert
)
import
IHaskell.Convert
(
convert
)
...
@@ -44,6 +45,9 @@ ghcVersionInts = map read . words . map dotToSpace $ VERSION_ghc
...
@@ -44,6 +45,9 @@ ghcVersionInts = map read . words . map dotToSpace $ VERSION_ghc
dotToSpace
'.'
=
' '
dotToSpace
'.'
=
' '
dotToSpace
x
=
x
dotToSpace
x
=
x
ihaskellCSS
::
String
ihaskellCSS
=
[
hereFile
|
html/custom.css
|]
consoleBanner
::
Text
consoleBanner
::
Text
consoleBanner
=
consoleBanner
=
"Welcome to IHaskell! Run `IHaskell --help` for more information.
\n
"
++
"Welcome to IHaskell! Run `IHaskell --help` for more information.
\n
"
++
...
@@ -65,7 +69,6 @@ ihaskell (Args Console flags) = showingHelp Console flags $ do
...
@@ -65,7 +69,6 @@ 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
...
@@ -286,12 +289,15 @@ replyTo interface req@ExecuteRequest{ getCode = code } replyHeader state = do
...
@@ -286,12 +289,15 @@ replyTo interface req@ExecuteRequest{ getCode = code } replyHeader state = do
sendOutput
(
ManyDisplay
manyOuts
)
=
mapM_
sendOutput
manyOuts
sendOutput
(
ManyDisplay
manyOuts
)
=
mapM_
sendOutput
manyOuts
sendOutput
(
Display
outs
)
=
do
sendOutput
(
Display
outs
)
=
do
header
<-
dupHeader
replyHeader
DisplayDataMessage
header
<-
dupHeader
replyHeader
DisplayDataMessage
send
$
PublishDisplayData
header
"haskell"
$
map
convertSvgToHtml
outs
send
$
PublishDisplayData
header
"haskell"
$
map
(
convertSvgToHtml
.
prependCss
)
outs
convertSvgToHtml
(
DisplayData
MimeSvg
svg
)
=
html
$
makeSvgImg
$
base64
$
encodeUtf8
svg
convertSvgToHtml
(
DisplayData
MimeSvg
svg
)
=
html
$
makeSvgImg
$
base64
$
encodeUtf8
svg
convertSvgToHtml
x
=
x
convertSvgToHtml
x
=
x
makeSvgImg
base64data
=
unpack
$
"<img src=
\"
data:image/svg+xml;base64,"
++
base64data
++
"
\"
/>"
makeSvgImg
base64data
=
unpack
$
"<img src=
\"
data:image/svg+xml;base64,"
++
base64data
++
"
\"
/>"
prependCss
(
DisplayData
MimeHtml
html
)
=
DisplayData
MimeHtml
$
concat
[
"<style>"
,
pack
ihaskellCSS
,
"</style>"
,
html
]
prependCss
x
=
x
startComm
::
CommInfo
->
IO
()
startComm
::
CommInfo
->
IO
()
startComm
(
CommInfo
widget
uuid
target
)
=
do
startComm
(
CommInfo
widget
uuid
target
)
=
do
-- Send the actual comm open.
-- Send the actual comm open.
...
...
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