Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'PrintOptions' for 'tomlToText' function #11

Closed
chshersh opened this issue Mar 29, 2018 · 3 comments
Closed

Add 'PrintOptions' for 'tomlToText' function #11

chshersh opened this issue Mar 29, 2018 · 3 comments

Comments

@chshersh
Copy link
Member

@chshersh chshersh commented Mar 29, 2018

No description provided.

@chshersh chshersh added the ast label Mar 29, 2018
@vrom911 vrom911 added this to To do in #2: Hacktoberfest (October, 2018) via automation Sep 30, 2018
@astynax

This comment has been minimized.

Copy link
Contributor

@astynax astynax commented Oct 2, 2018

Hi! I think I can handle this. But I need more info about the task.

@chshersh

This comment has been minimized.

Copy link
Member Author

@chshersh chshersh commented Oct 2, 2018

@astynax I highly appreciate your help on this issue!

This issue is about modifying these function:

prettyToml :: TOML -> Text
prettyToml = Text.drop 1 . prettyTomlInd 0 ""

So there should be two functions:

  1. prettyOptions that takes PrintOptions
  2. pretty: renamed version of prettyToml that calls prettyOptions with some defaultOptions

For now I can imagine the following two things that can be configurable (fields of PrintOptions):

  1. shouldSort :: Bool: specifes where keys should be sorted or not (default set to True)
  2. indent :: Int: indentation for nested tables (default set to 2). Use in this function:
    tab :: Int -> Text
    tab n = Text.cons '\n' (Text.replicate (2*n) " ")

If you have any other ideas regarding what we can configure in printing, please, feel free to suggest!

@astynax

This comment has been minimized.

Copy link
Contributor

@astynax astynax commented Oct 2, 2018

Ok 👌

@chshersh chshersh closed this in #100 Oct 4, 2018
#2: Hacktoberfest (October, 2018) automation moved this from To do to Done: Issues Oct 4, 2018
SanchayanMaity pushed a commit to SanchayanMaity/tomland that referenced this issue Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
3 participants
You can’t perform that action at this time.