Module: Booky::Textile::Precompiler::ClassMethods

Defined in:
lib/booky/textile/precompiler.rb

Instance Method Summary collapse

Instance Method Details

#apply(textile) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/booky/textile/precompiler.rb', line 10

def apply(textile)
  
  @output = ""
  @precompiler = self.new
  
  textile.each_line do |line|
    if options = @precompiler.matches(line)
      @output += "\n\n" unless @output.empty?
      @output += self.apply(@precompiler.compile_to(options))
      @output += "\n"
    else
      @output += line
    end
  end
  
  @output
end