Giter Site home page Giter Site logo

boxes's People

Contributors

asr avatar bitonic avatar byorgey avatar eelis avatar hdgarrood avatar ivan-m avatar kindaro avatar phadej avatar treeowl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

boxes's Issues

Add Examples to the docs

Hi,

I think the package documentation (as shown on hackage) and the haddock of the module could use some example of what kind of output your tool produces.

Greetings,
Joachim

support for escape codes

I like to format text containing ANSI escape sequences for adding color to texts.
Built-in support for ANSI sequences might be too complex and too unflexible.
Maybe we can implement it using zero-width boxes that contain escape sequences that have zero width on the screen. However, it could be difficult to align escape sequences to the corresponding text.
Alternatively, maybe Box can be generalized to element types other than Char. We could then decorate Char values and convert to ANSI sequences after layout by boxes.

Add library to Stackage

Currently, boxes is not included in any Stackage snapshots:
https://www.stackage.org/package/boxes
This means (among other things) that packages which depend upon boxes can't be built with the new stack build tool:
https://github.com/commercialhaskell/stack

Including a package in Stackage is up to the package owner:
https://github.com/fpco/stackage/#get-your-package-included
The suggested approach seems to be to get the package building with Travis (to make sure it builds with latest dependencies, etc.), and then submit a PR against stackage.

It would be great it boxes can be added to Stackage.

Explore possibility of multi-directional support

Support by various terminals, etc., is likely limited, but it's worth looking into. There are languages that run right to left; on their own, these should pose no challenge (right and left just swap), but mixing them with left to right will be somewhat challenging. There are also languages that are written primarily from top to bottom, then from left to right or right to left. These would likely be much harder to mix with LTR/RTL in this form, but it may not be entirely necessary, as these languages sometimes/often can be written LTR or RTL.

Add relevant pieces of Agda to the build matrix

Agda is by far the most important package depending on this one; I want to be aware of any breakage in Agda builds induced by future changes here. I don't know how to set that up, and I don't know if it's possible to do it cheaply enough, but it would be very nice.

Draw a frame around a box.

The title says it all. Nevertheless, an example:

λ printBox $ frame "^_^"
+---+
|^_^|
+---+

Of course, we may use fancier ASCII line art too.

I also propose that there is a similar function for a double frame.

Eventually we could render tables like this.

Upload new version to hackage

The hackage version of this package currently doesn't include the update to split 0.2.*. Could you please upload a new version with the dependency update included?

Add .travis.yml

We need to set up a .travis.yml file to get Travis to test things automatically.

Text version of boxes

Hello,

Thanks for sharing boxes.

Just want to check if @rustydc boxes code can be packaged as a text-boxes or such package?

Thanks

Alternative formatting without trailing spaces

I have vertically stacked text boxes of differing widths. When rendered they are all right padded with white spaces. A single box of large width causes lots of padded small boxes. The padding allows additional line breaks in a terminal if it is too narrow. Although this behavior is correct it can be annoying.
How about an alternative rendering function that emits only the spaces that are necessary for formatting? Maybe it should even be a rendering function that allows formatting options that can be extended in the future.

cannot print table with wrapped text inside of cells

using modified function from #5

but para left 50 instead of text

formatTable :: [Alignment] -> Int -> [[String]] -> Box
formatTable als sep cols = punctuateH top sep' $ map (uncurry singleCol) colal
  where als' = cycle als
        cols' = transpose cols
        colal = zip als' cols'
        sep' = emptyBox 0 sep

singleCol :: Alignment -> [String] -> Box
singleCol al = vcat al . map (para left 50 {- note this -})
main = do
  putStrLn $ render $ formatTable [ left, left ] 2
    [ [ "HELLO", "1111111111 11111111 1111111 1111111111 11111111 1111111 1111111111 11111111 1111111", "222222222 22222222 2222222222 222222222 22222222 2222222222" ]
    , [ "HELLO", "333333333 33333333 3333333333 333333333 33333333 3333333333", "444444444 44444444 4444444444 444444444 44444444 4444444444" ]
    , [ "HELLO", "555555555 55555555 5555555555 555555555 55555555 5555555555", "666666666 66666666 6666666666 666666666 66666666 6666666666" ]
    ]

outputs

HELLO  1111111111 11111111 1111111 1111111111 11111111   222222222 22222222 2222222222 222222222 22222222
HELLO  1111111 1111111111 11111111 1111111               2222222222
HELLO  333333333 33333333 3333333333 333333333 33333333  444444444 44444444 4444444444 444444444 44444444
       3333333333                                        4444444444
       555555555 55555555 5555555555 555555555 55555555  666666666 66666666 6666666666 666666666 66666666
       5555555555                                        6666666666

but expected

HELLO  1111111111 11111111 1111111 1111111111 11111111   222222222 22222222 2222222222 222222222 22222222
       1111111 1111111111 11111111 1111111               2222222222
HELLO  333333333 33333333 3333333333 333333333 33333333  444444444 44444444 4444444444 444444444 44444444
       3333333333                                        4444444444
HELLO  555555555 55555555 5555555555 555555555 55555555  666666666 66666666 6666666666 666666666 66666666
       5555555555                                        6666666666

Hackage information

Please replace

git clone git://github.com/treeowl/boxes.git

by

git clone https://github.com/treeowl/boxes.git

in boxes.cabal.

Consider other output formats

#1 suggests a Text interface, but we might also want to look into things like nroff, LaTeX, PostScript, and (though this may be trying to fit a square peg in a round hole) HTML/CSS.

Most QuickCheck properties blow up

I had to disable all but one of the QuickCheck properties to avoid using more thyme than I had available and far too many rams. I suspect the Arbitrary instances aren't quite right, but I'm not sure.

Build error with GHC 8.4.1-alpha1

GHC 8.4.1-alpha1 was announced. While testing Agda with this version of GHC, I got the following error on boxes (master branch):

$ cabal install
...
Text/PrettyPrint/Boxes.hs:33:7: error:
    Ambiguous occurrence ‘<>’
    It could refer to either ‘Prelude.<>’,
                             imported from ‘Prelude’ at Text/PrettyPrint/Boxes.hs:82:1-28
                             (and originally defined in ‘GHC.Base’)
                          or ‘Text.PrettyPrint.Boxes.<>’,
                             defined at Text/PrettyPrint/Boxes.hs:183:3
   |
33 |     , (<>)
   |       ^^^^
Failed to install boxes-0.1.4

Blocking agda/agda#2878.

`text` should account for newlines.

See for yourself:

λ rows "x\ny"
1

Expected behaviour:

I think there should be as many rows in the text box as there are lines in the text, and as many columns as there are characters in the longest of lines.

Actual behaviour:

text simply measures the length of the string for the column count, and there is always just one row.

Add instance Semigroup, or even Monoid?

<> in Boxes shadows the usual semigroup operation, while functioning in a compatible way. (I am ignoring the internal hierarchical representation for now. Be it necessary, we can perform simplification when concatenating.) There is also nullBox that we can make neutral element.

Surely this will simplify the usage of this package in the modern ecosystem.

I can take a shot at making the necessary adjustments.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.