From 408bf6b65fcbdecd8cbcc810e1fe9f7be95da5a1 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Sun, 26 Jun 2011 15:44:15 -0400
Subject: v3: info (texinfo) (sysenv), move output; line-breaks within object

* backslashes & line-breaks
* place under web server directory
* info tool setting prompt
* sysenv, accommodate info page changes
---
 lib/sisu/v3/sysenv.rb         | 50 +++++++++++++++++++++++++++++++++++++++++++
 lib/sisu/v3/texinfo.rb        |  5 +++++
 lib/sisu/v3/texinfo_format.rb |  3 ++-
 3 files changed, 57 insertions(+), 1 deletion(-)

(limited to 'lib')

diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 5134b6c2..e89d77c5 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -2286,6 +2286,12 @@ WOK
         ? @rc['program_select']['man'] \
         : 'nroff -man'                                                        #'nroff -man' #'groff -man -Tascii'
       end
+      def texinfo
+        ((defined? @rc['program_select']['info_viewer']) \
+        && @rc['program_select']['info_viewer'] =~/\S\S+/) \
+        ? @rc['program_select']['info_viewer'] \
+        : 'pinfo -f'                                                          #'pinfo -f' 'info' 'tkinfo'
+      end
       def file_encoding
         is=(defined? @rc['program_set']['file_encoding']) ? @rc['program_set']['encoding'] : ''
         (is.nil? || is==true) ? 'encoding' : is
@@ -3262,6 +3268,12 @@ WOK
         fn=base_filename.manpage
         file=make_file(path,fn)
       end
+      def texinfo
+        path=output_path.texinfo.dir
+        make_path(path)
+        fn=base_filename.texinfo
+        file=make_file(path,fn)
+      end
       def hash_digest
         path=output_path.hash_digest.dir
         make_path(path)
@@ -3466,6 +3478,15 @@ WOK
         end
         self
       end
+      def texinfo
+        def dir
+          output_path.texinfo.dir + '/' + base_filename.texinfo
+        end
+        def rel
+          output_path.texinfo.rel + '/' + base_filename.texinfo
+        end
+        self
+      end
       def manifest
         def dir
           output_path.manifest.dir + '/' + base_filename.manifest
@@ -3630,6 +3651,14 @@ WOK
           @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft
         end
       end
+      def texinfo
+        ft='info'
+        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?
@@ -4237,6 +4266,27 @@ WOK
         end
         self
       end
+      def texinfo
+        def ft
+         'texinfo'
+        end
+        def dir
+          set_path(ft).dir.ab
+        end
+        def url
+          set_path(ft).url.ab
+        end
+        def rel
+          set_path(ft).rel.ab
+        end
+        def rcp
+          set_path(ft).rcp.ab
+        end
+        def rel_sm
+          set_path(ft).rel_sm.ab
+        end
+        self
+      end
       def sitemaps
         def ft
           'sitemaps'
diff --git a/lib/sisu/v3/texinfo.rb b/lib/sisu/v3/texinfo.rb
index 7281a7f9..f1e3d5a2 100644
--- a/lib/sisu/v3/texinfo.rb
+++ b/lib/sisu/v3/texinfo.rb
@@ -77,6 +77,7 @@ module SiSU_TexInfo
     include SiSU_TexInfo
     def initialize(opt)
       @opt=opt
+      @md=SiSU_Param::Parameters.new(@opt).get
       @env=SiSU_Env::Info_env.new(@opt.fns)
       @vz=SiSU_Env::Get_init.instance.skin
     end
@@ -367,6 +368,10 @@ module SiSU_TexInfo
       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}")
     end
     def makeinfo
       if @md.fns =~/\.(?:-|ssm\.)?sst$/
diff --git a/lib/sisu/v3/texinfo_format.rb b/lib/sisu/v3/texinfo_format.rb
index b9fb3256..cd98754a 100644
--- a/lib/sisu/v3/texinfo_format.rb
+++ b/lib/sisu/v3/texinfo_format.rb
@@ -376,7 +376,8 @@ WOK
       txt.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
       txt.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
       txt.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
-      txt.gsub!(/#{Mx[:br_nl]}+/,"\n")
+      txt.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\')
+      txt.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n")                                   # watch
       txt.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ')
       #txt.gsub!(/\\/,'\\backslash ')
       txt.gsub!(/<:pb>/,'\\newpage')
-- 
cgit v1.2.3