class Tilt::NokogiriTemplate

Nokogiri template implementation. See: nokogiri.org/

Constants

DOCUMENT_HEADER

Public Instance Methods

evaluate(scope, locals) { || ... } click to toggle source
Calls superclass method
   # File lib/tilt/nokogiri.rb
12 def evaluate(scope, locals)
13   if @data.respond_to?(:to_str)
14     if block_given?
15       super(scope, locals){yield.sub(DOCUMENT_HEADER, "")}
16     else
17       super
18     end
19   else
20     ::Nokogiri::XML::Builder.new(&@data).to_xml
21   end
22 end
precompiled_postamble(locals) click to toggle source
   # File lib/tilt/nokogiri.rb
29 def precompiled_postamble(locals)
30   "xml.to_xml"
31 end
precompiled_preamble(locals) click to toggle source
Calls superclass method
   # File lib/tilt/nokogiri.rb
24 def precompiled_preamble(locals)
25   return super if locals.include? :xml
26   "xml = ::Nokogiri::XML::Builder.new { |xml| }\n#{super}"
27 end
precompiled_template(locals) click to toggle source
   # File lib/tilt/nokogiri.rb
33 def precompiled_template(locals)
34   @data.to_str
35 end