Delete CNAME
[openjpeg.git] / _plugins / debug.rb
1 # A simple way to inspect liquid template variables.
2 # Usage:
3 #  Can be used anywhere liquid syntax is parsed (templates, includes, posts/pages)
4 #  {{ site | debug }}
5 #  {{ site.posts | debug }}
6 #
7 require 'pp'
8 module Jekyll
9   # Need to overwrite the inspect method here because the original
10   # uses < > to encapsulate the psuedo post/page objects in which case
11   # the output is taken for HTML tags and hidden from view.
12   #
13   class Post
14     def inspect
15       "#Jekyll:Post @id=#{self.id.inspect}"
16     end
17   end
18   
19   class Page
20     def inspect
21       "#Jekyll:Page @name=#{self.name.inspect}"
22     end
23   end
24   
25 end # Jekyll
26   
27 module Jekyll
28   module DebugFilter
29     
30     def debug(obj, stdout=false)
31       puts obj.pretty_inspect if stdout
32       "<pre>#{obj.class}\n#{obj.pretty_inspect}</pre>"
33     end
34
35   end # DebugFilter
36 end # Jekyll
37
38 Liquid::Template.register_filter(Jekyll::DebugFilter)