module Text.Pandoc.CrossRef.References.Types where
import qualified Data.Map as M
import Text.Pandoc.Definition
import Control.Monad.State
import Data.Default
import Data.Accessor.Template
type Index = [(Int, Maybe String)]
data RefRec = RefRec { refIndex :: Index
, refTitle :: [Inline]
, refSubfigure :: Maybe Index
} deriving (Show, Eq)
type RefMap = M.Map String RefRec
data References = References { imgRefs_ :: RefMap
, eqnRefs_ :: RefMap
, tblRefs_ :: RefMap
, lstRefs_ :: RefMap
, secRefs_ :: RefMap
, curChap_ :: Index
} deriving (Show, Eq)
type WS a = State References a
instance Default References where
def = References n n n n n []
where n = M.empty
deriveAccessors ''References