aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/xml_dom.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-10-15 19:27:16 +0100
committerRalph Amissah <ralph@amissah.com>2007-10-15 19:27:16 +0100
commite1ec4bd2dad2bd22ad97cea398ae1cfcfae183a2 (patch)
tree6ffe3ae1b2453578a032ce053934a31f980645e9 /lib/sisu/v0/xml_dom.rb
parentregex matching of images, (and rearrangement of conditionals) (diff)
mostly the arrangement of conditionals
Diffstat (limited to 'lib/sisu/v0/xml_dom.rb')
-rw-r--r--lib/sisu/v0/xml_dom.rb46
1 files changed, 36 insertions, 10 deletions
diff --git a/lib/sisu/v0/xml_dom.rb b/lib/sisu/v0/xml_dom.rb
index 14cc162f..f8259664 100644
--- a/lib/sisu/v0/xml_dom.rb
+++ b/lib/sisu/v0/xml_dom.rb
@@ -225,7 +225,11 @@ WOK
xml_element="<heading#{lv}>"
3.downto(lv) do |x|
y=x - 1
- @@xml[:body] << "#{@tab*5}</content>\n" if @cont[1] or @cont[2] or @cont[3]
+ if @cont[1] \
+ or @cont[2] \
+ or @cont[3]
+ @@xml[:body] << "#{@tab*5}</content>\n"
+ end
#@@xml[:body] << "#{@tab*5}</content>\n" if @cont[1] == true or @cont[2] == true or @cont[3] == true
@cont[1]=false if @cont[1]
@cont[2]=false if @cont[2]
@@ -267,7 +271,10 @@ WOK
end
@cont[1]=true
when 5
- @@xml[:body] << "#{@tab*5}</content>\n" if @cont[2] or @cont[1]
+ if @cont[2] \
+ or @cont[1]
+ @@xml[:body] << "#{@tab*5}</content>\n"
+ end
if @copen[3] == true #6~
[3,2].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
elsif @copen[2] == true #5~
@@ -275,8 +282,14 @@ WOK
end
@cont[2]=true
when 6
- @@xml[:body] << "#{@tab*5}</content>\n" if @cont[3] or @cont[2] or @cont[1]
- [3].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" } if @copen[3] #6{
+ if @cont[3] \
+ or @cont[2] \
+ or @cont[1]
+ @@xml[:body] << "#{@tab*5}</content>\n"
+ end
+ if @copen[3] #6{
+ [3].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" }
+ end
@cont[3]=true
end
end
@@ -340,7 +353,11 @@ WOK
if d_meta; xml_head(d_meta)
end
end
- @rcdc=true if @rcdc==false and (para =~/~metadata/ or para =~/1~meta\s+Document Information/)
+ if @rcdc==false \
+ and (para =~/~metadata/ \
+ or para =~/1~meta\s+Document Information/)
+ @rcdc=true
+ end
if para !~/(^0~|<ENDNOTES>|<EOF>)/
if para =~/.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
paranum=para[@regx,3]
@@ -403,19 +420,25 @@ WOK
else 'norm'
end
xml_markup(para)
- @@xml[:body] << %{#{@tab*6}<object id="#{para[@regx,3]}">} << "\n" if para[@regx] and para[@regx,3]
+ if para[@regx] \
+ and para[@regx,3]
+ @@xml[:body] << %{#{@tab*6}<object id="#{para[@regx,3]}">} << "\n"
+ end
@@xml[:body] << "#{@tab*7}<ocn>#{para[@regx,3]}</ocn>" << "\n" if para[@regx,3]
@@xml[:body] << %{#{@tab*7}<text class="#{type}">#{para[@regx,2]}</text>\n} if para[@regx,2] # main text, contents, body KEEP
@@xml[:body] << "#{@tab*6}</object>" << "\n" if para[@regx]
end
end
- elsif para =~/(Note|Endnotes?)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
+ elsif para =~/(Note|Endnotes?)/ \
+ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
#format_scroll=MonoSiSU.new('<br /><a name="notes">Note</a>')
#para=format_scroll.boldPara
- elsif para =~/(MetaData)/ and para =~/<~\d+;[m]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info
+ elsif para =~/(MetaData)/ \
+ and para =~/<~\d+;[m]\d+;\w\d+><#@dp:#@dp>$/ #debug 2003w46 add rc info
format_scroll=Format_scroll.new(@md,'<br /><a name="metadata">MetaData</a>')
para=format_scroll.bold_para
- elsif para =~/(Owner Details)/ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
+ elsif para =~/(Owner Details)/ \
+ and para !~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/
format_scroll=Format_scroll.new(@md,'<br /><a name="owner.details">Owner Details</a>')
@@xml[:owner_details]=format_scroll.bold_para
para=''
@@ -424,7 +447,10 @@ WOK
format_text=Format_text_object.new(one,two)
para=format_text.seg_no_paranum
end
- para='' if para =~/<a name="n\d+">/ and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote
+ if para =~/<a name="n\d+">/ \
+ and para =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/ # -endnote
+ para=''
+ end
if para =~/.*<:#>.*$/
para=case para
when /<:i[1-9]>/