diff options
Diffstat (limited to 'lib/sisu/v4')
-rw-r--r-- | lib/sisu/v4/texinfo.rb | 16 | ||||
-rw-r--r-- | lib/sisu/v4/texinfo_format.rb | 76 | ||||
-rw-r--r-- | lib/sisu/v4/texpdf.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v4/urls.rb | 4 |
4 files changed, 38 insertions, 62 deletions
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/v4/texpdf.rb b/lib/sisu/v4/texpdf.rb index 3d226533..edefac31 100644 --- a/lib/sisu/v4/texpdf.rb +++ b/lib/sisu/v4/texpdf.rb @@ -114,10 +114,10 @@ module SiSU_TeX if @opt.cmd =~/[MVv]/ @env.url.output_tell if @md.opt.act[:pdf_l][:set]==:on - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").flow + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}#{@md.papersize_array[0]}.pdf").flow end if @md.opt.act[:pdf_p][:set]==:on - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").flow + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@opt.fns} #{@env.program.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}#{@md.papersize_array[0]}.pdf").flow end end @md=@particulars.md diff --git a/lib/sisu/v4/urls.rb b/lib/sisu/v4/urls.rb index af586c52..2af3a5b6 100644 --- a/lib/sisu/v4/urls.rb +++ b/lib/sisu/v4/urls.rb @@ -177,10 +177,10 @@ module SiSU_Urls end def pdf def portrait(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}pdf").result + SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_p}#{@md.papersize_array[0]}.pdf").result end def landscape(x) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}pdf").result + SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.pdf_viewer} #{@md.file.output_path.pdf.dir}/#{@md.file.base_filename.pdf_l}#{@md.papersize_array[0]}.pdf").result end self end |