muesli4 / table-layout

Layout data in grids and pretty tables. Provides a lot of tools to get the cell formatting right (positional alignment, alignment on specific characters and limiting of cell width)..
BSD 3-Clause "New" or "Revised" License
38 stars 11 forks source link

justify doesn't seem to work, but justifyText does #15

Closed hyperrealgopher closed 3 years ago

hyperrealgopher commented 3 years ago

Here's some example code (using justifyText) that works:

justify2 :: Text -> Text
justify2 text = Text.pack . unlines $ Justify.justifyText paragraphWidth (unlines wrappedLines)
 where
  paragraphWidth = 60
  wrapSettings = WrapSettings { preserveIndentation = False, breakLongWords = False }
  wrappedLines = map Text.unpack $ wrapTextToLines wrapSettings paragraphWidth text

Here's some example (using justify) code that seems to do nothing:

justify2 :: Text -> Text
justify2 text = Text.pack . unlines $ Justify.justify paragraphWidth wrappedLines
 where
  paragraphWidth = 60
  wrapSettings = WrapSettings { preserveIndentation = False, breakLongWords = False }
  wrappedLines = map Text.unpack $ wrapTextToLines wrapSettings paragraphWidth text
muesli4 commented 3 years ago

One thing is perfectly clear: The justification functionality is missing some serious test coverage. I apologize for the inconvenience. I try to get this fixed by tomorrow evening.