gdritter repos ptolemy / b45d2cc
First pass at packed, richer versions of basic Pandoc types Getty Ritter 8 years ago
2 changed file(s) with 112 addition(s) and 4 deletion(s). Collapse all Expand all
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)
77 author: Getty Ritter
88 maintainer: gettyritter@gmail.com
99 copyright: ©2016 Getty Ritter
10 category: Text
10 category: Text
1111 build-type: Simple
12 cabal-version: >=1.0
12 cabal-version: >= 1.2
1313
1414 library
15 -- exposed-modules:
15 exposed-modules: Text.Ptolemy.Core
1616 ghc-options: -Wall
17 build-depends: base >=4.7 && <4.9
17 build-depends: base >=4.7 && <4.9,
18 vector,
19 text
1820 default-language: Haskell2010
1921 default-extensions: OverloadedStrings,
2022 ScopedTypeVariables