{-# LANGUAGE OverloadedStrings #-}
module Text.Pandoc.Readers.Org.BlockStarts
( exampleLineStart
, hline
, noteMarker
, tableStart
, drawerStart
, headerStart
, metaLineStart
, latexEnvStart
, commentLineStart
, bulletListStart
, orderedListStart
, endOfBlock
) where
import Control.Monad (void)
import Data.Text (Text)
import qualified Data.Text as T
import Text.Pandoc.Readers.Org.Parsing
hline :: Monad m => OrgParser m ()
hline :: OrgParser m ()
hline = OrgParser m () -> OrgParser m ()
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m () -> OrgParser m ())
-> OrgParser m () -> OrgParser m ()
forall a b. (a -> b) -> a -> b
$ do
OrgParser m ()
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m ()
skipSpaces
[Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
[Char] -> ParsecT s u m [Char]
string [Char]
"-----"
ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many (Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
'-')
OrgParser m ()
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m ()
skipSpaces
ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *). Monad m => OrgParser m Char
newline
() -> OrgParser m ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
headerStart :: Monad m => OrgParser m Int
= OrgParser m Int -> OrgParser m Int
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m Int -> OrgParser m Int)
-> OrgParser m Int -> OrgParser m Int
forall a b. (a -> b) -> a -> b
$
([Char] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length ([Char] -> Int)
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> OrgParser m Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 (Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
'*')) OrgParser m Int
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> OrgParser m Int
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m [a]
many1 (Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
' ') OrgParser m Int
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) ()
-> OrgParser m Int
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) ()
forall (m :: * -> *). Monad m => OrgParser m ()
updateLastPreCharPos
tableStart :: Monad m => OrgParser m Char
tableStart :: OrgParser m Char
tableStart = OrgParser m Char -> OrgParser m Char
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m Char -> OrgParser m Char)
-> OrgParser m Char -> OrgParser m Char
forall a b. (a -> b) -> a -> b
$ ParserT Sources OrgParserState (ReaderT OrgParserLocal m) ()
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m ()
skipSpaces ParserT Sources OrgParserState (ReaderT OrgParserLocal m) ()
-> OrgParser m Char -> OrgParser m Char
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Char -> OrgParser m Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
'|'
gridTableStart :: Monad m => OrgParser m ()
gridTableStart :: OrgParser m ()
gridTableStart = OrgParser m () -> OrgParser m ()
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m () -> OrgParser m ())
-> OrgParser m () -> OrgParser m ()
forall a b. (a -> b) -> a -> b
$ OrgParser m ()
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m ()
skipSpaces OrgParser m ()
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> OrgParser m ()
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
'+' OrgParser m ()
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> OrgParser m ()
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
'-'
latexEnvStart :: Monad m => OrgParser m Text
latexEnvStart :: OrgParser m Text
latexEnvStart = OrgParser m Text -> OrgParser m Text
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m Text -> OrgParser m Text)
-> OrgParser m Text -> OrgParser m Text
forall a b. (a -> b) -> a -> b
$
ParserT Sources OrgParserState (ReaderT OrgParserLocal m) ()
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m ()
skipSpaces ParserT Sources OrgParserState (ReaderT OrgParserLocal m) ()
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> [Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
[Char] -> ParsecT s u m [Char]
string [Char]
"\\begin{"
ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> OrgParser m Text -> OrgParser m Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> OrgParser m Text
forall (m :: * -> *). Monad m => OrgParser m Text
latexEnvName
OrgParser m Text
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> OrgParser m Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* [Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
[Char] -> ParsecT s u m [Char]
string [Char]
"}"
OrgParser m Text
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> OrgParser m Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m Char
blankline
where
latexEnvName :: Monad m => OrgParser m Text
latexEnvName :: OrgParser m Text
latexEnvName = OrgParser m Text -> OrgParser m Text
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m Text -> OrgParser m Text)
-> OrgParser m Text -> OrgParser m Text
forall a b. (a -> b) -> a -> b
$ Text -> Text -> Text
forall a. Monoid a => a -> a -> a
mappend (Text -> Text -> Text)
-> OrgParser m Text
-> ParsecT
Sources OrgParserState (ReaderT OrgParserLocal m) (Text -> Text)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParserT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> OrgParser m Text
forall s (m :: * -> *) t st.
Stream s m t =>
ParserT s st m Char -> ParserT s st m Text
many1Char ParserT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
ParsecT s u m Char
alphaNum ParsecT
Sources OrgParserState (ReaderT OrgParserLocal m) (Text -> Text)
-> OrgParser m Text -> OrgParser m Text
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text -> OrgParser m Text -> OrgParser m Text
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
option Text
"" (Text -> OrgParser m Text
forall s (m :: * -> *) u.
(Stream s m Char, UpdateSourcePos s Char) =>
Text -> ParsecT s u m Text
textStr Text
"*")
bulletListStart :: Monad m => OrgParser m Int
bulletListStart :: OrgParser m Int
bulletListStart = OrgParser m Int -> OrgParser m Int
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m Int -> OrgParser m Int)
-> OrgParser m Int -> OrgParser m Int
forall a b. (a -> b) -> a -> b
$ do
Int
ind <- [Char] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length ([Char] -> Int)
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> OrgParser m Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m Char
spaceChar
[Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
[Char] -> ParsecT s u m Char
oneOf (if Int
ind Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 then [Char]
"+-" else [Char]
"*+-")
OrgParser m ()
forall (m :: * -> *). Monad m => OrgParser m ()
skipSpaces1 OrgParser m () -> OrgParser m () -> OrgParser m ()
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> OrgParser m () -> OrgParser m ()
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m a
lookAhead OrgParser m ()
forall (m :: * -> *). Monad m => OrgParser m ()
eol
Int -> OrgParser m Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int
ind Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
genericListStart :: Monad m
=> OrgParser m Text
-> OrgParser m Int
genericListStart :: OrgParser m Text -> OrgParser m Int
genericListStart OrgParser m Text
listMarker = OrgParser m Int -> OrgParser m Int
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m Int -> OrgParser m Int)
-> OrgParser m Int -> OrgParser m Int
forall a b. (a -> b) -> a -> b
$ do
Int
ind <- [Char] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length ([Char] -> Int)
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> OrgParser m Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m Char
spaceChar
OrgParser m Text
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void OrgParser m Text
listMarker
ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) ()
forall (m :: * -> *). Monad m => OrgParser m ()
skipSpaces1 ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) ()
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) ()
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) ()
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) ()
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) ()
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m a
lookAhead ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) ()
forall (m :: * -> *). Monad m => OrgParser m ()
eol
Int -> OrgParser m Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int
ind Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
eol :: Monad m => OrgParser m ()
eol :: OrgParser m ()
eol = ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> OrgParser m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
'\n')
orderedListStart :: Monad m => OrgParser m Int
orderedListStart :: OrgParser m Int
orderedListStart = OrgParser m Text -> OrgParser m Int
forall (m :: * -> *).
Monad m =>
OrgParser m Text -> OrgParser m Int
genericListStart OrgParser m Text
forall st. ParsecT Sources st (ReaderT OrgParserLocal m) Text
orderedListMarker
where orderedListMarker :: ParsecT Sources st (ReaderT OrgParserLocal m) Text
orderedListMarker = Text -> Char -> Text
T.snoc (Text -> Char -> Text)
-> ParsecT Sources st (ReaderT OrgParserLocal m) Text
-> ParsecT Sources st (ReaderT OrgParserLocal m) (Char -> Text)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParserT Sources st (ReaderT OrgParserLocal m) Char
-> ParsecT Sources st (ReaderT OrgParserLocal m) Text
forall s (m :: * -> *) t st.
Stream s m t =>
ParserT s st m Char -> ParserT s st m Text
many1Char ParserT Sources st (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
ParsecT s u m Char
digit ParsecT Sources st (ReaderT OrgParserLocal m) (Char -> Text)
-> ParserT Sources st (ReaderT OrgParserLocal m) Char
-> ParsecT Sources st (ReaderT OrgParserLocal m) Text
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> [Char] -> ParserT Sources st (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
[Char] -> ParsecT s u m Char
oneOf [Char]
".)"
drawerStart :: Monad m => OrgParser m Text
drawerStart :: OrgParser m Text
drawerStart = OrgParser m Text -> OrgParser m Text
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m Text -> OrgParser m Text)
-> OrgParser m Text -> OrgParser m Text
forall a b. (a -> b) -> a -> b
$ ParserT Sources OrgParserState (ReaderT OrgParserLocal m) ()
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m ()
skipSpaces ParserT Sources OrgParserState (ReaderT OrgParserLocal m) ()
-> OrgParser m Text -> OrgParser m Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> OrgParser m Text
forall u. ParsecT Sources u (ReaderT OrgParserLocal m) Text
drawerName OrgParser m Text
-> ParserT Sources OrgParserState (ReaderT OrgParserLocal m) ()
-> OrgParser m Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParserT Sources OrgParserState (ReaderT OrgParserLocal m) ()
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m ()
skipSpaces OrgParser m Text
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> OrgParser m Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *). Monad m => OrgParser m Char
newline
where drawerName :: ParsecT Sources u (ReaderT OrgParserLocal m) Text
drawerName = Char -> ParsecT Sources u (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
':' ParsecT Sources u (ReaderT OrgParserLocal m) Char
-> ParsecT Sources u (ReaderT OrgParserLocal m) Text
-> ParsecT Sources u (ReaderT OrgParserLocal m) Text
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ParsecT Sources u (ReaderT OrgParserLocal m) Char
-> ParsecT Sources u (ReaderT OrgParserLocal m) Char
-> ParsecT Sources u (ReaderT OrgParserLocal m) Text
forall s (m :: * -> *) t st a.
Stream s m t =>
ParserT s st m Char -> ParserT s st m a -> ParserT s st m Text
manyTillChar ParsecT Sources u (ReaderT OrgParserLocal m) Char
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m Char
nonspaceChar (Char -> ParsecT Sources u (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
':')
metaLineStart :: Monad m => OrgParser m ()
metaLineStart :: OrgParser m ()
metaLineStart = OrgParser m () -> OrgParser m ()
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m () -> OrgParser m ())
-> OrgParser m () -> OrgParser m ()
forall a b. (a -> b) -> a -> b
$ OrgParser m ()
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m ()
skipSpaces OrgParser m ()
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> OrgParser m ()
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* [Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
[Char] -> ParsecT s u m [Char]
string [Char]
"#+"
commentLineStart :: Monad m => OrgParser m ()
= OrgParser m () -> OrgParser m ()
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m () -> OrgParser m ())
-> OrgParser m () -> OrgParser m ()
forall a b. (a -> b) -> a -> b
$
OrgParser m ()
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m ()
skipSpaces OrgParser m ()
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> OrgParser m ()
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* [Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
[Char] -> ParsecT s u m [Char]
string [Char]
"#" OrgParser m ()
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> OrgParser m ()
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m a
lookAhead ([Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
[Char] -> ParsecT s u m Char
oneOf [Char]
" \n")
exampleLineStart :: Monad m => OrgParser m ()
exampleLineStart :: OrgParser m ()
exampleLineStart = () ()
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> OrgParser m ()
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m ()
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m ()
skipSpaces OrgParser m ()
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> [Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) [Char]
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
[Char] -> ParsecT s u m [Char]
string [Char]
": ")
noteMarker :: Monad m => OrgParser m Text
noteMarker :: OrgParser m Text
noteMarker = OrgParser m Text -> OrgParser m Text
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m Text -> OrgParser m Text)
-> OrgParser m Text -> OrgParser m Text
forall a b. (a -> b) -> a -> b
$ do
Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
'['
[OrgParser m Text] -> OrgParser m Text
forall s (m :: * -> *) t u a.
Stream s m t =>
[ParsecT s u m a] -> ParsecT s u m a
choice [ ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> OrgParser m Text
forall end s (m :: * -> *) t st.
(Show end, Stream s m t) =>
ParserT s st m Char -> ParserT s st m end -> ParserT s st m Text
many1TillChar ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
ParsecT s u m Char
digit (Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
']')
, Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
(<>) (Text -> Text -> Text)
-> OrgParser m Text
-> ParsecT
Sources OrgParserState (ReaderT OrgParserLocal m) (Text -> Text)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> OrgParser m Text
forall s (m :: * -> *) u.
(Stream s m Char, UpdateSourcePos s Char) =>
Text -> ParsecT s u m Text
textStr Text
"fn:"
ParsecT
Sources OrgParserState (ReaderT OrgParserLocal m) (Text -> Text)
-> OrgParser m Text -> OrgParser m Text
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> OrgParser m Text
forall end s (m :: * -> *) t st.
(Show end, Stream s m t) =>
ParserT s st m Char -> ParserT s st m end -> ParserT s st m Text
many1TillChar ([Char]
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
[Char] -> ParsecT s u m Char
noneOf [Char]
"\n\r\t ") (Char
-> ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *) s u.
(Monad m, Stream s m Char, UpdateSourcePos s Char) =>
Char -> ParsecT s u m Char
char Char
']')
]
endOfBlock :: Monad m => OrgParser m ()
endOfBlock :: OrgParser m ()
endOfBlock = OrgParser m () -> OrgParser m ()
forall s (m :: * -> *) t u a.
Stream s m t =>
ParsecT s u m a -> ParsecT s u m a
lookAhead (OrgParser m () -> OrgParser m ())
-> (OrgParser m () -> OrgParser m ())
-> OrgParser m ()
-> OrgParser m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OrgParser m () -> OrgParser m ()
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m () -> OrgParser m ())
-> OrgParser m () -> OrgParser m ()
forall a b. (a -> b) -> a -> b
$
ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> OrgParser m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall s (m :: * -> *) st.
(Stream s m Char, UpdateSourcePos s Char) =>
ParserT s st m Char
blankline OrgParser m () -> OrgParser m () -> OrgParser m ()
forall s u (m :: * -> *) a.
ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
<|> OrgParser m ()
forall (m :: * -> *). Monad m => OrgParser m ()
anyBlockStart
where
anyBlockStart :: Monad m => OrgParser m ()
anyBlockStart :: OrgParser m ()
anyBlockStart = OrgParser m () -> OrgParser m ()
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
try (OrgParser m () -> OrgParser m ())
-> ([OrgParser m ()] -> OrgParser m ())
-> [OrgParser m ()]
-> OrgParser m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [OrgParser m ()] -> OrgParser m ()
forall s (m :: * -> *) t u a.
Stream s m t =>
[ParsecT s u m a] -> ParsecT s u m a
choice ([OrgParser m ()] -> OrgParser m ())
-> [OrgParser m ()] -> OrgParser m ()
forall a b. (a -> b) -> a -> b
$
[ OrgParser m ()
forall (m :: * -> *). Monad m => OrgParser m ()
exampleLineStart
, OrgParser m ()
forall (m :: * -> *). Monad m => OrgParser m ()
hline
, OrgParser m ()
forall (m :: * -> *). Monad m => OrgParser m ()
metaLineStart
, OrgParser m ()
forall (m :: * -> *). Monad m => OrgParser m ()
commentLineStart
, OrgParser m ()
forall (m :: * -> *). Monad m => OrgParser m ()
gridTableStart
, ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Text
-> OrgParser m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Text
forall (m :: * -> *). Monad m => OrgParser m Text
noteMarker
, ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
-> OrgParser m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Char
forall (m :: * -> *). Monad m => OrgParser m Char
tableStart
, ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Text
-> OrgParser m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Text
forall (m :: * -> *). Monad m => OrgParser m Text
drawerStart
, ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Int
-> OrgParser m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Int
forall (m :: * -> *). Monad m => OrgParser m Int
headerStart
, ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Text
-> OrgParser m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Text
forall (m :: * -> *). Monad m => OrgParser m Text
latexEnvStart
, ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Int
-> OrgParser m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Int
forall (m :: * -> *). Monad m => OrgParser m Int
bulletListStart
, ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Int
-> OrgParser m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void ParsecT Sources OrgParserState (ReaderT OrgParserLocal m) Int
forall (m :: * -> *). Monad m => OrgParser m Int
orderedListStart
]