Module: Dyndoc

Defined in:
lib/dyndoc-convert.rb,
lib/dyndoc/cli/interactive-client.rb,
lib/dyndoc/srv/interactive-server.rb

Defined Under Namespace

Classes: InteractiveClient, InteractiveServer

Constant Summary collapse

@@dyndoc_tmpl_mngr =
nil

Class Method Summary collapse

Class Method Details

.cli_convert(input, config = {}) ⇒ Object



34
35
36
37
38
39
# File 'lib/dyndoc-convert.rb', line 34

def Dyndoc.cli_convert(input,config={})
  addr="127.0.0.1"
  dyndoc_start=[:dyndoc_libs]
  cli=Dyndoc::InteractiveClient.new(input,"",addr,dyndoc_start)
  return cli.content
end

.convert(input, config = {}) ⇒ Object

does notwork when called twice!!!! (ex: jekyll-dyndoc in mode dyndoc)



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/dyndoc-convert.rb', line 10

def Dyndoc.convert(input,config={})
  unless @@dyndoc_tmpl_mngr
    Dyndoc.cfg_dyn['dyndoc_session']=:interactive
    @@dyndoc_tmpl_mngr = Dyndoc::Ruby::TemplateManager.new({})
    ##is it really well-suited for interactive mode???
    @@dyndoc_tmpl_mngr.init_doc({:format_output=> "html"})
    @@dyndoc_tmpl_mngr.require_dyndoc_libs("DyndocWebTools")
    puts "InteractiveServer (re)initialized!\n"
    @@dyndoc_tmpl_mngr.as_default_tmpl_mngr! #=> Dyndoc.tmpl_mngr activated!
  end
  Dyndoc.warn :input, input
  output=@@dyndoc_tmpl_mngr.parse(input)
  ##
  Dyndoc.warn :output, output
  @@dyndoc_tmpl_mngr.filterGlobal.envir["body.content"]=output
  if config['tmpl_filename']
    @@dyndoc_tmpl_mngr.filterGlobal.envir["_FILENAME_CURRENT_"]=config['tmpl_filename'].dup
    @@dyndoc_tmpl_mngr.filterGlobal.envir["_FILENAME_"]=config['tmpl_filename'].dup #register name of template!!!
    @@dyndoc_tmpl_mngr.filterGlobal.envir["_FILENAME_ORIG_"]=config['tmpl_filename'].dup #register name of template!!!
    @@dyndoc_tmpl_mngr.filterGlobal.envir["_PWD_"]=File.dirname(config['tmpl_filename'])
  end
  return output
end