diff options
| author | Ralph Amissah <ralph@amissah.com> | 2014-01-12 21:16:18 -0500 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2014-01-12 21:16:18 -0500 | 
| commit | fbf1b64379de0539a0661edbe8a84e8ba48591f9 (patch) | |
| tree | 722d9a79ea5f6b3cbd3dca1c7af4a2a7c8bfef4e | |
| parent | v4 v5: version & changelog (& rakefile) (diff) | |
v4 v5: texinfo, fixes
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v4 | 2 | ||||
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v5 | 2 | ||||
| -rw-r--r-- | lib/sisu/v4/texinfo.rb | 16 | ||||
| -rw-r--r-- | lib/sisu/v4/texinfo_format.rb | 76 | ||||
| -rw-r--r-- | lib/sisu/v5/texinfo.rb | 25 | ||||
| -rw-r--r-- | lib/sisu/v5/texinfo_format.rb | 89 | ||||
| -rw-r--r-- | lib/sisu/v5/urls.rb | 2 | 
7 files changed, 86 insertions, 126 deletions
| diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 98201c9b..c252bea8 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -30,6 +30,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.2.18.orig.tar.xz    sisu_4.2.18.orig.tar.xz    sisu_4.2.18-1.dsc +* texinfo, fixes +  %% 4.2.17.orig.tar.xz (2014-01-06:01/1)  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.17  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.17-1 diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index b25de18d..8d10ec56 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -33,6 +33,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.2.1.orig.tar.xz    sisu_5.2.1.orig.tar.xz    sisu_5.2.1-1.dsc +* texinfo, fixes +  %% 5.2.0.orig.tar.xz (2014-01-06:01/1)  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.2.0  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.2.0-1 diff --git a/lib/sisu/v4/texinfo.rb b/lib/sisu/v4/texinfo.rb index b0f44a1f..f48ecebe 100644 --- a/lib/sisu/v4/texinfo.rb +++ b/lib/sisu/v4/texinfo.rb @@ -303,32 +303,36 @@ module SiSU_TexInfo        @@do_submenu,@@do_subsubmenu=1,1        data_new=[]        data.each do |dob| -        mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob) +        unless defined? dob.ln and dob.ln == (5..6) +          mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob) +        end          if dob.is==:heading            case dob.ln            when 1; dob=mono.level1            when 2; dob=mono.level2            when 3; dob=mono.level3            when 4; +            @@n4_txt=dob.obj              dob=mono.level4              n_menu+=1              @@do_submenu,@@do_subsubmenu=1,1            when 5;              n_submenu+=1              @@do_subsubmenu=1 +            @@n5_txt=dob.obj              if @@do_submenu==1                menu=SiSU_TexInfoFormat::TeXinfoTxt.new(@md,dob,@submenu[n_menu]) -              dob.obj="#{menu.submenu}#{mono.level5.obj}" +              dob.obj="#{menu.submenu}#{SiSU_TexInfoFormat::Texinfo.new(@md,dob,@@n4_txt).level5.obj}"                @@do_submenu=0 -            else dob=mono.level5 +            else dob.obj="#{SiSU_TexInfoFormat::Texinfo.new(@md,dob,@@n4_txt).level5.obj}"              end            when 6;              if @@do_submenu==1                menu=SiSU_TexInfoFormat::TeXinfoTxt.new(@md,dob,@submenu[n_menu]) +              dob.obj="#{menu.submenu}#{SiSU_TexInfoFormat::Texinfo.new(@md,dob,@@n5_txt).level6.obj}"                dob.obj="#{menu.subsubmenu}#{mono.level6.obj}"                @@do_subsubmenu=0 -            else -              dob=mono.level6 +            else dob.obj="#{SiSU_TexInfoFormat::Texinfo.new(@md,dob,@@n5_txt).level6.obj}"              end            end          else @@ -337,7 +341,7 @@ module SiSU_TexInfo            else              if dob.is==:para \              && (dob.obj !~/##{dob.ocn}/) -              dob.obj="#{dob.obj} ##{dob.ocn}" +              dob.obj="#{dob.obj} ##{dob.ocn}\n\n"              end            end          end diff --git a/lib/sisu/v4/texinfo_format.rb b/lib/sisu/v4/texinfo_format.rb index 04fb06f6..7bfa4e39 100644 --- a/lib/sisu/v4/texinfo_format.rb +++ b/lib/sisu/v4/texinfo_format.rb @@ -68,8 +68,8 @@ module SiSU_TexInfoFormat      @@tex_1='\\\\~' #?? debug      @@tabular="{tabular}"      @@tex_pattern_margin_number="\\\\marginpar.+?\s+" -    def initialize(md,dob=nil) -      @md,@dob=md,dob +    def initialize(md,dob=nil,up='') +      @md,@dob,@up=md,dob,up        if dob.is_a?(Hash)          p dob.class          p caller @@ -91,7 +91,7 @@ module SiSU_TexInfoFormat          subtitle=subtitle.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ").            gsub(/\$/,"\\$").            gsub(/[,]\s*/,' - ') -        subtitle="@subtitle @value{VERSION}, @value{UPDATED}\n" #bugwatch +        subtitle="\n@subtitle #{subtitle}\n"        end        subtitle ||=''        author=@md.author if @md.author @@ -102,7 +102,7 @@ module SiSU_TexInfoFormat  \\input texinfo   @c -*-texinfo-*-  @comment %**start of header  @setfilename #{@md.fnb}.info -@settitle #{title} @value{VERSION} +@settitle #{title}  @syncodeindex pg cp  @comment %**end of header  @c %% 2 @@ -138,7 +138,6 @@ WOK  @c %% 3  @titlepage  @title #{title} -@value{VERSION}, @value{UPDATED}  @author #{author}  @page  @vskip 0pt plus 1filll @@ -293,66 +292,41 @@ WOK      end      def menu        dob=clean(@dob) -      m=dob.obj -      m=m.gsub(/[:,]\s*/,' - '). +      m=dob.obj.gsub(/[:,]\s*/,' - ').          gsub(/@footnote\{.+?\}\s+/,'')        m="* #{m}::"      end -    def level1 +    def level_common        dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" +      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,''). +        gsub(/: \s*/,' - ') +      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n\n"        dob      end -    def level2 +    def level_sub(up)        dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" +      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,''). +        gsub(/: \s*/,' - ') +      dob.obj="@node #{nd}, #{up}\n@comment node-name, up\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n\n"        dob      end +    def level1 +      level_common +    end +    def level2 +      level_common +    end      def level3 -      dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" -      dob +      level_common      end      def level4 -      dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" -      dob +      level_common      end      def level5 -      dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" -      dob +      level_sub(@up)      end      def level6 -      dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" -      dob -    end -    def submenu -      @dob.obj=@dob.obj.join("\n") -      @dob.obj=@dob.obj.gsub(/[5]\\+~\S+/,'') -      dob=clean(@dob) -      dob.obj="@menu\n#{dob.obj}\n@end menu\n\n". -        gsub(/.+/m,"#{dob.obj}") -    end -    def subsubmenu -      @dob.obj=@dob.obj.join("\n") -      @dob.obj=@dob.obj.gsub(/[6]\\+~\S+/,'') -      dob=clean(@dob) -      dob.obj="@menu\n#{dob.obj}\n@end menu\n\n". -        gsub(/.+/m,"#{dob.obj}") -    end -    def indent1 -      @dob.obj=@dob.obj.gsub(/<:i1>(.*)/,'\1') -    end -    def indent2 -      @dob.obj=@dob.obj.gsub(/<:i2>(.*)/,'\1') +      level_sub(@up)      end      def spec_char(txt) # special characters        txt=txt.gsub(/#{Mx[:br_eof]}/i,''). @@ -554,16 +528,14 @@ WOK      end      def submenu        txt=@txt.join("\n") -      txt=txt.gsub(/[5]\\+~\S+/,'')        txt=clean(@dob,txt)        txt="@menu\n#{txt}\n@end menu\n\n"        txt=txt.gsub(/.+/m,"#{txt}")      end      def subsubmenu        txt=@txt.join("\n") -      txt=txt.gsub(/[6]\\+~\S+/,'')        txt=clean(@dob,txt) -      txt="@menu\n#{dob.obj}\n@end menu\n\n" +      txt="@menu\n#{txt}\n@end menu\n\n"        txt=txt.gsub(/.+/m,"#{txt}")      end    end diff --git a/lib/sisu/v5/texinfo.rb b/lib/sisu/v5/texinfo.rb index ba890be3..c18b4b1e 100644 --- a/lib/sisu/v5/texinfo.rb +++ b/lib/sisu/v5/texinfo.rb @@ -107,7 +107,7 @@ module SiSU_TexInfo          tool=(@opt.act[:verbose][:set]==:on \          || @opt.act[:verbose_plus][:set]==:on \          || @opt.act[:maintenance][:set]==:on) \ -        ?  "#{@env.program.texinfo} #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}" +        ? "cd #{@md.file.output_path.texinfo.dir} && #{@env.program.texinfo} #{@md.file.base_filename.info}; cd -"          : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"          (@opt.act[:verbose][:set]==:on \          || @opt.act[:verbose_plus][:set]==:on \ @@ -308,32 +308,36 @@ module SiSU_TexInfo        @@do_submenu,@@do_subsubmenu=1,1        data_new=[]        data.each do |dob| -        mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob) +        unless defined? dob.ln and dob.ln == (5..6) +          mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob) +        end          if dob.is==:heading            case dob.ln            when 1 then dob=mono.level1            when 2 then dob=mono.level2            when 3 then dob=mono.level3            when 4; +            @@n4_txt=dob.obj              dob=mono.level4              n_menu+=1              @@do_submenu,@@do_subsubmenu=1,1            when 5;              n_submenu+=1              @@do_subsubmenu=1 +            @@n5_txt=dob.obj              if @@do_submenu==1                menu=SiSU_TexInfoFormat::TeXinfoTxt.new(@md,dob,@submenu[n_menu]) -              dob.obj="#{menu.submenu}#{mono.level5.obj}" +              dob.obj="#{menu.submenu}#{SiSU_TexInfoFormat::Texinfo.new(@md,dob,@@n4_txt).level5.obj}"                @@do_submenu=0 -            else dob=mono.level5 +            else dob.obj="#{SiSU_TexInfoFormat::Texinfo.new(@md,dob,@@n4_txt).level5.obj}"              end            when 6;              if @@do_submenu==1                menu=SiSU_TexInfoFormat::TeXinfoTxt.new(@md,dob,@submenu[n_menu]) +              dob.obj="#{menu.submenu}#{SiSU_TexInfoFormat::Texinfo.new(@md,dob,@@n5_txt).level6.obj}"                dob.obj="#{menu.subsubmenu}#{mono.level6.obj}"                @@do_subsubmenu=0 -            else -              dob=mono.level6 +            else dob.obj="#{SiSU_TexInfoFormat::Texinfo.new(@md,dob,@@n5_txt).level6.obj}"              end            end          else @@ -341,8 +345,9 @@ module SiSU_TexInfo              dob.obj=nil            else              if dob.is==:para \ -            && (dob.obj !~/##{dob.ocn}/) -              dob.obj="#{dob.obj} ##{dob.ocn}" +            && (dob.obj !~/#{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}/) +              dob.obj=dob.ocn.is_a?(Fixnum) \ +              ? "#{dob.obj} #{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}\n\n" : "#{dob.obj}\n\n"              end            end          end @@ -412,7 +417,9 @@ module SiSU_TexInfo            FileUtils::mkdir_p(@f.output_path.texinfo.dir)          end          info_src=%{#{@env.processing_path.texi}/#{@md.fnb}.info} -        FileUtils::cp(info_src, @f.place_file.info.dir) +        Dir.glob("#{info_src}*").sort.each do |f| +          FileUtils::cp(f, File.dirname(@f.place_file.info.dir)) # bug should provide dir without need to extract it! +        end        end      end    end diff --git a/lib/sisu/v5/texinfo_format.rb b/lib/sisu/v5/texinfo_format.rb index 5e920475..5d513041 100644 --- a/lib/sisu/v5/texinfo_format.rb +++ b/lib/sisu/v5/texinfo_format.rb @@ -69,8 +69,8 @@ module SiSU_TexInfoFormat      @@tex_1='\\\\~' #?? debug      @@tabular="{tabular}"      @@tex_pattern_margin_number="\\\\marginpar.+?\s+" -    def initialize(md,dob=nil) -      @md,@dob=md,dob +    def initialize(md,dob=nil,up='') +      @md,@dob,@up=md,dob,up        if dob.is_a?(Hash)          p dob.class          p caller @@ -92,7 +92,7 @@ module SiSU_TexInfoFormat          subtitle=subtitle.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ").            gsub(/\$/,"\\$").            gsub(/[,]\s*/,' - ') -        subtitle="@subtitle @value{VERSION}, @value{UPDATED}\n" #bugwatch +        subtitle="\n@subtitle #{subtitle}\n"        end        subtitle ||=''        author=@md.author if @md.author @@ -103,7 +103,7 @@ module SiSU_TexInfoFormat  \\input texinfo   @c -*-texinfo-*-  @comment %**start of header  @setfilename #{@md.fnb}.info -@settitle #{title} @value{VERSION} +@settitle #{title}  @syncodeindex pg cp  @comment %**end of header  @c %% 2 @@ -139,7 +139,6 @@ WOK  @c %% 3  @titlepage  @title #{title} -@value{VERSION}, @value{UPDATED}  @author #{author}  @page  @vskip 0pt plus 1filll @@ -283,77 +282,52 @@ WOK      end      def clean(dob)        if dob.is==:heading \ -      and dob.obj !~/##{dob.ocn}/ -        dob.obj="#{dob.obj} ##{dob.ocn}" +      and dob.obj !~/#{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}/ +        dob.obj=dob.ocn.is_a?(Fixnum) \ +        ? "#{dob.obj} #{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}" : dob.obj        end        dob.obj=dob.obj.gsub(/\n/m,' '). -        gsub(/<:#>/,'').          gsub(/,\s+/,' - ').          strip        dob      end      def menu        dob=clean(@dob) -      m=dob.obj -      m=m.gsub(/[:,]\s*/,' - '). +      m=dob.obj.gsub(/[:,]\s*/,' - ').          gsub(/@footnote\{.+?\}\s+/,'')        m="* #{m}::"      end -    def level1 +    def level_common        dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" +      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,''). +        gsub(/: \s*/,' - ') +      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n\n"        dob      end -    def level2 +    def level_sub(up)        dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" +      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,''). +        gsub(/: \s*/,' - ') +      dob.obj="@node #{nd}, #{up}\n@comment node-name, up\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n\n"        dob      end +    def level1 +      level_common +    end +    def level2 +      level_common +    end      def level3 -      dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" -      dob +      level_common      end      def level4 -      dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" -      dob +      level_common      end      def level5 -      dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" -      dob +      level_sub(@up)      end      def level6 -      dob=clean(@dob) -      nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') -      dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" -      dob -    end -    def submenu -      @dob.obj=@dob.obj.join("\n") -      @dob.obj=@dob.obj.gsub(/[5]\\+~\S+/,'') -      dob=clean(@dob) -      dob.obj="@menu\n#{dob.obj}\n@end menu\n\n". -        gsub(/.+/m,"#{dob.obj}") -    end -    def subsubmenu -      @dob.obj=@dob.obj.join("\n") -      @dob.obj=@dob.obj.gsub(/[6]\\+~\S+/,'') -      dob=clean(@dob) -      dob.obj="@menu\n#{dob.obj}\n@end menu\n\n". -        gsub(/.+/m,"#{dob.obj}") -    end -    def indent1 -      @dob.obj=@dob.obj.gsub(/<:i1>(.*)/,'\1') -    end -    def indent2 -      @dob.obj=@dob.obj.gsub(/<:i2>(.*)/,'\1') +      level_sub(@up)      end      def spec_char(txt) # special characters        txt=txt.gsub(/#{Mx[:br_eof]}/i,''). @@ -548,23 +522,22 @@ WOK      end      def clean(dob,txt)        if dob.is==:heading \ -      and txt !~/##{dob.ocn}/ -        txt="#{dob.obj} ##{dob.ocn}" +      and txt !~/#{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}/ +        txt=dob.ocn.is_a?(Fixnum) \ +        ? "#{dob.obj} #{Dx[:ocn_o]}#{dob.ocn}#{Dx[:ocn_c]}" : dob.obj        end -      txt=txt.gsub(/<:#>/,'').strip +      txt.strip      end      def submenu        txt=@txt.join("\n") -      txt=txt.gsub(/[5]\\+~\S+/,'')        txt=clean(@dob,txt)        txt="@menu\n#{txt}\n@end menu\n\n"        txt=txt.gsub(/.+/m,"#{txt}")      end      def subsubmenu        txt=@txt.join("\n") -      txt=txt.gsub(/[6]\\+~\S+/,'')        txt=clean(@dob,txt) -      txt="@menu\n#{dob.obj}\n@end menu\n\n" +      txt="@menu\n#{txt}\n@end menu\n\n"        txt=txt.gsub(/.+/m,"#{txt}")      end    end diff --git a/lib/sisu/v5/urls.rb b/lib/sisu/v5/urls.rb index d814965f..e9d611ff 100644 --- a/lib/sisu/v5/urls.rb +++ b/lib/sisu/v5/urls.rb @@ -209,7 +209,7 @@ module SiSU_Urls          SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@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.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","pinfo -f #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}").result +        SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"[#{@opt.f_pth[:lng_is]}] -#{x}","cd #{@md.file.output_path.texinfo.dir} && #{@env.program.texinfo} #{@md.file.base_filename.info}; cd -").result        end        def po4a          def po(x,y) | 
