Commit 68bcf6c5 authored by Andrew Gibiansky's avatar Andrew Gibiansky

Adding logo!

parent 24db4b42
...@@ -7,6 +7,8 @@ module IHaskell.Display ( ...@@ -7,6 +7,8 @@ module IHaskell.Display (
) where ) where
import ClassyPrelude import ClassyPrelude
import Data.String.Utils (rstrip)
import IHaskell.Types import IHaskell.Types
-- | A class for displayable Haskell types. -- | A class for displayable Haskell types.
...@@ -15,7 +17,7 @@ class IHaskellDisplay a where ...@@ -15,7 +17,7 @@ class IHaskellDisplay a where
-- | Generate a plain text display. -- | Generate a plain text display.
plain :: String -> DisplayData plain :: String -> DisplayData
plain = Display PlainText plain = Display PlainText . rstrip
-- | Generate an HTML display. -- | Generate an HTML display.
html :: String -> DisplayData html :: String -> DisplayData
......
...@@ -190,7 +190,7 @@ evalCommand (Directive GetType expr) = wrapExecution $ do ...@@ -190,7 +190,7 @@ evalCommand (Directive GetType expr) = wrapExecution $ do
result <- exprType expr result <- exprType expr
flags <- getSessionDynFlags flags <- getSessionDynFlags
let typeStr = showSDocUnqual flags $ ppr result let typeStr = showSDocUnqual flags $ ppr result
return [Display PlainText typeStr, Display MimeHtml $ formatGetType typeStr] return [plain typeStr, html $ formatGetType typeStr]
evalCommand (Statement stmt) = do evalCommand (Statement stmt) = do
write $ "Statement: " ++ stmt write $ "Statement: " ++ stmt
...@@ -200,7 +200,7 @@ evalCommand (Statement stmt) = do ...@@ -200,7 +200,7 @@ evalCommand (Statement stmt) = do
RunOk names -> do RunOk names -> do
dflags <- getSessionDynFlags dflags <- getSessionDynFlags
write $ "Names: " ++ show (map (showPpr dflags) names) write $ "Names: " ++ show (map (showPpr dflags) names)
let output = [Display PlainText printed | not . null $ strip printed] let output = [plain printed | not . null $ strip printed]
return (Success, output) return (Success, output)
RunException exception -> do RunException exception -> do
write $ "RunException: " ++ show exception write $ "RunException: " ++ show exception
...@@ -300,6 +300,7 @@ formatError :: ErrMsg -> String ...@@ -300,6 +300,7 @@ formatError :: ErrMsg -> String
formatError = printf "<span style='color: red; font-style: italic;'>%s</span>" . formatError = printf "<span style='color: red; font-style: italic;'>%s</span>" .
replace "\n" "<br/>" . replace "\n" "<br/>" .
replace useDashV "" . replace useDashV "" .
rstrip .
typeCleaner typeCleaner
where where
useDashV = "\nUse -v to see a list of the files searched for." useDashV = "\nUse -v to see a list of the files searched for."
...@@ -312,4 +313,4 @@ formatGetType :: String -> String ...@@ -312,4 +313,4 @@ formatGetType :: String -> String
formatGetType = printf "<span style='font-weight: bold; color: green;'>%s</span>" formatGetType = printf "<span style='font-weight: bold; color: green;'>%s</span>"
displayError :: ErrMsg -> [DisplayData] displayError :: ErrMsg -> [DisplayData]
displayError msg = [Display PlainText msg, Display MimeHtml $ formatError msg] displayError msg = [plain msg, html $ formatError msg]
...@@ -97,6 +97,9 @@ writeConfigFilesTo profileDir ihaskellPath = do ...@@ -97,6 +97,9 @@ writeConfigFilesTo profileDir ihaskellPath = do
mkdir_p (conf "static/custom/") mkdir_p (conf "static/custom/")
writeFile (conf "static/custom/custom.js") Config.customjs writeFile (conf "static/custom/custom.js") Config.customjs
-- Make directory for images.
mkdir_p (conf "static/base/images")
-- The notebook/js directory many not exist, in which case we'll create it. -- The notebook/js directory many not exist, in which case we'll create it.
mkdir_p (conf "static/notebook/") mkdir_p (conf "static/notebook/")
mkdir_p (conf "static/notebook/js") mkdir_p (conf "static/notebook/js")
......
...@@ -144,7 +144,6 @@ replyTo interface ExecuteRequest{ getCode = code } replyHeader state = do ...@@ -144,7 +144,6 @@ replyTo interface ExecuteRequest{ getCode = code } replyHeader state = do
-- Construct a function for publishing output as this is going. -- Construct a function for publishing output as this is going.
let publish :: [DisplayData] -> Interpreter () let publish :: [DisplayData] -> Interpreter ()
publish outputs = do publish outputs = do
liftIO $ print outputs
header <- dupHeader replyHeader DisplayDataMessage header <- dupHeader replyHeader DisplayDataMessage
send $ PublishDisplayData header "haskell" outputs send $ PublishDisplayData header "haskell" outputs
......
...@@ -6,7 +6,12 @@ main :: IO () ...@@ -6,7 +6,12 @@ main :: IO ()
main = defaultMainWithHooks simpleUserHooks{ main = defaultMainWithHooks simpleUserHooks{
preConf = \args confFlags -> do preConf = \args confFlags -> do
buildParser buildParser
preConf simpleUserHooks args confFlags preConf simpleUserHooks args confFlags,
postInst = \args flags descr buildInfo -> do
postInst simpleUserHooks args flags descr buildInfo
system "IHaskell setup"
system "cp ./images/ihaskell-logo.png `ipython locate profile haskell`/static/base/images/ipynblogo.png"
return ()
} }
buildParser = system "./build-parser.sh" buildParser = system "./build-parser.sh"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment