joy32812 / snakeyaml

Automatically exported from code.google.com/p/snakeyaml
Apache License 2.0
0 stars 0 forks source link

Pretty Block - Add option to align colon and values of a mapping in DumperOptions #118

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
# Add option to align colon and values of a mapping in DumperOptions
# Using Java-1.6 and snakeyaml-1.6
# example
city    : Royal Oak
state   : MI
postal  : 48046
...

Original issue reported on code.google.com by firehoo...@gmail.com on 27 May 2011 at 5:55

GoogleCodeExporter commented 9 years ago
Sorry Using 1.8 also and should be enhancement.

Original comment by firehoo...@gmail.com on 27 May 2011 at 5:56

GoogleCodeExporter commented 9 years ago
Feel free to contribute a patch.

Original comment by py4fun@gmail.com on 29 May 2011 at 11:01

GoogleCodeExporter commented 9 years ago
You may have a look here http://code.google.com/p/snakeyaml/issues/detail?id=53 
for some basic directions.

Implement alignment as you suggested is not that easy. You have to go through 
all the properties to calculate the longest name. If you take into account that 
property names and values might be rather complex then the task becomes a 
challenge. You can simplify it a bit. Instead, you can define the 'recommended' 
length, which can be set in the DumperOptions. If the real length is bigger, 
the 'recommended' length is ignored.

Original comment by py4fun@gmail.com on 30 May 2011 at 2:08

GoogleCodeExporter commented 9 years ago
The Python YAML library gets the same proposal. The inspiration (and possible 
implementation) can be found there: http://pyyaml.org/ticket/214

Original comment by py4fun@gmail.com on 29 Nov 2011 at 10:04