require 'digest/sha1' module Awestruct module Extensions class Disqus def execute(site) site.pages.each{ |p| p.extend Disqus } end module Disqus def disqus_comments() identifier = "null" if self.disqus_identifier or site.disqus_generate_id identifier = %Q("#{self.resolve_disqus_identifier()}") end %Q{
} end def disqus_comments_link() identifier = '' if self.disqus_identifier or site.disqus_generate_id identifier = %Q{ data-disqus-identifier="#{self.resolve_disqus_identifier()}"} end %Q{ Comments } end def disqus_comments_count() %Q{ } end def resolve_disqus_identifier() self.disqus_identifier ? self.disqus_identifier : Digest::SHA1.hexdigest(self.date.strftime('%Y-%m-%d-') + self.slug) end end end end end