{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
module Text.Pandoc.Lens
(
Pandoc
, body
, meta
, Block
, blockInlines
, _Plain
, _Para
, _CodeBlock
, _BlockQuote
, _OrderedList
, _BulletList
, _DefinitionList
, _Header
, _HorizontalRule
, _Table
, _Div
, blockPrePlate
, Inline
, _Str
, _Emph
, _Strong
, _Strikeout
, _Superscript
, _Subscript
, _SmallCaps
, _Quoted
, _Cite
, _Code
, _Space
, _LineBreak
, _Math
, _RawInline
, _Link
, _Image
, _Note
, _Span
, inlinePrePlate
, MetaValue
, _MetaMap
, _MetaList
, _MetaBool
, _MetaString
, _MetaInlines
, _MetaBlocks
, HasAttr(..)
, attrIdentifier
, attrClasses
, attrs
) where
import Control.Lens
import Text.Pandoc.Definition
import Data.Map (Map)
import Data.Text (Text)
body :: Lens' Pandoc [Block]
body :: Lens' Pandoc [Block]
body = (Pandoc -> [Block])
-> (Pandoc -> [Block] -> Pandoc) -> Lens' Pandoc [Block]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens (\(Pandoc Meta
_ [Block]
b)->[Block]
b) (\(Pandoc Meta
m [Block]
_) [Block]
b->Meta -> [Block] -> Pandoc
Pandoc Meta
m [Block]
b)
meta :: Text -> Traversal' Pandoc MetaValue
meta :: Text -> Traversal' Pandoc MetaValue
meta Text
name = (Meta -> f Meta) -> Pandoc -> f Pandoc
Lens' Pandoc Meta
metaL ((Meta -> f Meta) -> Pandoc -> f Pandoc)
-> ((MetaValue -> f MetaValue) -> Meta -> f Meta)
-> (MetaValue -> f MetaValue)
-> Pandoc
-> f Pandoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Unwrapped Meta -> f (Unwrapped Meta)) -> Meta -> f Meta
forall s. Wrapped s => Iso' s (Unwrapped s)
Iso' Meta (Unwrapped Meta)
_Wrapped' ((Unwrapped Meta -> f (Unwrapped Meta)) -> Meta -> f Meta)
-> ((MetaValue -> f MetaValue)
-> Unwrapped Meta -> f (Unwrapped Meta))
-> (MetaValue -> f MetaValue)
-> Meta
-> f Meta
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (Unwrapped Meta)
-> Traversal' (Unwrapped Meta) (IxValue (Unwrapped Meta))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Text
Index (Unwrapped Meta)
name
where
metaL :: Lens' Pandoc Meta
metaL :: Lens' Pandoc Meta
metaL = (Pandoc -> Meta) -> (Pandoc -> Meta -> Pandoc) -> Lens' Pandoc Meta
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens (\(Pandoc Meta
m [Block]
_)->Meta
m) (\(Pandoc Meta
_ [Block]
a) Meta
m->Meta -> [Block] -> Pandoc
Pandoc Meta
m [Block]
a)
instance Wrapped Meta where
type Unwrapped Meta = Map Text MetaValue
_Wrapped' :: Iso' Meta (Unwrapped Meta)
_Wrapped' = (Meta -> Map Text MetaValue)
-> (Map Text MetaValue -> Meta)
-> Iso Meta Meta (Map Text MetaValue) (Map Text MetaValue)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso Meta -> Map Text MetaValue
unMeta Map Text MetaValue -> Meta
Meta
type instance Index Meta = Text
type instance IxValue Meta = MetaValue
instance Ixed Meta where
ix :: Index Meta -> Traversal' Meta (IxValue Meta)
ix Index Meta
k = (Unwrapped Meta -> f (Unwrapped Meta)) -> Meta -> f Meta
forall s. Wrapped s => Iso' s (Unwrapped s)
Iso' Meta (Unwrapped Meta)
_Wrapped' ((Unwrapped Meta -> f (Unwrapped Meta)) -> Meta -> f Meta)
-> ((MetaValue -> f MetaValue)
-> Unwrapped Meta -> f (Unwrapped Meta))
-> (MetaValue -> f MetaValue)
-> Meta
-> f Meta
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (Unwrapped Meta)
-> Traversal' (Unwrapped Meta) (IxValue (Unwrapped Meta))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (Unwrapped Meta)
Index Meta
k
instance At Meta where
at :: Index Meta -> Lens' Meta (Maybe (IxValue Meta))
at Index Meta
k = (Unwrapped Meta -> f (Unwrapped Meta)) -> Meta -> f Meta
forall s. Wrapped s => Iso' s (Unwrapped s)
Iso' Meta (Unwrapped Meta)
_Wrapped' ((Unwrapped Meta -> f (Unwrapped Meta)) -> Meta -> f Meta)
-> ((Maybe MetaValue -> f (Maybe MetaValue))
-> Unwrapped Meta -> f (Unwrapped Meta))
-> (Maybe MetaValue -> f (Maybe MetaValue))
-> Meta
-> f Meta
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (Unwrapped Meta)
-> Lens' (Unwrapped Meta) (Maybe (IxValue (Unwrapped Meta)))
forall m. At m => Index m -> Lens' m (Maybe (IxValue m))
at Index (Unwrapped Meta)
Index Meta
k
_Plain :: Prism' Block [Inline]
_Plain :: Prism' Block [Inline]
_Plain = ([Inline] -> Block)
-> (Block -> Maybe [Inline]) -> Prism' Block [Inline]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Inline] -> Block
Plain Block -> Maybe [Inline]
f
where
f :: Block -> Maybe [Inline]
f (Plain [Inline]
x) = [Inline] -> Maybe [Inline]
forall a. a -> Maybe a
Just [Inline]
x
f Block
_ = Maybe [Inline]
forall a. Maybe a
Nothing
_Para :: Prism' Block [Inline]
_Para :: Prism' Block [Inline]
_Para = ([Inline] -> Block)
-> (Block -> Maybe [Inline]) -> Prism' Block [Inline]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Inline] -> Block
Para Block -> Maybe [Inline]
f
where
f :: Block -> Maybe [Inline]
f (Para [Inline]
x) = [Inline] -> Maybe [Inline]
forall a. a -> Maybe a
Just [Inline]
x
f Block
_ = Maybe [Inline]
forall a. Maybe a
Nothing
_CodeBlock :: Prism' Block Text
_CodeBlock :: Prism' Block Text
_CodeBlock = (Text -> Block) -> (Block -> Maybe Text) -> Prism' Block Text
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Attr -> Text -> Block
CodeBlock Attr
nullAttr) Block -> Maybe Text
f
where
f :: Block -> Maybe Text
f (CodeBlock Attr
_ Text
x) = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
x
f Block
_ = Maybe Text
forall a. Maybe a
Nothing
_BlockQuote :: Prism' Block [Block]
_BlockQuote :: Prism' Block [Block]
_BlockQuote = ([Block] -> Block)
-> (Block -> Maybe [Block]) -> Prism' Block [Block]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Block] -> Block
BlockQuote Block -> Maybe [Block]
f
where
f :: Block -> Maybe [Block]
f (BlockQuote [Block]
x) = [Block] -> Maybe [Block]
forall a. a -> Maybe a
Just [Block]
x
f Block
_ = Maybe [Block]
forall a. Maybe a
Nothing
_OrderedList :: Prism' Block (ListAttributes, [[Block]])
_OrderedList :: Prism' Block (ListAttributes, [[Block]])
_OrderedList = ((ListAttributes, [[Block]]) -> Block)
-> (Block -> Maybe (ListAttributes, [[Block]]))
-> Prism' Block (ListAttributes, [[Block]])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ((ListAttributes -> [[Block]] -> Block)
-> (ListAttributes, [[Block]]) -> Block
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ListAttributes -> [[Block]] -> Block
OrderedList) Block -> Maybe (ListAttributes, [[Block]])
f
where
f :: Block -> Maybe (ListAttributes, [[Block]])
f (OrderedList ListAttributes
x [[Block]]
y) = (ListAttributes, [[Block]]) -> Maybe (ListAttributes, [[Block]])
forall a. a -> Maybe a
Just (ListAttributes
x, [[Block]]
y)
f Block
_ = Maybe (ListAttributes, [[Block]])
forall a. Maybe a
Nothing
_BulletList :: Prism' Block [[Block]]
_BulletList :: Prism' Block [[Block]]
_BulletList = ([[Block]] -> Block)
-> (Block -> Maybe [[Block]]) -> Prism' Block [[Block]]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [[Block]] -> Block
BulletList Block -> Maybe [[Block]]
f
where
f :: Block -> Maybe [[Block]]
f (BulletList [[Block]]
x) = [[Block]] -> Maybe [[Block]]
forall a. a -> Maybe a
Just [[Block]]
x
f Block
_ = Maybe [[Block]]
forall a. Maybe a
Nothing
_DefinitionList :: Prism' Block [([Inline], [[Block]])]
_DefinitionList :: Prism' Block [([Inline], [[Block]])]
_DefinitionList = ([([Inline], [[Block]])] -> Block)
-> (Block -> Maybe [([Inline], [[Block]])])
-> Prism' Block [([Inline], [[Block]])]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [([Inline], [[Block]])] -> Block
DefinitionList Block -> Maybe [([Inline], [[Block]])]
f
where
f :: Block -> Maybe [([Inline], [[Block]])]
f (DefinitionList [([Inline], [[Block]])]
x) = [([Inline], [[Block]])] -> Maybe [([Inline], [[Block]])]
forall a. a -> Maybe a
Just [([Inline], [[Block]])]
x
f Block
_ = Maybe [([Inline], [[Block]])]
forall a. Maybe a
Nothing
_Header :: Prism' Block (Int, [Inline])
= ((Int, [Inline]) -> Block)
-> (Block -> Maybe (Int, [Inline])) -> Prism' Block (Int, [Inline])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (\(Int
a,[Inline]
b) -> Int -> Attr -> [Inline] -> Block
Header Int
a Attr
nullAttr [Inline]
b) Block -> Maybe (Int, [Inline])
f
where
f :: Block -> Maybe (Int, [Inline])
f (Header Int
a Attr
_ [Inline]
b) = (Int, [Inline]) -> Maybe (Int, [Inline])
forall a. a -> Maybe a
Just (Int
a, [Inline]
b)
f Block
_ = Maybe (Int, [Inline])
forall a. Maybe a
Nothing
_HorizontalRule :: Prism' Block ()
_HorizontalRule :: Prism' Block ()
_HorizontalRule = (() -> Block) -> (Block -> Maybe ()) -> Prism' Block ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Block -> () -> Block
forall a b. a -> b -> a
const Block
HorizontalRule) Block -> Maybe ()
f
where
f :: Block -> Maybe ()
f Block
HorizontalRule = () -> Maybe ()
forall a. a -> Maybe a
Just ()
f Block
_ = Maybe ()
forall a. Maybe a
Nothing
_Table :: Prism' Block (Attr, Caption,[ColSpec],TableHead,[TableBody],TableFoot)
_Table :: Prism'
Block (Attr, Caption, [ColSpec], TableHead, [TableBody], TableFoot)
_Table = ((Attr, Caption, [ColSpec], TableHead, [TableBody], TableFoot)
-> Block)
-> (Block
-> Maybe
(Attr, Caption, [ColSpec], TableHead, [TableBody], TableFoot))
-> Prism'
Block (Attr, Caption, [ColSpec], TableHead, [TableBody], TableFoot)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (\(Attr
attr, Caption
caption, [ColSpec]
colSpecs, TableHead
tableHead, [TableBody]
tableBodies, TableFoot
tableFoot)
-> Attr
-> Caption
-> [ColSpec]
-> TableHead
-> [TableBody]
-> TableFoot
-> Block
Table Attr
attr Caption
caption [ColSpec]
colSpecs TableHead
tableHead [TableBody]
tableBodies TableFoot
tableFoot) Block
-> Maybe
(Attr, Caption, [ColSpec], TableHead, [TableBody], TableFoot)
f
where
f :: Block
-> Maybe
(Attr, Caption, [ColSpec], TableHead, [TableBody], TableFoot)
f (Table Attr
attr Caption
caption [ColSpec]
colSpecs TableHead
tableHead [TableBody]
tableBodies TableFoot
tableFoot)
= (Attr, Caption, [ColSpec], TableHead, [TableBody], TableFoot)
-> Maybe
(Attr, Caption, [ColSpec], TableHead, [TableBody], TableFoot)
forall a. a -> Maybe a
Just (Attr
attr, Caption
caption, [ColSpec]
colSpecs, TableHead
tableHead, [TableBody]
tableBodies, TableFoot
tableFoot)
f Block
_ = Maybe (Attr, Caption, [ColSpec], TableHead, [TableBody], TableFoot)
forall a. Maybe a
Nothing
_Div :: Prism' Block [Block]
_Div :: Prism' Block [Block]
_Div = ([Block] -> Block)
-> (Block -> Maybe [Block]) -> Prism' Block [Block]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Attr -> [Block] -> Block
Div Attr
nullAttr) Block -> Maybe [Block]
f
where
f :: Block -> Maybe [Block]
f (Div Attr
_ [Block]
a) = [Block] -> Maybe [Block]
forall a. a -> Maybe a
Just [Block]
a
f Block
_ = Maybe [Block]
forall a. Maybe a
Nothing
blockPrePlate :: Traversal' Block [Block]
blockPrePlate :: Traversal' Block [Block]
blockPrePlate [Block] -> f [Block]
f Block
blk =
case Block
blk of
BlockQuote [Block]
blks -> [Block] -> Block
BlockQuote ([Block] -> Block) -> f [Block] -> f Block
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Block] -> f [Block]
f [Block]
blks
OrderedList ListAttributes
attrs' [[Block]]
blks -> ListAttributes -> [[Block]] -> Block
OrderedList ListAttributes
attrs' ([[Block]] -> Block) -> f [[Block]] -> f Block
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f [[Block]] [[Block]] [Block] [Block]
-> LensLike f [[Block]] [[Block]] [Block] [Block]
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf LensLike f [[Block]] [[Block]] [Block] [Block]
forall s t a b. Each s t a b => Traversal s t a b
Traversal [[Block]] [[Block]] [Block] [Block]
each [Block] -> f [Block]
f [[Block]]
blks
BulletList [[Block]]
blks -> [[Block]] -> Block
BulletList ([[Block]] -> Block) -> f [[Block]] -> f Block
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f [[Block]] [[Block]] [Block] [Block]
-> LensLike f [[Block]] [[Block]] [Block] [Block]
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf LensLike f [[Block]] [[Block]] [Block] [Block]
forall s t a b. Each s t a b => Traversal s t a b
Traversal [[Block]] [[Block]] [Block] [Block]
each [Block] -> f [Block]
f [[Block]]
blks
DefinitionList [([Inline], [[Block]])]
blks -> [([Inline], [[Block]])] -> Block
DefinitionList ([([Inline], [[Block]])] -> Block)
-> f [([Inline], [[Block]])] -> f Block
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike
f [([Inline], [[Block]])] [([Inline], [[Block]])] [Block] [Block]
-> LensLike
f [([Inline], [[Block]])] [([Inline], [[Block]])] [Block] [Block]
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf ((([Inline], [[Block]]) -> f ([Inline], [[Block]]))
-> [([Inline], [[Block]])] -> f [([Inline], [[Block]])]
forall s t a b. Each s t a b => Traversal s t a b
Traversal
[([Inline], [[Block]])]
[([Inline], [[Block]])]
([Inline], [[Block]])
([Inline], [[Block]])
each ((([Inline], [[Block]]) -> f ([Inline], [[Block]]))
-> [([Inline], [[Block]])] -> f [([Inline], [[Block]])])
-> (([Block] -> f [Block])
-> ([Inline], [[Block]]) -> f ([Inline], [[Block]]))
-> LensLike
f [([Inline], [[Block]])] [([Inline], [[Block]])] [Block] [Block]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([[Block]] -> f [[Block]])
-> ([Inline], [[Block]]) -> f ([Inline], [[Block]])
forall s t a b. Field2 s t a b => Lens s t a b
Lens
([Inline], [[Block]]) ([Inline], [[Block]]) [[Block]] [[Block]]
_2 (([[Block]] -> f [[Block]])
-> ([Inline], [[Block]]) -> f ([Inline], [[Block]]))
-> LensLike f [[Block]] [[Block]] [Block] [Block]
-> ([Block] -> f [Block])
-> ([Inline], [[Block]])
-> f ([Inline], [[Block]])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LensLike f [[Block]] [[Block]] [Block] [Block]
forall s t a b. Each s t a b => Traversal s t a b
Traversal [[Block]] [[Block]] [Block] [Block]
each) [Block] -> f [Block]
f [([Inline], [[Block]])]
blks
Figure Attr
a Caption
b [Block]
blks -> Attr -> Caption -> [Block] -> Block
Figure Attr
a Caption
b ([Block] -> Block) -> f [Block] -> f Block
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Block] -> f [Block]
f [Block]
blks
Div Attr
attrs' [Block]
blks -> Attr -> [Block] -> Block
Div Attr
attrs' ([Block] -> Block) -> f [Block] -> f Block
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Block] -> f [Block]
f [Block]
blks
Block
_ -> Block -> f Block
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Block
blk
instance Plated Block where
plate :: Traversal' Block Block
plate = ([Block] -> f [Block]) -> Block -> f Block
Traversal' Block [Block]
blockPrePlate (([Block] -> f [Block]) -> Block -> f Block)
-> ((Block -> f Block) -> [Block] -> f [Block])
-> (Block -> f Block)
-> Block
-> f Block
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Block -> f Block) -> [Block] -> f [Block]
forall s t a b. Each s t a b => Traversal s t a b
Traversal [Block] [Block] Block Block
each
blockInlines :: Traversal' Block Inline
blockInlines :: Traversal' Block Inline
blockInlines Inline -> f Inline
f Block
blk =
case Block
blk of
Plain [Inline]
inls -> [Inline] -> Block
Plain ([Inline] -> Block) -> f [Inline] -> f Block
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Inline -> f Inline) -> [Inline] -> f [Inline]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Inline -> f Inline
f [Inline]
inls
Para [Inline]
inls -> [Inline] -> Block
Para ([Inline] -> Block) -> f [Inline] -> f Block
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Inline -> f Inline) -> [Inline] -> f [Inline]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Inline -> f Inline
f [Inline]
inls
LineBlock [[Inline]]
inlss -> [[Inline]] -> Block
LineBlock ([[Inline]] -> Block) -> f [[Inline]] -> f Block
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f [[Inline]] [[Inline]] Inline Inline
-> LensLike f [[Inline]] [[Inline]] Inline Inline
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf (([Inline] -> f [Inline]) -> [[Inline]] -> f [[Inline]]
forall s t a b. Each s t a b => Traversal s t a b
Traversal [[Inline]] [[Inline]] [Inline] [Inline]
each (([Inline] -> f [Inline]) -> [[Inline]] -> f [[Inline]])
-> ((Inline -> f Inline) -> [Inline] -> f [Inline])
-> LensLike f [[Inline]] [[Inline]] Inline Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Inline -> f Inline) -> [Inline] -> f [Inline]
forall s t a b. Each s t a b => Traversal s t a b
Traversal [Inline] [Inline] Inline Inline
each) Inline -> f Inline
f [[Inline]]
inlss
DefinitionList [([Inline], [[Block]])]
xs -> [([Inline], [[Block]])] -> Block
DefinitionList ([([Inline], [[Block]])] -> Block)
-> f [([Inline], [[Block]])] -> f Block
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike
f [([Inline], [[Block]])] [([Inline], [[Block]])] Inline Inline
-> LensLike
f [([Inline], [[Block]])] [([Inline], [[Block]])] Inline Inline
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf ((([Inline], [[Block]]) -> f ([Inline], [[Block]]))
-> [([Inline], [[Block]])] -> f [([Inline], [[Block]])]
forall s t a b. Each s t a b => Traversal s t a b
Traversal
[([Inline], [[Block]])]
[([Inline], [[Block]])]
([Inline], [[Block]])
([Inline], [[Block]])
each ((([Inline], [[Block]]) -> f ([Inline], [[Block]]))
-> [([Inline], [[Block]])] -> f [([Inline], [[Block]])])
-> ((Inline -> f Inline)
-> ([Inline], [[Block]]) -> f ([Inline], [[Block]]))
-> LensLike
f [([Inline], [[Block]])] [([Inline], [[Block]])] Inline Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Inline] -> f [Inline])
-> ([Inline], [[Block]]) -> f ([Inline], [[Block]])
forall s t a b. Field1 s t a b => Lens s t a b
Lens ([Inline], [[Block]]) ([Inline], [[Block]]) [Inline] [Inline]
_1 (([Inline] -> f [Inline])
-> ([Inline], [[Block]]) -> f ([Inline], [[Block]]))
-> ((Inline -> f Inline) -> [Inline] -> f [Inline])
-> (Inline -> f Inline)
-> ([Inline], [[Block]])
-> f ([Inline], [[Block]])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Inline -> f Inline) -> [Inline] -> f [Inline]
forall s t a b. Each s t a b => Traversal s t a b
Traversal [Inline] [Inline] Inline Inline
each) Inline -> f Inline
f [([Inline], [[Block]])]
xs
Header Int
n Attr
attr [Inline]
inls -> Int -> Attr -> [Inline] -> Block
Header Int
n Attr
attr ([Inline] -> Block) -> f [Inline] -> f Block
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Inline -> f Inline) -> [Inline] -> f [Inline]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse Inline -> f Inline
f [Inline]
inls
Block
_ -> Block -> f Block
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Block
blk
_Str :: Prism' Inline Text
_Str :: Prism' Inline Text
_Str = (Text -> Inline) -> (Inline -> Maybe Text) -> Prism' Inline Text
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Text -> Inline
Str Inline -> Maybe Text
f
where
f :: Inline -> Maybe Text
f (Str Text
s) = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
s
f Inline
_ = Maybe Text
forall a. Maybe a
Nothing
_Emph :: Prism' Inline [Inline]
_Emph :: Prism' Inline [Inline]
_Emph = ([Inline] -> Inline)
-> (Inline -> Maybe [Inline]) -> Prism' Inline [Inline]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Inline] -> Inline
Emph Inline -> Maybe [Inline]
f
where
f :: Inline -> Maybe [Inline]
f (Emph [Inline]
s) = [Inline] -> Maybe [Inline]
forall a. a -> Maybe a
Just [Inline]
s
f Inline
_ = Maybe [Inline]
forall a. Maybe a
Nothing
_Strong :: Prism' Inline [Inline]
_Strong :: Prism' Inline [Inline]
_Strong = ([Inline] -> Inline)
-> (Inline -> Maybe [Inline]) -> Prism' Inline [Inline]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Inline] -> Inline
Strong Inline -> Maybe [Inline]
f
where
f :: Inline -> Maybe [Inline]
f (Strong [Inline]
s) = [Inline] -> Maybe [Inline]
forall a. a -> Maybe a
Just [Inline]
s
f Inline
_ = Maybe [Inline]
forall a. Maybe a
Nothing
_Strikeout :: Prism' Inline [Inline]
_Strikeout :: Prism' Inline [Inline]
_Strikeout = ([Inline] -> Inline)
-> (Inline -> Maybe [Inline]) -> Prism' Inline [Inline]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Inline] -> Inline
Strikeout Inline -> Maybe [Inline]
f
where
f :: Inline -> Maybe [Inline]
f (Strikeout [Inline]
s) = [Inline] -> Maybe [Inline]
forall a. a -> Maybe a
Just [Inline]
s
f Inline
_ = Maybe [Inline]
forall a. Maybe a
Nothing
_Superscript :: Prism' Inline [Inline]
_Superscript :: Prism' Inline [Inline]
_Superscript = ([Inline] -> Inline)
-> (Inline -> Maybe [Inline]) -> Prism' Inline [Inline]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Inline] -> Inline
Superscript Inline -> Maybe [Inline]
f
where
f :: Inline -> Maybe [Inline]
f (Superscript [Inline]
s) = [Inline] -> Maybe [Inline]
forall a. a -> Maybe a
Just [Inline]
s
f Inline
_ = Maybe [Inline]
forall a. Maybe a
Nothing
_Subscript :: Prism' Inline [Inline]
_Subscript :: Prism' Inline [Inline]
_Subscript = ([Inline] -> Inline)
-> (Inline -> Maybe [Inline]) -> Prism' Inline [Inline]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Inline] -> Inline
Subscript Inline -> Maybe [Inline]
f
where
f :: Inline -> Maybe [Inline]
f (Subscript [Inline]
s) = [Inline] -> Maybe [Inline]
forall a. a -> Maybe a
Just [Inline]
s
f Inline
_ = Maybe [Inline]
forall a. Maybe a
Nothing
_SmallCaps :: Prism' Inline [Inline]
_SmallCaps :: Prism' Inline [Inline]
_SmallCaps = ([Inline] -> Inline)
-> (Inline -> Maybe [Inline]) -> Prism' Inline [Inline]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Inline] -> Inline
SmallCaps Inline -> Maybe [Inline]
f
where
f :: Inline -> Maybe [Inline]
f (SmallCaps [Inline]
s) = [Inline] -> Maybe [Inline]
forall a. a -> Maybe a
Just [Inline]
s
f Inline
_ = Maybe [Inline]
forall a. Maybe a
Nothing
_Quoted :: Prism' Inline (QuoteType, [Inline])
_Quoted :: Prism' Inline (QuoteType, [Inline])
_Quoted = ((QuoteType, [Inline]) -> Inline)
-> (Inline -> Maybe (QuoteType, [Inline]))
-> Prism' Inline (QuoteType, [Inline])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ((QuoteType -> [Inline] -> Inline)
-> (QuoteType, [Inline]) -> Inline
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry QuoteType -> [Inline] -> Inline
Quoted) Inline -> Maybe (QuoteType, [Inline])
f
where
f :: Inline -> Maybe (QuoteType, [Inline])
f (Quoted QuoteType
a [Inline]
b) = (QuoteType, [Inline]) -> Maybe (QuoteType, [Inline])
forall a. a -> Maybe a
Just (QuoteType
a,[Inline]
b)
f Inline
_ = Maybe (QuoteType, [Inline])
forall a. Maybe a
Nothing
_Cite :: Prism' Inline ([Citation], [Inline])
_Cite :: Prism' Inline ([Citation], [Inline])
_Cite = (([Citation], [Inline]) -> Inline)
-> (Inline -> Maybe ([Citation], [Inline]))
-> Prism' Inline ([Citation], [Inline])
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (([Citation] -> [Inline] -> Inline)
-> ([Citation], [Inline]) -> Inline
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry [Citation] -> [Inline] -> Inline
Cite) Inline -> Maybe ([Citation], [Inline])
f
where
f :: Inline -> Maybe ([Citation], [Inline])
f (Cite [Citation]
a [Inline]
b) = ([Citation], [Inline]) -> Maybe ([Citation], [Inline])
forall a. a -> Maybe a
Just ([Citation]
a,[Inline]
b)
f Inline
_ = Maybe ([Citation], [Inline])
forall a. Maybe a
Nothing
_Code :: Prism' Inline Text
_Code :: Prism' Inline Text
_Code = (Text -> Inline) -> (Inline -> Maybe Text) -> Prism' Inline Text
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Attr -> Text -> Inline
Code Attr
nullAttr) Inline -> Maybe Text
f
where
f :: Inline -> Maybe Text
f (Code Attr
_ Text
s) = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
s
f Inline
_ = Maybe Text
forall a. Maybe a
Nothing
_Space :: Prism' Inline ()
_Space :: Prism' Inline ()
_Space = (() -> Inline) -> (Inline -> Maybe ()) -> Prism' Inline ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Inline -> () -> Inline
forall a b. a -> b -> a
const Inline
Space) Inline -> Maybe ()
f
where
f :: Inline -> Maybe ()
f Inline
Space = () -> Maybe ()
forall a. a -> Maybe a
Just ()
f Inline
_ = Maybe ()
forall a. Maybe a
Nothing
_LineBreak :: Prism' Inline ()
_LineBreak :: Prism' Inline ()
_LineBreak = (() -> Inline) -> (Inline -> Maybe ()) -> Prism' Inline ()
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Inline -> () -> Inline
forall a b. a -> b -> a
const Inline
LineBreak) Inline -> Maybe ()
f
where
f :: Inline -> Maybe ()
f Inline
LineBreak = () -> Maybe ()
forall a. a -> Maybe a
Just ()
f Inline
_ = Maybe ()
forall a. Maybe a
Nothing
_Math :: Prism' Inline (MathType, Text)
_Math :: Prism' Inline (MathType, Text)
_Math = ((MathType, Text) -> Inline)
-> (Inline -> Maybe (MathType, Text))
-> Prism' Inline (MathType, Text)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ((MathType -> Text -> Inline) -> (MathType, Text) -> Inline
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry MathType -> Text -> Inline
Math) Inline -> Maybe (MathType, Text)
f
where
f :: Inline -> Maybe (MathType, Text)
f (Math MathType
a Text
b) = (MathType, Text) -> Maybe (MathType, Text)
forall a. a -> Maybe a
Just (MathType
a, Text
b)
f Inline
_ = Maybe (MathType, Text)
forall a. Maybe a
Nothing
_RawInline :: Prism' Inline (Format, Text)
_RawInline :: Prism' Inline (Format, Text)
_RawInline = ((Format, Text) -> Inline)
-> (Inline -> Maybe (Format, Text)) -> Prism' Inline (Format, Text)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' ((Format -> Text -> Inline) -> (Format, Text) -> Inline
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry Format -> Text -> Inline
RawInline) Inline -> Maybe (Format, Text)
f
where
f :: Inline -> Maybe (Format, Text)
f (RawInline Format
a Text
b) = (Format, Text) -> Maybe (Format, Text)
forall a. a -> Maybe a
Just (Format
a, Text
b)
f Inline
_ = Maybe (Format, Text)
forall a. Maybe a
Nothing
_Link :: Prism' Inline ([Inline], Target)
_Link :: Prism' Inline ([Inline], Target)
_Link = (([Inline], Target) -> Inline)
-> (Inline -> Maybe ([Inline], Target))
-> Prism' Inline ([Inline], Target)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (([Inline] -> Target -> Inline) -> ([Inline], Target) -> Inline
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry (([Inline] -> Target -> Inline) -> ([Inline], Target) -> Inline)
-> ([Inline] -> Target -> Inline) -> ([Inline], Target) -> Inline
forall a b. (a -> b) -> a -> b
$ Attr -> [Inline] -> Target -> Inline
Link Attr
nullAttr) Inline -> Maybe ([Inline], Target)
f
where
f :: Inline -> Maybe ([Inline], Target)
f (Link Attr
_ [Inline]
a Target
b) = ([Inline], Target) -> Maybe ([Inline], Target)
forall a. a -> Maybe a
Just ([Inline]
a, Target
b)
f Inline
_ = Maybe ([Inline], Target)
forall a. Maybe a
Nothing
_Image :: Prism' Inline ([Inline], Target)
_Image :: Prism' Inline ([Inline], Target)
_Image = (([Inline], Target) -> Inline)
-> (Inline -> Maybe ([Inline], Target))
-> Prism' Inline ([Inline], Target)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (([Inline] -> Target -> Inline) -> ([Inline], Target) -> Inline
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry (([Inline] -> Target -> Inline) -> ([Inline], Target) -> Inline)
-> ([Inline] -> Target -> Inline) -> ([Inline], Target) -> Inline
forall a b. (a -> b) -> a -> b
$ Attr -> [Inline] -> Target -> Inline
Image Attr
nullAttr) Inline -> Maybe ([Inline], Target)
f
where
f :: Inline -> Maybe ([Inline], Target)
f (Image Attr
_ [Inline]
a Target
b) = ([Inline], Target) -> Maybe ([Inline], Target)
forall a. a -> Maybe a
Just ([Inline]
a, Target
b)
f Inline
_ = Maybe ([Inline], Target)
forall a. Maybe a
Nothing
_Note :: Prism' Inline [Block]
_Note :: Prism' Inline [Block]
_Note = ([Block] -> Inline)
-> (Inline -> Maybe [Block]) -> Prism' Inline [Block]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Block] -> Inline
Note Inline -> Maybe [Block]
f
where
f :: Inline -> Maybe [Block]
f (Note [Block]
s) = [Block] -> Maybe [Block]
forall a. a -> Maybe a
Just [Block]
s
f Inline
_ = Maybe [Block]
forall a. Maybe a
Nothing
_Span :: Prism' Inline [Inline]
_Span :: Prism' Inline [Inline]
_Span = ([Inline] -> Inline)
-> (Inline -> Maybe [Inline]) -> Prism' Inline [Inline]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' (Attr -> [Inline] -> Inline
Span Attr
nullAttr) Inline -> Maybe [Inline]
f
where
f :: Inline -> Maybe [Inline]
f (Span Attr
_ [Inline]
s) = [Inline] -> Maybe [Inline]
forall a. a -> Maybe a
Just [Inline]
s
f Inline
_ = Maybe [Inline]
forall a. Maybe a
Nothing
inlinePrePlate :: Traversal' Inline [Inline]
inlinePrePlate :: Traversal' Inline [Inline]
inlinePrePlate [Inline] -> f [Inline]
f Inline
inl =
case Inline
inl of
Emph [Inline]
cs -> [Inline] -> Inline
Emph ([Inline] -> Inline) -> f [Inline] -> f Inline
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Inline] -> f [Inline]
f [Inline]
cs
Strong [Inline]
cs -> [Inline] -> Inline
Strong ([Inline] -> Inline) -> f [Inline] -> f Inline
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Inline] -> f [Inline]
f [Inline]
cs
Strikeout [Inline]
cs -> [Inline] -> Inline
Strikeout ([Inline] -> Inline) -> f [Inline] -> f Inline
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Inline] -> f [Inline]
f [Inline]
cs
Superscript [Inline]
cs -> [Inline] -> Inline
Superscript ([Inline] -> Inline) -> f [Inline] -> f Inline
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Inline] -> f [Inline]
f [Inline]
cs
Subscript [Inline]
cs -> [Inline] -> Inline
Subscript ([Inline] -> Inline) -> f [Inline] -> f Inline
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Inline] -> f [Inline]
f [Inline]
cs
SmallCaps [Inline]
cs -> [Inline] -> Inline
SmallCaps ([Inline] -> Inline) -> f [Inline] -> f Inline
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Inline] -> f [Inline]
f [Inline]
cs
Quoted QuoteType
q [Inline]
cs -> QuoteType -> [Inline] -> Inline
Quoted QuoteType
q ([Inline] -> Inline) -> f [Inline] -> f Inline
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Inline] -> f [Inline]
f [Inline]
cs
Cite [Citation]
cit [Inline]
cs -> [Citation] -> [Inline] -> Inline
Cite [Citation]
cit ([Inline] -> Inline) -> f [Inline] -> f Inline
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Inline] -> f [Inline]
f [Inline]
cs
Span Attr
attrs' [Inline]
cs -> Attr -> [Inline] -> Inline
Span Attr
attrs' ([Inline] -> Inline) -> f [Inline] -> f Inline
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Inline] -> f [Inline]
f [Inline]
cs
Inline
_ -> Inline -> f Inline
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Inline
inl
instance Plated Inline where
plate :: Traversal' Inline Inline
plate = ([Inline] -> f [Inline]) -> Inline -> f Inline
Traversal' Inline [Inline]
inlinePrePlate (([Inline] -> f [Inline]) -> Inline -> f Inline)
-> ((Inline -> f Inline) -> [Inline] -> f [Inline])
-> (Inline -> f Inline)
-> Inline
-> f Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Inline -> f Inline) -> [Inline] -> f [Inline]
forall s t a b. Each s t a b => Traversal s t a b
Traversal [Inline] [Inline] Inline Inline
each
_MetaMap :: Prism' MetaValue (Map Text MetaValue)
_MetaMap :: Prism' MetaValue (Map Text MetaValue)
_MetaMap = (Map Text MetaValue -> MetaValue)
-> (MetaValue -> Maybe (Map Text MetaValue))
-> Prism' MetaValue (Map Text MetaValue)
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Map Text MetaValue -> MetaValue
MetaMap MetaValue -> Maybe (Map Text MetaValue)
f
where
f :: MetaValue -> Maybe (Map Text MetaValue)
f (MetaMap Map Text MetaValue
x) = Map Text MetaValue -> Maybe (Map Text MetaValue)
forall a. a -> Maybe a
Just Map Text MetaValue
x
f MetaValue
_ = Maybe (Map Text MetaValue)
forall a. Maybe a
Nothing
_MetaList :: Prism' MetaValue [MetaValue]
_MetaList :: Prism' MetaValue [MetaValue]
_MetaList = ([MetaValue] -> MetaValue)
-> (MetaValue -> Maybe [MetaValue]) -> Prism' MetaValue [MetaValue]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [MetaValue] -> MetaValue
MetaList MetaValue -> Maybe [MetaValue]
f
where
f :: MetaValue -> Maybe [MetaValue]
f (MetaList [MetaValue]
x) = [MetaValue] -> Maybe [MetaValue]
forall a. a -> Maybe a
Just [MetaValue]
x
f MetaValue
_ = Maybe [MetaValue]
forall a. Maybe a
Nothing
_MetaBool :: Prism' MetaValue Bool
_MetaBool :: Prism' MetaValue Bool
_MetaBool = (Bool -> MetaValue)
-> (MetaValue -> Maybe Bool) -> Prism' MetaValue Bool
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Bool -> MetaValue
MetaBool MetaValue -> Maybe Bool
f
where
f :: MetaValue -> Maybe Bool
f (MetaBool Bool
x) = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
x
f MetaValue
_ = Maybe Bool
forall a. Maybe a
Nothing
_MetaString :: Prism' MetaValue Text
_MetaString :: Prism' MetaValue Text
_MetaString = (Text -> MetaValue)
-> (MetaValue -> Maybe Text) -> Prism' MetaValue Text
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' Text -> MetaValue
MetaString MetaValue -> Maybe Text
f
where
f :: MetaValue -> Maybe Text
f (MetaString Text
x) = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
x
f MetaValue
_ = Maybe Text
forall a. Maybe a
Nothing
_MetaInlines :: Prism' MetaValue [Inline]
_MetaInlines :: Prism' MetaValue [Inline]
_MetaInlines = ([Inline] -> MetaValue)
-> (MetaValue -> Maybe [Inline]) -> Prism' MetaValue [Inline]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Inline] -> MetaValue
MetaInlines MetaValue -> Maybe [Inline]
f
where
f :: MetaValue -> Maybe [Inline]
f (MetaInlines [Inline]
x) = [Inline] -> Maybe [Inline]
forall a. a -> Maybe a
Just [Inline]
x
f MetaValue
_ = Maybe [Inline]
forall a. Maybe a
Nothing
_MetaBlocks :: Prism' MetaValue [Block]
_MetaBlocks :: Prism' MetaValue [Block]
_MetaBlocks = ([Block] -> MetaValue)
-> (MetaValue -> Maybe [Block]) -> Prism' MetaValue [Block]
forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism' [Block] -> MetaValue
MetaBlocks MetaValue -> Maybe [Block]
f
where
f :: MetaValue -> Maybe [Block]
f (MetaBlocks [Block]
x) = [Block] -> Maybe [Block]
forall a. a -> Maybe a
Just [Block]
x
f MetaValue
_ = Maybe [Block]
forall a. Maybe a
Nothing
instance Plated MetaValue where
plate :: Traversal' MetaValue MetaValue
plate MetaValue -> f MetaValue
f MetaValue
inl =
case MetaValue
inl of
MetaMap Map Text MetaValue
cs -> Map Text MetaValue -> MetaValue
MetaMap (Map Text MetaValue -> MetaValue)
-> f (Map Text MetaValue) -> f MetaValue
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike
f (Map Text MetaValue) (Map Text MetaValue) MetaValue MetaValue
-> LensLike
f (Map Text MetaValue) (Map Text MetaValue) MetaValue MetaValue
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf LensLike
f (Map Text MetaValue) (Map Text MetaValue) MetaValue MetaValue
forall s t a b. Each s t a b => Traversal s t a b
Traversal
(Map Text MetaValue) (Map Text MetaValue) MetaValue MetaValue
each MetaValue -> f MetaValue
f Map Text MetaValue
cs
MetaList [MetaValue]
cs -> [MetaValue] -> MetaValue
MetaList ([MetaValue] -> MetaValue) -> f [MetaValue] -> f MetaValue
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LensLike f [MetaValue] [MetaValue] MetaValue MetaValue
-> LensLike f [MetaValue] [MetaValue] MetaValue MetaValue
forall (f :: * -> *) s t a b.
LensLike f s t a b -> LensLike f s t a b
traverseOf LensLike f [MetaValue] [MetaValue] MetaValue MetaValue
forall s t a b. Each s t a b => Traversal s t a b
Traversal [MetaValue] [MetaValue] MetaValue MetaValue
each MetaValue -> f MetaValue
f [MetaValue]
cs
MetaValue
_ -> MetaValue -> f MetaValue
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure MetaValue
inl
class HasAttr a where
attributes :: Traversal' a Attr
instance HasAttr Block where
attributes :: Traversal' Block Attr
attributes Attr -> f Attr
f (CodeBlock Attr
a Text
s) = (Attr -> Block) -> f Attr -> f Block
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Attr
a'->Attr -> Text -> Block
CodeBlock Attr
a' Text
s) (Attr -> f Attr
f Attr
a)
attributes Attr -> f Attr
f (Header Int
n Attr
a [Inline]
s) = (Attr -> Block) -> f Attr -> f Block
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Attr
a'->Int -> Attr -> [Inline] -> Block
Header Int
n Attr
a' [Inline]
s) (Attr -> f Attr
f Attr
a)
attributes Attr -> f Attr
f (Div Attr
a [Block]
s) = (Attr -> Block) -> f Attr -> f Block
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Attr
a'->Attr -> [Block] -> Block
Div Attr
a' [Block]
s) (Attr -> f Attr
f Attr
a)
attributes Attr -> f Attr
_ Block
x = Block -> f Block
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Block
x
instance HasAttr Inline where
attributes :: Traversal' Inline Attr
attributes Attr -> f Attr
f (Code Attr
a Text
s) = (Attr -> Inline) -> f Attr -> f Inline
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Attr
a'->Attr -> Text -> Inline
Code Attr
a' Text
s) (Attr -> f Attr
f Attr
a)
attributes Attr -> f Attr
f (Span Attr
a [Inline]
s) = (Attr -> Inline) -> f Attr -> f Inline
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Attr
a'->Attr -> [Inline] -> Inline
Span Attr
a' [Inline]
s) (Attr -> f Attr
f Attr
a)
attributes Attr -> f Attr
_ Inline
x = Inline -> f Inline
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Inline
x
attrIdentifier :: Lens' Attr Text
attrIdentifier :: Lens' Attr Text
attrIdentifier = (Text -> f Text) -> Attr -> f Attr
forall s t a b. Field1 s t a b => Lens s t a b
Lens' Attr Text
_1
attrClasses :: Lens' Attr [Text]
attrClasses :: Lens' Attr [Text]
attrClasses = ([Text] -> f [Text]) -> Attr -> f Attr
forall s t a b. Field2 s t a b => Lens s t a b
Lens' Attr [Text]
_2
attrs :: Lens' Attr [(Text, Text)]
attrs :: Lens' Attr [Target]
attrs = ([Target] -> f [Target]) -> Attr -> f Attr
forall s t a b. Field3 s t a b => Lens s t a b
Lens' Attr [Target]
_3