Class: Tilt::NokogiriTemplate

### Home Classes Methods

### In Files

- lib/tilt/nokogiri.rb

### Parent

Template

### Methods

- ::engine_initialized?
- #evaluate
- #initialize_engine
- #precompiled_postamble
- #precompiled_preamble
- #precompiled_template
- #prepare

### Class/Module Index

Quicksearch

- Tilt
- Tilt::AsciidoctorTemplate
- Tilt::BlueClothTemplate
- Tilt::BuilderTemplate
- Tilt::CSVTemplate
- Tilt::Cache
- Tilt::CoffeeScriptTemplate
- Tilt::CompileSite
- Tilt::CreoleTemplate
- Tilt::ERBTemplate
- Tilt::ErubisTemplate
- Tilt::EtanniTemplate
- Tilt::HamlTemplate
- Tilt::KramdownTemplate
- Tilt::LessTemplate
- Tilt::LiquidTemplate
- Tilt::MarkabyTemplate
- Tilt::MarukuTemplate
- Tilt::NokogiriTemplate
- Tilt::PlainTemplate
- Tilt::RDiscountTemplate
- Tilt::RDocTemplate
- Tilt::RadiusTemplate
- Tilt::RedClothTemplate
- Tilt::RedcarpetTemplate
- Tilt::RedcarpetTemplate::Redcarpet1
- Tilt::RedcarpetTemplate::Redcarpet2
- Tilt::SassTemplate
- Tilt::ScssTemplate
- Tilt::StringTemplate
- Tilt::Template
- Tilt::WikiClothTemplate
- Tilt::YajlTemplate

No matching classes.

# Tilt::NokogiriTemplate

Nokogiri template implementation. See: nokogiri.org/

### Constants

DOCUMENT_HEADER

### Public Class Methods

engine_initialized?() click to toggle source

    # File lib/tilt/nokogiri.rb, line 10
    def self.engine_initialized?
      defined? ::Nokogiri
    end

### Public Instance Methods

evaluate(scope, locals) click to toggle source

    # File lib/tilt/nokogiri.rb, line 20
    def evaluate(scope, locals)
      if data.respond_to?(:to_str)
        wrapper = proc { yield.sub(DOCUMENT_HEADER, "") } if block_given?
        super(scope, locals, &wrapper)
      else
        ::Nokogiri::XML::Builder.new.tap(&data).to_xml
      end
    end

initialize_engine() click to toggle source

    # File lib/tilt/nokogiri.rb, line 14
    def initialize_engine
      require_template_library 'nokogiri'
    end

precompiled_postamble(locals) click to toggle source

    # File lib/tilt/nokogiri.rb, line 34
    def precompiled_postamble(locals)
      "xml.to_xml"
    end

precompiled_preamble(locals) click to toggle source

    # File lib/tilt/nokogiri.rb, line 29
    def precompiled_preamble(locals)
      return super if locals.include? :xml
      "xml = ::Nokogiri::XML::Builder.new { |xml| }\n#{super}"
    end

precompiled_template(locals) click to toggle source

    # File lib/tilt/nokogiri.rb, line 38
    def precompiled_template(locals)
      data.to_str
    end

prepare() click to toggle source

    # File lib/tilt/nokogiri.rb, line 18
    def prepare; end

[Validate]

Generated with the Darkfish Rdoc Generator 2.