blob: 8d8673cf60556e2943fca4ce43583bdd508f1f4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
{- |
Module : Text.Pandoc.Writers.JATS.Types
Copyright : Copyright (C) 2017-2021 John MacFarlane
License : GNU GPL, version 2 or above
Maintainer : John MacFarlane <jgm@berkeley.edu>
Stability : alpha
Portability : portable
Types for pandoc's JATS writer.
-}
module Text.Pandoc.Writers.JATS.Types
( JATS
, JATSEnv (..)
, JATSState (..)
, JATSTagSet (..)
)
where
import Citeproc.Types (Reference)
import Control.Monad.Reader (ReaderT)
import Control.Monad.State (StateT)
import Data.Text (Text)
import Text.DocLayout (Doc)
import Text.Pandoc.Builder (Block, Inline, Inlines)
import Text.Pandoc.Options (WriterOptions)
-- | JATS tag set variant
data JATSTagSet
= TagSetArchiving -- ^ Archiving and Interchange Tag Set
| TagSetPublishing -- ^ Journal Publishing Tag Set
| TagSetArticleAuthoring -- ^ Article Authoring Tag Set
deriving (Eq)
-- | Internal state used by the writer.
newtype JATSState = JATSState
{ jatsNotes :: [(Int, Doc Text)]
}
-- | Environment containing all information relevant for rendering.
data JATSEnv m = JATSEnv
{ jatsTagSet :: JATSTagSet -- ^ The tag set that's being ouput
, jatsBlockWriter :: (Block -> Bool)
-> WriterOptions -> [Block] -> JATS m (Doc Text)
-- ^ Converts a block list to JATS, wrapping top-level blocks into a
-- @<p>@ element if the property evaluates to @True@.
-- See #7227.
, jatsInlinesWriter :: WriterOptions -> [Inline] -> JATS m (Doc Text)
-- ^ Converts an inline list to JATS.
, jatsReferences :: [Reference Inlines] -- ^ List of references
}
-- | JATS writer type
type JATS m = StateT JATSState (ReaderT (JATSEnv m) m)
|