-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
Extra new line added #221
Labels
Comments
Dupe? |
Probably, that's because of #125 workaround (the same exists in Ruby's parser). |
Both this and #222 actually caused by combination of two different bugs: one in the loader, and another in the dumper. Loader bug:
Dumper bug:
|
aepsilon
added a commit
to aepsilon/js-yaml
that referenced
this issue
Mar 31, 2016
Rewrote the scalar dumper with an emphasis on rigor, based on a careful reading of the YAML 1.2 spec and testing against LibYAML. Corrections: Block style chomping accounts for added the extra newline added by subsequent elements or at the end. Fixes nodeca#238. Top-level block scalars are indented. Fixes dumper side of nodeca#221. Folded style should be reliable now. The old dumper was not aware of the subtle rules for more-indented lines. More-indented lines no longer cause extra newlines to be added. (The old dumper also had an off-by-one error that dropped the last character from a long first word on a line.) Fixes nodeca#215, nodeca#222. Removes nodeca#217 workaround. Literal and folded styles can represent arbitrary "printable" strings, including leading/trailing whitespace. NB. For the 'construct-string-types' dumper test, the strings are dumped correctly. The test fails because a loader bug loses a newline when using the keep "+" chomping indicator. Additional: Added test suite covering several former bugs, new edge cases, and new expected behaviors. All previous applicable tests are included. Styles are chosen in a well-defined order. Plain and single are preferred for single lines under the width limit. Folded is preferred when a line is longer than the width limit (if enabled) and does not begin with a space. Literal is used for all other multi-line "printable" strings. Double-quoted is only used when a string is unrepresentable otherwise. Plain style is relaxed to include more characters and strings. Progress on nodeca#183. As indent increases, line width decreases down to min(lineWidth, 40). Setting lineWidth to -1 disables wrapping. Previously there was unexpected behavior past 40 indent: narrow lineWidth suddenly jumped to 40, and -1 (no limit) suddenly enforced a limit of 40.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test:
Output:
So extra new line added in the end of string.
The text was updated successfully, but these errors were encountered: