-
Notifications
You must be signed in to change notification settings - Fork 80
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
Ensure colons do not break titles #39
Conversation
When titles have colons in them, it breaks the liquid template. This encapsulates the titles in string literals if the user wants a title with a colon in it. Closes jekyll#38
a1a9d3d
to
b3e656c
Compare
@@ -13,8 +13,18 @@ def content | |||
<<-CONTENT.gsub /^\s+/, '' | |||
--- | |||
layout: #{params.layout} | |||
title: #{params.title} | |||
title: #{yaml_clean_title} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we could do this instead?
YAML.dump({
"layout" => params.layout,
"title" => params.title
})
That will create YAML and escape everything properly. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a far more elegant solution! thanks for the tip.
@parkr it looks like using Thanks again for taking time with my PR. |
Apparently in ruby 1.9, the string is interpreted as a non-specific tag. |
@parkr since the non-specific tag is still valid YAML, I just updated the spec to only ensure that the title is wrapped in quotes, not check that the syntax is exactly the same. |
Let's remove support for v1.9. We don't support it in Jekyll and it's EOL'd so I'm fine with this. Would you ensure you get the correct title in the YAML and that it parses properly? Thanks! |
This reverts commit 553dbbb.
@parkr I reverted the tests so they test for the exact string. This breaks tests on >1.9, but is better coverage. I think this is ready to 🚢 ! |
@jekyllbot: merge |
When titles have colons in them, it breaks the liquid template.
This encapsulates the titles in string literals if the user
wants a title with a colon in it.
Closes #38