packages feed

hslua-module-doclayout 1.0.0 → 1.0.1

raw patch · 2 files changed

+36/−43 lines, 2 filesdep ~hsluaPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hslua

API changes (from Hackage documentation)

Files

hslua-module-doclayout.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.0 name:                hslua-module-doclayout-version:             1.0.0+version:             1.0.1 synopsis:            Lua module wrapping Text.DocLayout. description:         Lua module wrapping @Text.DocLayout@. homepage:            https://github.com/hslua/hslua-module-doclayout@@ -30,7 +30,7 @@ library   build-depends:       base           >= 4.9 && < 5                      , doclayout      >= 0.2 && < 0.4-                     , hslua          >= 2.0 && < 2.1+                     , hslua          >= 2.1 && < 2.2                      , text           >= 1.0 && < 1.3   default-language:    Haskell2010   hs-source-dirs:      src
src/HsLua/Module/DocLayout.hs view
@@ -72,7 +72,7 @@ import Prelude hiding (concat) import Data.List (intersperse) import Data.Text (Text)-import HsLua as Lua hiding (concat, render)+import HsLua as Lua hiding (concat) import Text.DocLayout (Doc, (<+>), ($$), ($+$))  import qualified Data.Text as T@@ -198,14 +198,30 @@         ### liftPure2 (==)         <#> docParam "a"         <#> docParam "b"-        =#> booleanResult "whether the two Docs are equal"+        =#> boolResult "whether the two Docs are equal"       , operation Idiv   $ binaryOp ($+$) "Puts a above b"       , operation Tostring $ lambda         ### liftPure (Doc.render Nothing)         <#> docParam "doc"         =#> textResult "Rendered Doc without reflowing."       ]-      []+      [ method before_non_blank+      , method braces+      , method brackets+      , method chomp+      , method double_quotes+      , method is_empty+      , method flush+      , method height+      , method min_offset+      , method nestle+      , method nowrap+      , method offset+      , method parens+      , method quotes+      , method update_column+      , method vfill+      ]   where     binaryOp op descr = lambda       ### liftPure2 op@@ -220,7 +236,7 @@ render = defun "render"   ### liftPure2 (flip Doc.render)   <#> docParam "doc"-  <#> optionalParameter (peekIntegral @Int) "integer" "colwidth" ""+  <#> opt (integralParam "colwidth" "")   =#> functionResult pushText "Doc" "rendered doc"   #? ("Render a @'Doc'@. The text is reflowed on breakable spaces" <>       "to match the given line length. Text is not reflowed if the" <>@@ -235,7 +251,7 @@ is_empty = defun "is_empty"   ### liftPure Doc.isEmpty   <#> docParam "doc"-  =#> booleanResult "`true` iff `doc` is the empty document, `false` otherwise."+  =#> boolResult "`true` iff `doc` is the empty document, `false` otherwise."   #? "Checks whether a doc is empty."  -- | Returns the width of a @'Doc'@.@@ -243,7 +259,7 @@ offset = defun "offset"   ### liftPure Doc.offset   <#> docParam "doc"-  =#> intResult "doc width"+  =#> integralResult "doc width"   #? "Returns the width of a `Doc` as number of characters."  -- | Returns the minimal width of a @'Doc'@ when reflowed at@@ -252,7 +268,7 @@ min_offset = defun "min_offset"   ### liftPure Doc.minOffset   <#> docParam "doc"-  =#> intResult "minimal possible width"+  =#> integralResult "minimal possible width"   #? ("Returns the minimal width of a `Doc` when reflowed at " <>       "breakable spaces.") @@ -262,8 +278,8 @@ update_column = defun "update_column"   ### liftPure2 Doc.updateColumn   <#> docParam "doc"-  <#> intParam "i"-  =#> intResult "column number"+  <#> integralParam "i" ""+  =#> integralResult "column number"   #? ("Returns the column that would be occupied by the last " <>       "laid out character.") @@ -272,7 +288,7 @@ height = defun "height"   ### liftPure Doc.height   <#> docParam "doc"-  =#> intResult "doc height"+  =#> integralResult "doc height"   #? "Returns the height of a block or other Doc."  @@ -282,8 +298,8 @@ real_length :: DocumentedFunction e real_length = defun "real_length"   ### liftPure Doc.realLength-  <#> textParam "str"-  =#> intResult "text length"+  <#> textParam "str" ""+  =#> integralResult "text length"   #? ("Returns the real length of a string in a monospace font: " <>       "0 for a combining chaeracter, 1 for a regular character, " <>       "2 for an East Asian wide character.")@@ -297,7 +313,7 @@ after_break :: LuaError e => DocumentedFunction e after_break = defun "after_break"   ### liftPure Doc.afterBreak-  <#> textParam "text"+  <#> textParam "text" ""   =#> docResult "new doc"   #? ("Creates a `Doc` which is conditionally included only if it" <>       "comes at the beginning of a line.")@@ -316,7 +332,7 @@ blanklines :: LuaError e => DocumentedFunction e blanklines = defun "blanklines"   ### liftPure Doc.blanklines-  <#> intParam "n"+  <#> integralParam "n" ""   =#> docResult "conditional blank lines"   #? "Inserts blank lines unless they exist already." @@ -361,7 +377,7 @@   ### liftPure2 (\docs optSep -> mconcat $                   maybe docs (`intersperse` docs) optSep)   <#> parameter (peekList peekDoc) "`{Doc,...}`" "docs" "list of Docs"-  <#> optionalParameter peekDoc "Doc" "sep" "separator"+  <#> opt (parameter peekDoc "Doc" "sep" "separator")   =#> docResult "concatenated doc"   #? "Concatenates a list of `Doc`s." @@ -417,7 +433,7 @@ literal :: LuaError e => DocumentedFunction e literal = defun "literal"   ### liftPure Doc.literal-  <#> textParam "string"+  <#> textParam "string" ""   =#> docResult "doc contatining just the literal string"   #? "Creates a `Doc` from a string." @@ -493,7 +509,7 @@ vfill :: LuaError e => DocumentedFunction e vfill = defun "vfill"   ### liftPure Doc.vfill-  <#> textParam "border"+  <#> textParam "border" ""   =#> docResult "automatically expanding border Doc"   #? ("An expandable border that, when placed next to a box, " <>       "expands to the height of the box.  Strings cycle through the " <>@@ -519,7 +535,7 @@ pushDoc = pushUD typeDoc  instance Peekable (Doc Text) where-  peek = forcePeek . peekDoc+  safepeek = peekDoc  instance Pushable (Doc Text) where   push = pushDoc@@ -532,35 +548,12 @@ docParam :: LuaError e => Text -> Parameter e (Doc Text) docParam name = parameter peekDoc "Doc" name "" --- | @Int@ typed function parameter.-intParam :: Text -> Parameter e Int-intParam name = parameter (peekIntegral @Int) "integer "name ""---- | @Text@ typed function parameter.-textParam :: Text -> Parameter e Text-textParam name = parameter peekText "string" name ""- -- -- Results -- --- | Boolean function result.-booleanResult :: Text -- ^ Description-              -> FunctionResults e Bool-booleanResult = functionResult pushBool "boolean"- -- | Function result of type @'Doc'@. docResult :: LuaError e           => Text -- ^ Description           -> FunctionResults e (Doc Text) docResult = functionResult pushDoc "Doc"---- | Function result of type @'Int'@.-intResult :: Text -- ^ Description-          -> FunctionResults e Int-intResult = functionResult (pushIntegral @Int) "integer"---- | Function result of type @'Text'@.-textResult :: Text -- ^ Description-           -> FunctionResults e Text-textResult = functionResult pushText "text"