5858import Data.Text (Text )
5959import Foreign.Lua (Lua , NumResults (.. ), Optional ,
6060 Peekable , Pushable , StackIndex )
61- import Text.DocLayout (Doc , (<+>) , ($$) )
61+ import Text.DocLayout (Doc , (<+>) , ($$) , ($+$) )
6262
6363import qualified Data.Text as T
6464import qualified Foreign.Lua as Lua
@@ -253,6 +253,7 @@ pushDoc = Lua.pushAnyWithMetatable pushDocMT
253253 Lua. addfunction " __concat" __concat
254254 Lua. addfunction " __div" __div
255255 Lua. addfunction " __eq" __eq
256+ Lua. addfunction " __idiv" __idiv
256257 Lua. addfunction " __tostring" __tostring
257258
258259instance Pushable (Doc Text ) where
@@ -274,6 +275,10 @@ __div a b = return (a $$ b)
274275__eq :: Doc Text -> Doc Text -> Lua Bool
275276__eq a b = return (a == b)
276277
278+ -- | @a // b@ puts @a@ above @b@.
279+ __idiv :: Doc Text -> Doc Text -> Lua (Doc Text )
280+ __idiv a b = return (a $+$ b)
281+
277282-- | Convert to string by rendering without reflowing.
278283__tostring :: Doc Text -> Lua Text
279284__tostring d = return $ Doc. render Nothing d
0 commit comments