updated convertible to allow for posts with no, or empty YAML
This commit is contained in:
parent
b616a4ceca
commit
ca98cd0152
|
@ -23,6 +23,8 @@ module Jekyll
|
||||||
|
|
||||||
self.data = YAML.load($1)
|
self.data = YAML.load($1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.data ||= {}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Transform the contents based on the file extension.
|
# Transform the contents based on the file extension.
|
||||||
|
|
|
@ -20,8 +20,6 @@ module Jekyll
|
||||||
@dir = dir
|
@dir = dir
|
||||||
@name = name
|
@name = name
|
||||||
|
|
||||||
self.data = {}
|
|
||||||
|
|
||||||
self.process(name)
|
self.process(name)
|
||||||
self.read_yaml(File.join(base, dir), name)
|
self.read_yaml(File.join(base, dir), name)
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
---
|
||||||
|
Empty YAML.
|
|
@ -0,0 +1 @@
|
||||||
|
No YAML.
|
|
@ -236,6 +236,16 @@ class TestPost < Test::Unit::TestCase
|
||||||
assert post.tags.include?('pizza')
|
assert post.tags.include?('pizza')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "allow no yaml" do
|
||||||
|
post = setup_post("2009-06-22-no-yaml.textile")
|
||||||
|
assert_equal "No YAML.", post.content
|
||||||
|
end
|
||||||
|
|
||||||
|
should "allow empty yaml" do
|
||||||
|
post = setup_post("2009-06-22-empty-yaml.textile")
|
||||||
|
assert_equal "Empty YAML.", post.content
|
||||||
|
end
|
||||||
|
|
||||||
context "rendering" do
|
context "rendering" do
|
||||||
setup do
|
setup do
|
||||||
clear_dest
|
clear_dest
|
||||||
|
|
Loading…
Reference in New Issue