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 USE_PLATFORM_LINE_BREAKS option to YAMLGenerator.Feature #86

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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