Allow customizing block sequence indentation

Issue #327 resolved
Former user created an issue

Hi,

right now snakeyaml emits block sequences with a hard-coded zero indentation before the list indicator, e.g.:

aaa:
  bbb:
  - x1
  - x2

I would like to be able to further customize the indentation and be able to specify a whitespace ammount before the list indicator, so that I have an output like this (or whatever whitespace I want before the list indicators):

aaa:
  bbb:
   - x1
   - x2

I've digged in Emitter.java and found that it indeed emits the list indicator right after emitting the parent block's indentation, my proposal is to allow a whitespace by pushing another intermediate indentation state:

592.                writeIndent();
593.                writeIndicator("-", true, false, true);

the fix should be minimal, I can help with it

thank you

Comments (6)

  1. Andrey Somov

    Feel free to submit a patch or pull request with tests. We would like to see the complete change (together with DumperOptions) If you are quick then it can be released this month.

  2. Former user Account Deleted

    hi @asomov , my initial checks give positive results. thanks for the cooperation!

  3. Log in to comment