lib/dyndoc-convert.rb in dyndoc-ruby-0.8.2 vs lib/dyndoc-convert.rb in dyndoc-ruby-0.8.3
- old
+ new
@@ -5,10 +5,26 @@
module Dyndoc
@@dyndoc_tmpl_mngr=nil
+ def Dyndoc.process_html_file_from_dyn_file(code,html_file,dyn_file,dyn_layout,addr,dyndoc_start)
+ cli=Dyndoc::InteractiveClient.new(code,dyn_file,addr,dyndoc_start)
+
+ if dyn_layout
+ cli=Dyndoc::InteractiveClient.new(File.read(dyn_layout),"",addr) #File.expand_path(dyn_layout),addr)
+ end
+
+ if html_file and Dir.exist? File.dirname(html_file)
+ File.open(html_file,"w") do |f|
+ f << cli.content
+ end
+ else
+ puts cli.content
+ end
+ end
+
## does notwork when called twice!!!! (ex: jekyll-dyndoc in mode dyndoc)
def Dyndoc.convert(input,config={})
unless @@dyndoc_tmpl_mngr
Dyndoc.cfg_dyn['dyndoc_session']=:interactive
@@dyndoc_tmpl_mngr = Dyndoc::Ruby::TemplateManager.new({})
@@ -171,12 +187,12 @@
code_pre += '[#require]'+"\n"+dyn_libs if dyn_libs
code = code_pre + '[#main][#>]' + code
end
code += "\n" + dyn_post_code if dyn_post_code
## TO TEST!!!
- Dyndoc.warn :cfg,cfg
- Dyndoc.warn :page,page
+ ##Dyndoc.warn :cfg,cfg
+ ##Dyndoc.warn :page,page
code = "[#rb<]require 'ostruct';cfg = OpenStruct.new(" + cfg.inspect + ");page = OpenStruct.new(" + page.inspect + ")[#>]" +code
code = dyn_tags + code if dyn_tags
## add path for user
code_path = "[#path]"+File.join(opts[:dyn_root],'users',opts[:user],"dynlib")
@@ -187,22 +203,18 @@
### Dyndoc.warn :code,code
dyndoc_start=[:dyndoc_libs,:dyndoc_layout]
- cli=Dyndoc::InteractiveClient.new(code,dyn_file,addr,dyndoc_start)
-
- if dyn_layout
- cli=Dyndoc::InteractiveClient.new(File.read(dyn_layout),"",addr) #File.expand_path(dyn_layout),addr)
- end
-
- if html_file and Dir.exist? File.dirname(html_file)
- File.open(html_file,"w") do |f|
- f << cli.content
- end
- else
- puts cli.content
- end
+ unless opts[:doc_tag] == "__ALL_DOC_TAG__"
+ Dyndoc.process_html_file_from_dyn_file(code,html_file,dyn_file,dyn_layout,addr,dyndoc_start)
+ else
+ html_files.keys[1..-1].each do |doc_tag|
+ html_file=File.join(html_root,["users",opts[:user]] || [],cfg_files[:urls][doc_tag])
+ p [:html_multi,doc_tag,html_file]
+ Dyndoc.process_html_file_from_dyn_file(code.gsub(/__ALL_DOC_TAG__/,doc_tag),html_file,dyn_file,dyn_layout,addr,dyndoc_start)
+ end
+ end
end
end
end