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

Ignore final newline in folded YAML string #6054

Merged
merged 3 commits into from Jul 18, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/site_template/_config.yml
Expand Up @@ -15,7 +15,7 @@
# in the templates via {{ site.myvariable }}.
title: Your awesome title
email: your-email@example.com
description: > # this means to ignore newlines until "baseurl:"
description: >- # this means to ignore newlines until "baseurl:"
Write an awesome description for your new site here. You can edit this
line in _config.yml. It will appear in your document head meta (for
Google search results) and in your feed.xml site description.
Expand Down
8 changes: 8 additions & 0 deletions test/source/_config_folded.yml
@@ -0,0 +1,8 @@
folded_string: >
This string of text will ignore
newlines till the next key.
foo: bar
clean_folded_string: >-
This string of text will ignore
newlines till the next key.
baz: foo
16 changes: 16 additions & 0 deletions test/test_configuration.rb
Expand Up @@ -494,4 +494,20 @@ class TestConfiguration < JekyllUnitTest
})
end
end

context "folded YAML string" do
should "ignore newlines entirely" do
tester = Configuration.new
config_file = tester.read_config_file(source_dir("_config_folded.yml"))
config = Jekyll.configuration(config_file)
assert_equal(
config["folded_string"],
"This string of text will ignore newlines till the next key.\n"
)
assert_equal(
config["clean_folded_string"],
"This string of text will ignore newlines till the next key."
)
end
end
end