Permalink
Browse files

Merge remote branch 'MattHall/master'

  • Loading branch information...
2 parents 5db0408 + 226c7cc commit 9bd48752e604ae79edaf105110cfe023c869c533 @mojombo mojombo committed Dec 14, 2010
Showing with 19 additions and 3 deletions.
  1. +1 −0 History.txt
  2. +18 −3 lib/jekyll/convertible.rb
View
@@ -2,6 +2,7 @@
* Minor Enhancements
* Use OptionParser's [no-] functionality for better boolean parsing.
* Add Drupal migrator (#245)
+ * Complain about YAML and Liquid errors (#249)
== 0.8.0 / 2010-11-22
* Minor Enhancements
View
@@ -26,7 +26,11 @@ def read_yaml(base, name)
if self.content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
self.content = self.content[($1.size + $2.size)..-1]
- self.data = YAML.load($1)
+ begin
+ self.data = YAML.load($1)
+ rescue => e
+ puts "YAML Exception: #{e.message}"
+ end
end
self.data ||= {}
@@ -63,7 +67,13 @@ def do_layout(payload, layouts)
# render and transform content (this becomes the final content of the object)
payload["pygments_prefix"] = converter.pygments_prefix
payload["pygments_suffix"] = converter.pygments_suffix
- self.content = Liquid::Template.parse(self.content).render(payload, info)
+
+ begin
+ self.content = Liquid::Template.parse(self.content).render(payload, info)
+ rescue => e
+ puts "Liquid Exception: #{e.message} in #{self.data["layout"]}"
+ end
+
self.transform
# output keeps track of what will finally be written
@@ -73,7 +83,12 @@ def do_layout(payload, layouts)
layout = layouts[self.data["layout"]]
while layout
payload = payload.deep_merge({"content" => self.output, "page" => layout.data})
- self.output = Liquid::Template.parse(layout.content).render(payload, info)
+
+ begin
+ self.output = Liquid::Template.parse(layout.content).render(payload, info)
+ rescue => e
+ puts "Liquid Exception: #{e.message} in #{self.data["layout"]}"
+ end
layout = layouts[layout.data["layout"]]
end

0 comments on commit 9bd4875

Please sign in to comment.