    {-# LANGUAGE FlexibleContexts  #-}
    {-# LANGUAGE TupleSections     #-}
    {-# LANGUAGE OverloadedStrings #-}
    {- |
       Module      : Text.Pandoc.Readers.Muse
       Copyright   : Copyright (C) 2017-2020 Alexander Krotov
       License     : GNU GPL, version 2 or above

       Maintainer  : Alexander Krotov <ilabdsf@gmail.com>
       Stability   : alpha
       Portability : portable

    Conversion of Muse text to 'Pandoc' document.
    -}
    {-
    TODO:
    - <cite> tag
    -}
    module Text.Pandoc.Readers.Muse (readMuse) where

    import Control.Monad
    import Control.Monad.Reader
    import Control.Monad.Except (throwError)
    import Data.Bifunctor
    import Data.Default
    import Data.List (transpose, uncons)
    import qualified Data.Map as M
    import qualified Data.Set as Set
    import Data.Maybe (fromMaybe, isNothing, maybeToList)
    import Data.Text (Text)
    import qualified Data.Text as T
    import Text.Pandoc.Builder (Blocks, Inlines)
    import qualified Text.Pandoc.Builder as B
    import Text.Pandoc.Class.PandocMonad (PandocMonad (..))
    import Text.Pandoc.Definition
    import Text.Pandoc.Error (PandocError (PandocParsecError))
    import Text.Pandoc.Logging
    import Text.Pandoc.Options
    import Text.Pandoc.Parsing hiding (F)
    import Text.Pandoc.Shared (crFilter, trimr, underlineSpan, tshow)

    -- | Read Muse from an input string and return a Pandoc document.
    readMuse :: PandocMonad m
             => ReaderOptions
             -> Text
             -> m Pandoc
    readMuse :: ReaderOptions -> Text -> m Pandoc
    readMuse opts :: ReaderOptions
    opts s :: Text
    s = do
      let input :: Text
    input = Text -> Text
    crFilter Text
    s
      Either ParseError Pandoc
    res <- (ReaderT MuseEnv m (Either ParseError Pandoc)
     -> MuseEnv -> m (Either ParseError Pandoc))
    -> MuseEnv
    -> ReaderT MuseEnv m (Either ParseError Pandoc)
    -> m (Either ParseError Pandoc)
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip ReaderT MuseEnv m (Either ParseError Pandoc)
    -> MuseEnv -> m (Either ParseError Pandoc)
    forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
    runReaderT MuseEnv
    forall a. Default a => a
    def (ReaderT MuseEnv m (Either ParseError Pandoc)
     -> m (Either ParseError Pandoc))
    -> ReaderT MuseEnv m (Either ParseError Pandoc)
    -> m (Either ParseError Pandoc)
    forall a b. (a -> b) -> a -> b
    $ ParsecT Text MuseState (ReaderT MuseEnv m) Pandoc
    -> MuseState
    -> SourceName
    -> Text
    -> ReaderT MuseEnv m (Either ParseError Pandoc)
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> u -> SourceName -> s -> m (Either ParseError a)
    runParserT ParsecT Text MuseState (ReaderT MuseEnv m) Pandoc
    forall (m :: * -> *). PandocMonad m => MuseParser m Pandoc
    parseMuse MuseState
    forall a. Default a => a
    def{ museOptions :: ReaderOptions
    museOptions = ReaderOptions
    opts } "source" Text
    input
      case Either ParseError Pandoc
    res of
           Left e :: ParseError
    e  -> PandocError -> m Pandoc
    forall e (m :: * -> *) a. MonadError e m => e -> m a
    throwError (PandocError -> m Pandoc) -> PandocError -> m Pandoc
    forall a b. (a -> b) -> a -> b
    $ Text -> ParseError -> PandocError
    PandocParsecError Text
    input ParseError
    e
           Right d :: Pandoc
    d -> Pandoc -> m Pandoc
    forall (m :: * -> *) a. Monad m => a -> m a
    return Pandoc
    d

    type F = Future MuseState

    data MuseState = MuseState { MuseState -> F Meta
    museMeta :: F Meta -- ^ Document metadata
                               , MuseState -> ReaderOptions
    museOptions :: ReaderOptions
                               , MuseState -> Set Text
    museIdentifierList :: Set.Set Text
                               , MuseState -> Maybe SourcePos
    museLastSpacePos :: Maybe SourcePos -- ^ Position after last space or newline parsed
                               , MuseState -> Maybe SourcePos
    museLastStrPos :: Maybe SourcePos -- ^ Position after last str parsed
                               , MuseState -> [LogMessage]
    museLogMessages :: [LogMessage]
                               , MuseState -> Map Text (SourcePos, F Blocks)
    museNotes :: M.Map Text (SourcePos, F Blocks)
                               }

    instance Default MuseState where
      def :: MuseState
    def = MuseState :: F Meta
    -> ReaderOptions
    -> Set Text
    -> Maybe SourcePos
    -> Maybe SourcePos
    -> [LogMessage]
    -> Map Text (SourcePos, F Blocks)
    -> MuseState
    MuseState { museMeta :: F Meta
    museMeta = Meta -> F Meta
    forall (m :: * -> *) a. Monad m => a -> m a
    return Meta
    nullMeta
                      , museOptions :: ReaderOptions
    museOptions = ReaderOptions
    forall a. Default a => a
    def
                      , museIdentifierList :: Set Text
    museIdentifierList = Set Text
    forall a. Set a
    Set.empty
                      , museLastStrPos :: Maybe SourcePos
    museLastStrPos = Maybe SourcePos
    forall a. Maybe a
    Nothing
                      , museLastSpacePos :: Maybe SourcePos
    museLastSpacePos = Maybe SourcePos
    forall a. Maybe a
    Nothing
                      , museLogMessages :: [LogMessage]
    museLogMessages = []
                      , museNotes :: Map Text (SourcePos, F Blocks)
    museNotes = Map Text (SourcePos, F Blocks)
    forall k a. Map k a
    M.empty
                      }

    data MuseEnv =
      MuseEnv { MuseEnv -> Bool
    museInLink :: Bool -- ^ True when parsing a link description to avoid nested links
              , MuseEnv -> Bool
    museInPara :: Bool -- ^ True when parsing paragraph is not allowed
              }

    instance Default MuseEnv where
      def :: MuseEnv
    def = MuseEnv :: Bool -> Bool -> MuseEnv
    MuseEnv { museInLink :: Bool
    museInLink = Bool
    False
                    , museInPara :: Bool
    museInPara = Bool
    False
                    }

    type MuseParser m = ParserT Text MuseState (ReaderT MuseEnv m)

    instance HasReaderOptions MuseState where
      extractReaderOptions :: MuseState -> ReaderOptions
    extractReaderOptions = MuseState -> ReaderOptions
    museOptions

    instance HasIdentifierList MuseState where
      extractIdentifierList :: MuseState -> Set Text
    extractIdentifierList     = MuseState -> Set Text
    museIdentifierList
      updateIdentifierList :: (Set Text -> Set Text) -> MuseState -> MuseState
    updateIdentifierList f :: Set Text -> Set Text
    f st :: MuseState
    st = MuseState
    st{ museIdentifierList :: Set Text
    museIdentifierList = Set Text -> Set Text
    f (Set Text -> Set Text) -> Set Text -> Set Text
    forall a b. (a -> b) -> a -> b
    $ MuseState -> Set Text
    museIdentifierList MuseState
    st }

    instance HasLastStrPosition MuseState where
      setLastStrPos :: Maybe SourcePos -> MuseState -> MuseState
    setLastStrPos pos :: Maybe SourcePos
    pos st :: MuseState
    st = MuseState
    st{ museLastStrPos :: Maybe SourcePos
    museLastStrPos = Maybe SourcePos
    pos }
      getLastStrPos :: MuseState -> Maybe SourcePos
    getLastStrPos st :: MuseState
    st     = MuseState -> Maybe SourcePos
    museLastStrPos MuseState
    st

    instance HasLogMessages MuseState where
      addLogMessage :: LogMessage -> MuseState -> MuseState
    addLogMessage m :: LogMessage
    m s :: MuseState
    s = MuseState
    s{ museLogMessages :: [LogMessage]
    museLogMessages = LogMessage
    m LogMessage -> [LogMessage] -> [LogMessage]
    forall a. a -> [a] -> [a]
    : MuseState -> [LogMessage]
    museLogMessages MuseState
    s }
      getLogMessages :: MuseState -> [LogMessage]
    getLogMessages = [LogMessage] -> [LogMessage]
    forall a. [a] -> [a]
    reverse ([LogMessage] -> [LogMessage])
    -> (MuseState -> [LogMessage]) -> MuseState -> [LogMessage]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . MuseState -> [LogMessage]
    museLogMessages

    updateLastSpacePos :: Monad m => MuseParser m ()
    updateLastSpacePos :: MuseParser m ()
    updateLastSpacePos = ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    forall (m :: * -> *) s u. Monad m => ParsecT s u m SourcePos
    getPosition ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    -> (SourcePos -> MuseParser m ()) -> MuseParser m ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \pos :: SourcePos
    pos ->
      (MuseState -> MuseState) -> MuseParser m ()
    forall (m :: * -> *) u s. Monad m => (u -> u) -> ParsecT s u m ()
    updateState ((MuseState -> MuseState) -> MuseParser m ())
    -> (MuseState -> MuseState) -> MuseParser m ()
    forall a b. (a -> b) -> a -> b
    $ \s :: MuseState
    s -> MuseState
    s { museLastSpacePos :: Maybe SourcePos
    museLastSpacePos = SourcePos -> Maybe SourcePos
    forall a. a -> Maybe a
    Just SourcePos
    pos }

    -- | Parse Muse document
    parseMuse :: PandocMonad m => MuseParser m Pandoc
    parseMuse :: MuseParser m Pandoc
    parseMuse = do
      ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [()]
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => MuseParser m ()
    directive
      [F Blocks]
    blocks <- (:) (F Blocks -> [F Blocks] -> [F Blocks])
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F Blocks] -> [F Blocks])
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    parseBlocks ParsecT
      Text MuseState (ReaderT MuseEnv m) ([F Blocks] -> [F Blocks])
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    parseSection
      ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u.
    (Stream s m t, Show t) =>
    ParsecT s u m ()
    eof
      MuseState
    st <- ParsecT Text MuseState (ReaderT MuseEnv m) MuseState
    forall (m :: * -> *) s u. Monad m => ParsecT s u m u
    getState
      Future MuseState Pandoc -> MuseState -> Pandoc
    forall s a. Future s a -> s -> a
    runF (Meta -> [Block] -> Pandoc
    Pandoc (Meta -> [Block] -> Pandoc)
    -> F Meta -> Future MuseState ([Block] -> Pandoc)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseState -> F Meta
    museMeta MuseState
    st Future MuseState ([Block] -> Pandoc)
    -> Future MuseState [Block] -> Future MuseState Pandoc
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (Blocks -> [Block]) -> F Blocks -> Future MuseState [Block]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Blocks -> [Block]
    forall a. Many a -> [a]
    B.toList ([F Blocks] -> F Blocks
    forall a. Monoid a => [a] -> a
    mconcat [F Blocks]
    blocks)) MuseState
    st Pandoc
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m Pandoc
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *) st s.
    (PandocMonad m, HasLogMessages st) =>
    ParserT s st m ()
    reportLogMessages

    -- * Utility functions

    -- | Trim up to one newline from the beginning of the string.
    lchop :: Text -> Text
    lchop :: Text -> Text
    lchop s :: Text
    s = case Text -> Maybe (Char, Text)
    T.uncons Text
    s of
      Just ('\n', xs :: Text
    xs) -> Text
    xs
      _               -> Text
    s

    -- | Trim up to one newline from the end of the string.
    rchop :: Text -> Text
    rchop :: Text -> Text
    rchop s :: Text
    s = case Text -> Maybe (Text, Char)
    T.unsnoc Text
    s of
      Just (xs :: Text
    xs, '\n') -> Text
    xs
      _               -> Text
    s

    unindent :: Text -> Text
    unindent :: Text -> Text
    unindent = Text -> Text
    rchop (Text -> Text) -> (Text -> Text) -> Text -> Text
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> [Text] -> Text
    T.intercalate "\n" ([Text] -> Text) -> (Text -> [Text]) -> Text -> Text
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Text] -> [Text]
    dropSpacePrefix ([Text] -> [Text]) -> (Text -> [Text]) -> Text -> [Text]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Text -> [Text]
    T.splitOn "\n" (Text -> [Text]) -> (Text -> Text) -> Text -> [Text]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Text
    lchop

    dropSpacePrefix :: [Text] -> [Text]
    dropSpacePrefix :: [Text] -> [Text]
    dropSpacePrefix lns :: [Text]
    lns = Int -> Text -> Text
    T.drop Int
    maxIndent (Text -> Text) -> [Text] -> [Text]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [Text]
    lns
      where isSpaceChar :: Char -> Bool
    isSpaceChar c :: Char
    c = Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == ' ' Bool -> Bool -> Bool
    || Char
    c Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == '\t'
            maxIndent :: Int
    maxIndent = [Text] -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length ([Text] -> Int) -> [Text] -> Int
    forall a b. (a -> b) -> a -> b
    $ (Text -> Bool) -> [Text] -> [Text]
    forall a. (a -> Bool) -> [a] -> [a]
    takeWhile (Char -> Bool
    isSpaceChar (Char -> Bool) -> (Text -> Char) -> Text -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Char
    T.head) ([Text] -> [Text]) -> [Text] -> [Text]
    forall a b. (a -> b) -> a -> b
    $ (Text -> Bool) -> [Text] -> [Text]
    forall a. (a -> Bool) -> [a] -> [a]
    takeWhile Text -> Bool
    same ([Text] -> [Text]) -> [Text] -> [Text]
    forall a b. (a -> b) -> a -> b
    $ [Text] -> [Text]
    T.transpose [Text]
    lns
            same :: Text -> Bool
    same t :: Text
    t = case Text -> Maybe (Char, Text)
    T.uncons Text
    t of
              Just (c :: Char
    c, cs :: Text
    cs) -> (Char -> Bool) -> Text -> Bool
    T.all (Char -> Char -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char
    c) Text
    cs
              Nothing      -> Bool
    True

    atStart :: PandocMonad m => MuseParser m ()
    atStart :: MuseParser m ()
    atStart = do
      SourcePos
    pos <- ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    forall (m :: * -> *) s u. Monad m => ParsecT s u m SourcePos
    getPosition
      MuseState
    st <- ParsecT Text MuseState (ReaderT MuseEnv m) MuseState
    forall (m :: * -> *) s u. Monad m => ParsecT s u m u
    getState
      Bool -> MuseParser m ()
    forall (f :: * -> *). Alternative f => Bool -> f ()
    guard (Bool -> MuseParser m ()) -> Bool -> MuseParser m ()
    forall a b. (a -> b) -> a -> b
    $ MuseState -> Maybe SourcePos
    museLastStrPos MuseState
    st Maybe SourcePos -> Maybe SourcePos -> Bool
    forall a. Eq a => a -> a -> Bool
    /= SourcePos -> Maybe SourcePos
    forall a. a -> Maybe a
    Just SourcePos
    pos

    noSpaceBefore :: PandocMonad m => MuseParser m ()
    noSpaceBefore :: MuseParser m ()
    noSpaceBefore = do
      SourcePos
    pos <- ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    forall (m :: * -> *) s u. Monad m => ParsecT s u m SourcePos
    getPosition
      MuseState
    st <- ParsecT Text MuseState (ReaderT MuseEnv m) MuseState
    forall (m :: * -> *) s u. Monad m => ParsecT s u m u
    getState
      Bool -> MuseParser m ()
    forall (f :: * -> *). Alternative f => Bool -> f ()
    guard (Bool -> MuseParser m ()) -> Bool -> MuseParser m ()
    forall a b. (a -> b) -> a -> b
    $ MuseState -> Maybe SourcePos
    museLastSpacePos MuseState
    st Maybe SourcePos -> Maybe SourcePos -> Bool
    forall a. Eq a => a -> a -> Bool
    /= SourcePos -> Maybe SourcePos
    forall a. a -> Maybe a
    Just SourcePos
    pos

    firstColumn :: PandocMonad m => MuseParser m ()
    firstColumn :: MuseParser m ()
    firstColumn = ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    forall (m :: * -> *) s u. Monad m => ParsecT s u m SourcePos
    getPosition ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    -> (SourcePos -> MuseParser m ()) -> MuseParser m ()
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \pos :: SourcePos
    pos -> Bool -> MuseParser m ()
    forall (f :: * -> *). Alternative f => Bool -> f ()
    guard (SourcePos -> Int
    sourceColumn SourcePos
    pos Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == 1)

    -- * Parsers

    -- | Parse end-of-line, which can be either a newline or end-of-file.
    eol :: Stream s m Char => ParserT s st m ()
    eol :: ParserT s st m ()
    eol = ParsecT s st m Char -> ParserT s st m ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void ParsecT s st m Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    newline ParserT s st m () -> ParserT s st m () -> ParserT s st m ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParserT s st m ()
    forall s (m :: * -> *) t u.
    (Stream s m t, Show t) =>
    ParsecT s u m ()
    eof

    getIndent :: PandocMonad m
              => MuseParser m Int
    getIndent :: MuseParser m Int
    getIndent = Int -> Int -> Int
    forall a. Num a => a -> a -> a
    subtract 1 (Int -> Int) -> (SourcePos -> Int) -> SourcePos -> Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . SourcePos -> Int
    sourceColumn (SourcePos -> Int)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (SourcePos -> Int)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) (SourcePos -> Int)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    -> MuseParser m Int
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    forall (m :: * -> *) s u. Monad m => ParsecT s u m SourcePos
    getPosition

    -- ** HTML parsers

    openTag :: PandocMonad m => Text -> MuseParser m [(Text, Text)]
    openTag :: Text -> MuseParser m [(Text, Text)]
    openTag tag :: Text
    tag = MuseParser m [(Text, Text)] -> MuseParser m [(Text, Text)]
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m [(Text, Text)] -> MuseParser m [(Text, Text)])
    -> MuseParser m [(Text, Text)] -> MuseParser m [(Text, Text)]
    forall a b. (a -> b) -> a -> b
    $
      Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '<' ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Text -> ParsecT s u m Text
    textStr Text
    tag ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> MuseParser m [(Text, Text)] -> MuseParser m [(Text, Text)]
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT Text MuseState (ReaderT MuseEnv m) (Text, Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m [(Text, Text)]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) (Text, Text)
    forall u. ParsecT Text u (ReaderT MuseEnv m) (Text, Text)
    attr (Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '>')
      where
        attr :: ParsecT Text u (ReaderT MuseEnv m) (Text, Text)
    attr = ParsecT Text u (ReaderT MuseEnv m) (Text, Text)
    -> ParsecT Text u (ReaderT MuseEnv m) (Text, Text)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text u (ReaderT MuseEnv m) (Text, Text)
     -> ParsecT Text u (ReaderT MuseEnv m) (Text, Text))
    -> ParsecT Text u (ReaderT MuseEnv m) (Text, Text)
    -> ParsecT Text u (ReaderT MuseEnv m) (Text, Text)
    forall a b. (a -> b) -> a -> b
    $ (,)
          (Text -> Text -> (Text, Text))
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text u (ReaderT MuseEnv m) (Text -> Text -> (Text, Text))
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m [a]
    many1 ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
          ParsecT Text u (ReaderT MuseEnv m) (Text -> Text -> (Text, Text))
    -> ParsecT Text u (ReaderT MuseEnv m) Text
    -> ParsecT Text u (ReaderT MuseEnv m) (Text -> (Text, Text))
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) t st.
    Stream s m t =>
    ParserT s st m Char -> ParserT s st m Text
    many1Char (SourceName -> ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m Char
    noneOf "=\n")
          ParsecT Text u (ReaderT MuseEnv m) (Text -> (Text, Text))
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    -> ParsecT Text u (ReaderT MuseEnv m) (Text -> (Text, Text))
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  SourceName -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "=\""
          ParsecT Text u (ReaderT MuseEnv m) (Text -> (Text, Text))
    -> ParsecT Text u (ReaderT MuseEnv m) Text
    -> ParsecT Text u (ReaderT MuseEnv m) (Text, Text)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv 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 (SourceName -> ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m Char
    noneOf "\"") (Char -> ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '"')

    closeTag :: PandocMonad m => Text -> MuseParser m ()
    closeTag :: Text -> MuseParser m ()
    closeTag tag :: Text
    tag = MuseParser m () -> MuseParser m ()
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m () -> MuseParser m ())
    -> MuseParser m () -> MuseParser m ()
    forall a b. (a -> b) -> a -> b
    $ SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "</" ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Text -> ParsecT s u m Text
    textStr Text
    tag ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> MuseParser m () -> MuseParser m ()
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT Text MuseState (ReaderT MuseEnv m) Char -> MuseParser m ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '>')

    -- | Convert HTML attributes to Pandoc 'Attr'
    htmlAttrToPandoc :: [(Text, Text)] -> Attr
    htmlAttrToPandoc :: [(Text, Text)] -> Attr
    htmlAttrToPandoc attrs :: [(Text, Text)]
    attrs = (Text
    ident, [Text]
    classes, [(Text, Text)]
    keyvals)
      where
        ident :: Text
    ident   = Text -> Maybe Text -> Text
    forall a. a -> Maybe a -> a
    fromMaybe "" (Maybe Text -> Text) -> Maybe Text -> Text
    forall a b. (a -> b) -> a -> b
    $ Text -> [(Text, Text)] -> Maybe Text
    forall a b. Eq a => a -> [(a, b)] -> Maybe b
    lookup "id" [(Text, Text)]
    attrs
        classes :: [Text]
    classes = [Text] -> (Text -> [Text]) -> Maybe Text -> [Text]
    forall b a. b -> (a -> b) -> Maybe a -> b
    maybe [] Text -> [Text]
    T.words (Maybe Text -> [Text]) -> Maybe Text -> [Text]
    forall a b. (a -> b) -> a -> b
    $ Text -> [(Text, Text)] -> Maybe Text
    forall a b. Eq a => a -> [(a, b)] -> Maybe b
    lookup "class" [(Text, Text)]
    attrs
        keyvals :: [(Text, Text)]
    keyvals = [(Text
    k,Text
    v) | (k :: Text
    k,v :: Text
    v) <- [(Text, Text)]
    attrs, Text
    k Text -> Text -> Bool
    forall a. Eq a => a -> a -> Bool
    /= "id", Text
    k Text -> Text -> Bool
    forall a. Eq a => a -> a -> Bool
    /= "class"]

    parseHtmlContent :: PandocMonad m
                     => Text -- ^ Tag name
                     -> MuseParser m (Attr, F Blocks)
    parseHtmlContent :: Text -> MuseParser m (Attr, F Blocks)
    parseHtmlContent tag :: Text
    tag = MuseParser m (Attr, F Blocks) -> MuseParser m (Attr, F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (Attr, F Blocks) -> MuseParser m (Attr, F Blocks))
    -> MuseParser m (Attr, F Blocks) -> MuseParser m (Attr, F Blocks)
    forall a b. (a -> b) -> a -> b
    $ MuseParser m Int
    forall (m :: * -> *). PandocMonad m => MuseParser m Int
    getIndent MuseParser m Int
    -> (Int -> MuseParser m (Attr, F Blocks))
    -> MuseParser m (Attr, F Blocks)
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \indent :: Int
    indent -> (,)
      (Attr -> F Blocks -> (Attr, F Blocks))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Attr
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks -> (Attr, F Blocks))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ([(Text, Text)] -> Attr)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Attr
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [(Text, Text)] -> Attr
    htmlAttrToPandoc (Text -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m [(Text, Text)]
    openTag Text
    tag)
      ParsecT
      Text MuseState (ReaderT MuseEnv m) (F Blocks -> (Attr, F Blocks))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks -> (Attr, F Blocks))
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol
      ParsecT
      Text MuseState (ReaderT MuseEnv m) (F Blocks -> (Attr, F Blocks))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    -> MuseParser m (Attr, F Blocks)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall (m :: * -> *) a. MonadReader MuseEnv m => m a -> m a
    allowPara (ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks)
    parseBlocksTill (ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) ()
     -> ParsecT Text MuseState (ReaderT MuseEnv m) ())
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall a b. (a -> b) -> a -> b
    $ Int -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, HasReaderOptions st) =>
    Int -> ParserT s st m Text
    indentWith Int
    indent ParserT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> MuseParser m ()
    closeTag Text
    tag))
      MuseParser m (Attr, F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (Attr, F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol -- closing tag must be followed by optional whitespace and newline

    -- ** Directive parsers

    -- While not documented, Emacs Muse allows "-" in directive name
    parseDirectiveKey :: PandocMonad m => MuseParser m Text
    parseDirectiveKey :: MuseParser m Text
    parseDirectiveKey = Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '#' ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m Text -> MuseParser m Text
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m Text
    forall s (m :: * -> *) t st.
    Stream s m t =>
    ParserT s st m Char -> ParserT s st m Text
    manyChar (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    letter ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '-')

    parseEmacsDirective :: PandocMonad m => MuseParser m (Text, F Inlines)
    parseEmacsDirective :: MuseParser m (Text, F Inlines)
    parseEmacsDirective = (,)
      (Text -> F Inlines -> (Text, F Inlines))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Inlines -> (Text, F Inlines))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (m :: * -> *). PandocMonad m => MuseParser m Text
    parseDirectiveKey
      ParsecT
      Text MuseState (ReaderT MuseEnv m) (F Inlines -> (Text, F Inlines))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Inlines -> (Text, F Inlines))
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
      ParsecT
      Text MuseState (ReaderT MuseEnv m) (F Inlines -> (Text, F Inlines))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> MuseParser m (Text, F Inlines)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (F Inlines -> F Inlines
    forall s. Future s Inlines -> Future s Inlines
    trimInlinesF (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline' ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol)

    parseAmuseDirective :: PandocMonad m => MuseParser m (Text, F Inlines)
    parseAmuseDirective :: MuseParser m (Text, F Inlines)
    parseAmuseDirective = (,)
      (Text -> F Inlines -> (Text, F Inlines))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Inlines -> (Text, F Inlines))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (m :: * -> *). PandocMonad m => MuseParser m Text
    parseDirectiveKey
      ParsecT
      Text MuseState (ReaderT MuseEnv m) (F Inlines -> (Text, F Inlines))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Inlines -> (Text, F Inlines))
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m [a]
    many1 ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
      ParsecT
      Text MuseState (ReaderT MuseEnv m) (F Inlines -> (Text, F Inlines))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> MuseParser m (Text, F Inlines)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (F Inlines -> F Inlines
    forall s. Future s Inlines -> Future s Inlines
    trimInlinesF (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall end s (m :: * -> *) t st a.
    (Show end, Stream s m t) =>
    ParserT s st m a -> ParserT s st m end -> ParserT s st m [a]
    many1Till ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline ParserT Text MuseState (ReaderT MuseEnv m) ()
    endOfDirective)
      MuseParser m (Text, F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (Text, F Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    blankline
      where
        endOfDirective :: ParserT Text MuseState (ReaderT MuseEnv m) ()
    endOfDirective = ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m a
    lookAhead (ParserT Text MuseState (ReaderT MuseEnv m) ()
     -> ParserT Text MuseState (ReaderT MuseEnv m) ())
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall a b. (a -> b) -> a -> b
    $ ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u.
    (Stream s m t, Show t) =>
    ParsecT s u m ()
    eof ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    newline ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    blankline ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (m :: * -> *). PandocMonad m => MuseParser m Text
    parseDirectiveKey))

    directive :: PandocMonad m => MuseParser m ()
    directive :: MuseParser m ()
    directive = do
      Extensions
    ext <- (ReaderOptions -> Extensions)
    -> ParserT Text MuseState (ReaderT MuseEnv m) Extensions
    forall st s (m :: * -> *) t b.
    (HasReaderOptions st, Stream s m t) =>
    (ReaderOptions -> b) -> ParserT s st m b
    getOption ReaderOptions -> Extensions
    readerExtensions
      (key :: Text
    key, value :: F Inlines
    value) <- if Extension -> Extensions -> Bool
    extensionEnabled Extension
    Ext_amuse Extensions
    ext then MuseParser m (Text, F Inlines)
    forall (m :: * -> *).
    PandocMonad m =>
    MuseParser m (Text, F Inlines)
    parseAmuseDirective else MuseParser m (Text, F Inlines)
    forall (m :: * -> *).
    PandocMonad m =>
    MuseParser m (Text, F Inlines)
    parseEmacsDirective
      (MuseState -> MuseState) -> MuseParser m ()
    forall (m :: * -> *) u s. Monad m => (u -> u) -> ParsecT s u m ()
    updateState ((MuseState -> MuseState) -> MuseParser m ())
    -> (MuseState -> MuseState) -> MuseParser m ()
    forall a b. (a -> b) -> a -> b
    $ \st :: MuseState
    st -> MuseState
    st { museMeta :: F Meta
    museMeta = Text -> Inlines -> Meta -> Meta
    forall a b. (HasMeta a, ToMetaValue b) => Text -> b -> a -> a
    B.setMeta (Text -> Text
    forall p. (Eq p, IsString p) => p -> p
    translateKey Text
    key) (Inlines -> Meta -> Meta)
    -> F Inlines -> Future MuseState (Meta -> Meta)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> F Inlines
    value Future MuseState (Meta -> Meta) -> F Meta -> F Meta
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> MuseState -> F Meta
    museMeta MuseState
    st }
      where translateKey :: p -> p
    translateKey "cover" = "cover-image"
            translateKey x :: p
    x = p
    x

    -- ** Block parsers

    allowPara :: MonadReader MuseEnv m => m a -> m a
    allowPara :: m a -> m a
    allowPara p :: m a
    p = (MuseEnv -> MuseEnv) -> m a -> m a
    forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
    local (\s :: MuseEnv
    s -> MuseEnv
    s { museInPara :: Bool
    museInPara = Bool
    False }) m a
    p

    -- | Parse section contents until EOF or next header
    parseBlocks :: PandocMonad m
                => MuseParser m (F Blocks)
    parseBlocks :: MuseParser m (F Blocks)
    parseBlocks =
      MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks)
    forall u. ParsecT Text u (ReaderT MuseEnv m) (F Blocks)
    parseEnd MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|>
           MuseParser m (F Blocks)
    nextSection MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|>
           MuseParser m (F Blocks)
    listStart MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|>
           MuseParser m (F Blocks)
    blockStart MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|>
           MuseParser m (F Blocks)
    paraStart)
      where
        nextSection :: MuseParser m (F Blocks)
    nextSection = F Blocks
    forall a. Monoid a => a
    mempty F Blocks
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text, Int)
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ ParsecT Text MuseState (ReaderT MuseEnv m) (Text, Int)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text, Int)
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m a
    lookAhead ParsecT Text MuseState (ReaderT MuseEnv m) (Text, Int)
    forall (m :: * -> *). PandocMonad m => MuseParser m (Text, Int)
    headingStart
        parseEnd :: ParsecT Text u (ReaderT MuseEnv m) (F Blocks)
    parseEnd = F Blocks
    forall a. Monoid a => a
    mempty F Blocks
    -> ParsecT Text u (ReaderT MuseEnv m) ()
    -> ParsecT Text u (ReaderT MuseEnv m) (F Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ ParsecT Text u (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u.
    (Stream s m t, Show t) =>
    ParsecT s u m ()
    eof
        blockStart :: MuseParser m (F Blocks)
    blockStart = F Blocks -> F Blocks -> F Blocks
    forall a. Semigroup a => a -> a -> a
    (B.<>) (F Blocks -> F Blocks -> F Blocks)
    -> MuseParser m (F Blocks)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks -> F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    blockElements MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    emacsNoteBlock)
                            ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks -> F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall (m :: * -> *) a. MonadReader MuseEnv m => m a -> m a
    allowPara MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    parseBlocks
        listStart :: MuseParser m (F Blocks)
    listStart =
          (F Blocks -> F Blocks -> F Blocks)
    -> (F Blocks, F Blocks) -> F Blocks
    forall a b c. (a -> b -> c) -> (a, b) -> c
    uncurry F Blocks -> F Blocks -> F Blocks
    forall a. Semigroup a => a -> a -> a
    (B.<>) ((F Blocks, F Blocks) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    forall (m :: * -> *) a. MonadReader MuseEnv m => m a -> m a
    allowPara (MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    anyListUntil MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    parseBlocks ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    amuseNoteBlockUntil MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    parseBlocks)
        paraStart :: MuseParser m (F Blocks)
    paraStart = do
          Int
    indent <- SourceName -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length (SourceName -> Int)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Int
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
          (F Blocks -> F Blocks -> F Blocks)
    -> (F Blocks, F Blocks) -> F Blocks
    forall a b c. (a -> b -> c) -> (a, b) -> c
    uncurry F Blocks -> F Blocks -> F Blocks
    forall a. Semigroup a => a -> a -> a
    (B.<>) ((F Blocks, F Blocks) -> F Blocks)
    -> ((F Blocks, F Blocks) -> (F Blocks, F Blocks))
    -> (F Blocks, F Blocks)
    -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (F Blocks -> F Blocks)
    -> (F Blocks, F Blocks) -> (F Blocks, F Blocks)
    forall (p :: * -> * -> *) a b c.
    Bifunctor p =>
    (a -> b) -> p a c -> p b c
    first (Int -> F Blocks -> F Blocks
    forall a (f :: * -> *).
    (Ord a, Num a, Functor f) =>
    a -> f Blocks -> f Blocks
    p Int
    indent) ((F Blocks, F Blocks) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    paraUntil MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    parseBlocks
          where p :: a -> f Blocks -> f Blocks
    p indent :: a
    indent = if a
    indent a -> a -> Bool
    forall a. Ord a => a -> a -> Bool
    >= 2 Bool -> Bool -> Bool
    && a
    indent a -> a -> Bool
    forall a. Ord a => a -> a -> Bool
    < 6 then (Blocks -> Blocks) -> f Blocks -> f Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Blocks -> Blocks
    B.blockQuote else f Blocks -> f Blocks
    forall a. a -> a
    id

    -- | Parse section that starts with a header
    parseSection :: PandocMonad m
                 => MuseParser m (F Blocks)
    parseSection :: MuseParser m (F Blocks)
    parseSection =
      (F Blocks -> F Blocks -> F Blocks
    forall a. Semigroup a => a -> a -> a
    (B.<>) (F Blocks -> F Blocks -> F Blocks)
    -> MuseParser m (F Blocks)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks -> F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    emacsHeading ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks -> F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    parseBlocks) MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|>
      ((F Blocks -> F Blocks -> F Blocks)
    -> (F Blocks, F Blocks) -> F Blocks
    forall a b c. (a -> b -> c) -> (a, b) -> c
    uncurry F Blocks -> F Blocks -> F Blocks
    forall a. Semigroup a => a -> a -> a
    (B.<>) ((F Blocks, F Blocks) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    amuseHeadingUntil MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    parseBlocks)

    parseBlocksTill :: PandocMonad m
                    => MuseParser m a
                    -> MuseParser m (F Blocks)
    parseBlocksTill :: MuseParser m a -> MuseParser m (F Blocks)
    parseBlocksTill end :: MuseParser m a
    end = MuseParser m (F Blocks)
    continuation
      where
        parseEnd :: MuseParser m (F Blocks)
    parseEnd = F Blocks
    forall a. Monoid a => a
    mempty F Blocks -> MuseParser m a -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ MuseParser m a
    end
        blockStart :: MuseParser m (F Blocks)
    blockStart = F Blocks -> F Blocks -> F Blocks
    forall a. Semigroup a => a -> a -> a
    (B.<>) (F Blocks -> F Blocks -> F Blocks)
    -> MuseParser m (F Blocks)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks -> F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    blockElements ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks -> F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall (m :: * -> *) a. MonadReader MuseEnv m => m a -> m a
    allowPara MuseParser m (F Blocks)
    continuation
        listStart :: MuseParser m (F Blocks)
    listStart = (F Blocks -> F Blocks -> F Blocks)
    -> (F Blocks, F Blocks) -> F Blocks
    forall a b c. (a -> b -> c) -> (a, b) -> c
    uncurry F Blocks -> F Blocks -> F Blocks
    forall a. Semigroup a => a -> a -> a
    (B.<>) ((F Blocks, F Blocks) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    forall (m :: * -> *) a. MonadReader MuseEnv m => m a -> m a
    allowPara (MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    anyListUntil (MuseParser m (F Blocks)
    parseEnd MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    continuation))
        paraStart :: MuseParser m (F Blocks)
    paraStart = (F Blocks -> F Blocks -> F Blocks)
    -> (F Blocks, F Blocks) -> F Blocks
    forall a b c. (a -> b -> c) -> (a, b) -> c
    uncurry F Blocks -> F Blocks -> F Blocks
    forall a. Semigroup a => a -> a -> a
    (B.<>) ((F Blocks, F Blocks) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, F Blocks)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    paraUntil (MuseParser m (F Blocks)
    parseEnd MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    continuation)
        continuation :: MuseParser m (F Blocks)
    continuation = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ MuseParser m (F Blocks)
    parseEnd MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    listStart MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    blockStart MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    paraStart

    listItemContentsUntil :: PandocMonad m
                          => Int
                          -> MuseParser m a
                          -> MuseParser m a
                          -> MuseParser m (F Blocks, a)
    listItemContentsUntil :: Int
    -> MuseParser m a -> MuseParser m a -> MuseParser m (F Blocks, a)
    listItemContentsUntil col :: Int
    col pre :: MuseParser m a
    pre end :: MuseParser m a
    end = MuseParser m (F Blocks, a)
    p
      where
        p :: MuseParser m (F Blocks, a)
    p = MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try MuseParser m (F Blocks, a)
    listStart MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try MuseParser m (F Blocks, a)
    blockStart MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try MuseParser m (F Blocks, a)
    paraStart
        parsePre :: MuseParser m (F Blocks, a)
    parsePre = (F Blocks
    forall a. Monoid a => a
    mempty,) (a -> (F Blocks, a))
    -> MuseParser m a -> MuseParser m (F Blocks, a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m a
    pre
        parseEnd :: MuseParser m (F Blocks, a)
    parseEnd = (F Blocks
    forall a. Monoid a => a
    mempty,) (a -> (F Blocks, a))
    -> MuseParser m a -> MuseParser m (F Blocks, a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m a
    end
        paraStart :: MuseParser m (F Blocks, a)
    paraStart = do
          (f :: F Blocks
    f, (r :: F Blocks
    r, e :: a
    e)) <- MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, (F Blocks, a))
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    paraUntil (MuseParser m (F Blocks, a)
    parsePre MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks, a)
    continuation MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks, a)
    parseEnd)
          (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Blocks
    f F Blocks -> F Blocks -> F Blocks
    forall a. Semigroup a => a -> a -> a
    B.<> F Blocks
    r, a
    e)
        blockStart :: MuseParser m (F Blocks, a)
    blockStart = (F Blocks -> F Blocks) -> (F Blocks, a) -> (F Blocks, a)
    forall (p :: * -> * -> *) a b c.
    Bifunctor p =>
    (a -> b) -> p a c -> p b c
    first ((F Blocks -> F Blocks) -> (F Blocks, a) -> (F Blocks, a))
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks -> F Blocks)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ((F Blocks, a) -> (F Blocks, a))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (F Blocks -> F Blocks -> F Blocks
    forall a. Semigroup a => a -> a -> a
    (B.<>) (F Blocks -> F Blocks -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks -> F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    blockElements)
                           ParsecT
      Text MuseState (ReaderT MuseEnv m) ((F Blocks, a) -> (F Blocks, a))
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall (m :: * -> *) a. MonadReader MuseEnv m => m a -> m a
    allowPara (MuseParser m (F Blocks, a)
    parsePre MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks, a)
    continuation MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks, a)
    parseEnd)
        listStart :: MuseParser m (F Blocks, a)
    listStart = do
          (f :: F Blocks
    f, (r :: F Blocks
    r, e :: a
    e)) <- MuseParser m (F Blocks, (F Blocks, a))
    -> MuseParser m (F Blocks, (F Blocks, a))
    forall (m :: * -> *) a. MonadReader MuseEnv m => m a -> m a
    allowPara (MuseParser m (F Blocks, (F Blocks, a))
     -> MuseParser m (F Blocks, (F Blocks, a)))
    -> MuseParser m (F Blocks, (F Blocks, a))
    -> MuseParser m (F Blocks, (F Blocks, a))
    forall a b. (a -> b) -> a -> b
    $ MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, (F Blocks, a))
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    anyListUntil (MuseParser m (F Blocks, a)
    parsePre MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks, a)
    continuation MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks, a)
    parseEnd)
          (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Blocks
    f F Blocks -> F Blocks -> F Blocks
    forall a. Semigroup a => a -> a -> a
    B.<> F Blocks
    r, a
    e)
        continuation :: MuseParser m (F Blocks, a)
    continuation = MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a))
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall a b. (a -> b) -> a -> b
    $ do Maybe Char
    blank <- ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Maybe Char)
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m (Maybe a)
    optionMaybe ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    blankline
                                ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m ()
    skipMany ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    blankline
                                Int -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, HasReaderOptions st) =>
    Int -> ParserT s st m Text
    indentWith Int
    col
                                (MuseEnv -> MuseEnv)
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
    local (\s :: MuseEnv
    s -> MuseEnv
    s { museInPara :: Bool
    museInPara = MuseEnv -> Bool
    museInPara MuseEnv
    s Bool -> Bool -> Bool
    && Maybe Char -> Bool
    forall a. Maybe a -> Bool
    isNothing Maybe Char
    blank }) MuseParser m (F Blocks, a)
    p

    parseBlock :: PandocMonad m => MuseParser m (F Blocks)
    parseBlock :: MuseParser m (F Blocks)
    parseBlock = do
      F Blocks
    res <- MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    blockElements MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    para
      Text -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> m ()
    trace (Int -> Text -> Text
    T.take 60 (Text -> Text) -> Text -> Text
    forall a b. (a -> b) -> a -> b
    $ [Block] -> Text
    forall a. Show a => a -> Text
    tshow ([Block] -> Text) -> [Block] -> Text
    forall a b. (a -> b) -> a -> b
    $ Blocks -> [Block]
    forall a. Many a -> [a]
    B.toList (Blocks -> [Block]) -> Blocks -> [Block]
    forall a b. (a -> b) -> a -> b
    $ F Blocks -> MuseState -> Blocks
    forall s a. Future s a -> s -> a
    runF F Blocks
    res MuseState
    forall a. Default a => a
    def)
      F Blocks -> MuseParser m (F Blocks)
    forall (m :: * -> *) a. Monad m => a -> m a
    return F Blocks
    res
      where para :: MuseParser m (F Blocks)
    para = (F Blocks, ()) -> F Blocks
    forall a b. (a, b) -> a
    fst ((F Blocks, ()) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, ())
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks, ())
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    paraUntil (ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u.
    (Stream s m t, Show t) =>
    ParsecT s u m ()
    eof ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m a
    lookAhead MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    blockElements)))

    blockElements :: PandocMonad m => MuseParser m (F Blocks)
    blockElements :: MuseParser m (F Blocks)
    blockElements = (F Blocks
    forall a. Monoid a => a
    mempty F Blocks
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    blankline)
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    comment
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    separator
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    pagebreak
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    example
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    exampleTag
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    literalTag
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    centerTag
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    rightTag
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    quoteTag
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    divTag
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    biblioTag
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    playTag
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    verseTag
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    lineBlock
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    museGridTable
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    table
                MuseParser m (F Blocks)
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    commentTag

    -- | Parse a line comment, starting with @;@ in the first column.
    comment :: PandocMonad m => MuseParser m (F Blocks)
    comment :: MuseParser m (F Blocks)
    comment = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ F Blocks
    forall a. Monoid a => a
    mempty
      F Blocks
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => MuseParser m ()
    firstColumn
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char ';'
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m ()
    optional (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many (SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m Char
    noneOf "\n"))
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol

    -- | Parse a horizontal rule, consisting of 4 or more @\'-\'@ characters.
    separator :: PandocMonad m => MuseParser m (F Blocks)
    separator :: MuseParser m (F Blocks)
    separator = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ Blocks -> F Blocks
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Blocks
    B.horizontalRule
      F Blocks
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "----"
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many (Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '-')
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol

    -- | Parse a page break
    pagebreak :: PandocMonad m => MuseParser m (F Blocks)
    pagebreak :: MuseParser m (F Blocks)
    pagebreak = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ Blocks -> F Blocks
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Attr -> Blocks -> Blocks
    B.divWith ("", [], [("style", "page-break-before: always;")]) Blocks
    forall a. Monoid a => a
    mempty)
      F Blocks
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ Int
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    Int -> ParsecT s u m a -> ParsecT s u m [a]
    count 6 ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "* * * * *"
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol

    headingStart :: PandocMonad m => MuseParser m (Text, Int)
    headingStart :: MuseParser m (Text, Int)
    headingStart = MuseParser m (Text, Int) -> MuseParser m (Text, Int)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (Text, Int) -> MuseParser m (Text, Int))
    -> MuseParser m (Text, Int) -> MuseParser m (Text, Int)
    forall a b. (a -> b) -> a -> b
    $ (,)
      (Text -> Int -> (Text, Int))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Int -> (Text, Int))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) t a u.
    Stream s m t =>
    a -> ParsecT s u m a -> ParsecT s u m a
    option "" (ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (m :: * -> *). PandocMonad m => MuseParser m Text
    parseAnchor ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol))
      ParsecT Text MuseState (ReaderT MuseEnv m) (Int -> (Text, Int))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Int -> (Text, Int))
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => MuseParser m ()
    firstColumn
      ParsecT Text MuseState (ReaderT MuseEnv m) (Int -> (Text, Int))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Int
    -> MuseParser m (Text, Int)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (SourceName -> Int)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Int
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap SourceName -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m [a]
    many1 (ParsecT Text MuseState (ReaderT MuseEnv m) Char
     -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall a b. (a -> b) -> a -> b
    $ Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '*')
      MuseParser m (Text, Int)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m (Text, Int)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar

    -- | Parse a single-line heading.
    emacsHeading :: PandocMonad m => MuseParser m (F Blocks)
    emacsHeading :: MuseParser m (F Blocks)
    emacsHeading = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ do
      Extension -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) a st.
    (Stream s m a, HasReaderOptions st) =>
    Extension -> ParserT s st m ()
    guardDisabled Extension
    Ext_amuse
      (anchorId :: Text
    anchorId, level :: Int
    level) <- MuseParser m (Text, Int)
    forall (m :: * -> *). PandocMonad m => MuseParser m (Text, Int)
    headingStart
      F Inlines
    content <- F Inlines -> F Inlines
    forall s. Future s Inlines -> Future s Inlines
    trimInlinesF (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol
      Attr
    attr <- Attr -> Inlines -> ParserT Text MuseState (ReaderT MuseEnv m) Attr
    forall s (m :: * -> *) a st.
    (Stream s m a, HasReaderOptions st, HasLogMessages st,
     HasIdentifierList st) =>
    Attr -> Inlines -> ParserT s st m Attr
    registerHeader (Text
    anchorId, [], []) (F Inlines -> MuseState -> Inlines
    forall s a. Future s a -> s -> a
    runF F Inlines
    content MuseState
    forall a. Default a => a
    def)
      F Blocks -> MuseParser m (F Blocks)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Blocks -> MuseParser m (F Blocks))
    -> F Blocks -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ Attr -> Int -> Inlines -> Blocks
    B.headerWith Attr
    attr Int
    level (Inlines -> Blocks) -> F Inlines -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> F Inlines
    content

    -- | Parse a multi-line heading.
    -- It is a Text::Amuse extension, Emacs Muse does not allow heading to span multiple lines.
    amuseHeadingUntil :: PandocMonad m
                      => MuseParser m a -- ^ Terminator parser
                      -> MuseParser m (F Blocks, a)
    amuseHeadingUntil :: MuseParser m a -> MuseParser m (F Blocks, a)
    amuseHeadingUntil end :: MuseParser m a
    end = MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a))
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall a b. (a -> b) -> a -> b
    $ do
      Extension -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) a st.
    (Stream s m a, HasReaderOptions st) =>
    Extension -> ParserT s st m ()
    guardEnabled Extension
    Ext_amuse
      (anchorId :: Text
    anchorId, level :: Int
    level) <- MuseParser m (Text, Int)
    forall (m :: * -> *). PandocMonad m => MuseParser m (Text, Int)
    headingStart
      (content :: F Inlines
    content, e :: a
    e) <- MuseParser m a -> MuseParser m (F Inlines, a)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Inlines, a)
    paraContentsUntil MuseParser m a
    end
      Attr
    attr <- Attr -> Inlines -> ParserT Text MuseState (ReaderT MuseEnv m) Attr
    forall s (m :: * -> *) a st.
    (Stream s m a, HasReaderOptions st, HasLogMessages st,
     HasIdentifierList st) =>
    Attr -> Inlines -> ParserT s st m Attr
    registerHeader (Text
    anchorId, [], []) (F Inlines -> MuseState -> Inlines
    forall s a. Future s a -> s -> a
    runF F Inlines
    content MuseState
    forall a. Default a => a
    def)
      (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Attr -> Int -> Inlines -> Blocks
    B.headerWith Attr
    attr Int
    level (Inlines -> Blocks) -> F Inlines -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> F Inlines
    content, a
    e)

    -- | Parse an example between @{{{@ and @}}}@.
    -- It is an Amusewiki extension influenced by Creole wiki, as described in @Text::Amuse@ documentation.
    example :: PandocMonad m => MuseParser m (F Blocks)
    example :: MuseParser m (F Blocks)
    example = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ Blocks -> F Blocks
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Blocks -> F Blocks) -> (Text -> Blocks) -> Text -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Blocks
    B.codeBlock
      (Text -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> F Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "{{{"
      ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
      ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (Text -> Text
    unindent (Text -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv 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 Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    anyChar (SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "}}}"))

    -- | Parse an @\<example>@ tag.
    exampleTag :: PandocMonad m => MuseParser m (F Blocks)
    exampleTag :: MuseParser m (F Blocks)
    exampleTag = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ (Blocks -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Blocks -> F Blocks
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
     -> MuseParser m (F Blocks))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
    -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ Attr -> Text -> Blocks
    B.codeBlockWith
      (Attr -> Text -> Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Attr -> Text -> Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
      ParsecT Text MuseState (ReaderT MuseEnv m) (Attr -> Text -> Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Attr
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Blocks)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ([(Text, Text)] -> Attr
    htmlAttrToPandoc ([(Text, Text)] -> Attr)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Attr
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m [(Text, Text)]
    openTag "example")
      ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (Text -> Text
    unindent (Text -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv 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 Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    anyChar (Text -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> MuseParser m ()
    closeTag "example"))
      ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol

    -- | Parse a @\<literal>@ tag as a raw block.
    -- For 'RawInline' @\<literal>@ parser, see 'inlineLiteralTag'.
    literalTag :: PandocMonad m => MuseParser m (F Blocks)
    literalTag :: MuseParser m (F Blocks)
    literalTag = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ (Blocks -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Blocks -> F Blocks
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
     -> MuseParser m (F Blocks))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
    -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ Text -> Text -> Blocks
    B.rawBlock
      (Text -> Text -> Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Text -> Text -> Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
      ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Text -> Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Blocks)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (Text -> Maybe Text -> Text
    forall a. a -> Maybe a -> a
    fromMaybe "html" (Maybe Text -> Text)
    -> ([(Text, Text)] -> Maybe Text) -> [(Text, Text)] -> Text
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> [(Text, Text)] -> Maybe Text
    forall a b. Eq a => a -> [(a, b)] -> Maybe b
    lookup "style" ([(Text, Text)] -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m [(Text, Text)]
    openTag "literal") -- FIXME: Emacs Muse inserts <literal> without style into all output formats, but we assume HTML
      ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol
      ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (Text -> Text
    unindent (Text -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv 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 Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    anyChar (Text -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> MuseParser m ()
    closeTag "literal"))
      ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Blocks
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol

    -- | Parse @\<center>@ tag.
    -- Currently it is ignored as Pandoc cannot represent centered blocks.
    centerTag :: PandocMonad m => MuseParser m (F Blocks)
    centerTag :: MuseParser m (F Blocks)
    centerTag = (Attr, F Blocks) -> F Blocks
    forall a b. (a, b) -> b
    snd ((Attr, F Blocks) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Attr, F Blocks)
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) (Attr, F Blocks)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (Attr, F Blocks)
    parseHtmlContent "center"

    -- | Parse @\<right>@ tag.
    -- Currently it is ignored as Pandoc cannot represent centered blocks.
    rightTag :: PandocMonad m => MuseParser m (F Blocks)
    rightTag :: MuseParser m (F Blocks)
    rightTag = (Attr, F Blocks) -> F Blocks
    forall a b. (a, b) -> b
    snd ((Attr, F Blocks) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Attr, F Blocks)
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) (Attr, F Blocks)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (Attr, F Blocks)
    parseHtmlContent "right"

    -- | Parse @\<quote>@ tag.
    quoteTag :: PandocMonad m => MuseParser m (F Blocks)
    quoteTag :: MuseParser m (F Blocks)
    quoteTag = (Blocks -> Blocks) -> F Blocks -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Blocks -> Blocks
    B.blockQuote (F Blocks -> F Blocks)
    -> ((Attr, F Blocks) -> F Blocks) -> (Attr, F Blocks) -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Attr, F Blocks) -> F Blocks
    forall a b. (a, b) -> b
    snd ((Attr, F Blocks) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Attr, F Blocks)
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) (Attr, F Blocks)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (Attr, F Blocks)
    parseHtmlContent "quote"

    -- | Parse @\<div>@ tag.
    -- @\<div>@ tag is supported by Emacs Muse, but not Amusewiki 2.025.
    divTag :: PandocMonad m => MuseParser m (F Blocks)
    divTag :: MuseParser m (F Blocks)
    divTag = do
      (attrs :: Attr
    attrs, content :: F Blocks
    content) <- Text -> MuseParser m (Attr, F Blocks)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (Attr, F Blocks)
    parseHtmlContent "div"
      F Blocks -> MuseParser m (F Blocks)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Blocks -> MuseParser m (F Blocks))
    -> F Blocks -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ Attr -> Blocks -> Blocks
    B.divWith Attr
    attrs (Blocks -> Blocks) -> F Blocks -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> F Blocks
    content

    -- | Parse @\<biblio>@ tag, the result is the same as @\<div class="biblio">@.
    -- @\<biblio>@ tag is supported only in Text::Amuse mode.
    biblioTag :: PandocMonad m => MuseParser m (F Blocks)
    biblioTag :: MuseParser m (F Blocks)
    biblioTag = (Blocks -> Blocks) -> F Blocks -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Attr -> Blocks -> Blocks
    B.divWith ("", ["biblio"], [])) (F Blocks -> F Blocks)
    -> ((Attr, F Blocks) -> F Blocks) -> (Attr, F Blocks) -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Attr, F Blocks) -> F Blocks
    forall a b. (a, b) -> b
    snd
      ((Attr, F Blocks) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ((Attr, F Blocks) -> F Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  Extension -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) a st.
    (Stream s m a, HasReaderOptions st) =>
    Extension -> ParserT s st m ()
    guardEnabled Extension
    Ext_amuse
      ParsecT
      Text MuseState (ReaderT MuseEnv m) ((Attr, F Blocks) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Attr, F Blocks)
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) (Attr, F Blocks)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (Attr, F Blocks)
    parseHtmlContent "biblio"

    -- | Parse @\<play>@ tag, the result is the same as @\<div class="play">@.
    -- @\<play>@ tag is supported only in Text::Amuse mode.
    playTag :: PandocMonad m => MuseParser m (F Blocks)
    playTag :: MuseParser m (F Blocks)
    playTag = do
      Extension -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) a st.
    (Stream s m a, HasReaderOptions st) =>
    Extension -> ParserT s st m ()
    guardEnabled Extension
    Ext_amuse
      (Blocks -> Blocks) -> F Blocks -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Attr -> Blocks -> Blocks
    B.divWith ("", ["play"], [])) (F Blocks -> F Blocks)
    -> ((Attr, F Blocks) -> F Blocks) -> (Attr, F Blocks) -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Attr, F Blocks) -> F Blocks
    forall a b. (a, b) -> b
    snd ((Attr, F Blocks) -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Attr, F Blocks)
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) (Attr, F Blocks)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (Attr, F Blocks)
    parseHtmlContent "play"

    verseLine :: PandocMonad m => MuseParser m (F Inlines)
    verseLine :: MuseParser m (F Inlines)
    verseLine = F Inlines -> F Inlines -> F Inlines
    forall a. Semigroup a => a -> a -> a
    (<>)
      (F Inlines -> F Inlines -> F Inlines)
    -> MuseParser m (F Inlines)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Inlines -> F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (Inlines -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> F Inlines
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Inlines
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    forall s (m :: * -> *) t a u.
    Stream s m t =>
    a -> ParsecT s u m a -> ParsecT s u m a
    option Inlines
    forall a. Monoid a => a
    mempty (Text -> Inlines
    B.str (Text -> Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) t st.
    Stream s m t =>
    ParserT s st m Char -> ParserT s st m Text
    many1Char ('\160' Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ Char -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char ' ')))
      ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines -> F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (F Inlines -> F Inlines
    forall s. Future s Inlines -> Future s Inlines
    trimInlinesF (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat) (MuseParser m (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline' ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol)

    -- | Parse @\<verse>@ tag.
    verseTag :: PandocMonad m => MuseParser m (F Blocks)
    verseTag :: MuseParser m (F Blocks)
    verseTag = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ MuseParser m Int
    forall (m :: * -> *). PandocMonad m => MuseParser m Int
    getIndent MuseParser m Int
    -> (Int -> MuseParser m (F Blocks)) -> MuseParser m (F Blocks)
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \indent :: Int
    indent -> ([Inlines] -> Blocks) -> Future MuseState [Inlines] -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [Inlines] -> Blocks
    B.lineBlock (Future MuseState [Inlines] -> F Blocks)
    -> ([F Inlines] -> Future MuseState [Inlines])
    -> [F Inlines]
    -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> Future MuseState [Inlines]
    forall (t :: * -> *) (m :: * -> *) a.
    (Traversable t, Monad m) =>
    t (m a) -> m (t a)
    sequence
      ([F Inlines] -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  Text -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m [(Text, Text)]
    openTag "verse"
      ParsecT
      Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol
      ParsecT
      Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill (Int -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, HasReaderOptions st) =>
    Int -> ParserT s st m Text
    indentWith Int
    indent ParserT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    verseLine) (ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) ()
     -> ParsecT Text MuseState (ReaderT MuseEnv m) ())
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall a b. (a -> b) -> a -> b
    $ Int -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, HasReaderOptions st) =>
    Int -> ParserT s st m Text
    indentWith Int
    indent ParserT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> MuseParser m ()
    closeTag "verse")
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol

    -- | Parse @\<comment>@ tag.
    commentTag :: PandocMonad m => MuseParser m (F Blocks)
    commentTag :: MuseParser m (F Blocks)
    commentTag = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ F Blocks
    forall a. Monoid a => a
    mempty
      F Blocks
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Text -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m [(Text, Text)]
    openTag "comment"
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    anyChar (Text -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> MuseParser m ()
    closeTag "comment")
      MuseParser m (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol

    -- | Parse paragraph contents.
    paraContentsUntil :: PandocMonad m
                      => MuseParser m a -- ^ Terminator parser
                      -> MuseParser m (F Inlines, a)
    paraContentsUntil :: MuseParser m a -> MuseParser m (F Inlines, a)
    paraContentsUntil end :: MuseParser m a
    end = ([F Inlines] -> F Inlines) -> ([F Inlines], a) -> (F Inlines, a)
    forall (p :: * -> * -> *) a b c.
    Bifunctor p =>
    (a -> b) -> p a c -> p b c
    first (F Inlines -> F Inlines
    forall s. Future s Inlines -> Future s Inlines
    trimInlinesF (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat)
      (([F Inlines], a) -> (F Inlines, a))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ([F Inlines], a)
    -> MuseParser m (F Inlines, a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParserT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> MuseParser m a
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ([F Inlines], a)
    forall s u (m :: * -> *) a b.
    ParserT s u m a -> ParserT s u m b -> ParserT s u m ([a], b)
    manyUntil ParserT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline (MuseParser m a -> MuseParser m a
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m a -> MuseParser m a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> (MuseEnv -> MuseEnv) -> MuseParser m a -> MuseParser m a
    forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
    local (\s :: MuseEnv
    s -> MuseEnv
    s { museInPara :: Bool
    museInPara = Bool
    True}) MuseParser m a
    end))

    -- | Parse a paragraph.
    paraUntil :: PandocMonad m
              => MuseParser m a -- ^ Terminator parser
              -> MuseParser m (F Blocks, a)
    paraUntil :: MuseParser m a -> MuseParser m (F Blocks, a)
    paraUntil end :: MuseParser m a
    end = do
      Bool
    inPara <- (MuseEnv -> Bool)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Bool
    forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
    asks MuseEnv -> Bool
    museInPara
      Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *). Alternative f => Bool -> f ()
    guard (Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ())
    -> Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall a b. (a -> b) -> a -> b
    $ Bool -> Bool
    not Bool
    inPara
      (F Inlines -> F Blocks) -> (F Inlines, a) -> (F Blocks, a)
    forall (p :: * -> * -> *) a b c.
    Bifunctor p =>
    (a -> b) -> p a c -> p b c
    first ((Inlines -> Blocks) -> F Inlines -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> Blocks
    B.para) ((F Inlines, a) -> (F Blocks, a))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines, a)
    -> MuseParser m (F Blocks, a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m a
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines, a)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Inlines, a)
    paraContentsUntil MuseParser m a
    end

    noteMarker' :: PandocMonad m
                => Char
                -> Char
                -> MuseParser m Text
    noteMarker' :: Char -> Char -> MuseParser m Text
    noteMarker' l :: Char
    l r :: Char
    r = MuseParser m Text -> MuseParser m Text
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m Text -> MuseParser m Text)
    -> MuseParser m Text -> MuseParser m Text
    forall a b. (a -> b) -> a -> b
    $ (\x :: Char
    x y :: SourceName
    y -> SourceName -> Text
    T.pack (SourceName -> Text) -> SourceName -> Text
    forall a b. (a -> b) -> a -> b
    $ Char
    lChar -> SourceName -> SourceName
    forall a. a -> [a] -> [a]
    :Char
    xChar -> SourceName -> SourceName
    forall a. a -> [a] -> [a]
    :SourceName
    y SourceName -> SourceName -> SourceName
    forall a. [a] -> [a] -> [a]
    ++ [Char
    r])
      (Char -> SourceName -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Char -> SourceName -> Text)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char Char
    l
      ParsecT
      Text MuseState (ReaderT MuseEnv m) (Char -> SourceName -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (SourceName -> Text)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m Char
    oneOf "123456789"
      ParsecT Text MuseState (ReaderT MuseEnv m) (SourceName -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m Text
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    digit (Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char Char
    r)

    noteMarker :: PandocMonad m => MuseParser m Text
    noteMarker :: MuseParser m Text
    noteMarker = Char -> Char -> MuseParser m Text
    forall (m :: * -> *).
    PandocMonad m =>
    Char -> Char -> MuseParser m Text
    noteMarker' '[' ']' MuseParser m Text -> MuseParser m Text -> MuseParser m Text
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> Char -> Char -> MuseParser m Text
    forall (m :: * -> *).
    PandocMonad m =>
    Char -> Char -> MuseParser m Text
    noteMarker' '{' '}'

    addNote :: PandocMonad m
            => Text
            -> SourcePos
            -> F Blocks
            -> MuseParser m ()
    addNote :: Text -> SourcePos -> F Blocks -> MuseParser m ()
    addNote ref :: Text
    ref pos :: SourcePos
    pos content :: F Blocks
    content = do
      Map Text (SourcePos, F Blocks)
    oldnotes <- MuseState -> Map Text (SourcePos, F Blocks)
    museNotes (MuseState -> Map Text (SourcePos, F Blocks))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) MuseState
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Map Text (SourcePos, F Blocks))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) MuseState
    forall (m :: * -> *) s u. Monad m => ParsecT s u m u
    getState
      Bool -> MuseParser m () -> MuseParser m ()
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
    when (Text -> Map Text (SourcePos, F Blocks) -> Bool
    forall k a. Ord k => k -> Map k a -> Bool
    M.member Text
    ref Map Text (SourcePos, F Blocks)
    oldnotes)
        (LogMessage -> MuseParser m ()
    forall s (m :: * -> *) a st.
    (Stream s m a, HasLogMessages st) =>
    LogMessage -> ParserT s st m ()
    logMessage (LogMessage -> MuseParser m ()) -> LogMessage -> MuseParser m ()
    forall a b. (a -> b) -> a -> b
    $ Text -> SourcePos -> LogMessage
    DuplicateNoteReference Text
    ref SourcePos
    pos)
      (MuseState -> MuseState) -> MuseParser m ()
    forall (m :: * -> *) u s. Monad m => (u -> u) -> ParsecT s u m ()
    updateState ((MuseState -> MuseState) -> MuseParser m ())
    -> (MuseState -> MuseState) -> MuseParser m ()
    forall a b. (a -> b) -> a -> b
    $ \s :: MuseState
    s -> MuseState
    s{ museNotes :: Map Text (SourcePos, F Blocks)
    museNotes = Text
    -> (SourcePos, F Blocks)
    -> Map Text (SourcePos, F Blocks)
    -> Map Text (SourcePos, F Blocks)
    forall k a. Ord k => k -> a -> Map k a -> Map k a
    M.insert Text
    ref (SourcePos
    pos, F Blocks
    content) Map Text (SourcePos, F Blocks)
    oldnotes }

    -- Amusewiki version of note
    -- Parsing is similar to list item, except that note marker is used instead of list marker
    amuseNoteBlockUntil :: PandocMonad m
                        => MuseParser m a
                        -> MuseParser m (F Blocks, a)
    amuseNoteBlockUntil :: MuseParser m a -> MuseParser m (F Blocks, a)
    amuseNoteBlockUntil end :: MuseParser m a
    end = MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a))
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall a b. (a -> b) -> a -> b
    $ do
      Extension -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) a st.
    (Stream s m a, HasReaderOptions st) =>
    Extension -> ParserT s st m ()
    guardEnabled Extension
    Ext_amuse
      Text
    ref <- MuseParser m Text
    forall (m :: * -> *). PandocMonad m => MuseParser m Text
    noteMarker
      SourcePos
    pos <- ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    forall (m :: * -> *) s u. Monad m => ParsecT s u m SourcePos
    getPosition
      ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m a
    lookAhead ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol
      (content :: F Blocks
    content, e :: a
    e) <- MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall (m :: * -> *) a. MonadReader MuseEnv m => m a -> m a
    allowPara (MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a))
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall a b. (a -> b) -> a -> b
    $ Int
    -> MuseParser m a -> MuseParser m a -> MuseParser m (F Blocks, a)
    forall (m :: * -> *) a.
    PandocMonad m =>
    Int
    -> MuseParser m a -> MuseParser m a -> MuseParser m (F Blocks, a)
    listItemContentsUntil (SourcePos -> Int
    sourceColumn SourcePos
    pos) (SourceName -> MuseParser m a
    forall (m :: * -> *) a. MonadFail m => SourceName -> m a
    Prelude.fail "x") MuseParser m a
    end
      Text
    -> SourcePos
    -> F Blocks
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> SourcePos -> F Blocks -> MuseParser m ()
    addNote Text
    ref SourcePos
    pos F Blocks
    content
      (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Blocks
    forall a. Monoid a => a
    mempty, a
    e)

    -- Emacs version of note
    -- Notes are allowed only at the end of text, no indentation is required.
    emacsNoteBlock :: PandocMonad m => MuseParser m (F Blocks)
    emacsNoteBlock :: MuseParser m (F Blocks)
    emacsNoteBlock = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ do
      Extension -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) a st.
    (Stream s m a, HasReaderOptions st) =>
    Extension -> ParserT s st m ()
    guardDisabled Extension
    Ext_amuse
      Text
    ref <- MuseParser m Text
    forall (m :: * -> *). PandocMonad m => MuseParser m Text
    noteMarker
      SourcePos
    pos <- ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    forall (m :: * -> *) s u. Monad m => ParsecT s u m SourcePos
    getPosition
      F Blocks
    content <- ([F Blocks] -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [F Blocks] -> F Blocks
    forall a. Monoid a => [a] -> a
    mconcat ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    blocksTillNote
      Text
    -> SourcePos
    -> F Blocks
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> SourcePos -> F Blocks -> MuseParser m ()
    addNote Text
    ref SourcePos
    pos F Blocks
    content
      F Blocks -> MuseParser m (F Blocks)
    forall (m :: * -> *) a. Monad m => a -> m a
    return F Blocks
    forall a. Monoid a => a
    mempty
      where
        blocksTillNote :: ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    blocksTillNote =
          MuseParser m (F Blocks)
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    forall end s (m :: * -> *) t st a.
    (Show end, Stream s m t) =>
    ParserT s st m a -> ParserT s st m end -> ParserT s st m [a]
    many1Till MuseParser m (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    parseBlock (ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u.
    (Stream s m t, Show t) =>
    ParsecT s u m ()
    eof ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> () ()
    -> MuseParser m Text
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ MuseParser m Text -> MuseParser m Text
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m a
    lookAhead MuseParser m Text
    forall (m :: * -> *). PandocMonad m => MuseParser m Text
    noteMarker)

    --
    -- Verse markup
    --

    -- | Parse a line block indicated by @\'>\'@ characters.
    lineBlock :: PandocMonad m => MuseParser m (F Blocks)
    lineBlock :: MuseParser m (F Blocks)
    lineBlock = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ MuseParser m Int
    forall (m :: * -> *). PandocMonad m => MuseParser m Int
    getIndent MuseParser m Int
    -> (Int -> MuseParser m (F Blocks)) -> MuseParser m (F Blocks)
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \indent :: Int
    indent -> ([Inlines] -> Blocks) -> Future MuseState [Inlines] -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [Inlines] -> Blocks
    B.lineBlock (Future MuseState [Inlines] -> F Blocks)
    -> ([F Inlines] -> Future MuseState [Inlines])
    -> [F Inlines]
    -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> Future MuseState [Inlines]
    forall (t :: * -> *) (m :: * -> *) a.
    (Traversable t, Monad m) =>
    t (m a) -> m (t a)
    sequence
      ([F Inlines] -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall u. ParsecT Text u (ReaderT MuseEnv m) (F Inlines)
    blankVerseLine ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    nonblankVerseLine) ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s u (m :: * -> *) a sep.
    ParsecT s u m a -> ParsecT s u m sep -> ParsecT s u m [a]
    `sepBy1'` ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (Int -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, HasReaderOptions st) =>
    Int -> ParserT s st m Text
    indentWith Int
    indent)
      where
        blankVerseLine :: ParsecT Text u (ReaderT MuseEnv m) (F Inlines)
    blankVerseLine = ParsecT Text u (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text u (ReaderT MuseEnv m) (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text u (ReaderT MuseEnv m) (F Inlines)
     -> ParsecT Text u (ReaderT MuseEnv m) (F Inlines))
    -> ParsecT Text u (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text u (ReaderT MuseEnv m) (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ F Inlines
    forall a. Monoid a => a
    mempty F Inlines
    -> ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) (F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ Char -> ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '>' ParsecT Text u (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    blankline
        nonblankVerseLine :: ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    nonblankVerseLine = ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "> ") ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    verseLine

    -- *** List parsers

    bulletListItemsUntil :: PandocMonad m
                         => Int -- ^ Indentation
                         -> MuseParser m a -- ^ Terminator parser
                         -> MuseParser m ([F Blocks], a)
    bulletListItemsUntil :: Int -> MuseParser m a -> MuseParser m ([F Blocks], a)
    bulletListItemsUntil indent :: Int
    indent end :: MuseParser m a
    end = MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a))
    -> MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall a b. (a -> b) -> a -> b
    $ do
      Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '-'
      ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m a
    lookAhead ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol
      (x :: F Blocks
    x, (xs :: [F Blocks]
    xs, e :: a
    e)) <- ParsecT
      Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    forall (m :: * -> *) a. MonadReader MuseEnv m => m a -> m a
    allowPara (ParsecT
       Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
     -> ParsecT
          Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a)))
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    forall a b. (a -> b) -> a -> b
    $ Int
    -> MuseParser m ([F Blocks], a)
    -> MuseParser m ([F Blocks], a)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    forall (m :: * -> *) a.
    PandocMonad m =>
    Int
    -> MuseParser m a -> MuseParser m a -> MuseParser m (F Blocks, a)
    listItemContentsUntil (Int
    indent Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + 2) (MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m ()
    optional ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    blankline ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Int -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, HasReaderOptions st) =>
    Int -> ParserT s st m Text
    indentWith Int
    indent ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Int -> MuseParser m a -> MuseParser m ([F Blocks], a)
    forall (m :: * -> *) a.
    PandocMonad m =>
    Int -> MuseParser m a -> MuseParser m ([F Blocks], a)
    bulletListItemsUntil Int
    indent MuseParser m a
    end)) (([],) (a -> ([F Blocks], a))
    -> MuseParser m a -> MuseParser m ([F Blocks], a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m a
    end)
      ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Blocks
    xF Blocks -> [F Blocks] -> [F Blocks]
    forall a. a -> [a] -> [a]
    :[F Blocks]
    xs, a
    e)

    -- | Parse a bullet list.
    bulletListUntil :: PandocMonad m
                    => MuseParser m a
                    -> MuseParser m (F Blocks, a)
    bulletListUntil :: MuseParser m a -> MuseParser m (F Blocks, a)
    bulletListUntil end :: MuseParser m a
    end = MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a))
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall a b. (a -> b) -> a -> b
    $ do
      Int
    indent <- MuseParser m Int
    forall (m :: * -> *). PandocMonad m => MuseParser m Int
    getIndent
      Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *). Alternative f => Bool -> f ()
    guard (Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ())
    -> Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall a b. (a -> b) -> a -> b
    $ Int
    indent Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    /= 0
      ([F Blocks] -> F Blocks) -> ([F Blocks], a) -> (F Blocks, a)
    forall (p :: * -> * -> *) a b c.
    Bifunctor p =>
    (a -> b) -> p a c -> p b c
    first (([Blocks] -> Blocks) -> Future MuseState [Blocks] -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [Blocks] -> Blocks
    B.bulletList (Future MuseState [Blocks] -> F Blocks)
    -> ([F Blocks] -> Future MuseState [Blocks])
    -> [F Blocks]
    -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Blocks] -> Future MuseState [Blocks]
    forall (t :: * -> *) (m :: * -> *) a.
    (Traversable t, Monad m) =>
    t (m a) -> m (t a)
    sequence) (([F Blocks], a) -> (F Blocks, a))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ([F Blocks], a)
    -> MuseParser m (F Blocks, a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Int
    -> MuseParser m a
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ([F Blocks], a)
    forall (m :: * -> *) a.
    PandocMonad m =>
    Int -> MuseParser m a -> MuseParser m ([F Blocks], a)
    bulletListItemsUntil Int
    indent MuseParser m a
    end

    museOrderedListMarker :: PandocMonad m
                          => ListNumberStyle
                          -> MuseParser m Int
    museOrderedListMarker :: ListNumberStyle -> MuseParser m Int
    museOrderedListMarker style :: ListNumberStyle
    style =
      (ListNumberStyle, Int) -> Int
    forall a b. (a, b) -> b
    snd ((ListNumberStyle, Int) -> Int)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    -> MuseParser m Int
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall st.
    ParserT Text st (ReaderT MuseEnv m) (ListNumberStyle, Int)
    p MuseParser m Int
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m Int
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '.'
      where p :: ParserT Text st (ReaderT MuseEnv m) (ListNumberStyle, Int)
    p = case ListNumberStyle
    style of
                  Decimal    -> ParserT Text st (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s (m :: * -> *) st.
    Stream s m Char =>
    ParserT s st m (ListNumberStyle, Int)
    decimal
                  UpperRoman -> ParserT Text st (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s (m :: * -> *) st.
    Stream s m Char =>
    ParserT s st m (ListNumberStyle, Int)
    upperRoman
                  LowerRoman -> ParserT Text st (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s (m :: * -> *) st.
    Stream s m Char =>
    ParserT s st m (ListNumberStyle, Int)
    lowerRoman
                  UpperAlpha -> ParserT Text st (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s (m :: * -> *) st.
    Stream s m Char =>
    ParserT s st m (ListNumberStyle, Int)
    upperAlpha
                  LowerAlpha -> ParserT Text st (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s (m :: * -> *) st.
    Stream s m Char =>
    ParserT s st m (ListNumberStyle, Int)
    lowerAlpha
                  _          -> SourceName
    -> ParserT Text st (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall (m :: * -> *) a. MonadFail m => SourceName -> m a
    Prelude.fail "Unhandled case"

    orderedListItemsUntil :: PandocMonad m
                          => Int
                          -> ListNumberStyle
                          -> MuseParser m a
                          -> MuseParser m ([F Blocks], a)
    orderedListItemsUntil :: Int
    -> ListNumberStyle
    -> MuseParser m a
    -> MuseParser m ([F Blocks], a)
    orderedListItemsUntil indent :: Int
    indent style :: ListNumberStyle
    style end :: MuseParser m a
    end =
      MuseParser m ([F Blocks], a)
    continuation
      where
        continuation :: MuseParser m ([F Blocks], a)
    continuation = MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a))
    -> MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall a b. (a -> b) -> a -> b
    $ do
          SourcePos
    pos <- ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    forall (m :: * -> *) s u. Monad m => ParsecT s u m SourcePos
    getPosition
          ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m a
    lookAhead ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol
          (x :: F Blocks
    x, (xs :: [F Blocks]
    xs, e :: a
    e)) <- ParsecT
      Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    forall (m :: * -> *) a. MonadReader MuseEnv m => m a -> m a
    allowPara (ParsecT
       Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
     -> ParsecT
          Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a)))
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    forall a b. (a -> b) -> a -> b
    $ Int
    -> MuseParser m ([F Blocks], a)
    -> MuseParser m ([F Blocks], a)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    forall (m :: * -> *) a.
    PandocMonad m =>
    Int
    -> MuseParser m a -> MuseParser m a -> MuseParser m (F Blocks, a)
    listItemContentsUntil (SourcePos -> Int
    sourceColumn SourcePos
    pos) (MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m ()
    optional ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    blankline ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Int -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, HasReaderOptions st) =>
    Int -> ParserT s st m Text
    indentWith Int
    indent ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Int
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Int
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ListNumberStyle -> ParsecT Text MuseState (ReaderT MuseEnv m) Int
    forall (m :: * -> *).
    PandocMonad m =>
    ListNumberStyle -> MuseParser m Int
    museOrderedListMarker ListNumberStyle
    style ParsecT Text MuseState (ReaderT MuseEnv m) Int
    -> MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> MuseParser m ([F Blocks], a)
    continuation)) (([],) (a -> ([F Blocks], a))
    -> MuseParser m a -> MuseParser m ([F Blocks], a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m a
    end)
          ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Blocks
    xF Blocks -> [F Blocks] -> [F Blocks]
    forall a. a -> [a] -> [a]
    :[F Blocks]
    xs, a
    e)

    -- | Parse an ordered list.
    orderedListUntil :: PandocMonad m
                     => MuseParser m a
                     -> MuseParser m (F Blocks, a)
    orderedListUntil :: MuseParser m a -> MuseParser m (F Blocks, a)
    orderedListUntil end :: MuseParser m a
    end = MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a))
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall a b. (a -> b) -> a -> b
    $ do
      Int
    indent <- MuseParser m Int
    forall (m :: * -> *). PandocMonad m => MuseParser m Int
    getIndent
      Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *). Alternative f => Bool -> f ()
    guard (Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ())
    -> Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall a b. (a -> b) -> a -> b
    $ Int
    indent Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    /= 0
      (style :: ListNumberStyle
    style, start :: Int
    start) <- ParserT Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s (m :: * -> *) st.
    Stream s m Char =>
    ParserT s st m (ListNumberStyle, Int)
    decimal ParserT Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    -> ParserT
         Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    -> ParserT
         Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParserT Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s (m :: * -> *) st.
    Stream s m Char =>
    ParserT s st m (ListNumberStyle, Int)
    lowerRoman ParserT Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    -> ParserT
         Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    -> ParserT
         Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParserT Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s (m :: * -> *) st.
    Stream s m Char =>
    ParserT s st m (ListNumberStyle, Int)
    upperRoman ParserT Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    -> ParserT
         Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    -> ParserT
         Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParserT Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s (m :: * -> *) st.
    Stream s m Char =>
    ParserT s st m (ListNumberStyle, Int)
    lowerAlpha ParserT Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    -> ParserT
         Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    -> ParserT
         Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParserT Text MuseState (ReaderT MuseEnv m) (ListNumberStyle, Int)
    forall s (m :: * -> *) st.
    Stream s m Char =>
    ParserT s st m (ListNumberStyle, Int)
    upperAlpha
      Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '.'
      ([F Blocks] -> F Blocks) -> ([F Blocks], a) -> (F Blocks, a)
    forall (p :: * -> * -> *) a b c.
    Bifunctor p =>
    (a -> b) -> p a c -> p b c
    first (([Blocks] -> Blocks) -> Future MuseState [Blocks] -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (ListAttributes -> [Blocks] -> Blocks
    B.orderedListWith (Int
    start, ListNumberStyle
    style, ListNumberDelim
    Period)) (Future MuseState [Blocks] -> F Blocks)
    -> ([F Blocks] -> Future MuseState [Blocks])
    -> [F Blocks]
    -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Blocks] -> Future MuseState [Blocks]
    forall (t :: * -> *) (m :: * -> *) a.
    (Traversable t, Monad m) =>
    t (m a) -> m (t a)
    sequence)
        (([F Blocks], a) -> (F Blocks, a))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ([F Blocks], a)
    -> MuseParser m (F Blocks, a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Int
    -> ListNumberStyle
    -> MuseParser m a
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ([F Blocks], a)
    forall (m :: * -> *) a.
    PandocMonad m =>
    Int
    -> ListNumberStyle
    -> MuseParser m a
    -> MuseParser m ([F Blocks], a)
    orderedListItemsUntil Int
    indent ListNumberStyle
    style MuseParser m a
    end

    descriptionsUntil :: PandocMonad m
                      => Int
                      -> MuseParser m a
                      -> MuseParser m ([F Blocks], a)
    descriptionsUntil :: Int -> MuseParser m a -> MuseParser m ([F Blocks], a)
    descriptionsUntil indent :: Int
    indent end :: MuseParser m a
    end = do
      ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m a
    lookAhead ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol
      (x :: F Blocks
    x, (xs :: [F Blocks]
    xs, e :: a
    e)) <- ParsecT
      Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    forall (m :: * -> *) a. MonadReader MuseEnv m => m a -> m a
    allowPara (ParsecT
       Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
     -> ParsecT
          Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a)))
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    forall a b. (a -> b) -> a -> b
    $ Int
    -> MuseParser m ([F Blocks], a)
    -> MuseParser m ([F Blocks], a)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Blocks, ([F Blocks], a))
    forall (m :: * -> *) a.
    PandocMonad m =>
    Int
    -> MuseParser m a -> MuseParser m a -> MuseParser m (F Blocks, a)
    listItemContentsUntil Int
    indent (MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m ()
    optional ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    blankline ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Int -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, HasReaderOptions st) =>
    Int -> ParserT s st m Text
    indentWith Int
    indent ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar (SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "::") ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Int -> MuseParser m a -> MuseParser m ([F Blocks], a)
    forall (m :: * -> *) a.
    PandocMonad m =>
    Int -> MuseParser m a -> MuseParser m ([F Blocks], a)
    descriptionsUntil Int
    indent MuseParser m a
    end)) (([],) (a -> ([F Blocks], a))
    -> MuseParser m a -> MuseParser m ([F Blocks], a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m a
    end)
      ([F Blocks], a) -> MuseParser m ([F Blocks], a)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Blocks
    xF Blocks -> [F Blocks] -> [F Blocks]
    forall a. a -> [a] -> [a]
    :[F Blocks]
    xs, a
    e)

    definitionListItemsUntil :: PandocMonad m
                             => Int
                             -> MuseParser m a
                             -> MuseParser m ([F (Inlines, [Blocks])], a)
    definitionListItemsUntil :: Int -> MuseParser m a -> MuseParser m ([F (Inlines, [Blocks])], a)
    definitionListItemsUntil indent :: Int
    indent end :: MuseParser m a
    end =
      MuseParser m ([F (Inlines, [Blocks])], a)
    continuation
      where
        continuation :: MuseParser m ([F (Inlines, [Blocks])], a)
    continuation = MuseParser m ([F (Inlines, [Blocks])], a)
    -> MuseParser m ([F (Inlines, [Blocks])], a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m ([F (Inlines, [Blocks])], a)
     -> MuseParser m ([F (Inlines, [Blocks])], a))
    -> MuseParser m ([F (Inlines, [Blocks])], a)
    -> MuseParser m ([F (Inlines, [Blocks])], a)
    forall a b. (a -> b) -> a -> b
    $ do
          SourcePos
    pos <- ParsecT Text MuseState (ReaderT MuseEnv m) SourcePos
    forall (m :: * -> *) s u. Monad m => ParsecT s u m SourcePos
    getPosition
          F Inlines
    term <- F Inlines -> F Inlines
    forall s. Future s Inlines -> Future s Inlines
    trimInlinesF (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline' (ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
     -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall a b. (a -> b) -> a -> b
    $ SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "::")
          (x :: [F Blocks]
    x, (xs :: [F (Inlines, [Blocks])]
    xs, e :: a
    e)) <- Int
    -> MuseParser m ([F (Inlines, [Blocks])], a)
    -> MuseParser m ([F Blocks], ([F (Inlines, [Blocks])], a))
    forall (m :: * -> *) a.
    PandocMonad m =>
    Int -> MuseParser m a -> MuseParser m ([F Blocks], a)
    descriptionsUntil (SourcePos -> Int
    sourceColumn SourcePos
    pos) (MuseParser m ([F (Inlines, [Blocks])], a)
    -> MuseParser m ([F (Inlines, [Blocks])], a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m ()
    optional ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    blankline ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Int -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, HasReaderOptions st) =>
    Int -> ParserT s st m Text
    indentWith Int
    indent ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> MuseParser m ([F (Inlines, [Blocks])], a)
    -> MuseParser m ([F (Inlines, [Blocks])], a)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> MuseParser m ([F (Inlines, [Blocks])], a)
    continuation) MuseParser m ([F (Inlines, [Blocks])], a)
    -> MuseParser m ([F (Inlines, [Blocks])], a)
    -> MuseParser m ([F (Inlines, [Blocks])], a)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> (([],) (a -> ([F (Inlines, [Blocks])], a))
    -> MuseParser m a -> MuseParser m ([F (Inlines, [Blocks])], a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m a
    end))
          let xx :: F (Inlines, [Blocks])
    xx = (,) (Inlines -> [Blocks] -> (Inlines, [Blocks]))
    -> F Inlines -> Future MuseState ([Blocks] -> (Inlines, [Blocks]))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> F Inlines
    term Future MuseState ([Blocks] -> (Inlines, [Blocks]))
    -> Future MuseState [Blocks] -> F (Inlines, [Blocks])
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [F Blocks] -> Future MuseState [Blocks]
    forall (t :: * -> *) (m :: * -> *) a.
    (Traversable t, Monad m) =>
    t (m a) -> m (t a)
    sequence [F Blocks]
    x
          ([F (Inlines, [Blocks])], a)
    -> MuseParser m ([F (Inlines, [Blocks])], a)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F (Inlines, [Blocks])
    xxF (Inlines, [Blocks])
    -> [F (Inlines, [Blocks])] -> [F (Inlines, [Blocks])]
    forall a. a -> [a] -> [a]
    :[F (Inlines, [Blocks])]
    xs, a
    e)

    -- | Parse a definition list.
    definitionListUntil :: PandocMonad m
                        => MuseParser m a -- ^ Terminator parser
                        -> MuseParser m (F Blocks, a)
    definitionListUntil :: MuseParser m a -> MuseParser m (F Blocks, a)
    definitionListUntil end :: MuseParser m a
    end = MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a))
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall a b. (a -> b) -> a -> b
    $ do
      Int
    indent <- MuseParser m Int
    forall (m :: * -> *). PandocMonad m => MuseParser m Int
    getIndent
      Extension -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) a st.
    (Stream s m a, HasReaderOptions st) =>
    Extension -> ParserT s st m ()
    guardDisabled Extension
    Ext_amuse ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> Bool -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *). Alternative f => Bool -> f ()
    guard (Int
    indent Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    /= 0) -- Initial space is required by Amusewiki, but not Emacs Muse
      ([F (Inlines, [Blocks])] -> F Blocks)
    -> ([F (Inlines, [Blocks])], a) -> (F Blocks, a)
    forall (p :: * -> * -> *) a b c.
    Bifunctor p =>
    (a -> b) -> p a c -> p b c
    first (([(Inlines, [Blocks])] -> Blocks)
    -> Future MuseState [(Inlines, [Blocks])] -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [(Inlines, [Blocks])] -> Blocks
    B.definitionList (Future MuseState [(Inlines, [Blocks])] -> F Blocks)
    -> ([F (Inlines, [Blocks])]
        -> Future MuseState [(Inlines, [Blocks])])
    -> [F (Inlines, [Blocks])]
    -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F (Inlines, [Blocks])] -> Future MuseState [(Inlines, [Blocks])]
    forall (t :: * -> *) (m :: * -> *) a.
    (Traversable t, Monad m) =>
    t (m a) -> m (t a)
    sequence) (([F (Inlines, [Blocks])], a) -> (F Blocks, a))
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F (Inlines, [Blocks])], a)
    -> MuseParser m (F Blocks, a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Int
    -> MuseParser m a
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F (Inlines, [Blocks])], a)
    forall (m :: * -> *) a.
    PandocMonad m =>
    Int -> MuseParser m a -> MuseParser m ([F (Inlines, [Blocks])], a)
    definitionListItemsUntil Int
    indent MuseParser m a
    end

    anyListUntil :: PandocMonad m
                 => MuseParser m a -- ^ Terminator parser
                 -> MuseParser m (F Blocks, a)
    anyListUntil :: MuseParser m a -> MuseParser m (F Blocks, a)
    anyListUntil end :: MuseParser m a
    end =
      MuseParser m a -> MuseParser m (F Blocks, a)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    bulletListUntil MuseParser m a
    end MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m a -> MuseParser m (F Blocks, a)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    orderedListUntil MuseParser m a
    end MuseParser m (F Blocks, a)
    -> MuseParser m (F Blocks, a) -> MuseParser m (F Blocks, a)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m a -> MuseParser m (F Blocks, a)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks, a)
    definitionListUntil MuseParser m a
    end

    -- *** Table parsers

    -- | Internal Muse table representation.
    data MuseTable = MuseTable
      { MuseTable -> Inlines
    museTableCaption :: Inlines
      , MuseTable -> [[Blocks]]
    museTableHeaders :: [[Blocks]]
      , MuseTable -> [[Blocks]]
    museTableRows    :: [[Blocks]]
      , MuseTable -> [[Blocks]]
    museTableFooters :: [[Blocks]]
      }

    data MuseTableElement = MuseHeaderRow [Blocks]
                          | MuseBodyRow [Blocks]
                          | MuseFooterRow [Blocks]
                          | MuseCaption Inlines

    museToPandocTable :: MuseTable -> Blocks
    museToPandocTable :: MuseTable -> Blocks
    museToPandocTable (MuseTable caption :: Inlines
    caption headers :: [[Blocks]]
    headers body :: [[Blocks]]
    body footers :: [[Blocks]]
    footers) =
      Inlines
    -> [(Alignment, Double)] -> [Blocks] -> [[Blocks]] -> Blocks
    B.table Inlines
    caption [(Alignment, Double)]
    attrs [Blocks]
    headRow ([[Blocks]]
    rows [[Blocks]] -> [[Blocks]] -> [[Blocks]]
    forall a. [a] -> [a] -> [a]
    ++ [[Blocks]]
    body [[Blocks]] -> [[Blocks]] -> [[Blocks]]
    forall a. [a] -> [a] -> [a]
    ++ [[Blocks]]
    footers)
      where attrs :: [(Alignment, Double)]
    attrs = (Alignment
    AlignDefault, 0.0) (Alignment, Double) -> [[Blocks]] -> [(Alignment, Double)]
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ [[Blocks]] -> [[Blocks]]
    forall a. [[a]] -> [[a]]
    transpose ([[Blocks]]
    headers [[Blocks]] -> [[Blocks]] -> [[Blocks]]
    forall a. [a] -> [a] -> [a]
    ++ [[Blocks]]
    body [[Blocks]] -> [[Blocks]] -> [[Blocks]]
    forall a. [a] -> [a] -> [a]
    ++ [[Blocks]]
    footers)
            (headRow :: [Blocks]
    headRow, rows :: [[Blocks]]
    rows) = ([Blocks], [[Blocks]])
    -> Maybe ([Blocks], [[Blocks]]) -> ([Blocks], [[Blocks]])
    forall a. a -> Maybe a -> a
    fromMaybe ([], []) (Maybe ([Blocks], [[Blocks]]) -> ([Blocks], [[Blocks]]))
    -> Maybe ([Blocks], [[Blocks]]) -> ([Blocks], [[Blocks]])
    forall a b. (a -> b) -> a -> b
    $ [[Blocks]] -> Maybe ([Blocks], [[Blocks]])
    forall a. [a] -> Maybe (a, [a])
    uncons [[Blocks]]
    headers

    museAppendElement :: MuseTableElement
                      -> MuseTable
                      -> MuseTable
    museAppendElement :: MuseTableElement -> MuseTable -> MuseTable
    museAppendElement element :: MuseTableElement
    element tbl :: MuseTable
    tbl =
      case MuseTableElement
    element of
        MuseHeaderRow row :: [Blocks]
    row -> MuseTable
    tbl{ museTableHeaders :: [[Blocks]]
    museTableHeaders = [Blocks]
    row [Blocks] -> [[Blocks]] -> [[Blocks]]
    forall a. a -> [a] -> [a]
    : MuseTable -> [[Blocks]]
    museTableHeaders MuseTable
    tbl }
        MuseBodyRow row :: [Blocks]
    row -> MuseTable
    tbl{ museTableRows :: [[Blocks]]
    museTableRows = [Blocks]
    row [Blocks] -> [[Blocks]] -> [[Blocks]]
    forall a. a -> [a] -> [a]
    : MuseTable -> [[Blocks]]
    museTableRows MuseTable
    tbl }
        MuseFooterRow row :: [Blocks]
    row -> MuseTable
    tbl{ museTableFooters :: [[Blocks]]
    museTableFooters = [Blocks]
    row [Blocks] -> [[Blocks]] -> [[Blocks]]
    forall a. a -> [a] -> [a]
    : MuseTable -> [[Blocks]]
    museTableFooters MuseTable
    tbl }
        MuseCaption inlines :: Inlines
    inlines -> MuseTable
    tbl{ museTableCaption :: Inlines
    museTableCaption = Inlines
    inlines }

    tableElements :: PandocMonad m => MuseParser m (F [MuseTableElement])
    tableElements :: MuseParser m (F [MuseTableElement])
    tableElements = [Future MuseState MuseTableElement] -> F [MuseTableElement]
    forall (t :: * -> *) (m :: * -> *) a.
    (Traversable t, Monad m) =>
    t (m a) -> m (t a)
    sequence ([Future MuseState MuseTableElement] -> F [MuseTableElement])
    -> ParsecT
         Text
         MuseState
         (ReaderT MuseEnv m)
         [Future MuseState MuseTableElement]
    -> MuseParser m (F [MuseTableElement])
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT
      Text
      MuseState
      (ReaderT MuseEnv m)
      (Future MuseState MuseTableElement)
    -> ParsecT
         Text
         MuseState
         (ReaderT MuseEnv m)
         [Future MuseState MuseTableElement]
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m [a]
    many1 ParsecT
      Text
      MuseState
      (ReaderT MuseEnv m)
      (Future MuseState MuseTableElement)
    forall (m :: * -> *).
    PandocMonad m =>
    MuseParser m (Future MuseState MuseTableElement)
    tableParseElement

    elementsToTable :: [MuseTableElement] -> MuseTable
    elementsToTable :: [MuseTableElement] -> MuseTable
    elementsToTable = (MuseTableElement -> MuseTable -> MuseTable)
    -> MuseTable -> [MuseTableElement] -> MuseTable
    forall (t :: * -> *) a b.
    Foldable t =>
    (a -> b -> b) -> b -> t a -> b
    foldr MuseTableElement -> MuseTable -> MuseTable
    museAppendElement MuseTable
    emptyTable
      where emptyTable :: MuseTable
    emptyTable = Inlines -> [[Blocks]] -> [[Blocks]] -> [[Blocks]] -> MuseTable
    MuseTable Inlines
    forall a. Monoid a => a
    mempty [[Blocks]]
    forall a. Monoid a => a
    mempty [[Blocks]]
    forall a. Monoid a => a
    mempty [[Blocks]]
    forall a. Monoid a => a
    mempty

    museGridPart :: PandocMonad m => MuseParser m Int
    museGridPart :: MuseParser m Int
    museGridPart = MuseParser m Int -> MuseParser m Int
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m Int -> MuseParser m Int)
    -> MuseParser m Int -> MuseParser m Int
    forall a b. (a -> b) -> a -> b
    $ SourceName -> Int
    forall (t :: * -> *) a. Foldable t => t a -> Int
    length (SourceName -> Int)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m Int
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m [a]
    many1 (Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '-') MuseParser m Int
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m Int
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '+'

    museGridTableHeader :: PandocMonad m => MuseParser m [Int]
    museGridTableHeader :: MuseParser m [Int]
    museGridTableHeader = MuseParser m [Int] -> MuseParser m [Int]
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m [Int] -> MuseParser m [Int])
    -> MuseParser m [Int] -> MuseParser m [Int]
    forall a b. (a -> b) -> a -> b
    $ Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '+' ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m [Int] -> MuseParser m [Int]
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT Text MuseState (ReaderT MuseEnv m) Int
    -> MuseParser m [Int]
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m [a]
    many1 ParsecT Text MuseState (ReaderT MuseEnv m) Int
    forall (m :: * -> *). PandocMonad m => MuseParser m Int
    museGridPart MuseParser m [Int]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m [Int]
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol

    museGridTableRow :: PandocMonad m
                     => Int
                     -> [Int]
                     -> MuseParser m (F [Blocks])
    museGridTableRow :: Int -> [Int] -> MuseParser m (Future MuseState [Blocks])
    museGridTableRow indent :: Int
    indent indices :: [Int]
    indices = MuseParser m (Future MuseState [Blocks])
    -> MuseParser m (Future MuseState [Blocks])
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (Future MuseState [Blocks])
     -> MuseParser m (Future MuseState [Blocks]))
    -> MuseParser m (Future MuseState [Blocks])
    -> MuseParser m (Future MuseState [Blocks])
    forall a b. (a -> b) -> a -> b
    $ do
      [[Text]]
    lns <- ParsecT Text MuseState (ReaderT MuseEnv m) [Text]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [[Text]]
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m [a]
    many1 (ParsecT Text MuseState (ReaderT MuseEnv m) [Text]
     -> ParsecT Text MuseState (ReaderT MuseEnv m) [[Text]])
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [Text]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [[Text]]
    forall a b. (a -> b) -> a -> b
    $ ParsecT Text MuseState (ReaderT MuseEnv m) [Text]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [Text]
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (Int -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, HasReaderOptions st) =>
    Int -> ParserT s st m Text
    indentWith Int
    indent ParserT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [Text]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [Text]
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> [Int] -> ParsecT Text MuseState (ReaderT MuseEnv m) [Text]
    forall (m :: * -> *). PandocMonad m => [Int] -> MuseParser m [Text]
    museGridTableRawLine [Int]
    indices)
      let cols :: [Text]
    cols = ([Text] -> Text) -> [[Text]] -> [Text]
    forall a b. (a -> b) -> [a] -> [b]
    map ([Text] -> Text
    T.unlines ([Text] -> Text) -> ([Text] -> [Text]) -> [Text] -> Text
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Text -> Text) -> [Text] -> [Text]
    forall a b. (a -> b) -> [a] -> [b]
    map Text -> Text
    trimr) ([[Text]] -> [Text]) -> [[Text]] -> [Text]
    forall a b. (a -> b) -> a -> b
    $ [[Text]] -> [[Text]]
    forall a. [[a]] -> [[a]]
    transpose [[Text]]
    lns
      Int -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, HasReaderOptions st) =>
    Int -> ParserT s st m Text
    indentWith Int
    indent ParserT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [Int]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [Int]
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT Text MuseState (ReaderT MuseEnv m) [Int]
    forall (m :: * -> *). PandocMonad m => MuseParser m [Int]
    museGridTableHeader
      [F Blocks] -> Future MuseState [Blocks]
    forall (t :: * -> *) (m :: * -> *) a.
    (Traversable t, Monad m) =>
    t (m a) -> m (t a)
    sequence ([F Blocks] -> Future MuseState [Blocks])
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    -> MuseParser m (Future MuseState [Blocks])
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (Text -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks))
    -> [Text] -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    forall (t :: * -> *) (m :: * -> *) a b.
    (Traversable t, Monad m) =>
    (a -> m b) -> t a -> m (t b)
    mapM (ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    -> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall s (m :: * -> *) u a.
    (Stream s m Char, IsString s, HasLastStrPosition u) =>
    ParserT s u m a -> Text -> ParserT s u m a
    parseFromString' ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Blocks)
    parseBlocks) [Text]
    cols

    museGridTableRawLine :: PandocMonad m
                         => [Int]
                         -> MuseParser m [Text]
    museGridTableRawLine :: [Int] -> MuseParser m [Text]
    museGridTableRawLine indices :: [Int]
    indices =
      Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '|' ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m [Text] -> MuseParser m [Text]
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> [Int]
    -> (Int -> ParsecT Text MuseState (ReaderT MuseEnv m) Text)
    -> MuseParser m [Text]
    forall (t :: * -> *) (m :: * -> *) a b.
    (Traversable t, Monad m) =>
    t a -> (a -> m b) -> m (t b)
    forM [Int]
    indices (\n :: Int
    n -> Int
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) st.
    (Stream s m Char, Monad m) =>
    Int -> ParsecT s st m Char -> ParsecT s st m Text
    countChar Int
    n ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    anyChar ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '|') MuseParser m [Text]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m [Text]
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol

    museGridTable :: PandocMonad m => MuseParser m (F Blocks)
    museGridTable :: MuseParser m (F Blocks)
    museGridTable = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ do
      Int
    indent <- MuseParser m Int
    forall (m :: * -> *). PandocMonad m => MuseParser m Int
    getIndent
      [Int]
    indices <- MuseParser m [Int]
    forall (m :: * -> *). PandocMonad m => MuseParser m [Int]
    museGridTableHeader
      ([[Blocks]] -> Blocks) -> Future MuseState [[Blocks]] -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [[Blocks]] -> Blocks
    rowsToTable (Future MuseState [[Blocks]] -> F Blocks)
    -> ([Future MuseState [Blocks]] -> Future MuseState [[Blocks]])
    -> [Future MuseState [Blocks]]
    -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Future MuseState [Blocks]] -> Future MuseState [[Blocks]]
    forall (t :: * -> *) (m :: * -> *) a.
    (Traversable t, Monad m) =>
    t (m a) -> m (t a)
    sequence ([Future MuseState [Blocks]] -> F Blocks)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) [Future MuseState [Blocks]]
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT
      Text MuseState (ReaderT MuseEnv m) (Future MuseState [Blocks])
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) [Future MuseState [Blocks]]
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m [a]
    many1 (Int
    -> [Int]
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Future MuseState [Blocks])
    forall (m :: * -> *).
    PandocMonad m =>
    Int -> [Int] -> MuseParser m (Future MuseState [Blocks])
    museGridTableRow Int
    indent [Int]
    indices)
      where rowsToTable :: [[Blocks]] -> Blocks
    rowsToTable rows :: [[Blocks]]
    rows = Inlines
    -> [(Alignment, Double)] -> [Blocks] -> [[Blocks]] -> Blocks
    B.table Inlines
    forall a. Monoid a => a
    mempty [(Alignment, Double)]
    attrs [] [[Blocks]]
    rows
                               where attrs :: [(Alignment, Double)]
    attrs = (Alignment
    AlignDefault, 0.0) (Alignment, Double) -> [[Blocks]] -> [(Alignment, Double)]
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ [[Blocks]] -> [[Blocks]]
    forall a. [[a]] -> [[a]]
    transpose [[Blocks]]
    rows

    -- | Parse a table.
    table :: PandocMonad m => MuseParser m (F Blocks)
    table :: MuseParser m (F Blocks)
    table = MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Blocks) -> MuseParser m (F Blocks))
    -> MuseParser m (F Blocks) -> MuseParser m (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ ([MuseTableElement] -> Blocks) -> F [MuseTableElement] -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (MuseTable -> Blocks
    museToPandocTable (MuseTable -> Blocks)
    -> ([MuseTableElement] -> MuseTable)
    -> [MuseTableElement]
    -> Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [MuseTableElement] -> MuseTable
    elementsToTable) (F [MuseTableElement] -> F Blocks)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F [MuseTableElement])
    -> MuseParser m (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) (F [MuseTableElement])
    forall (m :: * -> *).
    PandocMonad m =>
    MuseParser m (F [MuseTableElement])
    tableElements

    tableParseElement :: PandocMonad m => MuseParser m (F MuseTableElement)
    tableParseElement :: MuseParser m (Future MuseState MuseTableElement)
    tableParseElement = MuseParser m (Future MuseState MuseTableElement)
    forall (m :: * -> *).
    PandocMonad m =>
    MuseParser m (Future MuseState MuseTableElement)
    tableParseHeader
                    MuseParser m (Future MuseState MuseTableElement)
    -> MuseParser m (Future MuseState MuseTableElement)
    -> MuseParser m (Future MuseState MuseTableElement)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (Future MuseState MuseTableElement)
    forall (m :: * -> *).
    PandocMonad m =>
    MuseParser m (Future MuseState MuseTableElement)
    tableParseBody
                    MuseParser m (Future MuseState MuseTableElement)
    -> MuseParser m (Future MuseState MuseTableElement)
    -> MuseParser m (Future MuseState MuseTableElement)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (Future MuseState MuseTableElement)
    forall (m :: * -> *).
    PandocMonad m =>
    MuseParser m (Future MuseState MuseTableElement)
    tableParseFooter
                    MuseParser m (Future MuseState MuseTableElement)
    -> MuseParser m (Future MuseState MuseTableElement)
    -> MuseParser m (Future MuseState MuseTableElement)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (Future MuseState MuseTableElement)
    forall (m :: * -> *).
    PandocMonad m =>
    MuseParser m (Future MuseState MuseTableElement)
    tableParseCaption

    tableParseRow :: PandocMonad m
                  => Int -- ^ Number of separator characters
                  -> MuseParser m (F [Blocks])
    tableParseRow :: Int -> MuseParser m (Future MuseState [Blocks])
    tableParseRow n :: Int
    n = MuseParser m (Future MuseState [Blocks])
    -> MuseParser m (Future MuseState [Blocks])
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (Future MuseState [Blocks])
     -> MuseParser m (Future MuseState [Blocks]))
    -> MuseParser m (Future MuseState [Blocks])
    -> MuseParser m (Future MuseState [Blocks])
    forall a b. (a -> b) -> a -> b
    $ [F Blocks] -> Future MuseState [Blocks]
    forall (t :: * -> *) (m :: * -> *) a.
    (Traversable t, Monad m) =>
    t (m a) -> m (t a)
    sequence ([F Blocks] -> Future MuseState [Blocks])
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    -> MuseParser m (Future MuseState [Blocks])
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    tableCells
      where tableCells :: ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    tableCells = (:) (F Blocks -> [F Blocks] -> [F Blocks])
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F Blocks] -> [F Blocks])
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks)
    tableCell ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall u. ParsecT Text u (ReaderT MuseEnv m) ()
    sep ParsecT
      Text MuseState (ReaderT MuseEnv m) ([F Blocks] -> [F Blocks])
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> (ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    tableCells ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> (F Blocks -> [F Blocks])
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Blocks]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap F Blocks -> [F Blocks]
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall (m :: * -> *) a.
    PandocMonad m =>
    MuseParser m a -> MuseParser m (F Blocks)
    tableCell ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol))
            tableCell :: ParsecT Text MuseState (ReaderT MuseEnv m) end
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    tableCell p :: ParsecT Text MuseState (ReaderT MuseEnv m) end
    p = ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
     -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall a b. (a -> b) -> a -> b
    $ (Inlines -> Blocks) -> F Inlines -> F Blocks
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> Blocks
    B.plain (F Inlines -> F Blocks)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Blocks
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . F Inlines -> F Inlines
    forall s. Future s Inlines -> Future s Inlines
    trimInlinesF (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat ([F Inlines] -> F Blocks)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (F Blocks)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) end
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline' ParsecT Text MuseState (ReaderT MuseEnv m) end
    p
            sep :: ParsecT Text u (ReaderT MuseEnv m) ()
    sep = ParsecT Text u (ReaderT MuseEnv m) ()
    -> ParsecT Text u (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text u (ReaderT MuseEnv m) ()
     -> ParsecT Text u (ReaderT MuseEnv m) ())
    -> ParsecT Text u (ReaderT MuseEnv m) ()
    -> ParsecT Text u (ReaderT MuseEnv m) ()
    forall a b. (a -> b) -> a -> b
    $ ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m [a]
    many1 ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text u (ReaderT MuseEnv m) SourceName
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Int
    -> ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    Int -> ParsecT s u m a -> ParsecT s u m [a]
    count Int
    n (Char -> ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '|') ParsecT Text u (ReaderT MuseEnv m) SourceName
    -> ParsecT Text u (ReaderT MuseEnv m) ()
    -> ParsecT Text u (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParsecT Text u (ReaderT MuseEnv m) ()
    -> ParsecT Text u (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m a
    lookAhead (ParsecT Text u (ReaderT MuseEnv m) SourceName
    -> ParsecT Text u (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m [a]
    many1 ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar) ParsecT Text u (ReaderT MuseEnv m) ()
    -> ParsecT Text u (ReaderT MuseEnv m) ()
    -> ParsecT Text u (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT Text u (ReaderT MuseEnv m) ()
    -> ParsecT Text u (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void ParsecT Text u (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol)

    -- | Parse a table header row.
    tableParseHeader :: PandocMonad m => MuseParser m (F MuseTableElement)
    tableParseHeader :: MuseParser m (Future MuseState MuseTableElement)
    tableParseHeader = ([Blocks] -> MuseTableElement)
    -> Future MuseState [Blocks] -> Future MuseState MuseTableElement
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [Blocks] -> MuseTableElement
    MuseHeaderRow (Future MuseState [Blocks] -> Future MuseState MuseTableElement)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Future MuseState [Blocks])
    -> MuseParser m (Future MuseState MuseTableElement)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Int
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Future MuseState [Blocks])
    forall (m :: * -> *).
    PandocMonad m =>
    Int -> MuseParser m (Future MuseState [Blocks])
    tableParseRow 2

    -- | Parse a table body row.
    tableParseBody :: PandocMonad m => MuseParser m (F MuseTableElement)
    tableParseBody :: MuseParser m (Future MuseState MuseTableElement)
    tableParseBody = ([Blocks] -> MuseTableElement)
    -> Future MuseState [Blocks] -> Future MuseState MuseTableElement
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [Blocks] -> MuseTableElement
    MuseBodyRow (Future MuseState [Blocks] -> Future MuseState MuseTableElement)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Future MuseState [Blocks])
    -> MuseParser m (Future MuseState MuseTableElement)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Int
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Future MuseState [Blocks])
    forall (m :: * -> *).
    PandocMonad m =>
    Int -> MuseParser m (Future MuseState [Blocks])
    tableParseRow 1

    -- | Parse a table footer row.
    tableParseFooter :: PandocMonad m => MuseParser m (F MuseTableElement)
    tableParseFooter :: MuseParser m (Future MuseState MuseTableElement)
    tableParseFooter = ([Blocks] -> MuseTableElement)
    -> Future MuseState [Blocks] -> Future MuseState MuseTableElement
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap [Blocks] -> MuseTableElement
    MuseFooterRow (Future MuseState [Blocks] -> Future MuseState MuseTableElement)
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Future MuseState [Blocks])
    -> MuseParser m (Future MuseState MuseTableElement)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Int
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Future MuseState [Blocks])
    forall (m :: * -> *).
    PandocMonad m =>
    Int -> MuseParser m (Future MuseState [Blocks])
    tableParseRow 3

    -- | Parse table caption.
    tableParseCaption :: PandocMonad m => MuseParser m (F MuseTableElement)
    tableParseCaption :: MuseParser m (Future MuseState MuseTableElement)
    tableParseCaption = MuseParser m (Future MuseState MuseTableElement)
    -> MuseParser m (Future MuseState MuseTableElement)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (Future MuseState MuseTableElement)
     -> MuseParser m (Future MuseState MuseTableElement))
    -> MuseParser m (Future MuseState MuseTableElement)
    -> MuseParser m (Future MuseState MuseTableElement)
    forall a b. (a -> b) -> a -> b
    $ (Inlines -> MuseTableElement)
    -> F Inlines -> Future MuseState MuseTableElement
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> MuseTableElement
    MuseCaption (F Inlines -> Future MuseState MuseTableElement)
    -> ([F Inlines] -> F Inlines)
    -> [F Inlines]
    -> Future MuseState MuseTableElement
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . F Inlines -> F Inlines
    forall s. Future s Inlines -> Future s Inlines
    trimInlinesF (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat
      ([F Inlines] -> Future MuseState MuseTableElement)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text
         MuseState
         (ReaderT MuseEnv m)
         ([F Inlines] -> Future MuseState MuseTableElement)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
      ParsecT
      Text
      MuseState
      (ReaderT MuseEnv m)
      ([F Inlines] -> Future MuseState MuseTableElement)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text
         MuseState
         (ReaderT MuseEnv m)
         ([F Inlines] -> Future MuseState MuseTableElement)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "|+"
      ParsecT
      Text
      MuseState
      (ReaderT MuseEnv m)
      ([F Inlines] -> Future MuseState MuseTableElement)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> MuseParser m (Future MuseState MuseTableElement)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParserT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall end s (m :: * -> *) t st a.
    (Show end, Stream s m t) =>
    ParserT s st m a -> ParserT s st m end -> ParserT s st m [a]
    many1Till ParserT Text MuseState (ReaderT MuseEnv m) (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline (ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParserT Text MuseState (ReaderT MuseEnv m) ()
     -> ParserT Text MuseState (ReaderT MuseEnv m) ())
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall a b. (a -> b) -> a -> b
    $ SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "+|" ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) st. Stream s m Char => ParserT s st m ()
    eol)

    -- ** Inline parsers

    inline' :: PandocMonad m => MuseParser m (F Inlines)
    inline' :: MuseParser m (F Inlines)
    inline' = MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    whitespace
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    br
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    anchor
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    footnote
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    strongEmph
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    strong
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    strongTag
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    emph
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    emphTag
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    underlined
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    superscriptTag
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    subscriptTag
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    strikeoutTag
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    verbatimTag
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    classTag
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inlineRtl
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inlineLtr
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    nbsp
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    linkOrImage
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    code
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    codeTag
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    mathTag
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inlineLiteralTag
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    str
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    asterisks
          MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    symbol
          MuseParser m (F Inlines) -> SourceName -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> SourceName -> ParsecT s u m a
    <?> "inline"

    inline :: PandocMonad m => MuseParser m (F Inlines)
    inline :: MuseParser m (F Inlines)
    inline = MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    endline MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline'

    -- | Parse a soft break.
    endline :: PandocMonad m => MuseParser m (F Inlines)
    endline :: MuseParser m (F Inlines)
    endline = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ Inlines -> F Inlines
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Inlines
    B.softbreak F Inlines
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    newline MuseParser m (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t a u.
    (Stream s m t, Show a) =>
    ParsecT s u m a -> ParsecT s u m ()
    notFollowedBy ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    blankline MuseParser m (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). Monad m => MuseParser m ()
    updateLastSpacePos

    parseAnchor :: PandocMonad m => MuseParser m Text
    parseAnchor :: MuseParser m Text
    parseAnchor = MuseParser m Text -> MuseParser m Text
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m Text -> MuseParser m Text)
    -> MuseParser m Text -> MuseParser m Text
    forall a b. (a -> b) -> a -> b
    $ Char -> Text -> Text
    T.cons
      (Char -> Text -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Char -> Text -> Text)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => MuseParser m ()
    firstColumn
      ParsecT Text MuseState (ReaderT MuseEnv m) (Char -> Text -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (Char -> Text -> Text)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '#'
      ParsecT Text MuseState (ReaderT MuseEnv m) (Char -> Text -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Text)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    letter
      ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Text)
    -> MuseParser m Text -> MuseParser m Text
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m Text
    forall s (m :: * -> *) t st.
    Stream s m t =>
    ParserT s st m Char -> ParserT s st m Text
    manyChar (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    letter ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    digit ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '-')

    anchor :: PandocMonad m => MuseParser m (F Inlines)
    anchor :: MuseParser m (F Inlines)
    anchor = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ do
      Text
    anchorId <- MuseParser m Text
    forall (m :: * -> *). PandocMonad m => MuseParser m Text
    parseAnchor
      ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m ()
    skipMany ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    newline
      F Inlines -> MuseParser m (F Inlines)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Inlines -> MuseParser m (F Inlines))
    -> F Inlines -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ Inlines -> F Inlines
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Inlines -> F Inlines) -> Inlines -> F Inlines
    forall a b. (a -> b) -> a -> b
    $ Attr -> Inlines -> Inlines
    B.spanWith (Text
    anchorId, [], []) Inlines
    forall a. Monoid a => a
    mempty

    -- | Parse a footnote reference.
    footnote :: PandocMonad m => MuseParser m (F Inlines)
    footnote :: MuseParser m (F Inlines)
    footnote = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ do
      Bool
    inLink <- (MuseEnv -> Bool)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Bool
    forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
    asks MuseEnv -> Bool
    museInLink
      Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *). Alternative f => Bool -> f ()
    guard (Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ())
    -> Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall a b. (a -> b) -> a -> b
    $ Bool -> Bool
    not Bool
    inLink
      Text
    ref <- MuseParser m Text
    forall (m :: * -> *). PandocMonad m => MuseParser m Text
    noteMarker
      F Inlines -> MuseParser m (F Inlines)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Inlines -> MuseParser m (F Inlines))
    -> F Inlines -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ do
        Map Text (SourcePos, F Blocks)
    notes <- (MuseState -> Map Text (SourcePos, F Blocks))
    -> Future MuseState (Map Text (SourcePos, F Blocks))
    forall s a. (s -> a) -> Future s a
    asksF MuseState -> Map Text (SourcePos, F Blocks)
    museNotes
        case Text
    -> Map Text (SourcePos, F Blocks) -> Maybe (SourcePos, F Blocks)
    forall k a. Ord k => k -> Map k a -> Maybe a
    M.lookup Text
    ref Map Text (SourcePos, F Blocks)
    notes of
          Nothing -> Inlines -> F Inlines
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Inlines -> F Inlines) -> Inlines -> F Inlines
    forall a b. (a -> b) -> a -> b
    $ Text -> Inlines
    B.str Text
    ref
          Just (_pos :: SourcePos
    _pos, contents :: F Blocks
    contents) -> do
            MuseState
    st <- Future MuseState MuseState
    forall s. Future s s
    askF
            let contents' :: Blocks
    contents' = F Blocks -> MuseState -> Blocks
    forall s a. Future s a -> s -> a
    runF F Blocks
    contents MuseState
    st { museNotes :: Map Text (SourcePos, F Blocks)
    museNotes = Text
    -> Map Text (SourcePos, F Blocks) -> Map Text (SourcePos, F Blocks)
    forall k a. Ord k => k -> Map k a -> Map k a
    M.delete Text
    ref (MuseState -> Map Text (SourcePos, F Blocks)
    museNotes MuseState
    st) }
            Inlines -> F Inlines
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Inlines -> F Inlines) -> Inlines -> F Inlines
    forall a b. (a -> b) -> a -> b
    $ Blocks -> Inlines
    B.note Blocks
    contents'

    whitespace :: PandocMonad m => MuseParser m (F Inlines)
    whitespace :: MuseParser m (F Inlines)
    whitespace = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ Inlines -> F Inlines
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Inlines
    B.space F Inlines
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m ()
    skipMany1 ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar MuseParser m (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). Monad m => MuseParser m ()
    updateLastSpacePos

    -- | Parse @\<br>@ tag.
    br :: PandocMonad m => MuseParser m (F Inlines)
    br :: MuseParser m (F Inlines)
    br = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ Inlines -> F Inlines
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Inlines
    B.linebreak F Inlines
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "<br>"

    emphasisBetween :: (PandocMonad m, Show a)
                    => MuseParser m a
                    -> MuseParser m (F Inlines)
    emphasisBetween :: MuseParser m a -> MuseParser m (F Inlines)
    emphasisBetween p :: MuseParser m a
    p = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ F Inlines -> F Inlines
    forall s. Future s Inlines -> Future s Inlines
    trimInlinesF (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat
      ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => MuseParser m ()
    atStart
      ParsecT
      Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    -> MuseParser m a
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  MuseParser m a
    p
      ParsecT
      Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t a u.
    (Stream s m t, Show a) =>
    ParsecT s u m a -> ParsecT s u m ()
    notFollowedBy ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    space
      ParsecT
      Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> MuseParser m (F Inlines)
    -> MuseParser m a
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall end s (m :: * -> *) t st a.
    (Show end, Stream s m t) =>
    ParserT s st m a -> ParserT s st m end -> ParserT s st m [a]
    many1Till MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline (MuseParser m a -> MuseParser m a
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m a -> MuseParser m a)
    -> MuseParser m a -> MuseParser m a
    forall a b. (a -> b) -> a -> b
    $ ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => MuseParser m ()
    noSpaceBefore ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m a -> MuseParser m a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> MuseParser m a
    p MuseParser m a
    -> ParsecT Text MuseState (ReaderT MuseEnv m) () -> MuseParser m a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t a u.
    (Stream s m t, Show a) =>
    ParsecT s u m a -> ParsecT s u m ()
    notFollowedBy ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    alphaNum)

    -- | Parse an inline tag, such as @\<em>@ and @\<strong>@.
    inlineTag :: PandocMonad m
              => Text -- ^ Tag name
              -> MuseParser m (F Inlines)
    inlineTag :: Text -> MuseParser m (F Inlines)
    inlineTag tag :: Text
    tag = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat
      ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  Text -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m [(Text, Text)]
    openTag Text
    tag
      ParsecT
      Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> MuseParser m (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline (Text -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> MuseParser m ()
    closeTag Text
    tag)

    -- | Parse strong emphasis inline markup, indicated by @***@.
    strongEmph :: PandocMonad m => MuseParser m (F Inlines)
    strongEmph :: MuseParser m (F Inlines)
    strongEmph = (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Inlines -> Inlines
    B.strong (Inlines -> Inlines) -> (Inlines -> Inlines) -> Inlines -> Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Inlines -> Inlines
    B.emph) (F Inlines -> F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m SourceName -> MuseParser m (F Inlines)
    forall (m :: * -> *) a.
    (PandocMonad m, Show a) =>
    MuseParser m a -> MuseParser m (F Inlines)
    emphasisBetween (SourceName -> MuseParser m SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "***" MuseParser m SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m SourceName
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t a u.
    (Stream s m t, Show a) =>
    ParsecT s u m a -> ParsecT s u m ()
    notFollowedBy (Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '*'))

    -- | Parse strong inline markup, indicated by @**@.
    strong :: PandocMonad m => MuseParser m (F Inlines)
    strong :: MuseParser m (F Inlines)
    strong = (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> Inlines
    B.strong (F Inlines -> F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m SourceName -> MuseParser m (F Inlines)
    forall (m :: * -> *) a.
    (PandocMonad m, Show a) =>
    MuseParser m a -> MuseParser m (F Inlines)
    emphasisBetween (SourceName -> MuseParser m SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "**" MuseParser m SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m SourceName
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t a u.
    (Stream s m t, Show a) =>
    ParsecT s u m a -> ParsecT s u m ()
    notFollowedBy (Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '*'))

    -- | Parse emphasis inline markup, indicated by @*@.
    emph :: PandocMonad m => MuseParser m (F Inlines)
    emph :: MuseParser m (F Inlines)
    emph = (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> Inlines
    B.emph (F Inlines -> F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m Char -> MuseParser m (F Inlines)
    forall (m :: * -> *) a.
    (PandocMonad m, Show a) =>
    MuseParser m a -> MuseParser m (F Inlines)
    emphasisBetween (Char -> MuseParser m Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '*' MuseParser m Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m Char
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* MuseParser m Char -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t a u.
    (Stream s m t, Show a) =>
    ParsecT s u m a -> ParsecT s u m ()
    notFollowedBy (Char -> MuseParser m Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '*'))

    -- | Parse underline inline markup, indicated by @_@.
    -- Supported only in Emacs Muse mode, not Text::Amuse.
    underlined :: PandocMonad m => MuseParser m (F Inlines)
    underlined :: MuseParser m (F Inlines)
    underlined = (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> Inlines
    underlineSpan
      (F Inlines -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) (F Inlines -> F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  Extension -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) a st.
    (Stream s m a, HasReaderOptions st) =>
    Extension -> ParserT s st m ()
    guardDisabled Extension
    Ext_amuse -- Supported only by Emacs Muse
      ParsecT Text MuseState (ReaderT MuseEnv m) (F Inlines -> F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> MuseParser m Char -> MuseParser m (F Inlines)
    forall (m :: * -> *) a.
    (PandocMonad m, Show a) =>
    MuseParser m a -> MuseParser m (F Inlines)
    emphasisBetween (Char -> MuseParser m Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '_')

    -- | Parse @\<strong>@ tag.
    strongTag :: PandocMonad m => MuseParser m (F Inlines)
    strongTag :: MuseParser m (F Inlines)
    strongTag = (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> Inlines
    B.strong (F Inlines -> F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> MuseParser m (F Inlines)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (F Inlines)
    inlineTag "strong"

    -- | Parse @\<em>@ tag.
    emphTag :: PandocMonad m => MuseParser m (F Inlines)
    emphTag :: MuseParser m (F Inlines)
    emphTag = (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> Inlines
    B.emph (F Inlines -> F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> MuseParser m (F Inlines)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (F Inlines)
    inlineTag "em"

    -- | Parse @\<sup>@ tag.
    superscriptTag :: PandocMonad m => MuseParser m (F Inlines)
    superscriptTag :: MuseParser m (F Inlines)
    superscriptTag = (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> Inlines
    B.superscript (F Inlines -> F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> MuseParser m (F Inlines)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (F Inlines)
    inlineTag "sup"

    -- | Parse @\<sub>@ tag.
    subscriptTag :: PandocMonad m => MuseParser m (F Inlines)
    subscriptTag :: MuseParser m (F Inlines)
    subscriptTag = (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> Inlines
    B.subscript (F Inlines -> F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> MuseParser m (F Inlines)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (F Inlines)
    inlineTag "sub"

    -- | Parse @\<del>@ tag.
    strikeoutTag :: PandocMonad m => MuseParser m (F Inlines)
    strikeoutTag :: MuseParser m (F Inlines)
    strikeoutTag = (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> Inlines
    B.strikeout (F Inlines -> F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> MuseParser m (F Inlines)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (F Inlines)
    inlineTag "del"

    -- | Parse @\<verbatim>@ tag.
    verbatimTag :: PandocMonad m => MuseParser m (F Inlines)
    verbatimTag :: MuseParser m (F Inlines)
    verbatimTag = Inlines -> F Inlines
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Inlines -> F Inlines) -> (Text -> Inlines) -> Text -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Inlines
    B.text
      (Text -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  Text -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m [(Text, Text)]
    openTag "verbatim"
      ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv 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 ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    anyChar (Text -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> MuseParser m ()
    closeTag "verbatim")

    -- | Parse @\<class>@ tag.
    classTag :: PandocMonad m => MuseParser m (F Inlines)
    classTag :: MuseParser m (F Inlines)
    classTag = do
      [Text]
    classes <- [Text] -> (Text -> [Text]) -> Maybe Text -> [Text]
    forall b a. b -> (a -> b) -> Maybe a -> b
    maybe [] Text -> [Text]
    T.words (Maybe Text -> [Text])
    -> ([(Text, Text)] -> Maybe Text) -> [(Text, Text)] -> [Text]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> [(Text, Text)] -> Maybe Text
    forall a b. Eq a => a -> [(a, b)] -> Maybe b
    lookup "name" ([(Text, Text)] -> [Text])
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [Text]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m [(Text, Text)]
    openTag "class"
      (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Attr -> Inlines -> Inlines
    B.spanWith ("", [Text]
    classes, [])) (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> MuseParser m (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline (Text -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> MuseParser m ()
    closeTag "class")

    -- | Parse @\<\<\<RTL>>>@ text.
    inlineRtl :: PandocMonad m => MuseParser m (F Inlines)
    inlineRtl :: MuseParser m (F Inlines)
    inlineRtl = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $
      (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Attr -> Inlines -> Inlines
    B.spanWith ("", [], [("dir", "rtl")])) (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "<<<" ParsecT
      Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> MuseParser m (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline (SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string ">>>")

    -- | Parse @\<\<\<LTR>>>@ text.
    inlineLtr :: PandocMonad m => MuseParser m (F Inlines)
    inlineLtr :: MuseParser m (F Inlines)
    inlineLtr = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $
      (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Attr -> Inlines -> Inlines
    B.spanWith ("", [], [("dir", "ltr")])) (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string ">>>" ParsecT
      Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> MuseParser m (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline (SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "<<<")

    -- | Parse "~~" as nonbreaking space.
    nbsp :: PandocMonad m => MuseParser m (F Inlines)
    nbsp :: MuseParser m (F Inlines)
    nbsp = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ Inlines -> F Inlines
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Text -> Inlines
    B.str "\160") F Inlines
    -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$ SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "~~"

    -- | Parse code markup, indicated by @\'=\'@ characters.
    code :: PandocMonad m => MuseParser m (F Inlines)
    code :: MuseParser m (F Inlines)
    code = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ (Inlines -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> F Inlines
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
     -> MuseParser m (F Inlines))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ Text -> Inlines
    B.code (Text -> Inlines)
    -> ((Text, Text) -> Text) -> (Text, Text) -> Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Text -> Text -> Text) -> (Text, Text) -> Text
    forall a b c. (a -> b -> c) -> (a, b) -> c
    uncurry Text -> Text -> Text
    forall a. Semigroup a => a -> a -> a
    (<>)
      ((Text, Text) -> Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ((Text, Text) -> Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => MuseParser m ()
    atStart
      ParsecT
      Text MuseState (ReaderT MuseEnv m) ((Text, Text) -> Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ((Text, Text) -> Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '='
      ParsecT
      Text MuseState (ReaderT MuseEnv m) ((Text, Text) -> Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ((Text, Text) -> Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t a u.
    (Stream s m t, Show a) =>
    ParsecT s u m a -> ParsecT s u m ()
    notFollowedBy (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    newline)
      ParsecT
      Text MuseState (ReaderT MuseEnv m) ((Text, Text) -> Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text, Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text, Text)
    forall s u (m :: * -> *) b.
    ParserT s u m Char -> ParserT s u m b -> ParserT s u m (Text, b)
    manyUntilChar (SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m Char
    noneOf "\n\r" ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> (ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    newline ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t a u.
    (Stream s m t, Show a) =>
    ParsecT s u m a -> ParsecT s u m ()
    notFollowedBy ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    newline)) (ParserT Text MuseState (ReaderT MuseEnv m) Text
    -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParserT Text MuseState (ReaderT MuseEnv m) Text
     -> ParserT Text MuseState (ReaderT MuseEnv m) Text)
    -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    forall a b. (a -> b) -> a -> b
    $ (Char -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Char -> Text
    T.singleton (ParsecT Text MuseState (ReaderT MuseEnv m) Char
     -> ParserT Text MuseState (ReaderT MuseEnv m) Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) Text
    forall a b. (a -> b) -> a -> b
    $ SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m Char
    noneOf " \t\n\r=" ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '=')
      ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) t a u.
    (Stream s m t, Show a) =>
    ParsecT s u m a -> ParsecT s u m ()
    notFollowedBy ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    alphaNum

    -- | Parse @\<code>@ tag.
    codeTag :: PandocMonad m => MuseParser m (F Inlines)
    codeTag :: MuseParser m (F Inlines)
    codeTag = (Inlines -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> F Inlines
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
     -> MuseParser m (F Inlines))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ Attr -> Text -> Inlines
    B.codeWith
      (Attr -> Text -> Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Attr
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ([(Text, Text)] -> Attr
    htmlAttrToPandoc ([(Text, Text)] -> Attr)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Attr
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m [(Text, Text)]
    openTag "code")
      ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv 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 ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    anyChar (Text -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> MuseParser m ()
    closeTag "code")

    -- | Parse @\<math>@ tag.
    -- @\<math>@ tag is an Emacs Muse extension enabled by @(require 'muse-latex2png)@
    mathTag :: PandocMonad m => MuseParser m (F Inlines)
    mathTag :: MuseParser m (F Inlines)
    mathTag = Inlines -> F Inlines
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Inlines -> F Inlines) -> (Text -> Inlines) -> Text -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Inlines
    B.math
      (Text -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  Text -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m [(Text, Text)]
    openTag "math"
      ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv 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 ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    anyChar (Text -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> MuseParser m ()
    closeTag "math")

    -- | Parse inline @\<literal>@ tag as a raw inline.
    inlineLiteralTag :: PandocMonad m => MuseParser m (F Inlines)
    inlineLiteralTag :: MuseParser m (F Inlines)
    inlineLiteralTag = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ (Inlines -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap Inlines -> F Inlines
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
     -> MuseParser m (F Inlines))
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ Text -> Text -> Inlines
    B.rawInline
      (Text -> Text -> Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> (Text -> Maybe Text -> Text
    forall a. a -> Maybe a -> a
    fromMaybe "html" (Maybe Text -> Text)
    -> ([(Text, Text)] -> Maybe Text) -> [(Text, Text)] -> Text
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> [(Text, Text)] -> Maybe Text
    forall a b. Eq a => a -> [(a, b)] -> Maybe b
    lookup "style" ([(Text, Text)] -> Text)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) [(Text, Text)]
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m [(Text, Text)]
    openTag "literal") -- FIXME: Emacs Muse inserts <literal> without style into all output formats, but we assume HTML
      ParsecT Text MuseState (ReaderT MuseEnv m) (Text -> Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Inlines
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    -> ParsecT Text MuseState (ReaderT MuseEnv 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 ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    anyChar (Text -> ParserT Text MuseState (ReaderT MuseEnv m) ()
    forall (m :: * -> *). PandocMonad m => Text -> MuseParser m ()
    closeTag "literal")

    str :: PandocMonad m => MuseParser m (F Inlines)
    str :: MuseParser m (F Inlines)
    str = Inlines -> F Inlines
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Inlines -> F Inlines) -> (Text -> Inlines) -> Text -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Inlines
    B.str (Text -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) t st.
    Stream s m t =>
    ParserT s st m Char -> ParserT s st m Text
    many1Char ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    alphaNum MuseParser m (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall s (m :: * -> *) a st.
    (Stream s m a, HasLastStrPosition st) =>
    ParserT s st m ()
    updateLastStrPos

    -- | Consume asterisks that were not used as emphasis opening.
    -- This prevents series of asterisks from being split into
    -- literal asterisk and emphasis opening.
    asterisks :: PandocMonad m => MuseParser m (F Inlines)
    asterisks :: MuseParser m (F Inlines)
    asterisks = Inlines -> F Inlines
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Inlines -> F Inlines) -> (Text -> Inlines) -> Text -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Inlines
    B.str (Text -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) t st.
    Stream s m t =>
    ParserT s st m Char -> ParserT s st m Text
    many1Char (Char -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '*')

    symbol :: PandocMonad m => MuseParser m (F Inlines)
    symbol :: MuseParser m (F Inlines)
    symbol = Inlines -> F Inlines
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Inlines -> F Inlines) -> (Char -> Inlines) -> Char -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Inlines
    B.str (Text -> Inlines) -> (Char -> Text) -> Char -> Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Char -> Text
    T.singleton (Char -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    nonspaceChar

    -- | Parse a link or image.
    linkOrImage :: PandocMonad m => MuseParser m (F Inlines)
    linkOrImage :: MuseParser m (F Inlines)
    linkOrImage = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ Text -> MuseParser m (F Inlines)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (F Inlines)
    link "URL:" MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    image MuseParser m (F Inlines)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a.
    ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
    <|> Text -> MuseParser m (F Inlines)
    forall (m :: * -> *).
    PandocMonad m =>
    Text -> MuseParser m (F Inlines)
    link ""

    linkContent :: PandocMonad m => MuseParser m (F Inlines)
    linkContent :: MuseParser m (F Inlines)
    linkContent = F Inlines -> F Inlines
    forall s. Future s Inlines -> Future s Inlines
    trimInlinesF (F Inlines -> F Inlines)
    -> ([F Inlines] -> F Inlines) -> [F Inlines] -> F Inlines
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [F Inlines] -> F Inlines
    forall a. Monoid a => [a] -> a
    mconcat
      ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT
         Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char '['
      ParsecT
      Text MuseState (ReaderT MuseEnv m) ([F Inlines] -> F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    -> MuseParser m (F Inlines)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> MuseParser m (F Inlines)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) [F Inlines]
    forall s (m :: * -> *) t u a end.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m end -> ParsecT s u m [a]
    manyTill MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    inline (Char -> ParsecT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char ']')

    -- | Parse a link starting with (possibly null) prefix
    link :: PandocMonad m => Text -> MuseParser m (F Inlines)
    link :: Text -> MuseParser m (F Inlines)
    link prefix :: Text
    prefix = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ do
      Bool
    inLink <- (MuseEnv -> Bool)
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Bool
    forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
    asks MuseEnv -> Bool
    museInLink
      Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall (f :: * -> *). Alternative f => Bool -> f ()
    guard (Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ())
    -> Bool -> ParsecT Text MuseState (ReaderT MuseEnv m) ()
    forall a b. (a -> b) -> a -> b
    $ Bool -> Bool
    not Bool
    inLink
      Text -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Text -> ParsecT s u m Text
    textStr (Text -> ParsecT Text MuseState (ReaderT MuseEnv m) Text)
    -> Text -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall a b. (a -> b) -> a -> b
    $ "[[" Text -> Text -> Text
    forall a. Semigroup a => a -> a -> a
    <> Text
    prefix
      Text
    url <- ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv 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 ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    anyChar (ParserT Text MuseState (ReaderT MuseEnv m) Char
     -> ParsecT Text MuseState (ReaderT MuseEnv m) Text)
    -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParsecT Text MuseState (ReaderT MuseEnv m) Text
    forall a b. (a -> b) -> a -> b
    $ Char -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char ']'
      F Inlines
    content <- F Inlines -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s (m :: * -> *) t a u.
    Stream s m t =>
    a -> ParsecT s u m a -> ParsecT s u m a
    option (Inlines -> F Inlines
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Inlines -> F Inlines) -> Inlines -> F Inlines
    forall a b. (a -> b) -> a -> b
    $ Text -> Inlines
    B.str Text
    url) ((MuseEnv -> MuseEnv)
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
    local (\s :: MuseEnv
    s -> MuseEnv
    s { museInLink :: Bool
    museInLink = Bool
    True }) MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    linkContent)
      Char -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char ']'
      F Inlines -> MuseParser m (F Inlines)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Inlines -> MuseParser m (F Inlines))
    -> F Inlines -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ Text -> Text -> Inlines -> Inlines
    B.link Text
    url "" (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> F Inlines
    content

    image :: PandocMonad m => MuseParser m (F Inlines)
    image :: MuseParser m (F Inlines)
    image = MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (MuseParser m (F Inlines) -> MuseParser m (F Inlines))
    -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ do
      SourceName -> ParsecT Text MuseState (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m SourceName
    string "[["
      (url :: Text
    url, (ext :: Text
    ext, width :: Maybe Text
    width, align :: Maybe Char
    align)) <- ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT
         Text MuseState (ReaderT MuseEnv m) (Text, Maybe Text, Maybe Char)
    -> ParserT
         Text
         MuseState
         (ReaderT MuseEnv m)
         (Text, (Text, Maybe Text, Maybe Char))
    forall s u (m :: * -> *) b.
    ParserT s u m Char -> ParserT s u m b -> ParserT s u m (Text, b)
    manyUntilChar (SourceName -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m Char
    noneOf "]") (ParserT
      Text MuseState (ReaderT MuseEnv m) (Text, Maybe Text, Maybe Char)
    forall u.
    ParsecT Text u (ReaderT MuseEnv m) (Text, Maybe Text, Maybe Char)
    imageExtensionAndOptions ParserT
      Text MuseState (ReaderT MuseEnv m) (Text, Maybe Text, Maybe Char)
    -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    -> ParserT
         Text MuseState (ReaderT MuseEnv m) (Text, Maybe Text, Maybe Char)
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Char -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char ']')
      F Inlines
    content <- F Inlines -> MuseParser m (F Inlines) -> MuseParser m (F Inlines)
    forall s (m :: * -> *) t a u.
    Stream s m t =>
    a -> ParsecT s u m a -> ParsecT s u m a
    option F Inlines
    forall a. Monoid a => a
    mempty MuseParser m (F Inlines)
    forall (m :: * -> *). PandocMonad m => MuseParser m (F Inlines)
    linkContent
      Char -> ParserT Text MuseState (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Char -> ParsecT s u m Char
    char ']'
      let widthAttr :: [(Text, Text)]
    widthAttr = case Maybe Char
    align of
                        Just 'f' -> [("width", Text -> Maybe Text -> Text
    forall a. a -> Maybe a -> a
    fromMaybe "100" Maybe Text
    width Text -> Text -> Text
    forall a. Semigroup a => a -> a -> a
    <> "%"), ("height", "75%")]
                        _ -> Maybe (Text, Text) -> [(Text, Text)]
    forall a. Maybe a -> [a]
    maybeToList (("width",) (Text -> (Text, Text)) -> (Text -> Text) -> Text -> (Text, Text)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Text -> Text -> Text
    forall a. Semigroup a => a -> a -> a
    <> "%") (Text -> (Text, Text)) -> Maybe Text -> Maybe (Text, Text)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Maybe Text
    width)
      let alignClass :: [Text]
    alignClass = case Maybe Char
    align of
                         Just 'r' -> ["align-right"]
                         Just 'l' -> ["align-left"]
                         Just 'f' -> []
                         _        -> []
      F Inlines -> MuseParser m (F Inlines)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (F Inlines -> MuseParser m (F Inlines))
    -> F Inlines -> MuseParser m (F Inlines)
    forall a b. (a -> b) -> a -> b
    $ Attr -> Text -> Text -> Inlines -> Inlines
    B.imageWith ("", [Text]
    alignClass, [(Text, Text)]
    widthAttr) (Text
    url Text -> Text -> Text
    forall a. Semigroup a => a -> a -> a
    <> Text
    ext) Text
    forall a. Monoid a => a
    mempty (Inlines -> Inlines) -> F Inlines -> F Inlines
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> F Inlines
    content
      where -- Taken from muse-image-regexp defined in Emacs Muse file lisp/muse-regexps.el
            imageExtensions :: [Text]
    imageExtensions = [".eps", ".gif", ".jpg", ".jpeg", ".pbm", ".png", ".tiff", ".xbm", ".xpm"]
            imageExtension :: ParsecT Text u (ReaderT MuseEnv m) Text
    imageExtension = [ParsecT Text u (ReaderT MuseEnv m) Text]
    -> ParsecT Text u (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    [ParsecT s u m a] -> ParsecT s u m a
    choice (ParsecT Text u (ReaderT MuseEnv m) Text
    -> ParsecT Text u (ReaderT MuseEnv m) Text
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m a
    try (ParsecT Text u (ReaderT MuseEnv m) Text
     -> ParsecT Text u (ReaderT MuseEnv m) Text)
    -> (Text -> ParsecT Text u (ReaderT MuseEnv m) Text)
    -> Text
    -> ParsecT Text u (ReaderT MuseEnv m) Text
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> ParsecT Text u (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) u.
    Stream s m Char =>
    Text -> ParsecT s u m Text
    textStr (Text -> ParsecT Text u (ReaderT MuseEnv m) Text)
    -> [Text] -> [ParsecT Text u (ReaderT MuseEnv m) Text]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> [Text]
    imageExtensions)
            imageExtensionAndOptions :: ParsecT Text u (ReaderT MuseEnv m) (Text, Maybe Text, Maybe Char)
    imageExtensionAndOptions = do
              Text
    ext <- ParsecT Text u (ReaderT MuseEnv m) Text
    forall u. ParsecT Text u (ReaderT MuseEnv m) Text
    imageExtension
              (width :: Maybe Text
    width, align :: Maybe Char
    align) <- (Maybe Text, Maybe Char)
    -> ParsecT Text u (ReaderT MuseEnv m) (Maybe Text, Maybe Char)
    -> ParsecT Text u (ReaderT MuseEnv m) (Maybe Text, Maybe Char)
    forall s (m :: * -> *) t a u.
    Stream s m t =>
    a -> ParsecT s u m a -> ParsecT s u m a
    option (Maybe Text
    forall a. Maybe a
    Nothing, Maybe Char
    forall a. Maybe a
    Nothing) ParsecT Text u (ReaderT MuseEnv m) (Maybe Text, Maybe Char)
    forall u.
    ParsecT Text u (ReaderT MuseEnv m) (Maybe Text, Maybe Char)
    imageAttrs
              (Text, Maybe Text, Maybe Char)
    -> ParsecT
         Text u (ReaderT MuseEnv m) (Text, Maybe Text, Maybe Char)
    forall (m :: * -> *) a. Monad m => a -> m a
    return (Text
    ext, Maybe Text
    width, Maybe Char
    align)
            imageAttrs :: ParsecT Text u (ReaderT MuseEnv m) (Maybe Text, Maybe Char)
    imageAttrs = (,)
              (Maybe Text -> Maybe Char -> (Maybe Text, Maybe Char))
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text
         u
         (ReaderT MuseEnv m)
         (Maybe Text -> Maybe Char -> (Maybe Text, Maybe Char))
    forall (f :: * -> *) a b. Functor f => a -> f b -> f a
    <$  ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m [a]
    many1 ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
              ParsecT
      Text
      u
      (ReaderT MuseEnv m)
      (Maybe Text -> Maybe Char -> (Maybe Text, Maybe Char))
    -> ParsecT Text u (ReaderT MuseEnv m) (Maybe Text)
    -> ParsecT
         Text u (ReaderT MuseEnv m) (Maybe Char -> (Maybe Text, Maybe Char))
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text u (ReaderT MuseEnv m) Text
    -> ParsecT Text u (ReaderT MuseEnv m) (Maybe Text)
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m (Maybe a)
    optionMaybe (ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) Text
    forall s (m :: * -> *) t st.
    Stream s m t =>
    ParserT s st m Char -> ParserT s st m Text
    many1Char ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    digit)
              ParsecT
      Text u (ReaderT MuseEnv m) (Maybe Char -> (Maybe Text, Maybe Char))
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    -> ParsecT
         Text u (ReaderT MuseEnv m) (Maybe Char -> (Maybe Text, Maybe Char))
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <*  ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) SourceName
    forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
    many ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u. Stream s m Char => ParsecT s u m Char
    spaceChar
              ParsecT
      Text u (ReaderT MuseEnv m) (Maybe Char -> (Maybe Text, Maybe Char))
    -> ParsecT Text u (ReaderT MuseEnv m) (Maybe Char)
    -> ParsecT Text u (ReaderT MuseEnv m) (Maybe Text, Maybe Char)
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ParsecT Text u (ReaderT MuseEnv m) Char
    -> ParsecT Text u (ReaderT MuseEnv m) (Maybe Char)
    forall s (m :: * -> *) t u a.
    Stream s m t =>
    ParsecT s u m a -> ParsecT s u m (Maybe a)
    optionMaybe (SourceName -> ParsecT Text u (ReaderT MuseEnv m) Char
    forall s (m :: * -> *) u.
    Stream s m Char =>
    SourceName -> ParsecT s u m Char
    oneOf "rlf")