aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/xml_dom.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/xml_dom.rb')
-rw-r--r--lib/sisu/v5/xml_dom.rb67
1 files changed, 48 insertions, 19 deletions
diff --git a/lib/sisu/v5/xml_dom.rb b/lib/sisu/v5/xml_dom.rb
index 38c60edf..fb7d3cb9 100644
--- a/lib/sisu/v5/xml_dom.rb
+++ b/lib/sisu/v5/xml_dom.rb
@@ -226,12 +226,15 @@ WOK
WOK
if lv==4
@copen[1]=true
- @copen[2]=@copen[3]=false
+ @copen[2]=@copen[3]=@copen[4]=false
elsif lv==5
@copen[2]=true
- @copen[3]=false
+ @copen[3]=@copen[4]=false
elsif lv==6
@copen[3]=true
+ @copen[4]=false
+ elsif lv==7
+ @copen[4]=true
end
end
def xml_structure(dob,type='norm')
@@ -259,21 +262,24 @@ WOK
@cont[2]=false if @cont[2]
@cont[3]=false if @cont[3]
####### attempt to close contents
- if @copen[3] # 6~
+ if @copen[4] # 4~
+ [4,3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+ @copen[1]=@copen[2]=@copen[3]=@copen[4]=false
+ elsif @copen[3] # 3~
[3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
@copen[1]=@copen[2]=@copen[3]=false
- elsif @copen[2] # 5~
+ elsif @copen[2] # 2~
[2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
@copen[1]=@copen[2]=@copen[3]=false
- elsif @copen[1] # 4~
+ elsif @copen[1] # 1~
[1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
@copen[1]=@copen[2]=@copen[3]=false
end
@@xml[:body] << "#{Ax[:tab]*y}</heading#{x}>" if @level[x]
@level[x]=false
end
- when 4..6
- 6.downto(lv) do |x|
+ when 4..7
+ 7.downto(lv) do |x|
if @level[x]==true
@xml_contents_close[x]=''
end
@@ -284,42 +290,61 @@ WOK
case lv
when 4
@@xml[:body] << "#{Ax[:tab]*5}</content>" if @cont[1]
- if @copen[3]==true # 6~
+ if @copen[4]==true # 4~
+ [4,3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+ elsif @copen[3]==true # 3~
[3,2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
- elsif @copen[2]==true # 5~
+ elsif @copen[2]==true # 2~
[2,1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
- elsif @copen[1]==true # 4~
+ elsif @copen[1]==true # 1~
[1].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
end
@cont[1]=true
when 5
- if @cont[2] \
+ if @cont[3] \
+ or @cont[2] \
or @cont[1]
@@xml[:body] << "#{Ax[:tab]*5}</content>"
end
- if @copen[3]==true #6~
+ if @copen[4]==true #4~
+ [4,3,2].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+ elsif @copen[3]==true #3~
[3,2].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
- elsif @copen[2]==true #5~
+ elsif @copen[2]==true #2~
[2].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
end
@cont[2]=true
when 6
- if @cont[3] \
+ if @cont[4] \
+ or @cont[3] \
or @cont[2] \
or @cont[1]
@@xml[:body] << "#{Ax[:tab]*5}</content>"
end
- if @copen[3] #6{
+ if @copen[4] #4~
+ [4,3].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+ elsif @copen[3] #3~
[3].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
end
@cont[3]=true
+ when 7
+ if @cont[4] \
+ or @cont[3] \
+ or @cont[2] \
+ or @cont[1]
+ @@xml[:body] << "#{Ax[:tab]*5}</content>"
+ end
+ if @copen[4] #4~
+ [4].each { |v| @@xml[:body] << "#{Ax[:tab]*n}</contents#{v}>" }
+ end
+ @cont[4]=true
end
end
xml_el ||=''
xml_element(dob,xml_el,xml_content,type)
if lv
@level[lv]=true
- ((lv+1)..6).each { |x| @level[x]=false }
+ ((lv+1)..7).each { |x| @level[x]=false }
end
end
def add_to_body(dob,type='norm')
@@ -367,8 +392,8 @@ WOK
@level,@cont,@copen,@xml_contents_close=[],[],[],[]
@rcdc=false
type='norm'
- (0..6).each { |x| @cont[x]=@level[x]=false }
- (4..6).each { |x| @xml_contents_close[x]='' }
+ (0..7).each { |x| @cont[x]=@level[x]=false }
+ (4..7).each { |x| @xml_contents_close[x]='' }
xml_head
data.each do |dob|
@trans.char_enc.utf8(dob) if @sys.locale =~/utf-?8/i #% utf8
@@ -420,6 +445,10 @@ WOK
type="heading_content_#{dob.lv}"
xml_structure(dob,type)
dob.obj=x.heading_body6
+ elsif dob.ln==7
+ type="heading_content_#{dob.lv}"
+ xml_structure(dob,type)
+ dob.obj=x.heading_body7
end
else
dob.ocn
@@ -486,7 +515,7 @@ WOK
end
end
@content_flag=true
- 6.downto(4) do |x|
+ 7.downto(4) do |x|
y=x - 1; v=x - 3
if @level[x]==true #2004w36 bug fix? watch/test previous logic broke on free.for.all @coontent_flag introduced
if @content_flag==true