| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Ipe.Reader
Synopsis
- readRawIpeFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpeFile r))
- readIpeFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpeFile r))
- readSinglePageFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpePage r))
- readSinglePageFileThrow :: (Coordinate r, Eq r) => OsPath -> IO (IpePage r)
- type ConversionError = Text
- readIpeStylesheet :: OsPath -> IO (Either ConversionError IpeStyle)
- addStyleSheetFrom :: OsPath -> IpeFile r -> IO (IpeFile r)
- fromIpeXML :: forall {k} t (r :: k). IpeRead (t r) => ByteString -> Either ConversionError (t r)
- readXML :: ByteString -> Either ConversionError (Node Text Text)
- class IpeReadText t where
- ipeReadText :: Text -> Either ConversionError t
- class IpeRead t where
- class IpeReadAttributes ats where
- ipeReadAttrs :: [(Text, Text)] -> Either ConversionError ats
- ipeReadAttrsFrom :: IpeReadAttributes ats => Node Text Text -> Either ConversionError ats
- ipeReadTextWith :: (Text -> Either t v) -> Text -> Either ConversionError (IpeValue v)
- ipeReadObject :: (IpeRead (i r), IpeReadAttributes (IpeAttributes i r)) => Proxy i -> proxy r -> Node Text Text -> Either ConversionError (i r :+ IpeAttributes i r)
- class Fractional r => Coordinate r where
Reading ipe Files
readRawIpeFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpeFile r)) Source #
Given a file path, tries to read an ipe file
readIpeFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpeFile r)) Source #
Given a file path, tries to read an ipe file.
This function applies all matrices to objects.
readSinglePageFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpePage r)) Source #
Since most Ipe file contain only one page, we provide a shortcut for that as well.
This function applies all matrices, and it makes sure there is at least one layer and view in the page.
readSinglePageFileThrow :: (Coordinate r, Eq r) => OsPath -> IO (IpePage r) Source #
Tries to read a single page file, throws an error when this
fails. See readSinglePageFile for further details.
type ConversionError = Text Source #
Readiing ipe style files
readIpeStylesheet :: OsPath -> IO (Either ConversionError IpeStyle) Source #
Reads an Ipe stylesheet from Disk.
addStyleSheetFrom :: OsPath -> IpeFile r -> IO (IpeFile r) Source #
Given a path to a stylesheet, add it to the ipe file with the highest priority. Throws an error when this fails.
Reading XML directly
fromIpeXML :: forall {k} t (r :: k). IpeRead (t r) => ByteString -> Either ConversionError (t r) Source #
Given a Bytestring, try to parse the bytestring into anything that is IpeReadable, i.e. any of the Ipe elements.
readXML :: ByteString -> Either ConversionError (Node Text Text) Source #
Reads the data from a Bytestring into a proper Node
Read classes
class IpeReadText t where Source #
Reading an ipe elemtn from a Text value
Methods
ipeReadText :: Text -> Either ConversionError t Source #
Try to read the text content into a value of type t
Instances
class IpeRead t where Source #
Reading an ipe lement from Xml
Methods
ipeRead :: Node Text Text -> Either ConversionError t Source #
Try to convert an xml tree into a value of type t
Instances
| IpeRead LayerName Source # | |
Defined in Ipe.Reader | |
| IpeRead IpeStyle Source # | |
Defined in Ipe.Reader | |
| IpeRead View Source # | |
Defined in Ipe.Reader | |
| (Coordinate r, Eq r) => IpeRead (Group r) Source # | |
Defined in Ipe.Reader | |
| Coordinate r => IpeRead (Image r) Source # | |
Defined in Ipe.Reader | |
| (Coordinate r, Fractional r, Eq r) => IpeRead (IpeObject r) Source # | |
Defined in Ipe.Reader | |
| Coordinate r => IpeRead (IpeSymbol r) Source # | Ipe read instances |
Defined in Ipe.Reader | |
| Coordinate r => IpeRead (MiniPage r) Source # | |
Defined in Ipe.Reader | |
| Coordinate r => IpeRead (TextLabel r) Source # | |
Defined in Ipe.Reader | |
| (Coordinate r, Fractional r, Eq r) => IpeRead (Path r) Source # | |
Defined in Ipe.Reader | |
| (Coordinate r, Eq r) => IpeRead (IpeFile r) Source # | |
Defined in Ipe.Reader | |
| (Coordinate r, Eq r) => IpeRead (IpePage r) Source # | |
Defined in Ipe.Reader | |
class IpeReadAttributes ats where Source #
Methods
ipeReadAttrs :: [(Text, Text)] -> Either ConversionError ats Source #
Given the attributes in their text form, try to parse them
Instances
ipeReadAttrsFrom :: IpeReadAttributes ats => Node Text Text -> Either ConversionError ats Source #
read the attributes of a given node
Some low level implementation functions
ipeReadTextWith :: (Text -> Either t v) -> Text -> Either ConversionError (IpeValue v) Source #
ipeReadObject :: (IpeRead (i r), IpeReadAttributes (IpeAttributes i r)) => Proxy i -> proxy r -> Node Text Text -> Either ConversionError (i r :+ IpeAttributes i r) Source #
If we can ipeRead an ipe element, and we can ipeReadAttrs its attributes we can properly read an ipe object using ipeReadObject
class Fractional r => Coordinate r where Source #
Represent stuff that can be used as a coordinate in ipe. (similar to show/read)
Minimal complete definition
Nothing
Methods
Instances
| Coordinate Double Source # | |
| Coordinate Float Source # | |
| Coordinate (Ratio Integer) Source # | |
| (Coordinate r, Ord r) => Coordinate (IntervalReal r) Source # | |
Defined in Ipe.PathParser | |
| Coordinate (RealNumber p) Source # | |
Defined in Ipe.PathParser | |
| (Coordinate r, Ord r, AbsoluteTolerance tol) => Coordinate (AbsolutelyApproximateValue tol r) Source # | |
Defined in Ipe.PathParser | |
| HasResolution p => Coordinate (Fixed p) Source # | |