Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Permit YAML blocks to end with three dots #2110

Closed
wants to merge 48 commits into from

11 participants

Lincoln Mullen Parker Moore Matt Rogers Stephen McDonald Вячеслав Павлутин Matthew Scharley XhmikosR Patrick Cate John Piasetzki Ben Hildred Daniel Schauenberg
Lincoln Mullen

The YAML spec permits blocks to end with three dots (...) in addition to
three dashes (---): http://www.yaml.org/spec/1.2/spec.html#id2760395. Some
programs that work with Jekyll (e.g., Pandoc) prefer the dots to dashes. This
commit permits the YAML metadata block to end with either dots or dashes. It
includes tests.

Lincoln Mullen lmullen Permit YAML blocks to end with three dots
The YAML spec permits blocks to end with three dots (...) in addition to
three dashes (---): http://www.yaml.org/spec/1.2/spec.html#id2760395. Some
programs that work with Jekyll (e.g., Pandoc) prefer the dots to dashes. This
commit permits the YAML metadata block to end with either dots or dashes. It
includes tests.
54e360a
Parker Moore
Owner

I've given this some thought and I see no reason we should change because of Pandoc's preference. If I've learned anything in the last year, it's that giving users too many ways to do something causes confusion.

Also, the YAML spec gives me rage so I don't care much what they have to say considering omitting the last segment is also valid. :smile:

What's the use-case for this?

Lincoln Mullen

At least one of the reasons for using a plain-text blogging engine is to filter the posts through Unix-lie tools. It seems to me that if the spec says that multiple end of document delimiters are permitted, and if other tools in the same space are using those delimiters, then Jekyll ought to support the full spec (even if you don't like the spec). Pandoc documents now use a YAML header for metadata, just like Jekyll posts. The use case is for files that can be both Pandoc documents and Jekyll blog posts.

Yes, omitting the last segment is valid in a file that contains only YAML, but it wouldn't be valid in a file (like a Jekyll blog post or Pandoc document) that contains other information, so that part of the spec is beside the point.

Parker Moore
Owner

What do you think, @mattr-?

Matt Rogers mattr- was assigned by parkr
Parker Moore parkr added the Feature label
Parker Moore parkr closed this
Parker Moore parkr reopened this
Parker Moore
Owner

@lmullen I don't see any need to keep this from going through. If you wouldn't mind rebasing, I'll merge.

stephenmcd and others added some commits
Stephen McDonald stephenmcd Use valid css class names when pygments language contains invalid cha…
…rs, eg html+jango
21d3a54
Parker Moore parkr Properly clean path for Windows machines which is *nix-compliant. 206c091
Вячеслав Павлутин slavapavlutin Fix tables alignments in Cucumber features 746efee
Вячеслав Павлутин slavapavlutin Remove redundant whitespace in a Cucumber feature fd4074e
Parker Moore parkr Update history to reflect merge of #2108 [ci skip] ffc8ec8
Parker Moore parkr Extract core extensions into a Utils module
Fixes #2111
fcef9e5
Parker Moore parkr Add Utils.stringify_hash_keys e6a576b
Parker Moore parkr Rename those Utils functions. 9aeae07
Parker Moore parkr Use jekyll-sass-converter 1.0.0.rc3 46be471
Parker Moore parkr Update history to reflect merge of #2112 [ci skip] 0e600a2
Matthew Scharley mscharley Use the rake helper for mkdir as this version makes two folders on Wi…
…ndows
be6bdc4
Matt Rogers mattr- Update history to reflect merge of #2118 [ci skip] 041a42a
Matt Rogers mattr- Properly strip drive name from clean path when sanitizing path. f384b6b
XhmikosR XhmikosR Remove obsolete `normalize_options`. b212283
XhmikosR XhmikosR Trim trailing spaces and convert tabs to spaces. 2bdae4d
Parker Moore parkr Update history to reflect merge of #2121 [ci skip] 64e37ba
Parker Moore parkr Update history to reflect merge of #2109 [ci skip] dbdce22
Parker Moore parkr Update history to reflect merge of #2122 [ci skip] 4aafc12
XhmikosR XhmikosR Update normalize.css to v3.0.0. d1d76ee
XhmikosR XhmikosR Update modernizr to v2.7.1. 1a8f15c
XhmikosR XhmikosR Losslessly compress images.
Before: 89,5 KB (91.747 bytes)
After:  87,4 KB (89.573 bytes)
6f68521
Parker Moore parkr Update history to reflect merge of #2128 [ci skip] 65c4bba
Parker Moore parkr Update history to reflect merge of #2126 [ci skip] c1eef0f
Parker Moore parkr Initialize each command in its own class so we can be *magical*. 9b2cf67
Parker Moore parkr Have a list of blessed gems to require and load. 1c4c663
Parker Moore parkr Add a message and error out when Pygments returns nil. 758e739
Parker Moore parkr Update history to reflect merge of #2143 [ci skip] 1fd439b
Parker Moore parkr Update history to reflect merge of #2129 [ci skip] 206f1a5
Patrick Cate patrickcate Added Jekyll-Ordinal plugin to list of third-party plugins.
Closes #2150.

Signed-off-by: Parker Moore <parkrmoore@gmail.com>
1b79ced
Parker Moore parkr Update history to reflect merge of #2150 [ci skip] 2672a7b
Parker Moore parkr Update history to reflect merge of #994 [ci skip] d8e36b1
Stephen McDonald stephenmcd Protect against nil @lang before fixing for css class names. 51dcae1
Matt Rogers mattr- Update history to reflect merge of #2155 [ci skip] 455bd9d
Parker Moore parkr Lock to cucumber v1.3.11 because 1.3.12 is failing like crazy. 6571727
Parker Moore parkr Move test dir to inside tmp in this repo. 2a4d5c8
Parker Moore parkr Went with @stomar's suggestion 9a2d439
Lincoln Mullen lmullen Add jekyll_figure plugin e012cf1
Parker Moore parkr Update history to reflect merge of #2158 [ci skip] b58ce77
Parker Moore parkr Update history to reflect merge of #2148 [ci skip] 5d337e4
John Piasetzki jpiasetz Add travis_retry to config 62ad10e
Parker Moore parkr Update history to reflect merge of #2160 [ci skip] fa6d2d1
Ben Hildred hildred better document safe mode 328ca69
Matt Rogers mattr- Update history to reflect merge of #2163 [ci skip] 627dfa7
Daniel Schauenberg mrtazz add support for unpublished drafts
I keep all my ideas for blog posts as drafts in my draft folder. However I'm
only really working on a couple at once. This let's me mark drafts that I'm
not working on right now as unpublished so they don't clutter the site while
I'm checking on the other drafts.
e438781
Parker Moore parkr Update history to reflect merge of #2164 [ci skip] f7362fa
Lincoln Mullen lmullen Merge branch 'recognize-dots-in-yaml' of https://github.com/lmullen/j… 0ba0d4a
Lincoln Mullen lmullen Merge branch 'master' of github.com:jekyll/jekyll 2060cf4
Lincoln Mullen

I think I did the rebase correctly; if not, my apologies.

Parker Moore parkr closed this in 31443e9
Parker Moore
Owner

Merged in 52ac2b3! Thanks :)

Parker Moore parkr referenced this pull request from a commit
Parker Moore parkr Revert "Permit YAML blocks to end with three dots"
This reverts commit 52ac2b3, introduced in
v2.0.0 by @lmullen. It has been reverted because it adds complication to
the process of writing Jekyll sites ("Do I use dots or dashes here??") and
because the sole purpose was to bend to the will of pandoc, which could
just as easily prefer dashes to dots.

Ref: #2110, 3134
c88ca41
Parker Moore parkr referenced this pull request
Closed

Revert "Permit YAML blocks to end with three dots" #3138

1 of 2 tasks complete
Parker Moore parkr referenced this pull request from a commit
Parker Moore parkr Revert "Permit YAML blocks to end with three dots"
This reverts commit 52ac2b3, introduced in
v2.0.0 by @lmullen. It has been reverted because it adds complication to
the process of writing Jekyll sites ("Do I use dots or dashes here??") and
because the sole purpose was to bend to the will of pandoc, which could
just as easily prefer dashes to dots.

Ref: #2110, 3134
46d2794
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 3, 2014
  1. Lincoln Mullen

    Permit YAML blocks to end with three dots

    lmullen authored
    The YAML spec permits blocks to end with three dots (...) in addition to
    three dashes (---): http://www.yaml.org/spec/1.2/spec.html#id2760395. Some
    programs that work with Jekyll (e.g., Pandoc) prefer the dots to dashes. This
    commit permits the YAML metadata block to end with either dots or dashes. It
    includes tests.
Commits on Mar 24, 2014
  1. Stephen McDonald Lincoln Mullen

    Use valid css class names when pygments language contains invalid cha…

    stephenmcd authored lmullen committed
    …rs, eg html+jango
  2. Parker Moore Lincoln Mullen
  3. Вячеслав Павлутин Lincoln Mullen

    Fix tables alignments in Cucumber features

    slavapavlutin authored lmullen committed
  4. Вячеслав Павлутин Lincoln Mullen

    Remove redundant whitespace in a Cucumber feature

    slavapavlutin authored lmullen committed
  5. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2108 [ci skip]

    parkr authored lmullen committed
  6. Parker Moore Lincoln Mullen

    Extract core extensions into a Utils module

    parkr authored lmullen committed
    Fixes #2111
  7. Parker Moore Lincoln Mullen

    Add Utils.stringify_hash_keys

    parkr authored lmullen committed
  8. Parker Moore Lincoln Mullen

    Rename those Utils functions.

    parkr authored lmullen committed
  9. Parker Moore Lincoln Mullen

    Use jekyll-sass-converter 1.0.0.rc3

    parkr authored lmullen committed
  10. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2112 [ci skip]

    parkr authored lmullen committed
  11. Matthew Scharley Lincoln Mullen
  12. Matt Rogers Lincoln Mullen

    Update history to reflect merge of #2118 [ci skip]

    mattr- authored lmullen committed
  13. Matt Rogers Lincoln Mullen
  14. XhmikosR Lincoln Mullen

    Remove obsolete `normalize_options`.

    XhmikosR authored lmullen committed
  15. XhmikosR Lincoln Mullen

    Trim trailing spaces and convert tabs to spaces.

    XhmikosR authored lmullen committed
  16. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2121 [ci skip]

    parkr authored lmullen committed
  17. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2109 [ci skip]

    parkr authored lmullen committed
  18. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2122 [ci skip]

    parkr authored lmullen committed
  19. XhmikosR Lincoln Mullen

    Update normalize.css to v3.0.0.

    XhmikosR authored lmullen committed
  20. XhmikosR Lincoln Mullen

    Update modernizr to v2.7.1.

    XhmikosR authored lmullen committed
  21. XhmikosR Lincoln Mullen

    Losslessly compress images.

    XhmikosR authored lmullen committed
    Before: 89,5 KB (91.747 bytes)
    After:  87,4 KB (89.573 bytes)
  22. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2128 [ci skip]

    parkr authored lmullen committed
  23. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2126 [ci skip]

    parkr authored lmullen committed
  24. Parker Moore Lincoln Mullen
  25. Parker Moore Lincoln Mullen

    Have a list of blessed gems to require and load.

    parkr authored lmullen committed
  26. Parker Moore Lincoln Mullen

    Add a message and error out when Pygments returns nil.

    parkr authored lmullen committed
  27. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2143 [ci skip]

    parkr authored lmullen committed
  28. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2129 [ci skip]

    parkr authored lmullen committed
  29. Patrick Cate Lincoln Mullen

    Added Jekyll-Ordinal plugin to list of third-party plugins.

    patrickcate authored lmullen committed
    Closes #2150.
    
    Signed-off-by: Parker Moore <parkrmoore@gmail.com>
  30. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2150 [ci skip]

    parkr authored lmullen committed
  31. Parker Moore Lincoln Mullen

    Update history to reflect merge of #994 [ci skip]

    parkr authored lmullen committed
  32. Stephen McDonald Lincoln Mullen

    Protect against nil @lang before fixing for css class names.

    stephenmcd authored lmullen committed
  33. Matt Rogers Lincoln Mullen

    Update history to reflect merge of #2155 [ci skip]

    mattr- authored lmullen committed
  34. Parker Moore Lincoln Mullen
  35. Parker Moore Lincoln Mullen

    Move test dir to inside tmp in this repo.

    parkr authored lmullen committed
  36. Parker Moore Lincoln Mullen

    Went with @stomar's suggestion

    parkr authored lmullen committed
  37. Lincoln Mullen

    Add jekyll_figure plugin

    lmullen authored
  38. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2158 [ci skip]

    parkr authored lmullen committed
  39. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2148 [ci skip]

    parkr authored lmullen committed
  40. John Piasetzki Lincoln Mullen

    Add travis_retry to config

    jpiasetz authored lmullen committed
  41. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2160 [ci skip]

    parkr authored lmullen committed
  42. Ben Hildred Lincoln Mullen

    better document safe mode

    hildred authored lmullen committed
  43. Matt Rogers Lincoln Mullen

    Update history to reflect merge of #2163 [ci skip]

    mattr- authored lmullen committed
  44. Daniel Schauenberg Lincoln Mullen

    add support for unpublished drafts

    mrtazz authored lmullen committed
    I keep all my ideas for blog posts as drafts in my draft folder. However I'm
    only really working on a couple at once. This let's me mark drafts that I'm
    not working on right now as unpublished so they don't clutter the site while
    I'm checking on the other drafts.
  45. Parker Moore Lincoln Mullen

    Update history to reflect merge of #2164 [ci skip]

    parkr authored lmullen committed
  46. Lincoln Mullen
  47. Lincoln Mullen
This page is out of date. Refresh to see the latest.
2  lib/jekyll/convertible.rb
View
@@ -43,7 +43,7 @@ def read_yaml(base, name, opts = {})
begin
self.content = File.read(File.join(base, name),
merged_file_read_opts(opts))
- if content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
+ if content =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
self.content = $POSTMATCH
self.data = SafeYAML.load($1)
end
5 test/source/_posts/2014-03-03-yaml-with-dots.md
View
@@ -0,0 +1,5 @@
+---
+title: Test Post Where YAML Ends in Dots
+...
+
+# Test
2  test/test_generated_site.rb
View
@@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
end
should "ensure post count is as expected" do
- assert_equal 39, @site.posts.size
+ assert_equal 40, @site.posts.size
end
should "insert site.posts into the index" do
12 test/test_post.rb
View
@@ -127,6 +127,18 @@ def do_render(post)
end
end
+ context "with three dots ending YAML header" do
+ setup do
+ @real_file = "2014-03-03-yaml-with-dots.md"
+ end
+ should "should read the YAML header" do
+ @post.read_yaml(@source, @real_file)
+
+ assert_equal({"title" => "Test Post Where YAML Ends in Dots"},
+ @post.data)
+ end
+ end
+
context "with embedded triple dash" do
setup do
@real_file = "2010-01-08-triple-dash.markdown"
Something went wrong with that request. Please try again.