diff options
author | Ralph Amissah <ralph@amissah.com> | 2007-10-15 19:27:16 +0100 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2007-10-15 19:27:16 +0100 |
commit | e1ec4bd2dad2bd22ad97cea398ae1cfcfae183a2 (patch) | |
tree | 6ffe3ae1b2453578a032ce053934a31f980645e9 /lib/sisu/v0/texinfo.rb | |
parent | regex matching of images, (and rearrangement of conditionals) (diff) |
mostly the arrangement of conditionals
Diffstat (limited to 'lib/sisu/v0/texinfo.rb')
-rw-r--r-- | lib/sisu/v0/texinfo.rb | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/sisu/v0/texinfo.rb b/lib/sisu/v0/texinfo.rb index a6d94c1a..c8fff3e1 100644 --- a/lib/sisu/v0/texinfo.rb +++ b/lib/sisu/v0/texinfo.rb @@ -194,20 +194,24 @@ module SiSU_TexInfo @@flag['poem']=1 end if @@flag['code'] - if @@flag['code'] and para =~ /<:code[-_](?:end|close)>/ #watch change not tested 200501 + if @@flag['code'] \ + and para =~ /<:code[-_](?:end|close)>/ #watch change not tested 200501 @@flag['code']=false end - if @@flag['code'] and para =~ /\S/ + if @@flag['code'] \ + 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 + 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/ + if @@flag['poem']==1 \ + and para =~ /\S/ sub_array=para.dup @@line_mode=sub_array.scan(/.+/) Tune.code_lines(@@line_mode) @@ -220,7 +224,8 @@ module SiSU_TexInfo def code_lines data=@data data.each do |line| - if line =~ /\S/ and line !~ /<:(code|verse).+/ + if line =~ /\S/ \ + and line !~ /<:(code|verse).+/ if @@flag['code'] line.gsub!(/^\s*(.+)/m, "\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\") @@counting+=1 if @@flag['code'] @@ -347,7 +352,8 @@ module SiSU_TexInfo 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 + if @md.fns !~ /\.e[pdr]00/ \ + and @md.markup !~ /not_to/i end def number_titles data=@data @@ -358,8 +364,10 @@ module SiSU_TexInfo 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*<!h-.+?-!>/ and para !~ /<:\d-endnotes>/ + if @md.markup =~ /num_top/i \ + and para !~ /0\\+/ + if para =~ /^[1-6]\\+(?:~\S+)?\s*<!h-.+?-!>/ \ + and para !~ /<:\d-endnotes>/ header=para[/<!h-(.+?)-!>/m, 1].gsub!(/-/m,'.') para.gsub!(/^(?:[1-6]\\+(?:~\S+)|<:([12356]|4-.+?-)>)\s*<!h-.+?-!>/, "\\1 #{header} ") @@ -378,7 +386,8 @@ module SiSU_TexInfo @tex_file=[] paranumber=0 data.each do |para| - if para =~/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/ and para !~ /<EOF>/ + if para =~/<\\~(\d+);\w\d+;\w\d+><#@dp:#@dp>/ \ + and para !~ /<EOF>/ 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 |