class Remarkably::Engines::HTML

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/remarkably/engines/html.rb, line 8
def initialize
  super
  @css_engine = Engines::CSS.new
end

Public Instance Methods

bookmarklet(args, hash, &block) click to toggle source
# File lib/remarkably/engines/html/helpers.rb, line 4
def bookmarklet args, hash, &block
  inline_javascript = args.shift.split("\n").map{|l|l.strip}.join('')
  inline_javascript.gsub!( '%', '%25' )
  { "'" => "%27",
    '"' => "%22",
    '&' => "%26",
    '/' => "%2F",
  }.each_pair do |key,value|
    inline_javascript.gsub!( key, value )
  end
  hash[:href]=%|javascript:(function(){#{inline_javascript}})();|
  method!( :a, args, hash, &block )
end
style(args, hash, &block) click to toggle source
# File lib/remarkably/engines/html.rb, line 12
def style args, hash, &block
  if block_given?
    @css_engine.clear!
    @context.remarkably_engine = @css_engine
    block.call
    @context.remarkably_engine = self
    args = ["\n#{@css_engine}"]+args
  end
  method!( :style, args, hash )
end