From d29a3e5469d8468084641c385ebf16948f7c2437 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 22 Jul 2008 20:00:59 -0400 Subject: sisu-0.68.0 proposed * middle layer document representation changed, (accounting for substantial patch) * texpdf multiple document sizes as specified in config * numerous small fixes [should on the whole be easier to maintain] --- lib/sisu/v0/texinfo.rb | 58 ++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) (limited to 'lib/sisu/v0/texinfo.rb') diff --git a/lib/sisu/v0/texinfo.rb b/lib/sisu/v0/texinfo.rb index 2b10c04c..adcba123 100644 --- a/lib/sisu/v0/texinfo.rb +++ b/lib/sisu/v0/texinfo.rb @@ -160,11 +160,11 @@ module SiSU_TexInfo data.each do |para| # DEBUG 2003w16 this is a kludge, because i could not get parameters # from param, Sort out ... revert to more elegant solution - if para =~ //,'') - para.gsub!(/(^|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)') + para.gsub!(/(^|#{Mx[:gl_c]}|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)') do_mono=TexInfoFormat::Texinfo.new(para,@md) @tex_file << do_mono.spec_char end @@ -176,10 +176,10 @@ module SiSU_TexInfo @tex_file=[] data.each do |para| # BUG bug -> have problems with endnotes in headers - if para =~ /\\~@\{\d+\s+/ #if para =~ /@\}\\~/m,' @footnote{ \1} ') - elsif para =~ /\\~@\{\*+\s+/ #if para =~ /@\}\\~/m,' @footnote{ \1} ') + if para =~ /#{Mx[:en_a_o]}\d+\s+/ #if para =~ // + if para =~ /#{Mx[:gr_o]}code#{Mx[:gr_c]}/ @@flag['code']=true @@counting=1 end - if para =~ /<:verse>/ + if para =~ /#{Mx[:gr_o]}verse#{Mx[:gr_c]}/ @@flag['poem']=1 end if @@flag['code'] if @@flag['code'] \ - and para =~ /<:code[-_](?:end|close)>/ #watch change not tested 200501 + and para =~ /#{Mx[:gr_o]}code[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501 @@flag['code']=false end if @@flag['code'] \ @@ -211,7 +211,7 @@ module SiSU_TexInfo end elsif @@flag['poem']==1 if @@flag['poem']==1 \ - and para =~ /<:verse[-_](?:end|close)>/ #watch change not tested 200501 + and para =~ /#{Mx[:gr_o]}verse[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501 @@flag['poem']=0 end if @@flag['poem']==1 \ @@ -229,7 +229,7 @@ module SiSU_TexInfo data=@data data.each do |line| if line =~ /\S/ \ - and line !~ /<:(code|verse).+/ + and line !~ /#{Mx[:gr_o]}(code|verse).+/ if @@flag['code'] line.gsub!(/^\s*(.+)/m, "\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\") @@counting+=1 if @@flag['code'] @@ -243,7 +243,7 @@ module SiSU_TexInfo @tex_file=[] @@tableheader=0 data.each do |para| - if para =~ /¡|\s*/,' ') - if para =~ /^[1-3]\\+~\S*(.+?)\s*$/ + if para =~ /^#{Mx[:lv_o]}[1-3]:\S*?#{Mx[:lv_c]}\s*(.+?)\s*$/ toc=TexInfoFormat::Texinfo.new($1,@md) texinfo_menu << toc.menu - elsif para =~ /^[4-6]\\+~(?:\S+)?\s+(.+?)\s*$/ + elsif para =~ /^#{Mx[:lv_o]}[4-6]:\S*?#{Mx[:lv_c]}\s*(.+?)\s*$/ toc=TexInfoFormat::Texinfo.new($1,@md) texinfo_menu << toc.menu case para - when /^[4]\\+~\S+\s+(.+?)\s*$/ + when /^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*(.+?)\s*$/ n_menu+=1 @submenu[n_menu]=[] - when /^[5]\\+~\S+\s+(.+?)\s*$/ + when /^#{Mx[:lv_o]}5:\S+?#{Mx[:lv_c]}\s*(.+?)\s*$/ n_submenu+=1 @subsubmenu[n_menu]=[] @submenu[n_menu] << toc.menu - when /^[6]\\+~\S+\s+(.+?)\s*$/ + when /^#{Mx[:lv_o]}6:\S+?#{Mx[:lv_c]}\s*(.+?)\s*$/ n_submenu+=1 @subsubmenu[n_submenu]=[] @subsubmenu[n_submenu] << toc.menu @@ -299,14 +299,14 @@ module SiSU_TexInfo data.each do |para| mono=TexInfoFormat::Texinfo.new(para,@md) case para - when /^1\\+/; mono.level1 - when /^2\\+/; mono.level2 - when /^3\\+/; mono.level3 - when /^4\\+~/ + when /^#{Mx[:lv_o]}1:/; mono.level1 + when /^#{Mx[:lv_o]}2:/; mono.level2 + when /^#{Mx[:lv_o]}3:/; mono.level3 + when /^#{Mx[:lv_o]}4:/; mono.level4 n_menu+=1 @@do_submenu,@@do_subsubmenu=1,1 - when /^5\\+/ + when /^#{Mx[:lv_o]}5:/; n_submenu+=1 @@do_subsubmenu=1 if @@do_submenu==1 @@ -315,7 +315,7 @@ module SiSU_TexInfo @@do_submenu=0 else mono.level5 end - when /^6\\+/ + when /^#{Mx[:lv_o]}6:/; if @@do_submenu==1 menu=TexInfoFormat::Texinfo.new(@subsubmenu[n_menu],@md) para="#{menu.subsubmenu}#{mono.level6}" @@ -339,9 +339,7 @@ module SiSU_TexInfo if para !~/\S/ para=nil else - para.gsub!(/<\\~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'<\1>') - #para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/,'<\1>') - #para.gsub!(/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/,'<\1>') + para.gsub!(/#{Mx[:id_o]}\\~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'<\1>') para end end @@ -369,7 +367,7 @@ module SiSU_TexInfo 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\\+/ + and para !~ /#{Rx[:meta]}/ if para =~ /^[1-6]\\+(?:~\S+)?\s*/ \ and para !~ /<:\d-endnotes>/ header=para[//m, 1].gsub!(/-/m,'.') @@ -390,9 +388,9 @@ module SiSU_TexInfo @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] + if para =~/#{Mx[:id_o]}\\~(\d+);\w\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/ \ + and para !~ /#{Mx[:br_eof]}/ + parablock,paranum=/(.+?)#{Mx[:id_o]}\\~(\d+);\w\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/im.match(para)[1,2] do_duo=TexInfoFormat::DuoTex.new(parablock,paranum) ###is BUG para=do_duo.paraNum if parablock end -- cgit v1.2.3