| 1 |
module Text.Ptolemy.Core where
|
| 2 |
|
| 3 |
import Data.Text (Text)
|
| 4 |
import qualified Data.Text as T
|
| 5 |
import Data.Vector (Vector)
|
| 6 |
import qualified Data.Vector as V
|
| 7 |
|
| 8 |
type Document = Vector Block
|
| 9 |
type DocumentList = Vector Document
|
| 10 |
type Chunk = Vector Inline
|
| 11 |
|
| 12 |
data Block
|
| 13 |
= Plain Chunk
|
| 14 |
| Para Chunk
|
| 15 |
| CodeBlock Attr Text
|
| 16 |
| RawBlock Format Text
|
| 17 |
| BlockQuote Document
|
| 18 |
| OrderedList ListAttributes DocumentList
|
| 19 |
| BulletList DocumentList
|
| 20 |
| DefinitionList (Vector (Chunk, DocumentList))
|
| 21 |
| Header Int Attr Chunk
|
| 22 |
| HorizontalRule
|
| 23 |
-- | Table ???
|
| 24 |
| Div Attr Document
|
| 25 |
| Null
|
| 26 |
deriving (Eq, Show, Read, Ord)
|
| 27 |
|
| 28 |
data Inline
|
| 29 |
= Str Text
|
| 30 |
| Emph Chunk
|
| 31 |
| Strong Chunk
|
| 32 |
| Strikeout Chunk
|
| 33 |
| Superscript Chunk
|
| 34 |
| Subscript Chunk
|
| 35 |
| SmallCaps Chunk
|
| 36 |
| Quoted QuoteType Chunk
|
| 37 |
| Cite (Vector Citation) Chunk
|
| 38 |
| Code Attr Text
|
| 39 |
| Space
|
| 40 |
| SoftBreak
|
| 41 |
| LineBreak
|
| 42 |
| Math MathType Text
|
| 43 |
| RawInline Format Text
|
| 44 |
| Link Attr Chunk Target
|
| 45 |
| Image Attr Chunk Target
|
| 46 |
| Note Document
|
| 47 |
| Span Attr Chunk
|
| 48 |
deriving (Eq, Show, Read, Ord)
|
| 49 |
|
| 50 |
data Attr = Attr
|
| 51 |
{ attrIdentifier :: Text
|
| 52 |
, attrClasses :: Vector Text
|
| 53 |
, attrProps :: Vector (Text, Text)
|
| 54 |
} deriving (Eq, Show, Read, Ord)
|
| 55 |
|
| 56 |
data ListAttributes = ListAttributes
|
| 57 |
{ laWhatever :: Int -- XXX What is this field for?
|
| 58 |
, laNumberStyle :: ListNumberStyle
|
| 59 |
, laNumberDelim :: ListNumberDelim
|
| 60 |
} deriving (Eq, Show, Read, Ord)
|
| 61 |
|
| 62 |
data Citation = Citation
|
| 63 |
{ ciId :: Text
|
| 64 |
, ciPrefix :: Chunk
|
| 65 |
, ciSuffix :: Chunk
|
| 66 |
, ciMode :: CitationMode
|
| 67 |
, ciNoteNum :: Int
|
| 68 |
, ciHash :: Int
|
| 69 |
} deriving (Eq, Show, Read, Ord)
|
| 70 |
|
| 71 |
data CitationMode
|
| 72 |
= AuthorInText
|
| 73 |
| SuppressAuthor
|
| 74 |
| NormalCitation
|
| 75 |
deriving (Eq, Show, Read, Ord)
|
| 76 |
|
| 77 |
data ListNumberStyle
|
| 78 |
= DefaultStyle
|
| 79 |
| Example
|
| 80 |
| Decimal
|
| 81 |
| LowerRoman
|
| 82 |
| UpperRoman
|
| 83 |
| LowerAlpha
|
| 84 |
| UpperAlpha
|
| 85 |
deriving (Eq, Show, Read, Ord)
|
| 86 |
|
| 87 |
data ListNumberDelim
|
| 88 |
= DefaultDelim
|
| 89 |
| Period
|
| 90 |
| OneParen
|
| 91 |
| TwoParens
|
| 92 |
deriving (Eq, Show, Read, Ord)
|
| 93 |
|
| 94 |
data QuoteType = SingleQuote | DoubleQuote
|
| 95 |
deriving (Eq, Show, Read, Ord)
|
| 96 |
|
| 97 |
data MathType = DisplayMath | InlineMath
|
| 98 |
deriving (Eq, Show, Read, Ord)
|
| 99 |
|
| 100 |
newtype Format = Format { fromFormat :: Text }
|
| 101 |
deriving (Eq, Show, Read, Ord)
|
| 102 |
|
| 103 |
data Target = Target
|
| 104 |
{ tgtURL :: Text
|
| 105 |
, tgtTitle :: Text
|
| 106 |
} deriving (Eq, Show, Read, Ord)
|