class Juli::Visitor::Html::Helper::FbLike

Helper-class for 'fb_like' helper

Constants

DEFAULT_TEMPLATE

default HTML template for facebook 'like' button. You can customize it in .juli/config facebook.like.template entry.

%{href} in the template will be replaced to the actual URL of current wiki page.

Public Class Methods

new() click to toggle source
# File lib/juli/visitor/html/helper/fb_like.rb, line 15
def initialize
  @fb_conf  = conf['facebook']
end

Public Instance Methods

on_root(in_file, root, visitor = nil) click to toggle source

called on each parsed document

# File lib/juli/visitor/html/helper/fb_like.rb, line 20
def on_root(in_file, root, visitor = nil)
  @in_file  = in_file
end
run(*args) click to toggle source
# File lib/juli/visitor/html/helper/fb_like.rb, line 24
def run(*args)
  raise Juli::NoConfig if !conf['url_prefix']
  raise Juli::NoConfig if !@in_file

  template.gsub('%{href}',
      conf['url_prefix'] + '/' + to_wikiname(@in_file) + conf['ext'])
end

Private Instance Methods

template() click to toggle source
# File lib/juli/visitor/html/helper/fb_like.rb, line 33
def template
  @fb_conf['like']['template']
end