From 26767cc88c0548ad7978021796d0ccc4c9f7ffed Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 2 Jun 2007 11:27:06 +0100 Subject: 0.53.0, pre-build, see changelog, library naming changed for scm, placed under v0 (instead of 0.53) --- lib/sisu/0.52/texinfo.rb | 408 ----------------------------------------------- 1 file changed, 408 deletions(-) delete mode 100644 lib/sisu/0.52/texinfo.rb (limited to 'lib/sisu/0.52/texinfo.rb') diff --git a/lib/sisu/0.52/texinfo.rb b/lib/sisu/0.52/texinfo.rb deleted file mode 100644 index ca62710b..00000000 --- a/lib/sisu/0.52/texinfo.rb +++ /dev/null @@ -1,408 +0,0 @@ -=begin - * Name: SiSU information Structuring Universe - Structured information, Serialized Units - * Author: Ralph Amissah - * http://www.jus.uio.no/sisu - * http://www.jus.uio.no/sisu/SiSU/download.html - - * Description: texinfo processing - - * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Ralph Amissah - - * License: GPL 2 or later - - Summary of GPL 2 - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - http://www.fsf.org/licenses/gpl.html - http://www.gnu.org/copyleft/gpl.html - http://www.jus.uio.no/sisu/gpl2.fsf - - SiSU was first released to the public on January 4th 2005 - - SiSU uses: - - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - © Ralph Amissah 1997, current 2007. - All Rights Reserved. - - * Ralph Amissah: ralph@amissah.com - ralph.amissah@gmail.com -=end -module SiSU_TexInfo - require SiSU_lib + '/html' - require SiSU_lib + '/param' - include SiSU_Param - include SiSU_Viz - #include Stamp ... needed removed arbitrarily 2005w05/1 (warnings about undefined flags) - require SiSU_lib + '/texinfo_format' - include TexInfoFormat - @tex_file=[] - @@tex_backslash="\\\\" - @@tabular="{tabular}" - @@table_pagebreak_counter,@@tex_endnote_call_counter,@@tex_table_flag,@@tex_counter,@@tex_column,@@tex_columns,@@counting=0,0,0,0,0,0,0 - @@column_instruct,@@tex_line_mode,@@tex_word_mode,@@start_table,@@line_mode='','','','','' - @@n,@@copyright,@@tableheader=nil,nil,nil - @@tex_col_w=[] - @@tex_pattern_margin_number="\\\\marginpar.+?\s+" - class Source #Songsheet - include SiSU_Param - include SiSU_Viz - include SiSU_TexInfo - def initialize(opt) - @opt=opt - @env=SiSU_Env::Info_env.new(@opt.fns) - @st={ 'tex'=>{} } - @tex=TexInfoFormat::Texinfo.new - @vz=SiSU_Env::Get_init.instance.skin - end - def directories - begin - case @opt.fns - when /\.[_-]?sst$/ - Dir.mkdir(@env.path.output) unless FileTest.directory?("#{@env.path.output}") - Dir.mkdir(@env.path.texi) unless FileTest.directory?(@env.path.tex) - @@filename_texinfo=File.new(%{#{@env.path.texi}/#@opt.fnb.texinfo},'w+') - end - rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt.cmd,$!,$@).rescue - ensure - end - end - def read - songsheet - end - def songsheet - begin - tell=SiSU_Screen::Ansi.new(@opt.cmd,'TexInfo') - tell.green_title_hi unless @opt.cmd =~/q/ - data=IO.readlines(@opt.fns,'') - @md=SiSU_Param::Parameters.new(@opt).get - puts "\t#{@@cX.grey}TexInfo#{@@cX.off}" - #@@copyright="\n #{@@tex_backslash*2}[3]\\ \\linebreak \\copyright \\ #{@md.copyright_tex}" if @md.copyright_tex #appears to be redundant ! remove 2004w19 - if @md.markup.to_s !~ /url_png/ - my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns) - directories - @marshalfile=my_make.marshal_meta - if FileTest.file?(@marshalfile)==true - File.open(@marshalfile) { |f| @@tuned_file=Marshal.load(f)} - tell.meta_verse_skipped unless @opt.cmd =~/q/ - else - tex_array=IO.readlines(@opt.fns,'') - SiSU_Metaverse.songsheet(tex_array) - end - tex_array=@@tuned_file - Texinfo_make.new(tex_array,@md).songsheet - tex_array='' - end - #@@filename_texinfo.close if @@filename_texinfo - @@filename_texinfo=nil - rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt.cmd,$!,$@).rescue - ensure - @@filename_texinfo.close if @@filename_texinfo - end - end - end - class Texinfo_make - include SiSU_Param - include TexInfoFormat - @@tex_1='(?:.+?)+~' #?? debug - @@tabular="{tabular}" - @@tex_pattern_margin_number="\\\\marginpar.+?\s+" - @@dp=nil - def initialize(data,md) - @data,@md=data,md #fns - @env=SiSU_Env::Info_env.new(@md.fns) - @st={ 'tex'=>{} } - #@tex=TexInfoFormat::Texinfo.new - @vz=SiSU_Env::Get_init.instance.skin - @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - end - def songsheet - begin - @data=pre - @data=endnote - @data=markup - @data=tail - output - makeinfo - rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.cmd,$!,$@).rescue - ensure - end - end - def pre - @tex_file=[] - data=@data - data.each do |para| - para.gsub!(/&/,'<=and>') - # DEBUG 2003w16 this is a kludge, because i could not get parameters - # from param, Sort out ... revert to more elegant solution - if para =~ //,'') - do_mono=TexInfoFormat::Texinfo.new(para,@md) - @tex_file << do_mono.spec_char - end - data=@tex_file.delete_if {|x| x =~ /^0(?:\\)+~/m} - data=@tex_file # ... - end - def endnote - data=@data - @tex_file=[] - data.each do |para| - # BUG bug -> have problems with endnotes in headers - if para =~ /\\~\\\{\d+\s+/ #if para =~ /\\\}\\~/m,' @footnote{ \2} ') - end - @tex_file << para - end - @tex_file - end - def poem - data=@data - @tex_file=[] - @@counting=0 - data.each do |para| - if para =~ /<:code>/ - @@flag['code']=1 - @@counting=1 - end - if para =~ /<:verse>/ - @@flag['poem']=1 - end - if @@flag['code']==1 - if @@flag['code']==1 and para =~ /<:code[-_](?:end|close)>/ #watch change not tested 200501 - @@flag['code']=0 - end - if @@flag['code']==1 and para =~ /\S/ - sub_array=para.dup - @@line_mode=sub_array.scan(/.+/) - Tune.code_lines(@@line_mode) - para=@@line_mode.join - end - elsif @@flag['poem']==1 - if @@flag['poem']==1 and para =~ /<:verse[-_](?:end|close)>/ #watch change not tested 200501 - @@flag['poem']=0 - end - if @@flag['poem']==1 and para =~ /\S/ - sub_array=para.dup - @@line_mode=sub_array.scan(/.+/) - Tune.code_lines(@@line_mode) - para=@@line_mode.join - end - end - @tex_file << para - end - end - def code_lines - data=@data - data.each do |line| - if line =~ /\S/ and line !~ /<:(code|verse).+/ - if @@flag['code']==1 - line.gsub!(/^\s*(.+)/m, "\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\") - @@counting+=1 if @@flag['code']==1 - else line.gsub!(/(.+)/m,'\noindent\1\') - end - end - end - end - def tables - data=@data - @tex_file=[] - @@tableheader=0 - data.each do |para| - if para =~ /¡|/ - # mono.indent1 - # when /^/ - # mono.indent2 - # when /<#@dp:#@dp>/,'~[\1]') - #para.gsub!(/[1-3]\\\\\{\\\\\{\\\\\{\s+/, '') - #para.gsub!(/[1-3]\\\\\{\s+/, '') - para=para - end - #para.gsub!(/^\s+$/mi, "") - end -#%case with endnotes - para.gsub!(/\s*[0-8]\\+(\S+)?\s+/,' ') if para - @tex_file << para if para - end - data=@tex_file - end - def numbering - data=@data - data=Texinfo_make.new(data,@md).number_titles - #TOGGLE to SWITCH PARAGRAPH NUMBERING (ON & OFF) - data=Texinfo_make.new(data,@md).number_paras \ - if @md.fns !~ /\.e[pdr]00/ and @md.markup !~ /not_to/i - end - def number_titles - data=@data - @tex_file=[] - input=%{#{@md.markup}}[/(num_top\s*=\s*(\d?))?/m,2] # else default usually 4 # this was a bit of a trick required to pass nil to input if nothing matched... #puts input - #input=/(num_top\s*=\s*(\d?))?/m.match(@md[:markup]) [2] # else default usually 4 # this was a bit of a trick required to pass nil to input if nothing matched... #puts input - num_top=input.to_i - t_no1=0; t_no2=0; t_no3=0; t_no4=0; - no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3); - data.each do |para| - if @md.markup =~ /num_top/i and para !~ /0\\+/ - if para =~ /^[1-6]\\+(?:~\S+)?\s*/ and para !~ /<:\d-endnotes>/ - header=para[//m, 1].gsub!(/-/m,'.') - para.gsub!(/^(?:[1-6]\\+(?:~\S+)|<:([12356]|4-.+?-)>)\s*/, - "\\1 #{header} ") - end - elsif para =~ /|||/ - if para =~ // - para.gsub!(//,'\1 ') - end - end - @tex_file << para - end - data=@tex_file - end - def number_paras - data=@data - @tex_file=[] - paranumber=0 - data.each do |para| - if para =~/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/ and para !~ // - parablock,paranum=/(.+?)<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/im.match(para)[1,2] - do_duo=TexInfoFormat::DuoTex.new(parablock,paranum) ###is BUG - para=do_duo.paraNum if parablock - end - @tex_file << para - end - data=@tex_file - end - def tail - data=@data - tex=TexInfoFormat::Texinfo.new('',@md) - data << tex.dublincore - data << tex.tail - end - def output - data=@data - data.compact! - data.each {|para| (@@filename_texinfo.puts para,"\n") if para} - @@filename_texinfo.close - end - def makeinfo - if @md.fns =~/\.[_-]?sst$/ - m=/(.+?)\.[_-]?sst$/.match(@md.fns) - fnb,sfx=m[1],m[2] - pwd=Dir.pwd - case sfx - when /[_-]?sst$/ - @env=SiSU_Env::Info_env.new(@md.fns,@md.cmd) - Dir.chdir(@env.path.texi) - texinfo=SiSU_Env::System_call.new("#{fnb}.texinfo") - texinfo.makeinfo - end - Dir.chdir(pwd) - end - end - end -end -__END__ - -- cgit v1.2.3