@@ -40,7 +40,6 @@ import Data.List (intersperse)
4040import qualified Data.Map as M
4141import Data.Text (Text)
4242import qualified Data.Text as T
43−import Data.Maybe (fromMaybe)
4443
4544--
4645-- Functions acting on the parser state
@@ -761,7 +760,7 @@ afterEmphasisPreChar :: PandocMonad m => OrgParser m Bool
761760afterEmphasisPreChar = do
762761 pos <- getPosition
763762 lastPrePos <- orgStateLastPreCharPos <$> getState
764− return . fromMaybe True $ (== pos) <$> lastPrePos
763+ return $ maybe True (== pos) lastPrePos
765764
766765-- | Whether the parser is right after a forbidden border char
767766notAfterForbiddenBorderChar :: PandocMonad m => OrgParser m Bool
@@ -773,20 +772,21 @@ notAfterForbiddenBorderChar = do
773772-- | Read a sub- or superscript expression
774773subOrSuperExpr :: PandocMonad m => OrgParser m (F Inlines)
775774subOrSuperExpr = try $
776− choice [ charsInBalanced '{' '}' (noneOf "\n\r")
777− , enclosing ('(', ')') <$> charsInBalanced '(' ')' (noneOf "\n\r")
778− , simpleSubOrSuperText
779− ] >>= parseFromString (mconcat <$> many inline)
775+ simpleSubOrSuperText <|>
776+ (choice [ charsInBalanced '{' '}' (noneOf "\n\r")
777+ , enclosing ('(', ')') <$> charsInBalanced '(' ')' (noneOf "\n\r")
778+ ] >>= parseFromString (mconcat <$> many inline))
780779 where enclosing (left, right) s = T.cons left $ T.snoc s right
781780
782−simpleSubOrSuperText :: PandocMonad m => OrgParser m Text
781+simpleSubOrSuperText :: PandocMonad m => OrgParser m (F Inlines)
783782simpleSubOrSuperText = try $ do
784783 state <- getState
785784 guard . exportSubSuperscripts . orgStateExportSettings $ state
786− choice [ textStr "*"
787− , mappend <$> option "" (T.singleton <$> oneOf "+-")
788− <*> many1Char alphaNum
789− ]
785+ return . B.str <$>
786+ choice [ textStr "*"
787+ , mappend <$> option "" (T.singleton <$> oneOf "+-")
788+ <*> many1Char alphaNum
789+ ]
790790
791791inlineLaTeX :: PandocMonad m => OrgParser m (F Inlines)
792792inlineLaTeX = try $ do