Skip to content

Commit

Permalink
Merge pull request #86 from copperleaftech/use-platform-line-breaks
Browse files Browse the repository at this point in the history
Add USE_PLATFORM_LINE_BREAKS option to YAMLGenerator.Feature
  • Loading branch information
cowtowncoder authored May 14, 2018
2 parents 48d14af + d1a8755 commit 1a78a3d
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ public enum Feature implements FormatFeature
*/
LITERAL_BLOCK_STYLE(false),

/**
* Option passed to SnakeYAML that determines if the line breaks used for
* serialization should be same as what the default is for current platform.
* <p>
* Default value is `false` for backwards compatibility
*/
USE_PLATFORM_LINE_BREAKS(false),

/**
* Feature enabling of which adds indentation for array entry generation
* (default indentation being 2 spaces).
Expand Down Expand Up @@ -251,6 +259,9 @@ protected DumperOptions buildDumperOptions(int jsonFeatures, int yamlFeatures,
opt.setIndicatorIndent(1);
opt.setIndent(2);
}
if (Feature.USE_PLATFORM_LINE_BREAKS.enabledIn(_formatFeatures)) {
opt.setLineBreak(DumperOptions.LineBreak.getPlatformLineBreak());
}
return opt;
}

Expand Down

0 comments on commit 1a78a3d

Please sign in to comment.