From d95befac55a3254d8e4a0bad11ee03143fa81a60 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 19 Oct 2022 22:21:00 -0700 Subject: Add custom extensions. T.P.Extensions [API change]: + Add CustomExtension constructor to Extension. + Remove Bounded, Enum instances for Extension. + Add `extensionsToList` function. + Revise `readExtension` so it can handle CustomExtension, and so that it returns a Text rather than Maybe Text. + Add `showExtension`. T.P.Format: + Revise error checking to handle CustomExtension. --- pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/Format.hs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'pandoc-lua-engine/src/Text') diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/Format.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/Format.hs index a71aeb952..377ce159b 100644 --- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/Format.hs +++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Marshal/Format.hs @@ -19,16 +19,12 @@ module Text.Pandoc.Lua.Marshal.Format import HsLua import Text.Pandoc.Extensions (Extension, Extensions, extensionsFromList, readExtension) import Text.Pandoc.Format (ExtensionsConfig (..)) -import qualified HsLua.Core.Utf8 as UTF8 -- | Retrieves an 'Extensions' set from the Lua stack. peekExtension :: LuaError e => Peeker e Extension peekExtension idx = do extString <- peekString idx - case readExtension extString of - Just ext -> return ext - Nothing -> failPeek . UTF8.fromString $ - "Unknown extension: " <> extString + return $ readExtension extString {-# INLINE peekExtension #-} -- | Retrieves an 'Extensions' set from the Lua stack. -- cgit v1.2.3