{-# LANGUAGE Strict #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
module Djot.AST
( Inline(..),
Many(..),
Inlines,
MathStyle(..),
Format(..),
Node(Node),
Pos(..),
addAttr,
addPos,
Block(..),
Blocks,
Doc(..),
NoteMap(..),
insertNote,
lookupNote,
ReferenceMap(..),
insertReference,
lookupReference,
normalizeLabel,
Attr(..),
Target(..),
TaskStatus(..),
Align(..),
Cell(..),
CellType(..),
Caption(..),
ListSpacing(..),
OrderedListAttributes(..),
OrderedListDelim(..),
OrderedListStyle(..),
QuoteType(..),
delete,
displayMath,
insert,
emailLink,
emph,
footnoteReference,
hardBreak,
highlight,
image,
inlineMath,
link,
nonBreakingSpace,
rawInline,
softBreak,
span_,
str,
strong,
subscript,
superscript,
singleQuoted,
doubleQuoted,
symbol,
verbatim,
urlLink,
para,
section,
heading,
blockQuote,
codeBlock,
div,
bulletList,
orderedList,
definitionList,
taskList,
thematicBreak,
table,
rawBlock,
inlinesToByteString
)
where
import Prelude hiding (div)
import Data.ByteString (ByteString)
import Data.Sequence (Seq)
import qualified Data.Sequence as Seq
import qualified Data.Map.Strict as M
import Data.Set (Set)
import Data.Data (Data, Typeable)
import qualified Data.ByteString.Char8 as B8
import GHC.Generics (Generic)
newtype Attr = Attr [(ByteString, ByteString)]
deriving (Int -> Attr -> ShowS
[Attr] -> ShowS
Attr -> String
(Int -> Attr -> ShowS)
-> (Attr -> String) -> ([Attr] -> ShowS) -> Show Attr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Attr -> ShowS
showsPrec :: Int -> Attr -> ShowS
$cshow :: Attr -> String
show :: Attr -> String
$cshowList :: [Attr] -> ShowS
showList :: [Attr] -> ShowS
Show, Attr -> Attr -> Bool
(Attr -> Attr -> Bool) -> (Attr -> Attr -> Bool) -> Eq Attr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Attr -> Attr -> Bool
== :: Attr -> Attr -> Bool
$c/= :: Attr -> Attr -> Bool
/= :: Attr -> Attr -> Bool
Eq, Eq Attr
Eq Attr =>
(Attr -> Attr -> Ordering)
-> (Attr -> Attr -> Bool)
-> (Attr -> Attr -> Bool)
-> (Attr -> Attr -> Bool)
-> (Attr -> Attr -> Bool)
-> (Attr -> Attr -> Attr)
-> (Attr -> Attr -> Attr)
-> Ord Attr
Attr -> Attr -> Bool
Attr -> Attr -> Ordering
Attr -> Attr -> Attr
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Attr -> Attr -> Ordering
compare :: Attr -> Attr -> Ordering
$c< :: Attr -> Attr -> Bool
< :: Attr -> Attr -> Bool
$c<= :: Attr -> Attr -> Bool
<= :: Attr -> Attr -> Bool
$c> :: Attr -> Attr -> Bool
> :: Attr -> Attr -> Bool
$c>= :: Attr -> Attr -> Bool
>= :: Attr -> Attr -> Bool
$cmax :: Attr -> Attr -> Attr
max :: Attr -> Attr -> Attr
$cmin :: Attr -> Attr -> Attr
min :: Attr -> Attr -> Attr
Ord, Typeable, (forall x. Attr -> Rep Attr x)
-> (forall x. Rep Attr x -> Attr) -> Generic Attr
forall x. Rep Attr x -> Attr
forall x. Attr -> Rep Attr x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Attr -> Rep Attr x
from :: forall x. Attr -> Rep Attr x
$cto :: forall x. Rep Attr x -> Attr
to :: forall x. Rep Attr x -> Attr
Generic, Typeable Attr
Typeable Attr =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr)
-> (Attr -> Constr)
-> (Attr -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr))
-> ((forall b. Data b => b -> b) -> Attr -> Attr)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r)
-> (forall u. (forall d. Data d => d -> u) -> Attr -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr)
-> Data Attr
Attr -> Constr
Attr -> DataType
(forall b. Data b => b -> b) -> Attr -> Attr
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
forall u. (forall d. Data d => d -> u) -> Attr -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Attr -> c Attr
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Attr
$ctoConstr :: Attr -> Constr
toConstr :: Attr -> Constr
$cdataTypeOf :: Attr -> DataType
dataTypeOf :: Attr -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Attr)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Attr)
$cgmapT :: (forall b. Data b => b -> b) -> Attr -> Attr
gmapT :: (forall b. Data b => b -> b) -> Attr -> Attr
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Attr -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Attr -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> Attr -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Attr -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Attr -> m Attr
Data)
instance Semigroup Attr where
Attr [(ByteString, ByteString)]
as <> :: Attr -> Attr -> Attr
<> Attr [(ByteString, ByteString)]
bs =
[(ByteString, ByteString)] -> Attr
Attr ([(ByteString, ByteString)] -> Attr)
-> [(ByteString, ByteString)] -> Attr
forall a b. (a -> b) -> a -> b
$ ((ByteString, ByteString)
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)])
-> [(ByteString, ByteString)]
-> [(ByteString, ByteString)]
-> [(ByteString, ByteString)]
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (ByteString, ByteString)
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
integrate [(ByteString, ByteString)]
bs [(ByteString, ByteString)]
as
instance Monoid Attr where
mappend :: Attr -> Attr -> Attr
mappend = Attr -> Attr -> Attr
forall a. Semigroup a => a -> a -> a
(<>)
mempty :: Attr
mempty = [(ByteString, ByteString)] -> Attr
Attr [(ByteString, ByteString)]
forall a. Monoid a => a
mempty
integrate :: (ByteString, ByteString)
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
integrate :: (ByteString, ByteString)
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
integrate (ByteString
k,ByteString
v) [(ByteString, ByteString)]
kvs =
case ByteString -> [(ByteString, ByteString)] -> Maybe ByteString
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup ByteString
k [(ByteString, ByteString)]
kvs of
Maybe ByteString
Nothing -> (ByteString
k,ByteString
v) (ByteString, ByteString)
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. a -> [a] -> [a]
: [(ByteString, ByteString)]
kvs
Just ByteString
v'
| ByteString
k ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ByteString
"class" ->
(ByteString
k, ByteString
v ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
" " ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
v') (ByteString, ByteString)
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. a -> [a] -> [a]
: ((ByteString, ByteString) -> Bool)
-> [(ByteString, ByteString)] -> [(ByteString, ByteString)]
forall a. (a -> Bool) -> [a] -> [a]
filter (\(ByteString
k',ByteString
_) -> ByteString
k' ByteString -> ByteString -> Bool
forall a. Eq a => a -> a -> Bool
/= ByteString
"class") [(ByteString, ByteString)]
kvs
| Bool
otherwise -> [(ByteString, ByteString)]
kvs
data Pos = NoPos | Pos Int Int Int Int
deriving (Int -> Pos -> ShowS
[Pos] -> ShowS
Pos -> String
(Int -> Pos -> ShowS)
-> (Pos -> String) -> ([Pos] -> ShowS) -> Show Pos
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Pos -> ShowS
showsPrec :: Int -> Pos -> ShowS
$cshow :: Pos -> String
show :: Pos -> String
$cshowList :: [Pos] -> ShowS
showList :: [Pos] -> ShowS
Show, Pos -> Pos -> Bool
(Pos -> Pos -> Bool) -> (Pos -> Pos -> Bool) -> Eq Pos
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Pos -> Pos -> Bool
== :: Pos -> Pos -> Bool
$c/= :: Pos -> Pos -> Bool
/= :: Pos -> Pos -> Bool
Eq, Eq Pos
Eq Pos =>
(Pos -> Pos -> Ordering)
-> (Pos -> Pos -> Bool)
-> (Pos -> Pos -> Bool)
-> (Pos -> Pos -> Bool)
-> (Pos -> Pos -> Bool)
-> (Pos -> Pos -> Pos)
-> (Pos -> Pos -> Pos)
-> Ord Pos
Pos -> Pos -> Bool
Pos -> Pos -> Ordering
Pos -> Pos -> Pos
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Pos -> Pos -> Ordering
compare :: Pos -> Pos -> Ordering
$c< :: Pos -> Pos -> Bool
< :: Pos -> Pos -> Bool
$c<= :: Pos -> Pos -> Bool
<= :: Pos -> Pos -> Bool
$c> :: Pos -> Pos -> Bool
> :: Pos -> Pos -> Bool
$c>= :: Pos -> Pos -> Bool
>= :: Pos -> Pos -> Bool
$cmax :: Pos -> Pos -> Pos
max :: Pos -> Pos -> Pos
$cmin :: Pos -> Pos -> Pos
min :: Pos -> Pos -> Pos
Ord, Typeable, (forall x. Pos -> Rep Pos x)
-> (forall x. Rep Pos x -> Pos) -> Generic Pos
forall x. Rep Pos x -> Pos
forall x. Pos -> Rep Pos x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Pos -> Rep Pos x
from :: forall x. Pos -> Rep Pos x
$cto :: forall x. Rep Pos x -> Pos
to :: forall x. Rep Pos x -> Pos
Generic)
instance Semigroup Pos where
Pos Int
sl1 Int
sc1 Int
_ Int
_ <> :: Pos -> Pos -> Pos
<> Pos Int
_ Int
_ Int
el2 Int
ec2 =
Int -> Int -> Int -> Int -> Pos
Pos Int
sl1 Int
sc1 Int
el2 Int
ec2
Pos
NoPos <> Pos
_ = Pos
NoPos
Pos
_ <> Pos
NoPos = Pos
NoPos
instance Monoid Pos where
mappend :: Pos -> Pos -> Pos
mappend = Pos -> Pos -> Pos
forall a. Semigroup a => a -> a -> a
(<>)
mempty :: Pos
mempty = Pos
NoPos
data Node a = Node Pos Attr a
deriving (Int -> Node a -> ShowS
[Node a] -> ShowS
Node a -> String
(Int -> Node a -> ShowS)
-> (Node a -> String) -> ([Node a] -> ShowS) -> Show (Node a)
forall a. Show a => Int -> Node a -> ShowS
forall a. Show a => [Node a] -> ShowS
forall a. Show a => Node a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> Node a -> ShowS
showsPrec :: Int -> Node a -> ShowS
$cshow :: forall a. Show a => Node a -> String
show :: Node a -> String
$cshowList :: forall a. Show a => [Node a] -> ShowS
showList :: [Node a] -> ShowS
Show, Node a -> Node a -> Bool
(Node a -> Node a -> Bool)
-> (Node a -> Node a -> Bool) -> Eq (Node a)
forall a. Eq a => Node a -> Node a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => Node a -> Node a -> Bool
== :: Node a -> Node a -> Bool
$c/= :: forall a. Eq a => Node a -> Node a -> Bool
/= :: Node a -> Node a -> Bool
Eq, Eq (Node a)
Eq (Node a) =>
(Node a -> Node a -> Ordering)
-> (Node a -> Node a -> Bool)
-> (Node a -> Node a -> Bool)
-> (Node a -> Node a -> Bool)
-> (Node a -> Node a -> Bool)
-> (Node a -> Node a -> Node a)
-> (Node a -> Node a -> Node a)
-> Ord (Node a)
Node a -> Node a -> Bool
Node a -> Node a -> Ordering
Node a -> Node a -> Node a
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall a. Ord a => Eq (Node a)
forall a. Ord a => Node a -> Node a -> Bool
forall a. Ord a => Node a -> Node a -> Ordering
forall a. Ord a => Node a -> Node a -> Node a
$ccompare :: forall a. Ord a => Node a -> Node a -> Ordering
compare :: Node a -> Node a -> Ordering
$c< :: forall a. Ord a => Node a -> Node a -> Bool
< :: Node a -> Node a -> Bool
$c<= :: forall a. Ord a => Node a -> Node a -> Bool
<= :: Node a -> Node a -> Bool
$c> :: forall a. Ord a => Node a -> Node a -> Bool
> :: Node a -> Node a -> Bool
$c>= :: forall a. Ord a => Node a -> Node a -> Bool
>= :: Node a -> Node a -> Bool
$cmax :: forall a. Ord a => Node a -> Node a -> Node a
max :: Node a -> Node a -> Node a
$cmin :: forall a. Ord a => Node a -> Node a -> Node a
min :: Node a -> Node a -> Node a
Ord, (forall a b. (a -> b) -> Node a -> Node b)
-> (forall a b. a -> Node b -> Node a) -> Functor Node
forall a b. a -> Node b -> Node a
forall a b. (a -> b) -> Node a -> Node b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> Node a -> Node b
fmap :: forall a b. (a -> b) -> Node a -> Node b
$c<$ :: forall a b. a -> Node b -> Node a
<$ :: forall a b. a -> Node b -> Node a
Functor, Functor Node
Foldable Node
(Functor Node, Foldable Node) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Node a -> f (Node b))
-> (forall (f :: * -> *) a.
Applicative f =>
Node (f a) -> f (Node a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Node a -> m (Node b))
-> (forall (m :: * -> *) a. Monad m => Node (m a) -> m (Node a))
-> Traversable Node
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Node (m a) -> m (Node a)
forall (f :: * -> *) a. Applicative f => Node (f a) -> f (Node a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Node a -> m (Node b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Node a -> f (Node b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Node a -> f (Node b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Node a -> f (Node b)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Node (f a) -> f (Node a)
sequenceA :: forall (f :: * -> *) a. Applicative f => Node (f a) -> f (Node a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Node a -> m (Node b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Node a -> m (Node b)
$csequence :: forall (m :: * -> *) a. Monad m => Node (m a) -> m (Node a)
sequence :: forall (m :: * -> *) a. Monad m => Node (m a) -> m (Node a)
Traversable, (forall m. Monoid m => Node m -> m)
-> (forall m a. Monoid m => (a -> m) -> Node a -> m)
-> (forall m a. Monoid m => (a -> m) -> Node a -> m)
-> (forall a b. (a -> b -> b) -> b -> Node a -> b)
-> (forall a b. (a -> b -> b) -> b -> Node a -> b)
-> (forall b a. (b -> a -> b) -> b -> Node a -> b)
-> (forall b a. (b -> a -> b) -> b -> Node a -> b)
-> (forall a. (a -> a -> a) -> Node a -> a)
-> (forall a. (a -> a -> a) -> Node a -> a)
-> (forall a. Node a -> [a])
-> (forall a. Node a -> Bool)
-> (forall a. Node a -> Int)
-> (forall a. Eq a => a -> Node a -> Bool)
-> (forall a. Ord a => Node a -> a)
-> (forall a. Ord a => Node a -> a)
-> (forall a. Num a => Node a -> a)
-> (forall a. Num a => Node a -> a)
-> Foldable Node
forall a. Eq a => a -> Node a -> Bool
forall a. Num a => Node a -> a
forall a. Ord a => Node a -> a
forall m. Monoid m => Node m -> m
forall a. Node a -> Bool
forall a. Node a -> Int
forall a. Node a -> [a]
forall a. (a -> a -> a) -> Node a -> a
forall m a. Monoid m => (a -> m) -> Node a -> m
forall b a. (b -> a -> b) -> b -> Node a -> b
forall a b. (a -> b -> b) -> b -> Node a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => Node m -> m
fold :: forall m. Monoid m => Node m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Node a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Node a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Node a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> Node a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> Node a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Node a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Node a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Node a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Node a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Node a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Node a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> Node a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> Node a -> a
foldr1 :: forall a. (a -> a -> a) -> Node a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Node a -> a
foldl1 :: forall a. (a -> a -> a) -> Node a -> a
$ctoList :: forall a. Node a -> [a]
toList :: forall a. Node a -> [a]
$cnull :: forall a. Node a -> Bool
null :: forall a. Node a -> Bool
$clength :: forall a. Node a -> Int
length :: forall a. Node a -> Int
$celem :: forall a. Eq a => a -> Node a -> Bool
elem :: forall a. Eq a => a -> Node a -> Bool
$cmaximum :: forall a. Ord a => Node a -> a
maximum :: forall a. Ord a => Node a -> a
$cminimum :: forall a. Ord a => Node a -> a
minimum :: forall a. Ord a => Node a -> a
$csum :: forall a. Num a => Node a -> a
sum :: forall a. Num a => Node a -> a
$cproduct :: forall a. Num a => Node a -> a
product :: forall a. Num a => Node a -> a
Foldable, Typeable, (forall x. Node a -> Rep (Node a) x)
-> (forall x. Rep (Node a) x -> Node a) -> Generic (Node a)
forall x. Rep (Node a) x -> Node a
forall x. Node a -> Rep (Node a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Node a) x -> Node a
forall a x. Node a -> Rep (Node a) x
$cfrom :: forall a x. Node a -> Rep (Node a) x
from :: forall x. Node a -> Rep (Node a) x
$cto :: forall a x. Rep (Node a) x -> Node a
to :: forall x. Rep (Node a) x -> Node a
Generic)
{-# INLINE addAttr #-}
addAttr :: Attr -> Node a -> Node a
addAttr :: forall a. Attr -> Node a -> Node a
addAttr Attr
attr (Node Pos
pos Attr
attr' a
bs) = Pos -> Attr -> a -> Node a
forall a. Pos -> Attr -> a -> Node a
Node Pos
pos (Attr
attr' Attr -> Attr -> Attr
forall a. Semigroup a => a -> a -> a
<> Attr
attr) a
bs
{-# INLINE addPos #-}
addPos :: Pos -> Node a -> Node a
addPos :: forall a. Pos -> Node a -> Node a
addPos Pos
pos (Node Pos
_ Attr
attr a
bs) = Pos -> Attr -> a -> Node a
forall a. Pos -> Attr -> a -> Node a
Node Pos
pos Attr
attr a
bs
newtype Format = Format { Format -> ByteString
unFormat :: ByteString }
deriving (Int -> Format -> ShowS
[Format] -> ShowS
Format -> String
(Int -> Format -> ShowS)
-> (Format -> String) -> ([Format] -> ShowS) -> Show Format
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Format -> ShowS
showsPrec :: Int -> Format -> ShowS
$cshow :: Format -> String
show :: Format -> String
$cshowList :: [Format] -> ShowS
showList :: [Format] -> ShowS
Show, Format -> Format -> Bool
(Format -> Format -> Bool)
-> (Format -> Format -> Bool) -> Eq Format
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Format -> Format -> Bool
== :: Format -> Format -> Bool
$c/= :: Format -> Format -> Bool
/= :: Format -> Format -> Bool
Eq, Eq Format
Eq Format =>
(Format -> Format -> Ordering)
-> (Format -> Format -> Bool)
-> (Format -> Format -> Bool)
-> (Format -> Format -> Bool)
-> (Format -> Format -> Bool)
-> (Format -> Format -> Format)
-> (Format -> Format -> Format)
-> Ord Format
Format -> Format -> Bool
Format -> Format -> Ordering
Format -> Format -> Format
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Format -> Format -> Ordering
compare :: Format -> Format -> Ordering
$c< :: Format -> Format -> Bool
< :: Format -> Format -> Bool
$c<= :: Format -> Format -> Bool
<= :: Format -> Format -> Bool
$c> :: Format -> Format -> Bool
> :: Format -> Format -> Bool
$c>= :: Format -> Format -> Bool
>= :: Format -> Format -> Bool
$cmax :: Format -> Format -> Format
max :: Format -> Format -> Format
$cmin :: Format -> Format -> Format
min :: Format -> Format -> Format
Ord, Typeable, (forall x. Format -> Rep Format x)
-> (forall x. Rep Format x -> Format) -> Generic Format
forall x. Rep Format x -> Format
forall x. Format -> Rep Format x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Format -> Rep Format x
from :: forall x. Format -> Rep Format x
$cto :: forall x. Rep Format x -> Format
to :: forall x. Rep Format x -> Format
Generic)
data MathStyle = DisplayMath | InlineMath
deriving (Int -> MathStyle -> ShowS
[MathStyle] -> ShowS
MathStyle -> String
(Int -> MathStyle -> ShowS)
-> (MathStyle -> String)
-> ([MathStyle] -> ShowS)
-> Show MathStyle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MathStyle -> ShowS
showsPrec :: Int -> MathStyle -> ShowS
$cshow :: MathStyle -> String
show :: MathStyle -> String
$cshowList :: [MathStyle] -> ShowS
showList :: [MathStyle] -> ShowS
Show, Eq MathStyle
Eq MathStyle =>
(MathStyle -> MathStyle -> Ordering)
-> (MathStyle -> MathStyle -> Bool)
-> (MathStyle -> MathStyle -> Bool)
-> (MathStyle -> MathStyle -> Bool)
-> (MathStyle -> MathStyle -> Bool)
-> (MathStyle -> MathStyle -> MathStyle)
-> (MathStyle -> MathStyle -> MathStyle)
-> Ord MathStyle
MathStyle -> MathStyle -> Bool
MathStyle -> MathStyle -> Ordering
MathStyle -> MathStyle -> MathStyle
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: MathStyle -> MathStyle -> Ordering
compare :: MathStyle -> MathStyle -> Ordering
$c< :: MathStyle -> MathStyle -> Bool
< :: MathStyle -> MathStyle -> Bool
$c<= :: MathStyle -> MathStyle -> Bool
<= :: MathStyle -> MathStyle -> Bool
$c> :: MathStyle -> MathStyle -> Bool
> :: MathStyle -> MathStyle -> Bool
$c>= :: MathStyle -> MathStyle -> Bool
>= :: MathStyle -> MathStyle -> Bool
$cmax :: MathStyle -> MathStyle -> MathStyle
max :: MathStyle -> MathStyle -> MathStyle
$cmin :: MathStyle -> MathStyle -> MathStyle
min :: MathStyle -> MathStyle -> MathStyle
Ord, MathStyle -> MathStyle -> Bool
(MathStyle -> MathStyle -> Bool)
-> (MathStyle -> MathStyle -> Bool) -> Eq MathStyle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MathStyle -> MathStyle -> Bool
== :: MathStyle -> MathStyle -> Bool
$c/= :: MathStyle -> MathStyle -> Bool
/= :: MathStyle -> MathStyle -> Bool
Eq, Typeable, (forall x. MathStyle -> Rep MathStyle x)
-> (forall x. Rep MathStyle x -> MathStyle) -> Generic MathStyle
forall x. Rep MathStyle x -> MathStyle
forall x. MathStyle -> Rep MathStyle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. MathStyle -> Rep MathStyle x
from :: forall x. MathStyle -> Rep MathStyle x
$cto :: forall x. Rep MathStyle x -> MathStyle
to :: forall x. Rep MathStyle x -> MathStyle
Generic)
data Target =
Direct ByteString
| Reference ByteString
deriving (Int -> Target -> ShowS
[Target] -> ShowS
Target -> String
(Int -> Target -> ShowS)
-> (Target -> String) -> ([Target] -> ShowS) -> Show Target
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Target -> ShowS
showsPrec :: Int -> Target -> ShowS
$cshow :: Target -> String
show :: Target -> String
$cshowList :: [Target] -> ShowS
showList :: [Target] -> ShowS
Show, Eq Target
Eq Target =>
(Target -> Target -> Ordering)
-> (Target -> Target -> Bool)
-> (Target -> Target -> Bool)
-> (Target -> Target -> Bool)
-> (Target -> Target -> Bool)
-> (Target -> Target -> Target)
-> (Target -> Target -> Target)
-> Ord Target
Target -> Target -> Bool
Target -> Target -> Ordering
Target -> Target -> Target
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Target -> Target -> Ordering
compare :: Target -> Target -> Ordering
$c< :: Target -> Target -> Bool
< :: Target -> Target -> Bool
$c<= :: Target -> Target -> Bool
<= :: Target -> Target -> Bool
$c> :: Target -> Target -> Bool
> :: Target -> Target -> Bool
$c>= :: Target -> Target -> Bool
>= :: Target -> Target -> Bool
$cmax :: Target -> Target -> Target
max :: Target -> Target -> Target
$cmin :: Target -> Target -> Target
min :: Target -> Target -> Target
Ord, Target -> Target -> Bool
(Target -> Target -> Bool)
-> (Target -> Target -> Bool) -> Eq Target
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Target -> Target -> Bool
== :: Target -> Target -> Bool
$c/= :: Target -> Target -> Bool
/= :: Target -> Target -> Bool
Eq, Typeable, (forall x. Target -> Rep Target x)
-> (forall x. Rep Target x -> Target) -> Generic Target
forall x. Rep Target x -> Target
forall x. Target -> Rep Target x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Target -> Rep Target x
from :: forall x. Target -> Rep Target x
$cto :: forall x. Rep Target x -> Target
to :: forall x. Rep Target x -> Target
Generic)
data QuoteType = SingleQuotes | DoubleQuotes
deriving (Int -> QuoteType -> ShowS
[QuoteType] -> ShowS
QuoteType -> String
(Int -> QuoteType -> ShowS)
-> (QuoteType -> String)
-> ([QuoteType] -> ShowS)
-> Show QuoteType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> QuoteType -> ShowS
showsPrec :: Int -> QuoteType -> ShowS
$cshow :: QuoteType -> String
show :: QuoteType -> String
$cshowList :: [QuoteType] -> ShowS
showList :: [QuoteType] -> ShowS
Show, Eq QuoteType
Eq QuoteType =>
(QuoteType -> QuoteType -> Ordering)
-> (QuoteType -> QuoteType -> Bool)
-> (QuoteType -> QuoteType -> Bool)
-> (QuoteType -> QuoteType -> Bool)
-> (QuoteType -> QuoteType -> Bool)
-> (QuoteType -> QuoteType -> QuoteType)
-> (QuoteType -> QuoteType -> QuoteType)
-> Ord QuoteType
QuoteType -> QuoteType -> Bool
QuoteType -> QuoteType -> Ordering
QuoteType -> QuoteType -> QuoteType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: QuoteType -> QuoteType -> Ordering
compare :: QuoteType -> QuoteType -> Ordering
$c< :: QuoteType -> QuoteType -> Bool
< :: QuoteType -> QuoteType -> Bool
$c<= :: QuoteType -> QuoteType -> Bool
<= :: QuoteType -> QuoteType -> Bool
$c> :: QuoteType -> QuoteType -> Bool
> :: QuoteType -> QuoteType -> Bool
$c>= :: QuoteType -> QuoteType -> Bool
>= :: QuoteType -> QuoteType -> Bool
$cmax :: QuoteType -> QuoteType -> QuoteType
max :: QuoteType -> QuoteType -> QuoteType
$cmin :: QuoteType -> QuoteType -> QuoteType
min :: QuoteType -> QuoteType -> QuoteType
Ord, QuoteType -> QuoteType -> Bool
(QuoteType -> QuoteType -> Bool)
-> (QuoteType -> QuoteType -> Bool) -> Eq QuoteType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: QuoteType -> QuoteType -> Bool
== :: QuoteType -> QuoteType -> Bool
$c/= :: QuoteType -> QuoteType -> Bool
/= :: QuoteType -> QuoteType -> Bool
Eq, Typeable, (forall x. QuoteType -> Rep QuoteType x)
-> (forall x. Rep QuoteType x -> QuoteType) -> Generic QuoteType
forall x. Rep QuoteType x -> QuoteType
forall x. QuoteType -> Rep QuoteType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. QuoteType -> Rep QuoteType x
from :: forall x. QuoteType -> Rep QuoteType x
$cto :: forall x. Rep QuoteType x -> QuoteType
to :: forall x. Rep QuoteType x -> QuoteType
Generic)
data Inline =
Str ByteString
| Emph Inlines
| Strong Inlines
| Highlight Inlines
| Insert Inlines
| Delete Inlines
| Superscript Inlines
| Subscript Inlines
| Verbatim ByteString
| Symbol ByteString
| Math MathStyle ByteString
| Link Inlines Target
| Image Inlines Target
| Span Inlines
| ByteString
| UrlLink ByteString
| EmailLink ByteString
| RawInline Format ByteString
| NonBreakingSpace
| Quoted QuoteType Inlines
| SoftBreak
| HardBreak
deriving (Int -> Inline -> ShowS
[Inline] -> ShowS
Inline -> String
(Int -> Inline -> ShowS)
-> (Inline -> String) -> ([Inline] -> ShowS) -> Show Inline
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Inline -> ShowS
showsPrec :: Int -> Inline -> ShowS
$cshow :: Inline -> String
show :: Inline -> String
$cshowList :: [Inline] -> ShowS
showList :: [Inline] -> ShowS
Show, Eq Inline
Eq Inline =>
(Inline -> Inline -> Ordering)
-> (Inline -> Inline -> Bool)
-> (Inline -> Inline -> Bool)
-> (Inline -> Inline -> Bool)
-> (Inline -> Inline -> Bool)
-> (Inline -> Inline -> Inline)
-> (Inline -> Inline -> Inline)
-> Ord Inline
Inline -> Inline -> Bool
Inline -> Inline -> Ordering
Inline -> Inline -> Inline
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Inline -> Inline -> Ordering
compare :: Inline -> Inline -> Ordering
$c< :: Inline -> Inline -> Bool
< :: Inline -> Inline -> Bool
$c<= :: Inline -> Inline -> Bool
<= :: Inline -> Inline -> Bool
$c> :: Inline -> Inline -> Bool
> :: Inline -> Inline -> Bool
$c>= :: Inline -> Inline -> Bool
>= :: Inline -> Inline -> Bool
$cmax :: Inline -> Inline -> Inline
max :: Inline -> Inline -> Inline
$cmin :: Inline -> Inline -> Inline
min :: Inline -> Inline -> Inline
Ord, Inline -> Inline -> Bool
(Inline -> Inline -> Bool)
-> (Inline -> Inline -> Bool) -> Eq Inline
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Inline -> Inline -> Bool
== :: Inline -> Inline -> Bool
$c/= :: Inline -> Inline -> Bool
/= :: Inline -> Inline -> Bool
Eq, Typeable, (forall x. Inline -> Rep Inline x)
-> (forall x. Rep Inline x -> Inline) -> Generic Inline
forall x. Rep Inline x -> Inline
forall x. Inline -> Rep Inline x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Inline -> Rep Inline x
from :: forall x. Inline -> Rep Inline x
$cto :: forall x. Rep Inline x -> Inline
to :: forall x. Rep Inline x -> Inline
Generic)
newtype Many a = Many { forall a. Many a -> Seq a
unMany :: Seq a }
deriving (Int -> Many a -> ShowS
[Many a] -> ShowS
Many a -> String
(Int -> Many a -> ShowS)
-> (Many a -> String) -> ([Many a] -> ShowS) -> Show (Many a)
forall a. Show a => Int -> Many a -> ShowS
forall a. Show a => [Many a] -> ShowS
forall a. Show a => Many a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> Many a -> ShowS
showsPrec :: Int -> Many a -> ShowS
$cshow :: forall a. Show a => Many a -> String
show :: Many a -> String
$cshowList :: forall a. Show a => [Many a] -> ShowS
showList :: [Many a] -> ShowS
Show, Eq (Many a)
Eq (Many a) =>
(Many a -> Many a -> Ordering)
-> (Many a -> Many a -> Bool)
-> (Many a -> Many a -> Bool)
-> (Many a -> Many a -> Bool)
-> (Many a -> Many a -> Bool)
-> (Many a -> Many a -> Many a)
-> (Many a -> Many a -> Many a)
-> Ord (Many a)
Many a -> Many a -> Bool
Many a -> Many a -> Ordering
Many a -> Many a -> Many a
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall a. Ord a => Eq (Many a)
forall a. Ord a => Many a -> Many a -> Bool
forall a. Ord a => Many a -> Many a -> Ordering
forall a. Ord a => Many a -> Many a -> Many a
$ccompare :: forall a. Ord a => Many a -> Many a -> Ordering
compare :: Many a -> Many a -> Ordering
$c< :: forall a. Ord a => Many a -> Many a -> Bool
< :: Many a -> Many a -> Bool
$c<= :: forall a. Ord a => Many a -> Many a -> Bool
<= :: Many a -> Many a -> Bool
$c> :: forall a. Ord a => Many a -> Many a -> Bool
> :: Many a -> Many a -> Bool
$c>= :: forall a. Ord a => Many a -> Many a -> Bool
>= :: Many a -> Many a -> Bool
$cmax :: forall a. Ord a => Many a -> Many a -> Many a
max :: Many a -> Many a -> Many a
$cmin :: forall a. Ord a => Many a -> Many a -> Many a
min :: Many a -> Many a -> Many a
Ord, Many a -> Many a -> Bool
(Many a -> Many a -> Bool)
-> (Many a -> Many a -> Bool) -> Eq (Many a)
forall a. Eq a => Many a -> Many a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => Many a -> Many a -> Bool
== :: Many a -> Many a -> Bool
$c/= :: forall a. Eq a => Many a -> Many a -> Bool
/= :: Many a -> Many a -> Bool
Eq, (forall a b. (a -> b) -> Many a -> Many b)
-> (forall a b. a -> Many b -> Many a) -> Functor Many
forall a b. a -> Many b -> Many a
forall a b. (a -> b) -> Many a -> Many b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> Many a -> Many b
fmap :: forall a b. (a -> b) -> Many a -> Many b
$c<$ :: forall a b. a -> Many b -> Many a
<$ :: forall a b. a -> Many b -> Many a
Functor, Functor Many
Foldable Many
(Functor Many, Foldable Many) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Many a -> f (Many b))
-> (forall (f :: * -> *) a.
Applicative f =>
Many (f a) -> f (Many a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Many a -> m (Many b))
-> (forall (m :: * -> *) a. Monad m => Many (m a) -> m (Many a))
-> Traversable Many
forall (t :: * -> *).
(Functor t, Foldable t) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Many (m a) -> m (Many a)
forall (f :: * -> *) a. Applicative f => Many (f a) -> f (Many a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Many a -> m (Many b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Many a -> f (Many b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Many a -> f (Many b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Many a -> f (Many b)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Many (f a) -> f (Many a)
sequenceA :: forall (f :: * -> *) a. Applicative f => Many (f a) -> f (Many a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Many a -> m (Many b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Many a -> m (Many b)
$csequence :: forall (m :: * -> *) a. Monad m => Many (m a) -> m (Many a)
sequence :: forall (m :: * -> *) a. Monad m => Many (m a) -> m (Many a)
Traversable, (forall m. Monoid m => Many m -> m)
-> (forall m a. Monoid m => (a -> m) -> Many a -> m)
-> (forall m a. Monoid m => (a -> m) -> Many a -> m)
-> (forall a b. (a -> b -> b) -> b -> Many a -> b)
-> (forall a b. (a -> b -> b) -> b -> Many a -> b)
-> (forall b a. (b -> a -> b) -> b -> Many a -> b)
-> (forall b a. (b -> a -> b) -> b -> Many a -> b)
-> (forall a. (a -> a -> a) -> Many a -> a)
-> (forall a. (a -> a -> a) -> Many a -> a)
-> (forall a. Many a -> [a])
-> (forall a. Many a -> Bool)
-> (forall a. Many a -> Int)
-> (forall a. Eq a => a -> Many a -> Bool)
-> (forall a. Ord a => Many a -> a)
-> (forall a. Ord a => Many a -> a)
-> (forall a. Num a => Many a -> a)
-> (forall a. Num a => Many a -> a)
-> Foldable Many
forall a. Eq a => a -> Many a -> Bool
forall a. Num a => Many a -> a
forall a. Ord a => Many a -> a
forall m. Monoid m => Many m -> m
forall a. Many a -> Bool
forall a. Many a -> Int
forall a. Many a -> [a]
forall a. (a -> a -> a) -> Many a -> a
forall m a. Monoid m => (a -> m) -> Many a -> m
forall b a. (b -> a -> b) -> b -> Many a -> b
forall a b. (a -> b -> b) -> b -> Many a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => Many m -> m
fold :: forall m. Monoid m => Many m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Many a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Many a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Many a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> Many a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> Many a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Many a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Many a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Many a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Many a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Many a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Many a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> Many a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> Many a -> a
foldr1 :: forall a. (a -> a -> a) -> Many a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Many a -> a
foldl1 :: forall a. (a -> a -> a) -> Many a -> a
$ctoList :: forall a. Many a -> [a]
toList :: forall a. Many a -> [a]
$cnull :: forall a. Many a -> Bool
null :: forall a. Many a -> Bool
$clength :: forall a. Many a -> Int
length :: forall a. Many a -> Int
$celem :: forall a. Eq a => a -> Many a -> Bool
elem :: forall a. Eq a => a -> Many a -> Bool
$cmaximum :: forall a. Ord a => Many a -> a
maximum :: forall a. Ord a => Many a -> a
$cminimum :: forall a. Ord a => Many a -> a
minimum :: forall a. Ord a => Many a -> a
$csum :: forall a. Num a => Many a -> a
sum :: forall a. Num a => Many a -> a
$cproduct :: forall a. Num a => Many a -> a
product :: forall a. Num a => Many a -> a
Foldable, Typeable, (forall x. Many a -> Rep (Many a) x)
-> (forall x. Rep (Many a) x -> Many a) -> Generic (Many a)
forall x. Rep (Many a) x -> Many a
forall x. Many a -> Rep (Many a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Many a) x -> Many a
forall a x. Many a -> Rep (Many a) x
$cfrom :: forall a x. Many a -> Rep (Many a) x
from :: forall x. Many a -> Rep (Many a) x
$cto :: forall a x. Rep (Many a) x -> Many a
to :: forall x. Rep (Many a) x -> Many a
Generic)
type Inlines = Many (Node Inline)
instance Semigroup Inlines where
Many Seq (Node Inline)
as <> :: Inlines -> Inlines -> Inlines
<> Many Seq (Node Inline)
bs =
case (Seq (Node Inline) -> ViewR (Node Inline)
forall a. Seq a -> ViewR a
Seq.viewr Seq (Node Inline)
as, Seq (Node Inline) -> ViewL (Node Inline)
forall a. Seq a -> ViewL a
Seq.viewl Seq (Node Inline)
bs) of
(Seq (Node Inline)
as' Seq.:> Node Pos
pos1 Attr
attr (Str ByteString
s), Node Pos
pos2 Attr
attr' (Str ByteString
t) Seq.:< Seq (Node Inline)
bs')
| Attr
attr Attr -> Attr -> Bool
forall a. Eq a => a -> a -> Bool
== Attr
forall a. Monoid a => a
mempty Bool -> Bool -> Bool
&& Attr
attr' Attr -> Attr -> Bool
forall a. Eq a => a -> a -> Bool
/= Attr
forall a. Monoid a => a
mempty
, (ByteString
sa, ByteString
sb) <- (Char -> Bool) -> ByteString -> (ByteString, ByteString)
B8.spanEnd (Bool -> Bool
not (Bool -> Bool) -> (Char -> Bool) -> Char -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Bool
isSpaceOrTab) ByteString
s
, Bool -> Bool
not (ByteString -> Bool
B8.null ByteString
sb)
-> if ByteString -> Bool
B8.null ByteString
sa
then
Seq (Node Inline) -> Inlines
forall a. Seq a -> Many a
Many (Seq (Node Inline)
as' Seq (Node Inline) -> Seq (Node Inline) -> Seq (Node Inline)
forall a. Semigroup a => a -> a -> a
<> (Pos -> Attr -> Inline -> Node Inline
forall a. Pos -> Attr -> a -> Node a
Node (Pos
pos1 Pos -> Pos -> Pos
forall a. Semigroup a => a -> a -> a
<> Pos
pos2) Attr
attr' (ByteString -> Inline
Str (ByteString
s ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
t)) Node Inline -> Seq (Node Inline) -> Seq (Node Inline)
forall a. a -> Seq a -> Seq a
Seq.<| Seq (Node Inline)
bs'))
else
let sblen :: Int
sblen = ByteString -> Int
B8.length ((Char -> Bool) -> ByteString -> ByteString
B8.filter (\Char
c -> Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
< Char
'\128' Bool -> Bool -> Bool
|| Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
>= Char
'\192') ByteString
sb)
(Pos
pos1', Pos
pos2') =
case Pos
pos1 Pos -> Pos -> Pos
forall a. Semigroup a => a -> a -> a
<> Pos
pos2 of
Pos
NoPos -> (Pos
NoPos, Pos
NoPos)
Pos Int
sl Int
sc Int
el Int
ec ->
(Int -> Int -> Int -> Int -> Pos
Pos Int
sl Int
sc Int
el (Int
ec Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
sblen),
Int -> Int -> Int -> Int -> Pos
Pos Int
sl (Int
sc Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
sblen Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) Int
el Int
ec)
in Seq (Node Inline) -> Inlines
forall a. Seq a -> Many a
Many ((Seq (Node Inline)
as' Seq (Node Inline) -> Node Inline -> Seq (Node Inline)
forall a. Seq a -> a -> Seq a
Seq.|> Pos -> Attr -> Inline -> Node Inline
forall a. Pos -> Attr -> a -> Node a
Node Pos
pos1' Attr
forall a. Monoid a => a
mempty (ByteString -> Inline
Str ByteString
sa)
Seq (Node Inline) -> Node Inline -> Seq (Node Inline)
forall a. Seq a -> a -> Seq a
Seq.|> Pos -> Attr -> Inline -> Node Inline
forall a. Pos -> Attr -> a -> Node a
Node Pos
pos2' Attr
attr (ByteString -> Inline
Str (ByteString
sb ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
t))) Seq (Node Inline) -> Seq (Node Inline) -> Seq (Node Inline)
forall a. Semigroup a => a -> a -> a
<> Seq (Node Inline)
bs')
| Attr
attr Attr -> Attr -> Bool
forall a. Eq a => a -> a -> Bool
== Attr
attr'
-> Seq (Node Inline) -> Inlines
forall a. Seq a -> Many a
Many (Seq (Node Inline)
as' Seq (Node Inline) -> Seq (Node Inline) -> Seq (Node Inline)
forall a. Semigroup a => a -> a -> a
<> (Pos -> Attr -> Inline -> Node Inline
forall a. Pos -> Attr -> a -> Node a
Node (Pos
pos1 Pos -> Pos -> Pos
forall a. Semigroup a => a -> a -> a
<> Pos
pos2) Attr
attr (ByteString -> Inline
Str (ByteString
s ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
t)) Node Inline -> Seq (Node Inline) -> Seq (Node Inline)
forall a. a -> Seq a -> Seq a
Seq.<| Seq (Node Inline)
bs'))
(Seq (Node Inline)
as' Seq.:> Node Pos
pos Attr
attr (Str ByteString
s), Node Pos
_ Attr
_ Inline
HardBreak Seq.:< Seq (Node Inline)
_)
| (Char -> Bool) -> ByteString -> Bool
B8.all Char -> Bool
isSpaceOrTab (Int -> ByteString -> ByteString
B8.takeEnd Int
1 ByteString
s)
-> Seq (Node Inline) -> Inlines
forall a. Seq a -> Many a
Many (Seq (Node Inline)
as' Seq (Node Inline) -> Seq (Node Inline) -> Seq (Node Inline)
forall a. Semigroup a => a -> a -> a
<> (Pos -> Attr -> Inline -> Node Inline
forall a. Pos -> Attr -> a -> Node a
Node Pos
pos Attr
attr (ByteString -> Inline
Str ((Char -> Bool) -> ByteString -> ByteString
B8.dropWhileEnd Char -> Bool
isSpaceOrTab ByteString
s))
Node Inline -> Seq (Node Inline) -> Seq (Node Inline)
forall a. a -> Seq a -> Seq a
Seq.<| Seq (Node Inline)
bs))
(ViewR (Node Inline), ViewL (Node Inline))
_ -> Seq (Node Inline) -> Inlines
forall a. Seq a -> Many a
Many (Seq (Node Inline)
as Seq (Node Inline) -> Seq (Node Inline) -> Seq (Node Inline)
forall a. Semigroup a => a -> a -> a
<> Seq (Node Inline)
bs)
where
isSpaceOrTab :: Char -> Bool
isSpaceOrTab Char
' ' = Bool
True
isSpaceOrTab Char
'\t' = Bool
True
isSpaceOrTab Char
_ = Bool
False
instance Monoid Inlines where
mappend :: Inlines -> Inlines -> Inlines
mappend = Inlines -> Inlines -> Inlines
forall a. Semigroup a => a -> a -> a
(<>)
mempty :: Inlines
mempty = Seq (Node Inline) -> Inlines
forall a. Seq a -> Many a
Many Seq (Node Inline)
forall a. Monoid a => a
mempty
data ListSpacing = Tight | Loose
deriving (Int -> ListSpacing -> ShowS
[ListSpacing] -> ShowS
ListSpacing -> String
(Int -> ListSpacing -> ShowS)
-> (ListSpacing -> String)
-> ([ListSpacing] -> ShowS)
-> Show ListSpacing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListSpacing -> ShowS
showsPrec :: Int -> ListSpacing -> ShowS
$cshow :: ListSpacing -> String
show :: ListSpacing -> String
$cshowList :: [ListSpacing] -> ShowS
showList :: [ListSpacing] -> ShowS
Show, Eq ListSpacing
Eq ListSpacing =>
(ListSpacing -> ListSpacing -> Ordering)
-> (ListSpacing -> ListSpacing -> Bool)
-> (ListSpacing -> ListSpacing -> Bool)
-> (ListSpacing -> ListSpacing -> Bool)
-> (ListSpacing -> ListSpacing -> Bool)
-> (ListSpacing -> ListSpacing -> ListSpacing)
-> (ListSpacing -> ListSpacing -> ListSpacing)
-> Ord ListSpacing
ListSpacing -> ListSpacing -> Bool
ListSpacing -> ListSpacing -> Ordering
ListSpacing -> ListSpacing -> ListSpacing
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ListSpacing -> ListSpacing -> Ordering
compare :: ListSpacing -> ListSpacing -> Ordering
$c< :: ListSpacing -> ListSpacing -> Bool
< :: ListSpacing -> ListSpacing -> Bool
$c<= :: ListSpacing -> ListSpacing -> Bool
<= :: ListSpacing -> ListSpacing -> Bool
$c> :: ListSpacing -> ListSpacing -> Bool
> :: ListSpacing -> ListSpacing -> Bool
$c>= :: ListSpacing -> ListSpacing -> Bool
>= :: ListSpacing -> ListSpacing -> Bool
$cmax :: ListSpacing -> ListSpacing -> ListSpacing
max :: ListSpacing -> ListSpacing -> ListSpacing
$cmin :: ListSpacing -> ListSpacing -> ListSpacing
min :: ListSpacing -> ListSpacing -> ListSpacing
Ord, ListSpacing -> ListSpacing -> Bool
(ListSpacing -> ListSpacing -> Bool)
-> (ListSpacing -> ListSpacing -> Bool) -> Eq ListSpacing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListSpacing -> ListSpacing -> Bool
== :: ListSpacing -> ListSpacing -> Bool
$c/= :: ListSpacing -> ListSpacing -> Bool
/= :: ListSpacing -> ListSpacing -> Bool
Eq, Typeable, (forall x. ListSpacing -> Rep ListSpacing x)
-> (forall x. Rep ListSpacing x -> ListSpacing)
-> Generic ListSpacing
forall x. Rep ListSpacing x -> ListSpacing
forall x. ListSpacing -> Rep ListSpacing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ListSpacing -> Rep ListSpacing x
from :: forall x. ListSpacing -> Rep ListSpacing x
$cto :: forall x. Rep ListSpacing x -> ListSpacing
to :: forall x. Rep ListSpacing x -> ListSpacing
Generic)
data OrderedListStyle =
Decimal | LetterUpper | LetterLower | RomanUpper | RomanLower
deriving (Int -> OrderedListStyle -> ShowS
[OrderedListStyle] -> ShowS
OrderedListStyle -> String
(Int -> OrderedListStyle -> ShowS)
-> (OrderedListStyle -> String)
-> ([OrderedListStyle] -> ShowS)
-> Show OrderedListStyle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OrderedListStyle -> ShowS
showsPrec :: Int -> OrderedListStyle -> ShowS
$cshow :: OrderedListStyle -> String
show :: OrderedListStyle -> String
$cshowList :: [OrderedListStyle] -> ShowS
showList :: [OrderedListStyle] -> ShowS
Show, Eq OrderedListStyle
Eq OrderedListStyle =>
(OrderedListStyle -> OrderedListStyle -> Ordering)
-> (OrderedListStyle -> OrderedListStyle -> Bool)
-> (OrderedListStyle -> OrderedListStyle -> Bool)
-> (OrderedListStyle -> OrderedListStyle -> Bool)
-> (OrderedListStyle -> OrderedListStyle -> Bool)
-> (OrderedListStyle -> OrderedListStyle -> OrderedListStyle)
-> (OrderedListStyle -> OrderedListStyle -> OrderedListStyle)
-> Ord OrderedListStyle
OrderedListStyle -> OrderedListStyle -> Bool
OrderedListStyle -> OrderedListStyle -> Ordering
OrderedListStyle -> OrderedListStyle -> OrderedListStyle
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: OrderedListStyle -> OrderedListStyle -> Ordering
compare :: OrderedListStyle -> OrderedListStyle -> Ordering
$c< :: OrderedListStyle -> OrderedListStyle -> Bool
< :: OrderedListStyle -> OrderedListStyle -> Bool
$c<= :: OrderedListStyle -> OrderedListStyle -> Bool
<= :: OrderedListStyle -> OrderedListStyle -> Bool
$c> :: OrderedListStyle -> OrderedListStyle -> Bool
> :: OrderedListStyle -> OrderedListStyle -> Bool
$c>= :: OrderedListStyle -> OrderedListStyle -> Bool
>= :: OrderedListStyle -> OrderedListStyle -> Bool
$cmax :: OrderedListStyle -> OrderedListStyle -> OrderedListStyle
max :: OrderedListStyle -> OrderedListStyle -> OrderedListStyle
$cmin :: OrderedListStyle -> OrderedListStyle -> OrderedListStyle
min :: OrderedListStyle -> OrderedListStyle -> OrderedListStyle
Ord, OrderedListStyle -> OrderedListStyle -> Bool
(OrderedListStyle -> OrderedListStyle -> Bool)
-> (OrderedListStyle -> OrderedListStyle -> Bool)
-> Eq OrderedListStyle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OrderedListStyle -> OrderedListStyle -> Bool
== :: OrderedListStyle -> OrderedListStyle -> Bool
$c/= :: OrderedListStyle -> OrderedListStyle -> Bool
/= :: OrderedListStyle -> OrderedListStyle -> Bool
Eq, Typeable, (forall x. OrderedListStyle -> Rep OrderedListStyle x)
-> (forall x. Rep OrderedListStyle x -> OrderedListStyle)
-> Generic OrderedListStyle
forall x. Rep OrderedListStyle x -> OrderedListStyle
forall x. OrderedListStyle -> Rep OrderedListStyle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OrderedListStyle -> Rep OrderedListStyle x
from :: forall x. OrderedListStyle -> Rep OrderedListStyle x
$cto :: forall x. Rep OrderedListStyle x -> OrderedListStyle
to :: forall x. Rep OrderedListStyle x -> OrderedListStyle
Generic)
data OrderedListDelim =
RightPeriod | RightParen | LeftRightParen
deriving (Int -> OrderedListDelim -> ShowS
[OrderedListDelim] -> ShowS
OrderedListDelim -> String
(Int -> OrderedListDelim -> ShowS)
-> (OrderedListDelim -> String)
-> ([OrderedListDelim] -> ShowS)
-> Show OrderedListDelim
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OrderedListDelim -> ShowS
showsPrec :: Int -> OrderedListDelim -> ShowS
$cshow :: OrderedListDelim -> String
show :: OrderedListDelim -> String
$cshowList :: [OrderedListDelim] -> ShowS
showList :: [OrderedListDelim] -> ShowS
Show, Eq OrderedListDelim
Eq OrderedListDelim =>
(OrderedListDelim -> OrderedListDelim -> Ordering)
-> (OrderedListDelim -> OrderedListDelim -> Bool)
-> (OrderedListDelim -> OrderedListDelim -> Bool)
-> (OrderedListDelim -> OrderedListDelim -> Bool)
-> (OrderedListDelim -> OrderedListDelim -> Bool)
-> (OrderedListDelim -> OrderedListDelim -> OrderedListDelim)
-> (OrderedListDelim -> OrderedListDelim -> OrderedListDelim)
-> Ord OrderedListDelim
OrderedListDelim -> OrderedListDelim -> Bool
OrderedListDelim -> OrderedListDelim -> Ordering
OrderedListDelim -> OrderedListDelim -> OrderedListDelim
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: OrderedListDelim -> OrderedListDelim -> Ordering
compare :: OrderedListDelim -> OrderedListDelim -> Ordering
$c< :: OrderedListDelim -> OrderedListDelim -> Bool
< :: OrderedListDelim -> OrderedListDelim -> Bool
$c<= :: OrderedListDelim -> OrderedListDelim -> Bool
<= :: OrderedListDelim -> OrderedListDelim -> Bool
$c> :: OrderedListDelim -> OrderedListDelim -> Bool
> :: OrderedListDelim -> OrderedListDelim -> Bool
$c>= :: OrderedListDelim -> OrderedListDelim -> Bool
>= :: OrderedListDelim -> OrderedListDelim -> Bool
$cmax :: OrderedListDelim -> OrderedListDelim -> OrderedListDelim
max :: OrderedListDelim -> OrderedListDelim -> OrderedListDelim
$cmin :: OrderedListDelim -> OrderedListDelim -> OrderedListDelim
min :: OrderedListDelim -> OrderedListDelim -> OrderedListDelim
Ord, OrderedListDelim -> OrderedListDelim -> Bool
(OrderedListDelim -> OrderedListDelim -> Bool)
-> (OrderedListDelim -> OrderedListDelim -> Bool)
-> Eq OrderedListDelim
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OrderedListDelim -> OrderedListDelim -> Bool
== :: OrderedListDelim -> OrderedListDelim -> Bool
$c/= :: OrderedListDelim -> OrderedListDelim -> Bool
/= :: OrderedListDelim -> OrderedListDelim -> Bool
Eq, Typeable, (forall x. OrderedListDelim -> Rep OrderedListDelim x)
-> (forall x. Rep OrderedListDelim x -> OrderedListDelim)
-> Generic OrderedListDelim
forall x. Rep OrderedListDelim x -> OrderedListDelim
forall x. OrderedListDelim -> Rep OrderedListDelim x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OrderedListDelim -> Rep OrderedListDelim x
from :: forall x. OrderedListDelim -> Rep OrderedListDelim x
$cto :: forall x. Rep OrderedListDelim x -> OrderedListDelim
to :: forall x. Rep OrderedListDelim x -> OrderedListDelim
Generic)
data OrderedListAttributes =
OrderedListAttributes
{ OrderedListAttributes -> OrderedListStyle
orderedListStyle :: OrderedListStyle
, OrderedListAttributes -> OrderedListDelim
orderedListDelim :: OrderedListDelim
, OrderedListAttributes -> Int
orderedListStart :: Int }
deriving (Int -> OrderedListAttributes -> ShowS
[OrderedListAttributes] -> ShowS
OrderedListAttributes -> String
(Int -> OrderedListAttributes -> ShowS)
-> (OrderedListAttributes -> String)
-> ([OrderedListAttributes] -> ShowS)
-> Show OrderedListAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OrderedListAttributes -> ShowS
showsPrec :: Int -> OrderedListAttributes -> ShowS
$cshow :: OrderedListAttributes -> String
show :: OrderedListAttributes -> String
$cshowList :: [OrderedListAttributes] -> ShowS
showList :: [OrderedListAttributes] -> ShowS
Show, Eq OrderedListAttributes
Eq OrderedListAttributes =>
(OrderedListAttributes -> OrderedListAttributes -> Ordering)
-> (OrderedListAttributes -> OrderedListAttributes -> Bool)
-> (OrderedListAttributes -> OrderedListAttributes -> Bool)
-> (OrderedListAttributes -> OrderedListAttributes -> Bool)
-> (OrderedListAttributes -> OrderedListAttributes -> Bool)
-> (OrderedListAttributes
-> OrderedListAttributes -> OrderedListAttributes)
-> (OrderedListAttributes
-> OrderedListAttributes -> OrderedListAttributes)
-> Ord OrderedListAttributes
OrderedListAttributes -> OrderedListAttributes -> Bool
OrderedListAttributes -> OrderedListAttributes -> Ordering
OrderedListAttributes
-> OrderedListAttributes -> OrderedListAttributes
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: OrderedListAttributes -> OrderedListAttributes -> Ordering
compare :: OrderedListAttributes -> OrderedListAttributes -> Ordering
$c< :: OrderedListAttributes -> OrderedListAttributes -> Bool
< :: OrderedListAttributes -> OrderedListAttributes -> Bool
$c<= :: OrderedListAttributes -> OrderedListAttributes -> Bool
<= :: OrderedListAttributes -> OrderedListAttributes -> Bool
$c> :: OrderedListAttributes -> OrderedListAttributes -> Bool
> :: OrderedListAttributes -> OrderedListAttributes -> Bool
$c>= :: OrderedListAttributes -> OrderedListAttributes -> Bool
>= :: OrderedListAttributes -> OrderedListAttributes -> Bool
$cmax :: OrderedListAttributes
-> OrderedListAttributes -> OrderedListAttributes
max :: OrderedListAttributes
-> OrderedListAttributes -> OrderedListAttributes
$cmin :: OrderedListAttributes
-> OrderedListAttributes -> OrderedListAttributes
min :: OrderedListAttributes
-> OrderedListAttributes -> OrderedListAttributes
Ord, OrderedListAttributes -> OrderedListAttributes -> Bool
(OrderedListAttributes -> OrderedListAttributes -> Bool)
-> (OrderedListAttributes -> OrderedListAttributes -> Bool)
-> Eq OrderedListAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OrderedListAttributes -> OrderedListAttributes -> Bool
== :: OrderedListAttributes -> OrderedListAttributes -> Bool
$c/= :: OrderedListAttributes -> OrderedListAttributes -> Bool
/= :: OrderedListAttributes -> OrderedListAttributes -> Bool
Eq, Typeable, (forall x. OrderedListAttributes -> Rep OrderedListAttributes x)
-> (forall x. Rep OrderedListAttributes x -> OrderedListAttributes)
-> Generic OrderedListAttributes
forall x. Rep OrderedListAttributes x -> OrderedListAttributes
forall x. OrderedListAttributes -> Rep OrderedListAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. OrderedListAttributes -> Rep OrderedListAttributes x
from :: forall x. OrderedListAttributes -> Rep OrderedListAttributes x
$cto :: forall x. Rep OrderedListAttributes x -> OrderedListAttributes
to :: forall x. Rep OrderedListAttributes x -> OrderedListAttributes
Generic)
data TaskStatus = Complete | Incomplete
deriving (Int -> TaskStatus -> ShowS
[TaskStatus] -> ShowS
TaskStatus -> String
(Int -> TaskStatus -> ShowS)
-> (TaskStatus -> String)
-> ([TaskStatus] -> ShowS)
-> Show TaskStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TaskStatus -> ShowS
showsPrec :: Int -> TaskStatus -> ShowS
$cshow :: TaskStatus -> String
show :: TaskStatus -> String
$cshowList :: [TaskStatus] -> ShowS
showList :: [TaskStatus] -> ShowS
Show, Eq TaskStatus
Eq TaskStatus =>
(TaskStatus -> TaskStatus -> Ordering)
-> (TaskStatus -> TaskStatus -> Bool)
-> (TaskStatus -> TaskStatus -> Bool)
-> (TaskStatus -> TaskStatus -> Bool)
-> (TaskStatus -> TaskStatus -> Bool)
-> (TaskStatus -> TaskStatus -> TaskStatus)
-> (TaskStatus -> TaskStatus -> TaskStatus)
-> Ord TaskStatus
TaskStatus -> TaskStatus -> Bool
TaskStatus -> TaskStatus -> Ordering
TaskStatus -> TaskStatus -> TaskStatus
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TaskStatus -> TaskStatus -> Ordering
compare :: TaskStatus -> TaskStatus -> Ordering
$c< :: TaskStatus -> TaskStatus -> Bool
< :: TaskStatus -> TaskStatus -> Bool
$c<= :: TaskStatus -> TaskStatus -> Bool
<= :: TaskStatus -> TaskStatus -> Bool
$c> :: TaskStatus -> TaskStatus -> Bool
> :: TaskStatus -> TaskStatus -> Bool
$c>= :: TaskStatus -> TaskStatus -> Bool
>= :: TaskStatus -> TaskStatus -> Bool
$cmax :: TaskStatus -> TaskStatus -> TaskStatus
max :: TaskStatus -> TaskStatus -> TaskStatus
$cmin :: TaskStatus -> TaskStatus -> TaskStatus
min :: TaskStatus -> TaskStatus -> TaskStatus
Ord, TaskStatus -> TaskStatus -> Bool
(TaskStatus -> TaskStatus -> Bool)
-> (TaskStatus -> TaskStatus -> Bool) -> Eq TaskStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TaskStatus -> TaskStatus -> Bool
== :: TaskStatus -> TaskStatus -> Bool
$c/= :: TaskStatus -> TaskStatus -> Bool
/= :: TaskStatus -> TaskStatus -> Bool
Eq, Typeable, (forall x. TaskStatus -> Rep TaskStatus x)
-> (forall x. Rep TaskStatus x -> TaskStatus) -> Generic TaskStatus
forall x. Rep TaskStatus x -> TaskStatus
forall x. TaskStatus -> Rep TaskStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TaskStatus -> Rep TaskStatus x
from :: forall x. TaskStatus -> Rep TaskStatus x
$cto :: forall x. Rep TaskStatus x -> TaskStatus
to :: forall x. Rep TaskStatus x -> TaskStatus
Generic)
newtype Caption = Caption Blocks
deriving (Int -> Caption -> ShowS
[Caption] -> ShowS
Caption -> String
(Int -> Caption -> ShowS)
-> (Caption -> String) -> ([Caption] -> ShowS) -> Show Caption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Caption -> ShowS
showsPrec :: Int -> Caption -> ShowS
$cshow :: Caption -> String
show :: Caption -> String
$cshowList :: [Caption] -> ShowS
showList :: [Caption] -> ShowS
Show, Eq Caption
Eq Caption =>
(Caption -> Caption -> Ordering)
-> (Caption -> Caption -> Bool)
-> (Caption -> Caption -> Bool)
-> (Caption -> Caption -> Bool)
-> (Caption -> Caption -> Bool)
-> (Caption -> Caption -> Caption)
-> (Caption -> Caption -> Caption)
-> Ord Caption
Caption -> Caption -> Bool
Caption -> Caption -> Ordering
Caption -> Caption -> Caption
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Caption -> Caption -> Ordering
compare :: Caption -> Caption -> Ordering
$c< :: Caption -> Caption -> Bool
< :: Caption -> Caption -> Bool
$c<= :: Caption -> Caption -> Bool
<= :: Caption -> Caption -> Bool
$c> :: Caption -> Caption -> Bool
> :: Caption -> Caption -> Bool
$c>= :: Caption -> Caption -> Bool
>= :: Caption -> Caption -> Bool
$cmax :: Caption -> Caption -> Caption
max :: Caption -> Caption -> Caption
$cmin :: Caption -> Caption -> Caption
min :: Caption -> Caption -> Caption
Ord, Caption -> Caption -> Bool
(Caption -> Caption -> Bool)
-> (Caption -> Caption -> Bool) -> Eq Caption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Caption -> Caption -> Bool
== :: Caption -> Caption -> Bool
$c/= :: Caption -> Caption -> Bool
/= :: Caption -> Caption -> Bool
Eq, Typeable, (forall x. Caption -> Rep Caption x)
-> (forall x. Rep Caption x -> Caption) -> Generic Caption
forall x. Rep Caption x -> Caption
forall x. Caption -> Rep Caption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Caption -> Rep Caption x
from :: forall x. Caption -> Rep Caption x
$cto :: forall x. Rep Caption x -> Caption
to :: forall x. Rep Caption x -> Caption
Generic)
data Align = AlignLeft | AlignRight | AlignCenter | AlignDefault
deriving (Int -> Align -> ShowS
[Align] -> ShowS
Align -> String
(Int -> Align -> ShowS)
-> (Align -> String) -> ([Align] -> ShowS) -> Show Align
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Align -> ShowS
showsPrec :: Int -> Align -> ShowS
$cshow :: Align -> String
show :: Align -> String
$cshowList :: [Align] -> ShowS
showList :: [Align] -> ShowS
Show, Eq Align
Eq Align =>
(Align -> Align -> Ordering)
-> (Align -> Align -> Bool)
-> (Align -> Align -> Bool)
-> (Align -> Align -> Bool)
-> (Align -> Align -> Bool)
-> (Align -> Align -> Align)
-> (Align -> Align -> Align)
-> Ord Align
Align -> Align -> Bool
Align -> Align -> Ordering
Align -> Align -> Align
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Align -> Align -> Ordering
compare :: Align -> Align -> Ordering
$c< :: Align -> Align -> Bool
< :: Align -> Align -> Bool
$c<= :: Align -> Align -> Bool
<= :: Align -> Align -> Bool
$c> :: Align -> Align -> Bool
> :: Align -> Align -> Bool
$c>= :: Align -> Align -> Bool
>= :: Align -> Align -> Bool
$cmax :: Align -> Align -> Align
max :: Align -> Align -> Align
$cmin :: Align -> Align -> Align
min :: Align -> Align -> Align
Ord, Align -> Align -> Bool
(Align -> Align -> Bool) -> (Align -> Align -> Bool) -> Eq Align
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Align -> Align -> Bool
== :: Align -> Align -> Bool
$c/= :: Align -> Align -> Bool
/= :: Align -> Align -> Bool
Eq, Typeable, (forall x. Align -> Rep Align x)
-> (forall x. Rep Align x -> Align) -> Generic Align
forall x. Rep Align x -> Align
forall x. Align -> Rep Align x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Align -> Rep Align x
from :: forall x. Align -> Rep Align x
$cto :: forall x. Rep Align x -> Align
to :: forall x. Rep Align x -> Align
Generic)
data CellType = HeadCell | BodyCell
deriving (Int -> CellType -> ShowS
[CellType] -> ShowS
CellType -> String
(Int -> CellType -> ShowS)
-> (CellType -> String) -> ([CellType] -> ShowS) -> Show CellType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CellType -> ShowS
showsPrec :: Int -> CellType -> ShowS
$cshow :: CellType -> String
show :: CellType -> String
$cshowList :: [CellType] -> ShowS
showList :: [CellType] -> ShowS
Show, Eq CellType
Eq CellType =>
(CellType -> CellType -> Ordering)
-> (CellType -> CellType -> Bool)
-> (CellType -> CellType -> Bool)
-> (CellType -> CellType -> Bool)
-> (CellType -> CellType -> Bool)
-> (CellType -> CellType -> CellType)
-> (CellType -> CellType -> CellType)
-> Ord CellType
CellType -> CellType -> Bool
CellType -> CellType -> Ordering
CellType -> CellType -> CellType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CellType -> CellType -> Ordering
compare :: CellType -> CellType -> Ordering
$c< :: CellType -> CellType -> Bool
< :: CellType -> CellType -> Bool
$c<= :: CellType -> CellType -> Bool
<= :: CellType -> CellType -> Bool
$c> :: CellType -> CellType -> Bool
> :: CellType -> CellType -> Bool
$c>= :: CellType -> CellType -> Bool
>= :: CellType -> CellType -> Bool
$cmax :: CellType -> CellType -> CellType
max :: CellType -> CellType -> CellType
$cmin :: CellType -> CellType -> CellType
min :: CellType -> CellType -> CellType
Ord, CellType -> CellType -> Bool
(CellType -> CellType -> Bool)
-> (CellType -> CellType -> Bool) -> Eq CellType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CellType -> CellType -> Bool
== :: CellType -> CellType -> Bool
$c/= :: CellType -> CellType -> Bool
/= :: CellType -> CellType -> Bool
Eq, Typeable, (forall x. CellType -> Rep CellType x)
-> (forall x. Rep CellType x -> CellType) -> Generic CellType
forall x. Rep CellType x -> CellType
forall x. CellType -> Rep CellType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CellType -> Rep CellType x
from :: forall x. CellType -> Rep CellType x
$cto :: forall x. Rep CellType x -> CellType
to :: forall x. Rep CellType x -> CellType
Generic)
data Cell = Cell CellType Align Inlines
deriving (Int -> Cell -> ShowS
[Cell] -> ShowS
Cell -> String
(Int -> Cell -> ShowS)
-> (Cell -> String) -> ([Cell] -> ShowS) -> Show Cell
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Cell -> ShowS
showsPrec :: Int -> Cell -> ShowS
$cshow :: Cell -> String
show :: Cell -> String
$cshowList :: [Cell] -> ShowS
showList :: [Cell] -> ShowS
Show, Eq Cell
Eq Cell =>
(Cell -> Cell -> Ordering)
-> (Cell -> Cell -> Bool)
-> (Cell -> Cell -> Bool)
-> (Cell -> Cell -> Bool)
-> (Cell -> Cell -> Bool)
-> (Cell -> Cell -> Cell)
-> (Cell -> Cell -> Cell)
-> Ord Cell
Cell -> Cell -> Bool
Cell -> Cell -> Ordering
Cell -> Cell -> Cell
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Cell -> Cell -> Ordering
compare :: Cell -> Cell -> Ordering
$c< :: Cell -> Cell -> Bool
< :: Cell -> Cell -> Bool
$c<= :: Cell -> Cell -> Bool
<= :: Cell -> Cell -> Bool
$c> :: Cell -> Cell -> Bool
> :: Cell -> Cell -> Bool
$c>= :: Cell -> Cell -> Bool
>= :: Cell -> Cell -> Bool
$cmax :: Cell -> Cell -> Cell
max :: Cell -> Cell -> Cell
$cmin :: Cell -> Cell -> Cell
min :: Cell -> Cell -> Cell
Ord, Cell -> Cell -> Bool
(Cell -> Cell -> Bool) -> (Cell -> Cell -> Bool) -> Eq Cell
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Cell -> Cell -> Bool
== :: Cell -> Cell -> Bool
$c/= :: Cell -> Cell -> Bool
/= :: Cell -> Cell -> Bool
Eq, Typeable, (forall x. Cell -> Rep Cell x)
-> (forall x. Rep Cell x -> Cell) -> Generic Cell
forall x. Rep Cell x -> Cell
forall x. Cell -> Rep Cell x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Cell -> Rep Cell x
from :: forall x. Cell -> Rep Cell x
$cto :: forall x. Rep Cell x -> Cell
to :: forall x. Rep Cell x -> Cell
Generic)
data Block =
Para Inlines
| Section Blocks
| Heading Int Inlines
| BlockQuote Blocks
| CodeBlock ByteString ByteString
| Div Blocks
| OrderedList OrderedListAttributes ListSpacing [Blocks]
| BulletList ListSpacing [Blocks]
| TaskList ListSpacing [(TaskStatus, Blocks)]
| DefinitionList ListSpacing [(Inlines, Blocks)]
| ThematicBreak
| Table (Maybe Caption) [[Cell]]
| RawBlock Format ByteString
deriving (Int -> Block -> ShowS
[Block] -> ShowS
Block -> String
(Int -> Block -> ShowS)
-> (Block -> String) -> ([Block] -> ShowS) -> Show Block
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Block -> ShowS
showsPrec :: Int -> Block -> ShowS
$cshow :: Block -> String
show :: Block -> String
$cshowList :: [Block] -> ShowS
showList :: [Block] -> ShowS
Show, Eq Block
Eq Block =>
(Block -> Block -> Ordering)
-> (Block -> Block -> Bool)
-> (Block -> Block -> Bool)
-> (Block -> Block -> Bool)
-> (Block -> Block -> Bool)
-> (Block -> Block -> Block)
-> (Block -> Block -> Block)
-> Ord Block
Block -> Block -> Bool
Block -> Block -> Ordering
Block -> Block -> Block
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Block -> Block -> Ordering
compare :: Block -> Block -> Ordering
$c< :: Block -> Block -> Bool
< :: Block -> Block -> Bool
$c<= :: Block -> Block -> Bool
<= :: Block -> Block -> Bool
$c> :: Block -> Block -> Bool
> :: Block -> Block -> Bool
$c>= :: Block -> Block -> Bool
>= :: Block -> Block -> Bool
$cmax :: Block -> Block -> Block
max :: Block -> Block -> Block
$cmin :: Block -> Block -> Block
min :: Block -> Block -> Block
Ord, Block -> Block -> Bool
(Block -> Block -> Bool) -> (Block -> Block -> Bool) -> Eq Block
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Block -> Block -> Bool
== :: Block -> Block -> Bool
$c/= :: Block -> Block -> Bool
/= :: Block -> Block -> Bool
Eq, Typeable, (forall x. Block -> Rep Block x)
-> (forall x. Rep Block x -> Block) -> Generic Block
forall x. Rep Block x -> Block
forall x. Block -> Rep Block x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Block -> Rep Block x
from :: forall x. Block -> Rep Block x
$cto :: forall x. Rep Block x -> Block
to :: forall x. Rep Block x -> Block
Generic)
type Blocks = Many (Node Block)
instance Semigroup Blocks where
Many Seq (Node Block)
as <> :: Blocks -> Blocks -> Blocks
<> Many Seq (Node Block)
bs = Seq (Node Block) -> Blocks
forall a. Seq a -> Many a
Many (Seq (Node Block)
as Seq (Node Block) -> Seq (Node Block) -> Seq (Node Block)
forall a. Semigroup a => a -> a -> a
<> Seq (Node Block)
bs)
instance Monoid Blocks where
mappend :: Blocks -> Blocks -> Blocks
mappend = Blocks -> Blocks -> Blocks
forall a. Semigroup a => a -> a -> a
(<>)
mempty :: Blocks
mempty = Seq (Node Block) -> Blocks
forall a. Seq a -> Many a
Many Seq (Node Block)
forall a. Monoid a => a
mempty
data Doc =
Doc{ Doc -> Blocks
docBlocks :: Blocks
, :: NoteMap
, Doc -> ReferenceMap
docReferences :: ReferenceMap
, Doc -> ReferenceMap
docAutoReferences :: ReferenceMap
, Doc -> Set ByteString
docAutoIdentifiers :: Set ByteString
} deriving (Int -> Doc -> ShowS
[Doc] -> ShowS
Doc -> String
(Int -> Doc -> ShowS)
-> (Doc -> String) -> ([Doc] -> ShowS) -> Show Doc
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Doc -> ShowS
showsPrec :: Int -> Doc -> ShowS
$cshow :: Doc -> String
show :: Doc -> String
$cshowList :: [Doc] -> ShowS
showList :: [Doc] -> ShowS
Show, Eq Doc
Eq Doc =>
(Doc -> Doc -> Ordering)
-> (Doc -> Doc -> Bool)
-> (Doc -> Doc -> Bool)
-> (Doc -> Doc -> Bool)
-> (Doc -> Doc -> Bool)
-> (Doc -> Doc -> Doc)
-> (Doc -> Doc -> Doc)
-> Ord Doc
Doc -> Doc -> Bool
Doc -> Doc -> Ordering
Doc -> Doc -> Doc
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Doc -> Doc -> Ordering
compare :: Doc -> Doc -> Ordering
$c< :: Doc -> Doc -> Bool
< :: Doc -> Doc -> Bool
$c<= :: Doc -> Doc -> Bool
<= :: Doc -> Doc -> Bool
$c> :: Doc -> Doc -> Bool
> :: Doc -> Doc -> Bool
$c>= :: Doc -> Doc -> Bool
>= :: Doc -> Doc -> Bool
$cmax :: Doc -> Doc -> Doc
max :: Doc -> Doc -> Doc
$cmin :: Doc -> Doc -> Doc
min :: Doc -> Doc -> Doc
Ord, Doc -> Doc -> Bool
(Doc -> Doc -> Bool) -> (Doc -> Doc -> Bool) -> Eq Doc
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Doc -> Doc -> Bool
== :: Doc -> Doc -> Bool
$c/= :: Doc -> Doc -> Bool
/= :: Doc -> Doc -> Bool
Eq, Typeable, (forall x. Doc -> Rep Doc x)
-> (forall x. Rep Doc x -> Doc) -> Generic Doc
forall x. Rep Doc x -> Doc
forall x. Doc -> Rep Doc x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Doc -> Rep Doc x
from :: forall x. Doc -> Rep Doc x
$cto :: forall x. Rep Doc x -> Doc
to :: forall x. Rep Doc x -> Doc
Generic)
instance Semigroup Doc where
Doc Blocks
bs NoteMap
ns ReferenceMap
rs ReferenceMap
ar Set ByteString
ai <> :: Doc -> Doc -> Doc
<> Doc Blocks
bs' NoteMap
ns' ReferenceMap
rs' ReferenceMap
ar' Set ByteString
ai' =
Blocks
-> NoteMap -> ReferenceMap -> ReferenceMap -> Set ByteString -> Doc
Doc (Blocks
bs Blocks -> Blocks -> Blocks
forall a. Semigroup a => a -> a -> a
<> Blocks
bs') (NoteMap
ns NoteMap -> NoteMap -> NoteMap
forall a. Semigroup a => a -> a -> a
<> NoteMap
ns') (ReferenceMap
rs ReferenceMap -> ReferenceMap -> ReferenceMap
forall a. Semigroup a => a -> a -> a
<> ReferenceMap
rs') (ReferenceMap
ar ReferenceMap -> ReferenceMap -> ReferenceMap
forall a. Semigroup a => a -> a -> a
<> ReferenceMap
ar') (Set ByteString
ai Set ByteString -> Set ByteString -> Set ByteString
forall a. Semigroup a => a -> a -> a
<> Set ByteString
ai')
instance Monoid Doc where
mappend :: Doc -> Doc -> Doc
mappend = Doc -> Doc -> Doc
forall a. Semigroup a => a -> a -> a
(<>)
mempty :: Doc
mempty = Blocks
-> NoteMap -> ReferenceMap -> ReferenceMap -> Set ByteString -> Doc
Doc Blocks
forall a. Monoid a => a
mempty NoteMap
forall a. Monoid a => a
mempty ReferenceMap
forall a. Monoid a => a
mempty ReferenceMap
forall a. Monoid a => a
mempty Set ByteString
forall a. Monoid a => a
mempty
newtype NoteMap = NoteMap { NoteMap -> Map ByteString Blocks
unNoteMap :: M.Map ByteString Blocks }
deriving (Int -> NoteMap -> ShowS
[NoteMap] -> ShowS
NoteMap -> String
(Int -> NoteMap -> ShowS)
-> (NoteMap -> String) -> ([NoteMap] -> ShowS) -> Show NoteMap
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NoteMap -> ShowS
showsPrec :: Int -> NoteMap -> ShowS
$cshow :: NoteMap -> String
show :: NoteMap -> String
$cshowList :: [NoteMap] -> ShowS
showList :: [NoteMap] -> ShowS
Show, Eq NoteMap
Eq NoteMap =>
(NoteMap -> NoteMap -> Ordering)
-> (NoteMap -> NoteMap -> Bool)
-> (NoteMap -> NoteMap -> Bool)
-> (NoteMap -> NoteMap -> Bool)
-> (NoteMap -> NoteMap -> Bool)
-> (NoteMap -> NoteMap -> NoteMap)
-> (NoteMap -> NoteMap -> NoteMap)
-> Ord NoteMap
NoteMap -> NoteMap -> Bool
NoteMap -> NoteMap -> Ordering
NoteMap -> NoteMap -> NoteMap
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: NoteMap -> NoteMap -> Ordering
compare :: NoteMap -> NoteMap -> Ordering
$c< :: NoteMap -> NoteMap -> Bool
< :: NoteMap -> NoteMap -> Bool
$c<= :: NoteMap -> NoteMap -> Bool
<= :: NoteMap -> NoteMap -> Bool
$c> :: NoteMap -> NoteMap -> Bool
> :: NoteMap -> NoteMap -> Bool
$c>= :: NoteMap -> NoteMap -> Bool
>= :: NoteMap -> NoteMap -> Bool
$cmax :: NoteMap -> NoteMap -> NoteMap
max :: NoteMap -> NoteMap -> NoteMap
$cmin :: NoteMap -> NoteMap -> NoteMap
min :: NoteMap -> NoteMap -> NoteMap
Ord, NoteMap -> NoteMap -> Bool
(NoteMap -> NoteMap -> Bool)
-> (NoteMap -> NoteMap -> Bool) -> Eq NoteMap
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NoteMap -> NoteMap -> Bool
== :: NoteMap -> NoteMap -> Bool
$c/= :: NoteMap -> NoteMap -> Bool
/= :: NoteMap -> NoteMap -> Bool
Eq, NonEmpty NoteMap -> NoteMap
NoteMap -> NoteMap -> NoteMap
(NoteMap -> NoteMap -> NoteMap)
-> (NonEmpty NoteMap -> NoteMap)
-> (forall b. Integral b => b -> NoteMap -> NoteMap)
-> Semigroup NoteMap
forall b. Integral b => b -> NoteMap -> NoteMap
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
$c<> :: NoteMap -> NoteMap -> NoteMap
<> :: NoteMap -> NoteMap -> NoteMap
$csconcat :: NonEmpty NoteMap -> NoteMap
sconcat :: NonEmpty NoteMap -> NoteMap
$cstimes :: forall b. Integral b => b -> NoteMap -> NoteMap
stimes :: forall b. Integral b => b -> NoteMap -> NoteMap
Semigroup, Semigroup NoteMap
NoteMap
Semigroup NoteMap =>
NoteMap
-> (NoteMap -> NoteMap -> NoteMap)
-> ([NoteMap] -> NoteMap)
-> Monoid NoteMap
[NoteMap] -> NoteMap
NoteMap -> NoteMap -> NoteMap
forall a.
Semigroup a =>
a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
$cmempty :: NoteMap
mempty :: NoteMap
$cmappend :: NoteMap -> NoteMap -> NoteMap
mappend :: NoteMap -> NoteMap -> NoteMap
$cmconcat :: [NoteMap] -> NoteMap
mconcat :: [NoteMap] -> NoteMap
Monoid, Typeable, (forall x. NoteMap -> Rep NoteMap x)
-> (forall x. Rep NoteMap x -> NoteMap) -> Generic NoteMap
forall x. Rep NoteMap x -> NoteMap
forall x. NoteMap -> Rep NoteMap x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. NoteMap -> Rep NoteMap x
from :: forall x. NoteMap -> Rep NoteMap x
$cto :: forall x. Rep NoteMap x -> NoteMap
to :: forall x. Rep NoteMap x -> NoteMap
Generic)
insertNote :: ByteString -> Blocks -> NoteMap -> NoteMap
insertNote :: ByteString -> Blocks -> NoteMap -> NoteMap
insertNote ByteString
label Blocks
ref (NoteMap Map ByteString Blocks
m) =
Map ByteString Blocks -> NoteMap
NoteMap (ByteString
-> Blocks -> Map ByteString Blocks -> Map ByteString Blocks
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (ByteString -> ByteString
normalizeLabel ByteString
label) Blocks
ref Map ByteString Blocks
m)
lookupNote :: ByteString -> NoteMap -> Maybe Blocks
lookupNote :: ByteString -> NoteMap -> Maybe Blocks
lookupNote ByteString
label (NoteMap Map ByteString Blocks
m) =
ByteString -> Map ByteString Blocks -> Maybe Blocks
forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup (ByteString -> ByteString
normalizeLabel ByteString
label) Map ByteString Blocks
m
newtype ReferenceMap =
ReferenceMap { ReferenceMap -> Map ByteString (ByteString, Attr)
unReferenceMap :: M.Map ByteString (ByteString, Attr) }
deriving (Int -> ReferenceMap -> ShowS
[ReferenceMap] -> ShowS
ReferenceMap -> String
(Int -> ReferenceMap -> ShowS)
-> (ReferenceMap -> String)
-> ([ReferenceMap] -> ShowS)
-> Show ReferenceMap
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReferenceMap -> ShowS
showsPrec :: Int -> ReferenceMap -> ShowS
$cshow :: ReferenceMap -> String
show :: ReferenceMap -> String
$cshowList :: [ReferenceMap] -> ShowS
showList :: [ReferenceMap] -> ShowS
Show, Eq ReferenceMap
Eq ReferenceMap =>
(ReferenceMap -> ReferenceMap -> Ordering)
-> (ReferenceMap -> ReferenceMap -> Bool)
-> (ReferenceMap -> ReferenceMap -> Bool)
-> (ReferenceMap -> ReferenceMap -> Bool)
-> (ReferenceMap -> ReferenceMap -> Bool)
-> (ReferenceMap -> ReferenceMap -> ReferenceMap)
-> (ReferenceMap -> ReferenceMap -> ReferenceMap)
-> Ord ReferenceMap
ReferenceMap -> ReferenceMap -> Bool
ReferenceMap -> ReferenceMap -> Ordering
ReferenceMap -> ReferenceMap -> ReferenceMap
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ReferenceMap -> ReferenceMap -> Ordering
compare :: ReferenceMap -> ReferenceMap -> Ordering
$c< :: ReferenceMap -> ReferenceMap -> Bool
< :: ReferenceMap -> ReferenceMap -> Bool
$c<= :: ReferenceMap -> ReferenceMap -> Bool
<= :: ReferenceMap -> ReferenceMap -> Bool
$c> :: ReferenceMap -> ReferenceMap -> Bool
> :: ReferenceMap -> ReferenceMap -> Bool
$c>= :: ReferenceMap -> ReferenceMap -> Bool
>= :: ReferenceMap -> ReferenceMap -> Bool
$cmax :: ReferenceMap -> ReferenceMap -> ReferenceMap
max :: ReferenceMap -> ReferenceMap -> ReferenceMap
$cmin :: ReferenceMap -> ReferenceMap -> ReferenceMap
min :: ReferenceMap -> ReferenceMap -> ReferenceMap
Ord, ReferenceMap -> ReferenceMap -> Bool
(ReferenceMap -> ReferenceMap -> Bool)
-> (ReferenceMap -> ReferenceMap -> Bool) -> Eq ReferenceMap
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReferenceMap -> ReferenceMap -> Bool
== :: ReferenceMap -> ReferenceMap -> Bool
$c/= :: ReferenceMap -> ReferenceMap -> Bool
/= :: ReferenceMap -> ReferenceMap -> Bool
Eq, NonEmpty ReferenceMap -> ReferenceMap
ReferenceMap -> ReferenceMap -> ReferenceMap
(ReferenceMap -> ReferenceMap -> ReferenceMap)
-> (NonEmpty ReferenceMap -> ReferenceMap)
-> (forall b. Integral b => b -> ReferenceMap -> ReferenceMap)
-> Semigroup ReferenceMap
forall b. Integral b => b -> ReferenceMap -> ReferenceMap
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
$c<> :: ReferenceMap -> ReferenceMap -> ReferenceMap
<> :: ReferenceMap -> ReferenceMap -> ReferenceMap
$csconcat :: NonEmpty ReferenceMap -> ReferenceMap
sconcat :: NonEmpty ReferenceMap -> ReferenceMap
$cstimes :: forall b. Integral b => b -> ReferenceMap -> ReferenceMap
stimes :: forall b. Integral b => b -> ReferenceMap -> ReferenceMap
Semigroup, Semigroup ReferenceMap
ReferenceMap
Semigroup ReferenceMap =>
ReferenceMap
-> (ReferenceMap -> ReferenceMap -> ReferenceMap)
-> ([ReferenceMap] -> ReferenceMap)
-> Monoid ReferenceMap
[ReferenceMap] -> ReferenceMap
ReferenceMap -> ReferenceMap -> ReferenceMap
forall a.
Semigroup a =>
a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
$cmempty :: ReferenceMap
mempty :: ReferenceMap
$cmappend :: ReferenceMap -> ReferenceMap -> ReferenceMap
mappend :: ReferenceMap -> ReferenceMap -> ReferenceMap
$cmconcat :: [ReferenceMap] -> ReferenceMap
mconcat :: [ReferenceMap] -> ReferenceMap
Monoid, Typeable, (forall x. ReferenceMap -> Rep ReferenceMap x)
-> (forall x. Rep ReferenceMap x -> ReferenceMap)
-> Generic ReferenceMap
forall x. Rep ReferenceMap x -> ReferenceMap
forall x. ReferenceMap -> Rep ReferenceMap x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReferenceMap -> Rep ReferenceMap x
from :: forall x. ReferenceMap -> Rep ReferenceMap x
$cto :: forall x. Rep ReferenceMap x -> ReferenceMap
to :: forall x. Rep ReferenceMap x -> ReferenceMap
Generic)
normalizeLabel :: ByteString -> ByteString
normalizeLabel :: ByteString -> ByteString
normalizeLabel = [ByteString] -> ByteString
B8.unwords ([ByteString] -> ByteString)
-> (ByteString -> [ByteString]) -> ByteString -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> [ByteString]
B8.words
insertReference :: ByteString -> (ByteString, Attr) -> ReferenceMap
-> ReferenceMap
insertReference :: ByteString -> (ByteString, Attr) -> ReferenceMap -> ReferenceMap
insertReference ByteString
label (ByteString, Attr)
ref (ReferenceMap Map ByteString (ByteString, Attr)
rm) =
Map ByteString (ByteString, Attr) -> ReferenceMap
ReferenceMap (ByteString
-> (ByteString, Attr)
-> Map ByteString (ByteString, Attr)
-> Map ByteString (ByteString, Attr)
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert (ByteString -> ByteString
normalizeLabel ByteString
label) (ByteString, Attr)
ref Map ByteString (ByteString, Attr)
rm)
lookupReference :: ByteString -> ReferenceMap -> Maybe (ByteString, Attr)
lookupReference :: ByteString -> ReferenceMap -> Maybe (ByteString, Attr)
lookupReference ByteString
label (ReferenceMap Map ByteString (ByteString, Attr)
rm) =
ByteString
-> Map ByteString (ByteString, Attr) -> Maybe (ByteString, Attr)
forall k a. Ord k => k -> Map k a -> Maybe a
M.lookup (ByteString -> ByteString
normalizeLabel ByteString
label) Map ByteString (ByteString, Attr)
rm
{-# INLINE inline #-}
inline :: Inline -> Inlines
inline :: Inline -> Inlines
inline = Seq (Node Inline) -> Inlines
forall a. Seq a -> Many a
Many (Seq (Node Inline) -> Inlines)
-> (Inline -> Seq (Node Inline)) -> Inline -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Node Inline -> Seq (Node Inline)
forall a. a -> Seq a
Seq.singleton (Node Inline -> Seq (Node Inline))
-> (Inline -> Node Inline) -> Inline -> Seq (Node Inline)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Pos -> Attr -> Inline -> Node Inline
forall a. Pos -> Attr -> a -> Node a
Node Pos
NoPos Attr
forall a. Monoid a => a
mempty
str, verbatim, symbol :: ByteString -> Inlines
str :: ByteString -> Inlines
str = Inline -> Inlines
inline (Inline -> Inlines)
-> (ByteString -> Inline) -> ByteString -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Inline
Str
verbatim :: ByteString -> Inlines
verbatim = Inline -> Inlines
inline (Inline -> Inlines)
-> (ByteString -> Inline) -> ByteString -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Inline
Verbatim
symbol :: ByteString -> Inlines
symbol = Inline -> Inlines
inline (Inline -> Inlines)
-> (ByteString -> Inline) -> ByteString -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Inline
Symbol
emph, strong, superscript, subscript :: Inlines -> Inlines
emph :: Inlines -> Inlines
emph = Inline -> Inlines
inline (Inline -> Inlines) -> (Inlines -> Inline) -> Inlines -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inlines -> Inline
Emph
strong :: Inlines -> Inlines
strong = Inline -> Inlines
inline (Inline -> Inlines) -> (Inlines -> Inline) -> Inlines -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inlines -> Inline
Strong
superscript :: Inlines -> Inlines
superscript = Inline -> Inlines
inline (Inline -> Inlines) -> (Inlines -> Inline) -> Inlines -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inlines -> Inline
Superscript
subscript :: Inlines -> Inlines
subscript = Inline -> Inlines
inline (Inline -> Inlines) -> (Inlines -> Inline) -> Inlines -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inlines -> Inline
Subscript
highlight, insert, delete :: Inlines -> Inlines
highlight :: Inlines -> Inlines
highlight = Inline -> Inlines
inline (Inline -> Inlines) -> (Inlines -> Inline) -> Inlines -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inlines -> Inline
Highlight
insert :: Inlines -> Inlines
insert = Inline -> Inlines
inline (Inline -> Inlines) -> (Inlines -> Inline) -> Inlines -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inlines -> Inline
Insert
delete :: Inlines -> Inlines
delete = Inline -> Inlines
inline (Inline -> Inlines) -> (Inlines -> Inline) -> Inlines -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inlines -> Inline
Delete
link, image :: Inlines -> Target -> Inlines
link :: Inlines -> Target -> Inlines
link Inlines
ils Target
url = Inline -> Inlines
inline (Inline -> Inlines) -> Inline -> Inlines
forall a b. (a -> b) -> a -> b
$ Inlines -> Target -> Inline
Link Inlines
ils Target
url
image :: Inlines -> Target -> Inlines
image Inlines
ils Target
url = Inline -> Inlines
inline (Inline -> Inlines) -> Inline -> Inlines
forall a b. (a -> b) -> a -> b
$ Inlines -> Target -> Inline
Image Inlines
ils Target
url
span_ :: Inlines -> Inlines
span_ :: Inlines -> Inlines
span_ = Inline -> Inlines
inline (Inline -> Inlines) -> (Inlines -> Inline) -> Inlines -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inlines -> Inline
Span
softBreak, hardBreak, nonBreakingSpace :: Inlines
softBreak :: Inlines
softBreak = Inline -> Inlines
inline Inline
SoftBreak
hardBreak :: Inlines
hardBreak = Inline -> Inlines
inline Inline
HardBreak
nonBreakingSpace :: Inlines
nonBreakingSpace = Inline -> Inlines
inline Inline
NonBreakingSpace
inlineMath, displayMath :: ByteString -> Inlines
inlineMath :: ByteString -> Inlines
inlineMath = Inline -> Inlines
inline (Inline -> Inlines)
-> (ByteString -> Inline) -> ByteString -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MathStyle -> ByteString -> Inline
Math MathStyle
InlineMath
displayMath :: ByteString -> Inlines
displayMath = Inline -> Inlines
inline (Inline -> Inlines)
-> (ByteString -> Inline) -> ByteString -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MathStyle -> ByteString -> Inline
Math MathStyle
DisplayMath
singleQuoted, doubleQuoted :: Inlines -> Inlines
singleQuoted :: Inlines -> Inlines
singleQuoted = Inline -> Inlines
inline (Inline -> Inlines) -> (Inlines -> Inline) -> Inlines -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QuoteType -> Inlines -> Inline
Quoted QuoteType
SingleQuotes
doubleQuoted :: Inlines -> Inlines
doubleQuoted = Inline -> Inlines
inline (Inline -> Inlines) -> (Inlines -> Inline) -> Inlines -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QuoteType -> Inlines -> Inline
Quoted QuoteType
DoubleQuotes
footnoteReference :: ByteString -> Inlines
= Inline -> Inlines
inline (Inline -> Inlines)
-> (ByteString -> Inline) -> ByteString -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Inline
FootnoteReference
urlLink, emailLink :: ByteString -> Inlines
urlLink :: ByteString -> Inlines
urlLink = Inline -> Inlines
inline (Inline -> Inlines)
-> (ByteString -> Inline) -> ByteString -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Inline
UrlLink
emailLink :: ByteString -> Inlines
emailLink = Inline -> Inlines
inline (Inline -> Inlines)
-> (ByteString -> Inline) -> ByteString -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Inline
EmailLink
rawInline :: Format -> ByteString -> Inlines
rawInline :: Format -> ByteString -> Inlines
rawInline Format
f = Inline -> Inlines
inline (Inline -> Inlines)
-> (ByteString -> Inline) -> ByteString -> Inlines
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Format -> ByteString -> Inline
RawInline Format
f
block :: Block -> Blocks
block :: Block -> Blocks
block = Seq (Node Block) -> Blocks
forall a. Seq a -> Many a
Many (Seq (Node Block) -> Blocks)
-> (Block -> Seq (Node Block)) -> Block -> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Node Block -> Seq (Node Block)
forall a. a -> Seq a
Seq.singleton (Node Block -> Seq (Node Block))
-> (Block -> Node Block) -> Block -> Seq (Node Block)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Pos -> Attr -> Block -> Node Block
forall a. Pos -> Attr -> a -> Node a
Node Pos
NoPos Attr
forall a. Monoid a => a
mempty
para :: Inlines -> Blocks
para :: Inlines -> Blocks
para = Block -> Blocks
block (Block -> Blocks) -> (Inlines -> Block) -> Inlines -> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inlines -> Block
Para
section :: Blocks -> Blocks
section :: Blocks -> Blocks
section = Block -> Blocks
block (Block -> Blocks) -> (Blocks -> Block) -> Blocks -> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Blocks -> Block
Section
heading :: Int -> Inlines -> Blocks
heading :: Int -> Inlines -> Blocks
heading Int
lev = Block -> Blocks
block (Block -> Blocks) -> (Inlines -> Block) -> Inlines -> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Inlines -> Block
Heading Int
lev
blockQuote :: Blocks -> Blocks
blockQuote :: Blocks -> Blocks
blockQuote = Block -> Blocks
block (Block -> Blocks) -> (Blocks -> Block) -> Blocks -> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Blocks -> Block
BlockQuote
codeBlock :: ByteString -> ByteString -> Blocks
codeBlock :: ByteString -> ByteString -> Blocks
codeBlock ByteString
lang ByteString
bs = Block -> Blocks
block (Block -> Blocks) -> Block -> Blocks
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString -> Block
CodeBlock ByteString
lang ByteString
bs
bulletList :: ListSpacing -> [Blocks] -> Blocks
bulletList :: ListSpacing -> [Blocks] -> Blocks
bulletList ListSpacing
tightness = Block -> Blocks
block (Block -> Blocks) -> ([Blocks] -> Block) -> [Blocks] -> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ListSpacing -> [Blocks] -> Block
BulletList ListSpacing
tightness
orderedList :: OrderedListAttributes -> ListSpacing -> [Blocks] -> Blocks
orderedList :: OrderedListAttributes -> ListSpacing -> [Blocks] -> Blocks
orderedList OrderedListAttributes
attr ListSpacing
tightness = Block -> Blocks
block (Block -> Blocks) -> ([Blocks] -> Block) -> [Blocks] -> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OrderedListAttributes -> ListSpacing -> [Blocks] -> Block
OrderedList OrderedListAttributes
attr ListSpacing
tightness
definitionList :: ListSpacing -> [(Inlines, Blocks)] -> Blocks
definitionList :: ListSpacing -> [(Inlines, Blocks)] -> Blocks
definitionList ListSpacing
tightness = Block -> Blocks
block (Block -> Blocks)
-> ([(Inlines, Blocks)] -> Block) -> [(Inlines, Blocks)] -> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ListSpacing -> [(Inlines, Blocks)] -> Block
DefinitionList ListSpacing
tightness
taskList :: ListSpacing -> [(TaskStatus, Blocks)] -> Blocks
taskList :: ListSpacing -> [(TaskStatus, Blocks)] -> Blocks
taskList ListSpacing
tightness = Block -> Blocks
block (Block -> Blocks)
-> ([(TaskStatus, Blocks)] -> Block)
-> [(TaskStatus, Blocks)]
-> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ListSpacing -> [(TaskStatus, Blocks)] -> Block
TaskList ListSpacing
tightness
div :: Blocks -> Blocks
div :: Blocks -> Blocks
div = Block -> Blocks
block (Block -> Blocks) -> (Blocks -> Block) -> Blocks -> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Blocks -> Block
Div
thematicBreak :: Blocks
thematicBreak :: Blocks
thematicBreak = Block -> Blocks
block Block
ThematicBreak
table :: Maybe Caption -> [[Cell]] -> Blocks
table :: Maybe Caption -> [[Cell]] -> Blocks
table Maybe Caption
mbCaption = Block -> Blocks
block (Block -> Blocks) -> ([[Cell]] -> Block) -> [[Cell]] -> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe Caption -> [[Cell]] -> Block
Table Maybe Caption
mbCaption
rawBlock :: Format -> ByteString -> Blocks
rawBlock :: Format -> ByteString -> Blocks
rawBlock Format
f = Block -> Blocks
block (Block -> Blocks) -> (ByteString -> Block) -> ByteString -> Blocks
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Format -> ByteString -> Block
RawBlock Format
f
inlinesToByteString :: Inlines -> ByteString
inlinesToByteString :: Inlines -> ByteString
inlinesToByteString = (Node Inline -> ByteString) -> Seq (Node Inline) -> ByteString
forall m a. Monoid m => (a -> m) -> Seq a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Node Inline -> ByteString
go (Seq (Node Inline) -> ByteString)
-> (Inlines -> Seq (Node Inline)) -> Inlines -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inlines -> Seq (Node Inline)
forall a. Many a -> Seq a
unMany
where
go :: Node Inline -> ByteString
go (Node Pos
_pos Attr
_attr Inline
x) =
case Inline
x of
Str ByteString
bs -> ByteString
bs
Emph Inlines
ils -> Inlines -> ByteString
inlinesToByteString Inlines
ils
Strong Inlines
ils -> Inlines -> ByteString
inlinesToByteString Inlines
ils
Highlight Inlines
ils -> Inlines -> ByteString
inlinesToByteString Inlines
ils
Insert Inlines
ils -> Inlines -> ByteString
inlinesToByteString Inlines
ils
Delete Inlines
ils -> Inlines -> ByteString
inlinesToByteString Inlines
ils
Superscript Inlines
ils -> Inlines -> ByteString
inlinesToByteString Inlines
ils
Subscript Inlines
ils -> Inlines -> ByteString
inlinesToByteString Inlines
ils
Quoted QuoteType
SingleQuotes Inlines
ils ->
ByteString
"\x2018" ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> Inlines -> ByteString
inlinesToByteString Inlines
ils ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
"\x2019"
Quoted QuoteType
DoubleQuotes Inlines
ils ->
ByteString
"\x201C" ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> Inlines -> ByteString
inlinesToByteString Inlines
ils ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
"\x201D"
Verbatim ByteString
bs -> ByteString
bs
Math MathStyle
DisplayMath ByteString
bs -> ByteString
"$$" ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
bs ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
"$$"
Math MathStyle
InlineMath ByteString
bs -> ByteString
"$" ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
bs ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
"$"
Symbol ByteString
bs -> ByteString
":" ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
bs ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
":"
Link Inlines
ils Target
_url -> Inlines -> ByteString
inlinesToByteString Inlines
ils
Image Inlines
ils Target
_url -> Inlines -> ByteString
inlinesToByteString Inlines
ils
Span Inlines
ils -> Inlines -> ByteString
inlinesToByteString Inlines
ils
UrlLink ByteString
url -> ByteString
url
EmailLink ByteString
email -> ByteString
email
RawInline Format
_ ByteString
_ -> ByteString
forall a. Monoid a => a
mempty
FootnoteReference ByteString
bs -> ByteString
"[" ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
bs ByteString -> ByteString -> ByteString
forall a. Semigroup a => a -> a -> a
<> ByteString
"]"
Inline
SoftBreak -> ByteString
"\n"
Inline
HardBreak -> ByteString
"\n"
Inline
NonBreakingSpace -> ByteString
"\160"