From 344270faca3b8179c5d45e0abede70df841635c7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 24 Sep 2011 07:45:01 -0400 Subject: v3: info files, fix output; remote, include info file & manpage (when selected) --- lib/sisu/v3/manifest.rb | 28 ++++++++++++++-------------- lib/sisu/v3/sysenv.rb | 33 ++++++++++++++++++++++++++++++++- lib/sisu/v3/texinfo.rb | 27 ++++++++++++++++----------- lib/sisu/v3/urls.rb | 2 +- 4 files changed, 63 insertions(+), 27 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index adc048ef..cb25781f 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -360,6 +360,20 @@ module SiSU_Manifest id,file='XML DOM',@f.base_filename.xml_dom summarize(id,file,pth,rel,url) end + if FileTest.file?(@f.place_file.info.dir)==true + pth=@f.output_path.texinfo.dir + rel=@f.output_path.texinfo.rel_sm + url=@f.output_path.texinfo.url + id,file='Info file',@f.base_filename.info + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.manpage.dir)==true + pth=@f.output_path.manpage.dir + rel=@f.output_path.manpage.rel_sm + url=@f.output_path.manpage.url + id,file='Manpage',@f.base_filename.manpage + summarize(id,file,pth,rel,url) + end if FileTest.file?(@f.place_file.txt.dir)==true if @md.opt.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)' elsif @md.opt.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)' @@ -383,20 +397,6 @@ module SiSU_Manifest pth,rel,url='','','' summarize(id,file,pth,rel,url) end - if FileTest.file?(@f.place_file.manpage.dir)==true - pth=@f.output_path.manpage.dir - rel=@f.output_path.manpage.rel_sm - url=@f.output_path.manpage.url - id,file='Manpage',@f.base_filename.manpage - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.texinfo.dir)==true - pth=@f.output_path.texinfo.dir - rel=@f.output_path.texinfo.rel_sm - url=@f.output_path.texinfo.url - id,file='Texinfo',@f.base_filename.texinfo - summarize(id,file,pth,rel,url) - end if FileTest.file?(@f.place_file.hash_digest.dir)==true pth=@f.output_path.hash_digest.dir rel=@f.output_path.hash_digest.rel_sm diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 79ae61af..ad831489 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -2998,6 +2998,14 @@ WOK && FileTest.file?(@f.place_file.txt.dir) inp << @f.place_file.txt.rel end + if @opt.cmd =~/i/ \ + && FileTest.file?(@f.place_file.manpage.dir) + inp << @f.place_file.manpage.rel + end + if @opt.cmd =~/I/ \ + && FileTest.file?(@f.place_file.info.dir) + inp << @f.place_file.info.rel + end if @opt.cmd =~/N/ \ && FileTest.file?(@f.place_file.hash_digest.dir) inp << @f.place_file.hash_digest.rel @@ -3375,6 +3383,12 @@ WOK fn=base_filename.texinfo file=make_file(path,fn) end + def info + path=output_path.texinfo.dir + make_path(path) + fn=base_filename.info + file=make_file(path,fn) + end def hash_digest path=output_path.hash_digest.dir make_path(path) @@ -3594,6 +3608,15 @@ WOK end self end + def info + def dir + output_path.texinfo.dir + '/' + base_filename.info + end + def rel + output_path.texinfo.rel + '/' + base_filename.info + end + self + end def manifest def dir output_path.manifest.dir + '/' + base_filename.manifest @@ -3758,7 +3781,7 @@ WOK @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft end end - def texinfo + def info ft='info' if @env.output_dir_structure.by_language_code? @md.fnb + '.' + ft @@ -3766,6 +3789,14 @@ WOK @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft end end + def texinfo + ft='texinfo' + if @env.output_dir_structure.by_language_code? + @md.fnb + '.' + ft + else + @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft + end + end def hash_digest ft='.txt' if @env.output_dir_structure.by_language_code? diff --git a/lib/sisu/v3/texinfo.rb b/lib/sisu/v3/texinfo.rb index ab1b7c98..f0331513 100644 --- a/lib/sisu/v3/texinfo.rb +++ b/lib/sisu/v3/texinfo.rb @@ -98,7 +98,7 @@ module SiSU_TexInfo def song begin tool=(@opt.cmd =~/[MVv]/) \ - ? "#{@env.program.texinfo} #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.texinfo}" + ? "#{@env.program.texinfo} #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" tell=@opt.cmd=~/[MVvz]/ \ && @opt.cmd !~/q/ \ @@ -133,6 +133,7 @@ module SiSU_TexInfo @md,@data=md,data @env=SiSU_Env::Info_env.new(@md.fns) @vz=SiSU_Env::Get_init.instance.skin + @f=SiSU_Env::SiSU_file.new(@md) end def songsheet begin @@ -142,6 +143,7 @@ module SiSU_TexInfo @data=tail output makeinfo #KEEP reinstate when fixed #% + place_info rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.opt.cmd,$!,$@).rescue ensure end @@ -363,19 +365,15 @@ module SiSU_TexInfo def output data=@data data.compact! - filename=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo} - filename_texinfo=File.new(filename,'w+') - puts filename if @md.opt.cmd =~/M/ - data.each {|s| (filename_texinfo.puts s,"\n") if s} - filename_texinfo.close - file_info_src=%{#{@env.processing_path.texi}/#{@md.fnb}.info} - file_info="#{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.texinfo}" - SiSU_Env::SiSU_file.new(@md).mkdir - system("cp #{file_info_src} #{file_info}") + filename_texinfo=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo} + file_texinfo=File.new(filename_texinfo,'w+') + puts filename_texinfo if @md.opt.cmd =~/M/ + data.each {|s| (file_texinfo.puts s,"\n") if s} + file_texinfo.close end def makeinfo if @md.fns =~/\.(?:-|ssm\.)?sst$/ - m=/(.+?)\.([_-]?sst)$/.match(@md.fns) + m=/(.+?)\.((?:-|ssm\.)?sst)$/.match(@md.fns) fnb,sfx=m[1],m[2] pwd=Dir.pwd case sfx @@ -387,6 +385,13 @@ module SiSU_TexInfo end Dir.chdir(pwd) end + def place_info + unless FileTest.directory?(@f.output_path.texinfo.dir) + mkdir_p(@f.output_path.texinfo.dir) + end + info_src=%{#{@env.processing_path.texi}/#{@md.fnb}.info} + system("cp #{info_src} #{@f.place_file.info.dir}") + end end end end diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index a6612175..d0193da4 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -181,7 +181,7 @@ module SiSU_urls SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.manpage_viewer} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").result end def pinfo(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","pinfo -f #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.texinfo}").result + SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","pinfo -f #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}").result end def po4a def po(x,y) -- cgit v1.2.3