class Plate::Compiler

Attributes

body[RW]
meta[RW]
repeating[RW]

Public Class Methods

new() click to toggle source
# File lib/plate/compiler.rb, line 7
def initialize
  @parser = Parser.new
  self.repeating = false
  self.meta = {}
end

Public Instance Methods

compile(code) click to toggle source
# File lib/plate/compiler.rb, line 13
def compile(code)
  self.body = @parser
    .parse(code)
    .compile(self)
end
fonts() click to toggle source
# File lib/plate/compiler.rb, line 19
def fonts
  return '' if meta['fonts'].nil?
  meta['fonts'].map { |font|
    "<link href=\"http://fonts.googleapis.com/css?family=#{CGI.escape(font)}\" rel=\"stylesheet\">"
  }.join("")
end
repeating?() click to toggle source
# File lib/plate/compiler.rb, line 26
def repeating?
  repeating
end