class Tilt::DynDocTemplate

Public Class Methods

engine_initialized?() click to toggle source
# File lib/dyndoc/common/tilt.rb, line 65
def self.engine_initialized?
  defined? ::DynDoc
end
init(libs=nil) click to toggle source
# File lib/dyndoc/common/tilt.rb, line 10
def DynDocTemplate.init(libs=nil)
  # unless $curDyn
  #   require 'dyndoc/V3/init/dyn'
  #   CqlsDoc.init_dyn
  #   CqlsDoc.set_curDyn(:V3)
  #   $curDyn.init(false)
  #   $curDyn.tmpl_doc.init_doc
  #   if libs
  #     @@libs=libs
  #     $curDyn.tmpl_doc.require_dyndoc_libs(libs)
  #   end
  #   "options(bitmapType='cairo')".to_R
  #   $curDyn.tmpl.format_output="html"
  #   $curDyn.tmpl.dyndoc_mode=:web # No command line
  #   #p [$curDyn.tmpl.dyndocMode,$curDyn.tmpl.fmtOutput]
  # end

  ## same as interactive-server
  @tmpl_mngr=nil
  @tmpl_filename=nil
  init_dyndoc
end

Public Instance Methods

evaluate(scope, locals, &block) click to toggle source
# File lib/dyndoc/common/tilt.rb, line 80
    def evaluate(scope, locals, &block)

#=begin
      #puts "locals";p locals
      ## first!!!!
      if locals.keys.include? :init_doc and locals[:init_doc]
          $curDyn.tmpl_doc.init_doc
          $curDyn.tmpl_doc.require_dyndoc_libs(@@libs) if @@libs
          "options(bitmapType='cairo')".to_R
          $curDyn.tmpl.format_output="html"
          $curDyn.tmpl.dyndoc_mode=:web # No command line
        #p [$curDyn.tmpl.dyndocMode,$curDyn.tmpl.fmtOutput]
          locals.delete :init_doc
      end
        locals.each do |tag, value|
          if tag==:path
            CqlsDoc.setRootDoc($curDyn[:rootDoc],value)
          elsif tag==:libs
            @@libs=libs
          else
                 $curDyn.tmpl.filterGlobal.envir[tag]=value
          end
      end
#=end
      $curDyn.tmpl.filterGlobal.envir["yield"]=block.call if block
        @output=prepare_output
        #puts @output
        #@output
    end
init_dyndoc() click to toggle source
# File lib/dyndoc/common/tilt.rb, line 33
def init_dyndoc
  unless @tmpl_mngr
    Dyndoc.cfg_dyn['dyndoc_session']=:interactive
    @tmpl_mngr = Dyndoc::Ruby::TemplateManager.new({})
    ##is it really well-suited for interactive mode???
  end
  reinit_dyndoc
end
initialize_engine() click to toggle source
# File lib/dyndoc/common/tilt.rb, line 69
def initialize_engine
    DynDocTemplate.init
end
prepare() click to toggle source
# File lib/dyndoc/common/tilt.rb, line 73
def prepare; end
prepare_output() click to toggle source
# File lib/dyndoc/common/tilt.rb, line 76
def prepare_output
              return process_dyndoc(data)
end
process_dyndoc(content) click to toggle source
# File lib/dyndoc/common/tilt.rb, line 51
def process_dyndoc(content)
  ##p [:process_dyndoc_content,content]
  @content=@tmpl_mngr.parse(content)
  ##Dyndoc.warn :content, @content
  @tmpl_mngr.filterGlobal.envir["body.content"]=@content
  if @tmpl_filename
    @tmpl_mngr.filterGlobal.envir["_FILENAME_CURRENT_"]=@tmpl_filename.dup
    @tmpl_mngr.filterGlobal.envir["_FILENAME_"]=@tmpl_filename.dup #register name of template!!!
    @tmpl_mngr.filterGlobal.envir["_FILENAME_ORIG_"]=@tmpl_filename.dup #register name of template!!!
    @tmpl_mngr.filterGlobal.envir["_PWD_"]=File.dirname(@tmpl_filename)
  end
  return @content
end
reinit_dyndoc() click to toggle source
# File lib/dyndoc/common/tilt.rb, line 42
def reinit_dyndoc
  if @tmpl_mngr
    @tmpl_mngr.init_doc({:format_output=> "html"})
    @tmpl_mngr.require_dyndoc_libs("DyndocWebTools")
    puts "InteractiveServer (re)initialized!\n"
    @tmpl_mngr.as_default_tmpl_mngr! #=> Dyndoc.tmpl_mngr activated!
  end
end