Sha256: edf21d1b53a32df81e3db85e3baba406a89aab7892050f41b19cf1848c5d9d51

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 KB

Contents

require 'awestruct/handler_chain'
require 'awestruct/handlers/verbatim_file_handler'
require 'awestruct/handlers/css_tilt_handler'
require 'awestruct/handlers/restructuredtext_handler'
require 'awestruct/handlers/javascript_handler'
require 'awestruct/handlers/redirect_handler'
require 'awestruct/handlers/tilt_handler'
# TC: shouldn't the asciidoctor be covered by the tilt handler?
# JP: We have some additional asciidoctor integration that the tilt handler doesn't handle (yet, working on it)
require 'awestruct/handlers/asciidoctor_handler'

module Awestruct

  class HandlerChains

    DEFAULTS = [
      Awestruct::Handlers::CssTiltHandler::CHAIN,
      Awestruct::Handlers::RedirectHandler::CHAIN,
      Awestruct::Handlers::RestructuredtextHandler::CHAIN,
      Awestruct::Handlers::JavascriptHandler::CHAIN,
      # TC: shouldn't the asciidoctor be covered by the tilt handler?
      # JP: We have some additional asciidoctor integration that the tilt handler doesn't handle (yet, working on it)
      Awestruct::Handlers::AsciidoctorHandler::CHAIN,
      Awestruct::Handlers::TiltHandler::NON_INTERPOLATION_CHAIN,
      Awestruct::Handlers::TiltHandler::INTERPOLATION_CHAIN,
      HandlerChain.new( /.*/, Awestruct::Handlers::VerbatimFileHandler )
    ]

    def initialize(include_defaults=true)
      @chains = []
      self << :defaults if include_defaults
    end

    def[](path)
      @chains.detect{|e| e.matches?( path.to_s ) }
    end

    def <<(chain)
      @chains += DEFAULTS and return if ( chain == :defaults )
      @chains << chain
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
awestruct-0.5.4.2 lib/awestruct/handler_chains.rb
awestruct-0.5.4.1 lib/awestruct/handler_chains.rb
awestruct-0.5.4 lib/awestruct/handler_chains.rb