Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Permit YAML blocks to end with three dots #2110

Closed
wants to merge 48 commits into from
@lmullen

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.

@lmullen 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
@parkr
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?

@lmullen

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.

@parkr
Owner

What do you think, @mattr-?

@mattr- mattr- was assigned by parkr
@parkr parkr added the Feature label
@parkr parkr closed this
@parkr parkr reopened this
@parkr
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
@stephenmcd stephenmcd Use valid css class names when pygments language contains invalid cha…
…rs, eg html+jango
21d3a54
@parkr parkr Properly clean path for Windows machines which is *nix-compliant. 206c091
@slavapavlutin slavapavlutin Fix tables alignments in Cucumber features 746efee
@slavapavlutin slavapavlutin Remove redundant whitespace in a Cucumber feature fd4074e
@parkr parkr Update history to reflect merge of #2108 [ci skip] ffc8ec8
@parkr parkr Extract core extensions into a Utils module
Fixes #2111
fcef9e5
@parkr parkr Add Utils.stringify_hash_keys e6a576b
@parkr parkr Rename those Utils functions. 9aeae07
@parkr parkr Use jekyll-sass-converter 1.0.0.rc3 46be471
@parkr parkr Update history to reflect merge of #2112 [ci skip] 0e600a2
@mscharley mscharley Use the rake helper for mkdir as this version makes two folders on Wi…
…ndows
be6bdc4
@mattr- mattr- Update history to reflect merge of #2118 [ci skip] 041a42a
@mattr- 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
@parkr parkr Update history to reflect merge of #2121 [ci skip] 64e37ba
@parkr parkr Update history to reflect merge of #2109 [ci skip] dbdce22
@parkr 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
@parkr parkr Update history to reflect merge of #2128 [ci skip] 65c4bba
@parkr parkr Update history to reflect merge of #2126 [ci skip] c1eef0f
@parkr parkr Initialize each command in its own class so we can be *magical*. 9b2cf67
@parkr parkr Have a list of blessed gems to require and load. 1c4c663
@parkr parkr Add a message and error out when Pygments returns nil. 758e739
@parkr parkr Update history to reflect merge of #2143 [ci skip] 1fd439b
@parkr parkr Update history to reflect merge of #2129 [ci skip] 206f1a5
@patrickcate patrickcate Added Jekyll-Ordinal plugin to list of third-party plugins.
Closes #2150.

Signed-off-by: Parker Moore <parkrmoore@gmail.com>
1b79ced
@parkr parkr Update history to reflect merge of #2150 [ci skip] 2672a7b
@parkr parkr Update history to reflect merge of #994 [ci skip] d8e36b1
@stephenmcd stephenmcd Protect against nil @lang before fixing for css class names. 51dcae1
@mattr- mattr- Update history to reflect merge of #2155 [ci skip] 455bd9d
@parkr parkr Lock to cucumber v1.3.11 because 1.3.12 is failing like crazy. 6571727
@parkr parkr Move test dir to inside tmp in this repo. 2a4d5c8
@parkr parkr Went with @stomar's suggestion 9a2d439
@lmullen lmullen Add jekyll_figure plugin e012cf1
@parkr parkr Update history to reflect merge of #2158 [ci skip] b58ce77
@parkr parkr Update history to reflect merge of #2148 [ci skip] 5d337e4
@jpiasetz jpiasetz Add travis_retry to config 62ad10e
@parkr parkr Update history to reflect merge of #2160 [ci skip] fa6d2d1
@hildred hildred better document safe mode 328ca69
@mattr- mattr- Update history to reflect merge of #2163 [ci skip] 627dfa7
@mrtazz 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
@parkr parkr Update history to reflect merge of #2164 [ci skip] f7362fa
@lmullen lmullen Merge branch 'recognize-dots-in-yaml' of https://github.com/lmullen/j… 0ba0d4a
@lmullen lmullen Merge branch 'master' of github.com:jekyll/jekyll 2060cf4
@lmullen

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

@parkr parkr closed this in 31443e9
@parkr
Owner

Merged in 52ac2b3! Thanks :)

@parkr parkr referenced this pull request from a commit
@parkr 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
@parkr parkr referenced this pull request
Closed

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

1 of 2 tasks complete
@parkr parkr referenced this pull request from a commit
@parkr 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. @lmullen

    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. @stephenmcd @lmullen

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

    stephenmcd authored lmullen committed
    …rs, eg html+jango
  2. @parkr @lmullen
  3. @slavapavlutin @lmullen

    Fix tables alignments in Cucumber features

    slavapavlutin authored lmullen committed
  4. @slavapavlutin @lmullen

    Remove redundant whitespace in a Cucumber feature

    slavapavlutin authored lmullen committed
  5. @parkr @lmullen

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

    parkr authored lmullen committed
  6. @parkr @lmullen

    Extract core extensions into a Utils module

    parkr authored lmullen committed
    Fixes #2111
  7. @parkr @lmullen

    Add Utils.stringify_hash_keys

    parkr authored lmullen committed
  8. @parkr @lmullen

    Rename those Utils functions.

    parkr authored lmullen committed
  9. @parkr @lmullen

    Use jekyll-sass-converter 1.0.0.rc3

    parkr authored lmullen committed
  10. @parkr @lmullen

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

    parkr authored lmullen committed
  11. @mscharley @lmullen
  12. @mattr- @lmullen

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

    mattr- authored lmullen committed
  13. @mattr- @lmullen
  14. @XhmikosR @lmullen

    Remove obsolete `normalize_options`.

    XhmikosR authored lmullen committed
  15. @XhmikosR @lmullen

    Trim trailing spaces and convert tabs to spaces.

    XhmikosR authored lmullen committed
  16. @parkr @lmullen

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

    parkr authored lmullen committed
  17. @parkr @lmullen

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

    parkr authored lmullen committed
  18. @parkr @lmullen

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

    parkr authored lmullen committed
  19. @XhmikosR @lmullen

    Update normalize.css to v3.0.0.

    XhmikosR authored lmullen committed
  20. @XhmikosR @lmullen

    Update modernizr to v2.7.1.

    XhmikosR authored lmullen committed
  21. @XhmikosR @lmullen

    Losslessly compress images.

    XhmikosR authored lmullen committed
    Before: 89,5 KB (91.747 bytes)
    After:  87,4 KB (89.573 bytes)
  22. @parkr @lmullen

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

    parkr authored lmullen committed
  23. @parkr @lmullen

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

    parkr authored lmullen committed
  24. @parkr @lmullen
  25. @parkr @lmullen

    Have a list of blessed gems to require and load.

    parkr authored lmullen committed
  26. @parkr @lmullen

    Add a message and error out when Pygments returns nil.

    parkr authored lmullen committed
  27. @parkr @lmullen

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

    parkr authored lmullen committed
  28. @parkr @lmullen

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

    parkr authored lmullen committed
  29. @patrickcate @lmullen

    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. @parkr @lmullen

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

    parkr authored lmullen committed
  31. @parkr @lmullen

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

    parkr authored lmullen committed
  32. @stephenmcd @lmullen

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

    stephenmcd authored lmullen committed
  33. @mattr- @lmullen

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

    mattr- authored lmullen committed
  34. @parkr @lmullen
  35. @parkr @lmullen

    Move test dir to inside tmp in this repo.

    parkr authored lmullen committed
  36. @parkr @lmullen

    Went with @stomar's suggestion

    parkr authored lmullen committed
  37. @lmullen

    Add jekyll_figure plugin

    lmullen authored
  38. @parkr @lmullen

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

    parkr authored lmullen committed
  39. @parkr @lmullen

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

    parkr authored lmullen committed
  40. @jpiasetz @lmullen

    Add travis_retry to config

    jpiasetz authored lmullen committed
  41. @parkr @lmullen

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

    parkr authored lmullen committed
  42. @hildred @lmullen

    better document safe mode

    hildred authored lmullen committed
  43. @mattr- @lmullen

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

    mattr- authored lmullen committed
  44. @mrtazz @lmullen

    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. @parkr @lmullen

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

    parkr authored lmullen committed
  46. @lmullen
  47. @lmullen
This page is out of date. Refresh to see the latest.
View
2  lib/jekyll/convertible.rb
@@ -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
View
5 test/source/_posts/2014-03-03-yaml-with-dots.md
@@ -0,0 +1,5 @@
+---
+title: Test Post Where YAML Ends in Dots
+...
+
+# Test
View
2  test/test_generated_site.rb
@@ -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
View
12 test/test_post.rb
@@ -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.