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
79db72cf
Commit
79db72cf
authored
Mar 09, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates to Display for using Text. Now compiles and runs.
parent
fb22bcf4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
Args.hs
src/IHaskell/Convert/Args.hs
+3
-3
Display.hs
src/IHaskell/Display.hs
+7
-7
Flags.hs
src/IHaskell/Flags.hs
+3
-3
No files found.
src/IHaskell/Convert/Args.hs
View file @
79db72cf
...
...
@@ -11,7 +11,7 @@ import Data.Char (toLower)
import
Data.List
(
partition
)
import
Data.Maybe
(
fromMaybe
)
import
qualified
Data.Text.Lazy
as
T
(
pack
,
Text
)
import
IHaskell.Flags
(
Argument
(
ConvertFrom
,
ConvertFromFormat
,
ConvertLhsStyle
,
ConvertTo
,
ConvertToFormat
,
OverwriteFiles
),
LhsStyle
,
lhsStyleBird
,
NotebookFormat
(
..
))
import
IHaskell.Flags
(
Argument
(
..
),
LhsStyle
,
lhsStyleBird
,
NotebookFormat
(
..
))
import
System.FilePath
((
<.>
),
dropExtension
,
takeExtension
)
import
Text.Printf
(
printf
)
...
...
@@ -93,7 +93,7 @@ mergeArg (ConvertTo outputFile) convertSpec
convertToIpynb
=
case
(
convertToIpynb
convertSpec
,
fromExt
outputFile
)
of
(
prev
,
Nothing
)
->
prev
(
prev
@
(
Just
_
),
_
)
->
prev
(
Nothing
,
format
)
->
fmap
(
==
I
PYNB
)
format
(
Nothing
,
format
)
->
fmap
(
==
I
pynbFile
)
format
}
mergeArg
unexpectedArg
_
=
error
$
"IHaskell.Convert.mergeArg: impossible argument: "
...
...
@@ -103,5 +103,5 @@ mergeArg unexpectedArg _ = error $ "IHaskell.Convert.mergeArg: impossible argume
fromExt
::
FilePath
->
Maybe
NotebookFormat
fromExt
s
=
case
map
toLower
(
takeExtension
s
)
of
".lhs"
->
Just
LhsMarkdown
".ipynb"
->
Just
I
PYNB
".ipynb"
->
Just
I
pynbFile
_
->
Nothing
src/IHaskell/Display.hs
View file @
79db72cf
...
...
@@ -11,14 +11,14 @@ module IHaskell.Display (
import
ClassyPrelude
import
Data.Serialize
as
Serialize
import
Data.ByteString
hiding
(
map
)
import
Data.ByteString
hiding
(
map
,
pack
)
import
Data.String.Utils
(
rstrip
)
import
qualified
Data.ByteString.Base64
as
Base64
import
qualified
Data.ByteString.Char8
as
Char
import
IHaskell.Types
type
Base64
=
ByteString
type
Base64
=
Text
-- | A class for displayable Haskell types.
--
...
...
@@ -59,19 +59,19 @@ many = ManyDisplay
-- | Generate a plain text display.
plain
::
String
->
DisplayData
plain
=
DisplayData
PlainText
.
Char
.
pack
.
rstrip
plain
=
DisplayData
PlainText
.
pack
.
rstrip
-- | Generate an HTML display.
html
::
String
->
DisplayData
html
=
DisplayData
MimeHtml
.
Char
.
pack
html
=
DisplayData
MimeHtml
.
pack
-- | Genreate an SVG display.
svg
::
String
->
DisplayData
svg
=
DisplayData
MimeSvg
.
Char
.
pack
svg
=
DisplayData
MimeSvg
.
pack
-- | Genreate a LaTeX display.
latex
::
String
->
DisplayData
latex
=
DisplayData
MimeLatex
.
Char
.
pack
latex
=
DisplayData
MimeLatex
.
pack
-- | Generate a PNG display of the given width and height. Data must be
-- provided in a Base64 encoded manner, suitable for embedding into HTML.
...
...
@@ -91,7 +91,7 @@ encode64 str = base64 $ Char.pack str
-- | Convert from a ByteString into base 64 encoded data.
base64
::
ByteString
->
Base64
base64
=
Base64
.
encode
base64
=
decodeUtf8
.
Base64
.
encode
-- | For internal use within IHaskell.
-- Serialize displays to a ByteString.
...
...
src/IHaskell/Flags.hs
View file @
79db72cf
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE NoImplicitPrelude
, DeriveFunctor
#-}
module
IHaskell.Flags
(
IHaskellMode
(
..
),
Argument
(
..
),
...
...
@@ -48,7 +48,7 @@ data LhsStyle string = LhsStyle
data
NotebookFormat
=
LhsMarkdown
|
Ipynb
|
Ipynb
File
deriving
(
Eq
,
Show
)
-- Which mode IHaskell is being invoked in.
...
...
@@ -143,7 +143,7 @@ convert = mode "convert" (Args ConvertLhs []) description unnamedArg convertFlag
storeFormat
constructor
str
(
Args
mode
prev
)
=
case
toLower
str
of
"lhs"
->
Right
$
Args
mode
$
constructor
LhsMarkdown
:
prev
"ipynb"
->
Right
$
Args
mode
$
constructor
I
PYNB
:
prev
"ipynb"
->
Right
$
Args
mode
$
constructor
I
pynbFile
:
prev
_
->
Left
$
"Unknown format requested: "
++
str
storeLhs
str
previousArgs
=
case
toLower
str
of
...
...
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