From b26f950ccaa0a1a973b282a516bd80295536feb2 Mon Sep 17 00:00:00 2001
From: Albert Krewinkel <albert@zeitkraut.de>
Date: Tue, 2 Nov 2021 17:25:47 +0100
Subject: [PATCH] Lua: display Attr values using their native Haskell
 representation

---
 src/Text/Pandoc/Lua/Marshaling/Attr.hs | 4 ++++
 test/lua/module/pandoc.lua             | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/Text/Pandoc/Lua/Marshaling/Attr.hs b/src/Text/Pandoc/Lua/Marshaling/Attr.hs
index a38bc6ec7..97e702e35 100644
--- a/src/Text/Pandoc/Lua/Marshaling/Attr.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/Attr.hs
@@ -42,6 +42,10 @@ typeAttr = deftype "Attr"
     <#> parameter peekAttr "a1" "Attr" ""
     <#> parameter peekAttr "a2" "Attr" ""
     =#> functionResult pushBool "boolean" "whether the two are equal"
+  , operation Tostring $ lambda
+    ### liftPure show
+    <#> parameter peekAttr "Attr" "attr" ""
+    =#> functionResult pushString "string" "native Haskell representation"
   ]
   [ property "identifier" "element identifier"
       (pushText, \(ident,_,_) -> ident)
diff --git a/test/lua/module/pandoc.lua b/test/lua/module/pandoc.lua
index 057d24202..9f5f5c771 100644
--- a/test/lua/module/pandoc.lua
+++ b/test/lua/module/pandoc.lua
@@ -185,10 +185,10 @@ return {
       end),
       test('has property `text`', function ()
         local code = pandoc.Code('true')
-        -- assert.are_equal(code.text, 'true')
+        assert.are_equal(code.text, 'true')
 
-        -- code.text = '1 + 1'
-        -- assert.are_equal(pandoc.Code('1 + 1'), code)
+        code.text = '1 + 1'
+        assert.are_equal(pandoc.Code('1 + 1'), code)
       end),
     },
     group 'Link' {