aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Lua/Marshaling/AST.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Lua/Marshaling/AST.hs b/src/Text/Pandoc/Lua/Marshaling/AST.hs
index 568b610cc..31d040c83 100644
--- a/src/Text/Pandoc/Lua/Marshaling/AST.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/AST.hs
@@ -67,6 +67,7 @@ import Text.Pandoc.Lua.Marshaling.ListAttributes
(peekListAttributes, pushListAttributes)
import qualified HsLua as Lua
+import qualified Text.Pandoc.Builder as B
import qualified Text.Pandoc.Lua.Util as LuaUtil
instance Pushable Pandoc where
@@ -796,10 +797,12 @@ peekInlineFuzzy = retrieving "Inline" . choice
-- | Try extra-hard to return the value at the given index as a list of
-- inlines.
peekInlinesFuzzy :: LuaError e => Peeker e [Inline]
-peekInlinesFuzzy = choice
- [ peekList peekInlineFuzzy
- , fmap pure . peekInlineFuzzy
- ]
+peekInlinesFuzzy idx = liftLua (ltype idx) >>= \case
+ TypeString -> B.toList . B.text <$> peekText idx
+ _ -> choice
+ [ peekList peekInlineFuzzy
+ , fmap pure . peekInlineFuzzy
+ ] idx
-- | Try extra hard to retrieve a Block value from the stack. Treats bar
-- Inline elements as if they were wrapped in 'Plain'.