From c467f0fed109c362faa733c1a258a26bc6aba5cd Mon Sep 17 00:00:00 2001 From: Albert Krewinkel <albert@zeitkraut.de> Date: Tue, 2 Nov 2021 17:21:29 +0100 Subject: Lua: allow omitting the 2nd parameter in pandoc.Code constructor Fixes a regression introduced in 2.15 which required users to always specify an Attr value when constructing a Code element. --- src/Text/Pandoc/Lua/Module/Pandoc.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc/Lua/Module') diff --git a/src/Text/Pandoc/Lua/Module/Pandoc.hs b/src/Text/Pandoc/Lua/Module/Pandoc.hs index 6d1ccea04..f09159b4e 100644 --- a/src/Text/Pandoc/Lua/Module/Pandoc.hs +++ b/src/Text/Pandoc/Lua/Module/Pandoc.hs @@ -138,9 +138,9 @@ inlineConstructors = <#> parameter peekInlinesFuzzy "content" "Inline" "placeholder content" =#> functionResult pushInline "Inline" "cite element" , defun "Code" - ### liftPure2 (flip Code) + ### liftPure2 (\text mattr -> Code (fromMaybe nullAttr mattr) text) <#> parameter peekText "code" "string" "code string" - <#> parameter peekAttr "attr" "Attr" "additional attributes" + <#> optionalParameter peekAttr "attr" "Attr" "additional attributes" =#> functionResult pushInline "Inline" "code element" , mkInlinesConstr "Emph" Emph , defun "Image" -- cgit v1.2.3