|
@@ -1,7 +1,6 @@
|
|
module Text.Ptolemy.Core where
|
|
module Text.Ptolemy.Core where
|
|
|
|
|
|
import Data.Text (Text)
|
|
import Data.Text (Text)
|
|
-import qualified Data.Text as T
|
|
|
|
import Data.Vector (Vector)
|
|
import Data.Vector (Vector)
|
|
import qualified Data.Vector as V
|
|
import qualified Data.Vector as V
|
|
|
|
|
|
@@ -9,6 +8,12 @@ type Document = Vector Block
|
|
type DocumentList = Vector Document
|
|
type DocumentList = Vector Document
|
|
type Chunk = Vector Inline
|
|
type Chunk = Vector Inline
|
|
|
|
|
|
|
|
+newtype PtolemyError = PtolemyError { ptolemyErrorMessage :: String }
|
|
|
|
+ deriving (Eq, Show)
|
|
|
|
+
|
|
|
|
+vec :: [a] -> Vector a
|
|
|
|
+vec = V.fromList
|
|
|
|
+
|
|
data Block
|
|
data Block
|
|
= Plain Chunk
|
|
= Plain Chunk
|
|
| Para Chunk
|
|
| Para Chunk
|
|
@@ -17,7 +22,7 @@ data Block
|
|
| BlockQuote Document
|
|
| BlockQuote Document
|
|
| OrderedList ListAttributes DocumentList
|
|
| OrderedList ListAttributes DocumentList
|
|
| BulletList DocumentList
|
|
| BulletList DocumentList
|
|
- | DefinitionList (Vector (Chunk, DocumentList))
|
|
|
|
|
|
+ | DefinitionList (Vector Definition)
|
|
| Header Int Attr Chunk
|
|
| Header Int Attr Chunk
|
|
| HorizontalRule
|
|
| HorizontalRule
|
|
-- | Table ???
|
|
-- | Table ???
|
|
@@ -25,6 +30,11 @@ data Block
|
|
| Null
|
|
| Null
|
|
deriving (Eq, Show, Read, Ord)
|
|
deriving (Eq, Show, Read, Ord)
|
|
|
|
|
|
|
|
+data Definition = Definition
|
|
|
|
+ { dfTerm :: Chunk
|
|
|
|
+ , dfDefinition :: DocumentList
|
|
|
|
+ } deriving (Eq, Show, Read, Ord)
|
|
|
|
+
|
|
data Inline
|
|
data Inline
|
|
= Str Text
|
|
= Str Text
|
|
| Emph Chunk
|
|
| Emph Chunk
|
|
@@ -53,6 +63,13 @@ data Attr = Attr
|
|
, attrProps :: Vector (Text, Text)
|
|
, attrProps :: Vector (Text, Text)
|
|
} deriving (Eq, Show, Read, Ord)
|
|
} deriving (Eq, Show, Read, Ord)
|
|
|
|
|
|
|
|
+emptyAttr :: Attr
|
|
|
|
+emptyAttr = Attr
|
|
|
|
+ { attrIdentifier = ""
|
|
|
|
+ , attrClasses = vec []
|
|
|
|
+ , attrProps = vec []
|
|
|
|
+ }
|
|
|
|
+
|
|
data ListAttributes = ListAttributes
|
|
data ListAttributes = ListAttributes
|
|
{ laWhatever :: Int -- XXX What is this field for?
|
|
{ laWhatever :: Int -- XXX What is this field for?
|
|
, laNumberStyle :: ListNumberStyle
|
|
, laNumberStyle :: ListNumberStyle
|