aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-10-23 23:58:37 -0400
committerRalph Amissah <ralph@amissah.com>2013-10-23 23:58:37 -0400
commit15ff37477b84c90a365954c81ce6726a0137de37 (patch)
treeb83dca57a5a9b48bf0a827e8350bfb4532b2fb26
parentv4 v5: dal, parent & node info, fix (diff)
v4 v5: dal, collapsed levels implementedsisu_4.2.8
* convenience, collapse sisu's dual level document structure for output of markup with straight linear structure
-rw-r--r--data/doc/sisu/CHANGELOG_v44
-rw-r--r--data/doc/sisu/CHANGELOG_v54
-rw-r--r--lib/sisu/v4/dal.rb19
-rw-r--r--lib/sisu/v4/dal_doc_objects.rb14
-rw-r--r--lib/sisu/v4/dal_doc_str.rb25
-rw-r--r--lib/sisu/v5/dal.rb19
-rw-r--r--lib/sisu/v5/dal_doc_objects.rb14
-rw-r--r--lib/sisu/v5/dal_doc_str.rb69
8 files changed, 143 insertions, 25 deletions
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4
index dcae4ada..ff63d83d 100644
--- a/data/doc/sisu/CHANGELOG_v4
+++ b/data/doc/sisu/CHANGELOG_v4
@@ -34,6 +34,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.2.8.orig.tar.xz
(used e.g. for mind map type output (last for kdissert output, no longer
supported))
+* dal, collapsed levels implemented
+ convenience, collapse sisu's dual level document structure for output of
+ markup with straight linear structure
+
%% 4.2.7.orig.tar.xz (2013-10-17:41/4)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.7
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.7-1
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index 7f3db7f0..3dd84b85 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -36,6 +36,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.21.orig.tar.xz
(used e.g. for mind map type output (last for kdissert output, no longer
supported))
+* dal, collapsed levels implemented
+ convenience, collapse sisu's dual level document structure for output of
+ markup with straight linear structure
+
%% 5.0.20.orig.tar.xz (2013-10-17:41/4)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.20
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.20-1
diff --git a/lib/sisu/v4/dal.rb b/lib/sisu/v4/dal.rb
index ca2429b1..839e4c9a 100644
--- a/lib/sisu/v4/dal.rb
+++ b/lib/sisu/v4/dal.rb
@@ -290,6 +290,25 @@ module SiSU_DAL
SiSU_Screen::Ansi.new(@opt.cmd,"dal -> #{cf.meta}").txt_grey if @opt.cmd =~/M/
end
dal.each {|s| dal_array << s}
+ if @opt.cmd =~/M/
+ dal_array.each do |obj|
+ if defined? obj.parent
+ if defined? obj.ln
+ if defined? obj.node
+ puts %{#{obj.ln}: #{obj.ocn} : #{obj.parent} : #{obj.node} - #{obj.lc}}
+ else
+ puts %{#{obj.ln}: #{obj.ocn} : #{obj.parent}}
+ end
+ else
+ if defined? obj.node
+ puts %{ #{obj.ocn} : #{obj.parent} : #{obj.node} - #{obj.lc}}
+ else
+ puts %{ #{obj.ocn} : #{obj.parent}}
+ end
+ end
+ end
+ end
+ end
dal_array
end
def read_fnm
diff --git a/lib/sisu/v4/dal_doc_objects.rb b/lib/sisu/v4/dal_doc_objects.rb
index 8fdd8068..0561b363 100644
--- a/lib/sisu/v4/dal_doc_objects.rb
+++ b/lib/sisu/v4/dal_doc_objects.rb
@@ -99,10 +99,10 @@ module SiSU_DAL_DocumentStructure
end
end
class ObjectHeading
- attr_accessor :obj,:is,:tags,:of,:lv,:ln,:toc_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp
+ attr_accessor :obj,:is,:tags,:of,:lv,:ln,:lc,:toc_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp
def initialize
@of=:para
- @is=@obj=@lv=@ln=@toc_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil
+ @is=@obj=@lv=@ln=@lc=@toc_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil
@tags=[]
end
def heading_ln(lv)
@@ -152,6 +152,7 @@ module SiSU_DAL_DocumentStructure
parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
+ lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure)
toc_= h[:toc_] || ((defined? o.toc_) ? o.toc_ : false) #Bool, do not include in toc, (relevant to headings)
ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
@@ -162,7 +163,7 @@ module SiSU_DAL_DocumentStructure
note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@lv,@ln,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@toc_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,name,tags,obj,idx,ocn,odv,osp,node,parent,toc_,ocn_,note_,autonum_,digest,tmp
+ @of,@is,@lv,@ln,@lc,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@toc_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,lc,name,tags,obj,idx,ocn,odv,osp,node,parent,toc_,ocn_,note_,autonum_,digest,tmp
self
end
def heading_insert(h,o=nil)
@@ -390,10 +391,10 @@ module SiSU_DAL_DocumentStructure
end
end
class ObjectStructure
- attr_accessor :obj,:tag,:node,:lv,:ln,:status,:is,:of,:tmp
+ attr_accessor :obj,:tag,:node,:lv,:ln,:lc,:status,:is,:of,:tmp
def initialize
@of=:structure
- @is=@obj=@node=@lv=@ln=@status=@tmp=nil
+ @is=@obj=@node=@lv=@ln=@lc=@status=@tmp=nil
end
def xml_dom(h,o=nil)
of= @of #String, classification - group
@@ -401,10 +402,11 @@ module SiSU_DAL_DocumentStructure
obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content
lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
+ lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure)
node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status open or close
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@status,@node,@lv,@ln,@tmp=of,is,obj,status,node,lv,ln,tmp
+ @of,@is,@obj,@status,@node,@lv,@ln,@lc,@tmp=of,is,obj,status,node,lv,ln,lc,tmp
self
end
end
diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb
index 552163a2..8a177569 100644
--- a/lib/sisu/v4/dal_doc_str.rb
+++ b/lib/sisu/v4/dal_doc_str.rb
@@ -802,6 +802,7 @@ module SiSU_DAL_DocumentStructureExtract
node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnu=0 # h heading, o other, t table, g group, i image
regex_exclude_ocn_and_node = /#{Rx[:meta]}|^@\S+?:\s|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^\^~ |<:e[:_]\d+?>|^<:\#|<:- |<[:!]!4|<hr width|#{Mx[:br_endnotes]}|\A\s*\Z/mi #ocn here #&nbsp; added with Tune.code #¡
parent=node1=node2=node3=node4=node5=node6=nil
+ @collapsed_lv1=1
data.each do |dob|
h={}
if (dob.obj !~ regex_exclude_ocn_and_node || dob.is==:code) \
@@ -839,81 +840,103 @@ module SiSU_DAL_DocumentStructureExtract
if ln==1 \
or ln=~@md.lv1; ocnh1+=1 #heading
node1="1:#{ocnh1};#{ocn}"
+ @collapsed_lv1=1
+ collapsed_level=@collapsed_lv1
node,ocn_sp,parent=node1,"h#{ocnh}",0 #FIX
elsif ln==2 \
or ln=~@md.lv2; ocnh2+=1
node2="2:#{ocnh2};#{ocn}"
parent=if node1
+ @collapsed_lv2=@collapsed_lv1+1
node1
else
0
end
+ collapsed_level=@collapsed_lv2
node,ocn_sp=node2,"h#{ocnh}"
elsif ln==3 \
or ln=~@md.lv3; ocnh3+=1
node3="3:#{ocnh3};#{ocn}"
parent=if node2
+ @collapsed_lv3=@collapsed_lv2+1
node2
elsif node1
puts "warning, incorrect parent or node level, parent is :A~ parent should be :B~ else this node should be :B~ rather than :C~" unless @md.opt.cmd=~/q/
+ @collapsed_lv3=@collapsed_lv1+1
node1
else
puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
0
end
+ collapsed_level=@collapsed_lv3
node,ocn_sp=node3,"h#{ocnh}"
elsif ln==4 \
or ln=~@md.lv4; ocnh4+=1
node4="4:#{ocnh4};#{ocn}"
parent=if node3
+ @collapsed_lv4=@collapsed_lv3+1
node3
elsif node2
+ @collapsed_lv4=@collapsed_lv2+1
node2
elsif node1
+ @collapsed_lv4=@collapsed_lv1+1
node1
else
puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
0
end
+ collapsed_level=@collapsed_lv4
node,ocn_sp=node4,"h#{ocnh}"
elsif ln==5 \
or ln=~@md.lv5; ocnh5+=1
node5="5:#{ocnh5};#{ocn}"
parent=if node4
+ @collapsed_lv5=@collapsed_lv4+1
node4
elsif node3
puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ @collapsed_lv5=@collapsed_lv3+1
node3
elsif node2
puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ @collapsed_lv5=@collapsed_lv2+1
node2
elsif node1
puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ @collapsed_lv5=@collapsed_lv1+1
node1
else
0
end
+ collapsed_level=@collapsed_lv5
node,ocn_sp=node5,"h#{ocnh}"
elsif ln==6 \
or ln=~@md.lv6; ocnh6+=1
node6="6:#{ocnh6};#{ocn}"
parent=if node5
+ @collapsed_lv6=@collapsed_lv5+1
node5
elsif node4
puts "warning, incorrect parent or node level, parent is 4~ parent should be 5~ else this node should be 5~ rather than 6~" unless @md.opt.cmd=~/q/
+ @collapsed_lv6=@collapsed_lv4+1
node4
elsif node3
puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ @collapsed_lv6=@collapsed_lv3+1
node3
elsif node2
puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ @collapsed_lv6=@collapsed_lv2+1
node2
elsif node1
puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ @collapsed_lv6=@collapsed_lv1+1
node1
else
0
end
+ collapsed_level=@collapsed_lv6
node,ocn_sp=node6,"h#{ocnh}"
end
else
@@ -938,7 +961,7 @@ module SiSU_DAL_DocumentStructureExtract
end
end
if dob.is==:heading
- dob.ln,dob.node,dob.ocn,dob.odv,dob.osp,dob.parent=ln,node,ocn,ocn_dv,ocn_sp,parent
+ dob.ln,dob.node,dob.ocn,dob.odv,dob.osp,dob.parent,dob.lc=ln,node,ocn,ocn_dv,ocn_sp,parent,collapsed_level
else
if dob.of !=:meta \
&& dob.of !=:comment \
diff --git a/lib/sisu/v5/dal.rb b/lib/sisu/v5/dal.rb
index 0c245599..fb8a19ae 100644
--- a/lib/sisu/v5/dal.rb
+++ b/lib/sisu/v5/dal.rb
@@ -298,6 +298,25 @@ module SiSU_DAL
end
end
dal.each {|s| dal_array << s}
+ if @opt.act[:maintenance][:set]==:on
+ dal_array.each do |obj|
+ if defined? obj.parent
+ if defined? obj.ln
+ if defined? obj.node
+ puts %{#{obj.ln}: #{obj.ocn} : #{obj.parent} : #{obj.node} - #{obj.lc}}
+ else
+ puts %{#{obj.ln}: #{obj.ocn} : #{obj.parent}}
+ end
+ else
+ if defined? obj.node
+ puts %{ #{obj.ocn} : #{obj.parent} : #{obj.node} - #{obj.lc}}
+ else
+ puts %{ #{obj.ocn} : #{obj.parent}}
+ end
+ end
+ end
+ end
+ end
dal_array
end
def read_fnm
diff --git a/lib/sisu/v5/dal_doc_objects.rb b/lib/sisu/v5/dal_doc_objects.rb
index b2be6105..518535b0 100644
--- a/lib/sisu/v5/dal_doc_objects.rb
+++ b/lib/sisu/v5/dal_doc_objects.rb
@@ -99,10 +99,10 @@ module SiSU_DAL_DocumentStructure
end
end
class ObjectHeading
- attr_accessor :obj,:is,:tags,:of,:lv,:ln,:toc_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp
+ attr_accessor :obj,:is,:tags,:of,:lv,:ln,:lc,:toc_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp
def initialize
@of=:para
- @is=@obj=@lv=@ln=@toc_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil
+ @is=@obj=@lv=@ln=@lc=@toc_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil
@tags=[]
end
def heading_ln(lv)
@@ -152,6 +152,7 @@ module SiSU_DAL_DocumentStructure
parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
+ lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure)
toc_= h[:toc_] || ((defined? o.toc_) ? o.toc_ : false) #Bool, do not include in toc, (relevant to headings)
ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
@@ -162,7 +163,7 @@ module SiSU_DAL_DocumentStructure
note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@lv,@ln,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@toc_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,name,tags,obj,idx,ocn,odv,osp,node,parent,toc_,ocn_,note_,autonum_,digest,tmp
+ @of,@is,@lv,@ln,@lc,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@toc_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,lc,name,tags,obj,idx,ocn,odv,osp,node,parent,toc_,ocn_,note_,autonum_,digest,tmp
self
end
def heading_insert(h,o=nil)
@@ -390,10 +391,10 @@ module SiSU_DAL_DocumentStructure
end
end
class ObjectStructure
- attr_accessor :obj,:tag,:node,:lv,:ln,:status,:is,:of,:tmp
+ attr_accessor :obj,:tag,:node,:lv,:ln,:lc,:status,:is,:of,:tmp
def initialize
@of=:structure
- @is=@obj=@node=@lv=@ln=@status=@tmp=nil
+ @is=@obj=@node=@lv=@ln=@lc=@status=@tmp=nil
end
def xml_dom(h,o=nil)
of= @of #String, classification - group
@@ -401,10 +402,11 @@ module SiSU_DAL_DocumentStructure
obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content
lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
+ lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure)
node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status open or close
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@status,@node,@lv,@ln,@tmp=of,is,obj,status,node,lv,ln,tmp
+ @of,@is,@obj,@status,@node,@lv,@ln,@lc,@tmp=of,is,obj,status,node,lv,ln,lc,tmp
self
end
end
diff --git a/lib/sisu/v5/dal_doc_str.rb b/lib/sisu/v5/dal_doc_str.rb
index dbdab139..edf826de 100644
--- a/lib/sisu/v5/dal_doc_str.rb
+++ b/lib/sisu/v5/dal_doc_str.rb
@@ -802,6 +802,7 @@ module SiSU_DAL_DocumentStructureExtract
node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnu=0 # h heading, o other, t table, g group, i image
regex_exclude_ocn_and_node = /#{Rx[:meta]}|^@\S+?:\s|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^\^~ |<:e[:_]\d+?>|^<:\#|<:- |<[:!]!4|<hr width|#{Mx[:br_endnotes]}|\A\s*\Z/mi #ocn here #&nbsp; added with Tune.code #¡
parent=node1=node2=node3=node4=node5=node6=nil
+ @collapsed_lv1=1
data.each do |dob|
h={}
if (dob.obj !~ regex_exclude_ocn_and_node || dob.is==:code) \
@@ -839,81 +840,123 @@ module SiSU_DAL_DocumentStructureExtract
if ln==1 \
or ln=~@md.lv1; ocnh1+=1 #heading
node1="1:#{ocnh1};#{ocn}"
+ @collapsed_lv1=1
+ collapsed_level=@collapsed_lv1
node,ocn_sp,parent=node1,"h#{ocnh}",0 #FIX
elsif ln==2 \
or ln=~@md.lv2; ocnh2+=1
node2="2:#{ocnh2};#{ocn}"
parent=if node1
+ @collapsed_lv2=@collapsed_lv1+1
node1
else
0
end
+ collapsed_level=@collapsed_lv2
node,ocn_sp=node2,"h#{ocnh}"
elsif ln==3 \
or ln=~@md.lv3; ocnh3+=1
node3="3:#{ocnh3};#{ocn}"
parent=if node2
+ @collapsed_lv3=@collapsed_lv2+1
node2
elsif node1
- puts "warning, incorrect parent or node level, parent is :A~ parent should be :B~ else this node should be :B~ rather than :C~" unless @md.opt.act[:quiet][:set]==:on
+ unless @md.opt.act[:quiet][:set]==:on
+ puts "warning, incorrect parent or node level, parent is :A~ parent should be :B~ else this node should be :B~ rather than :C~"
+ end
+ @collapsed_lv3=@collapsed_lv1+1
node1
else
- puts "warning, incorrect node and or parent level" unless @md.opt.act[:quiet][:set]==:on
+ unless @md.opt.act[:quiet][:set]==:on
+ puts "warning, incorrect node and or parent level"
+ end
0
end
+ collapsed_level=@collapsed_lv3
node,ocn_sp=node3,"h#{ocnh}"
elsif ln==4 \
or ln=~@md.lv4; ocnh4+=1
node4="4:#{ocnh4};#{ocn}"
parent=if node3
+ @collapsed_lv4=@collapsed_lv3+1
node3
elsif node2
+ @collapsed_lv4=@collapsed_lv2+1
node2
elsif node1
+ @collapsed_lv4=@collapsed_lv1+1
node1
else
- puts "warning, incorrect node and or parent level" unless @md.opt.act[:quiet][:set]==:on
+ unless @md.opt.act[:quiet][:set]==:on
+ puts "warning, incorrect node and or parent level"
+ end
0
end
+ collapsed_level=@collapsed_lv4
node,ocn_sp=node4,"h#{ocnh}"
elsif ln==5 \
or ln=~@md.lv5; ocnh5+=1
node5="5:#{ocnh5};#{ocn}"
parent=if node4
+ @collapsed_lv5=@collapsed_lv4+1
node4
elsif node3
- puts "warning, incorrect node and or parent level" unless @md.opt.act[:quiet][:set]==:on
+ unless @md.opt.act[:quiet][:set]==:on
+ puts "warning, incorrect node and or parent level"
+ end
+ @collapsed_lv5=@collapsed_lv3+1
node3
elsif node2
- puts "warning, incorrect node and or parent level" unless @md.opt.act[:quiet][:set]==:on
+ unless @md.opt.act[:quiet][:set]==:on
+ puts "warning, incorrect node and or parent level"
+ end
+ @collapsed_lv5=@collapsed_lv2+1
node2
elsif node1
- puts "warning, incorrect node and or parent level" unless @md.opt.act[:quiet][:set]==:on
+ unless @md.opt.act[:quiet][:set]==:on
+ puts "warning, incorrect node and or parent level"
+ end
+ @collapsed_lv5=@collapsed_lv1+1
node1
else
0
end
+ collapsed_level=@collapsed_lv5
node,ocn_sp=node5,"h#{ocnh}"
elsif ln==6 \
or ln=~@md.lv6; ocnh6+=1
node6="6:#{ocnh6};#{ocn}"
parent=if node5
+ @collapsed_lv6=@collapsed_lv5+1
node5
elsif node4
- puts "warning, incorrect parent or node level, parent is 4~ parent should be 5~ else this node should be 5~ rather than 6~" unless @md.opt.act[:quiet][:set]==:on
+ unless @md.opt.act[:quiet][:set]==:on
+ puts "warning, incorrect parent or node level, parent is 4~ parent should be 5~ else this node should be 5~ rather than 6~"
+ end
+ @collapsed_lv6=@collapsed_lv4+1
node4
elsif node3
- puts "warning, incorrect node and or parent level" unless @md.opt.act[:quiet][:set]==:on
+ unless @md.opt.act[:quiet][:set]==:on
+ puts "warning, incorrect node and or parent level"
+ end
+ @collapsed_lv6=@collapsed_lv3+1
node3
elsif node2
- puts "warning, incorrect node and or parent level" unless @md.opt.act[:quiet][:set]==:on
+ unless @md.opt.act[:quiet][:set]==:on
+ puts "warning, incorrect node and or parent level"
+ end
+ @collapsed_lv6=@collapsed_lv2+1
node2
elsif node1
- puts "warning, incorrect node and or parent level" unless @md.opt.act[:quiet][:set]==:on
+ unless @md.opt.act[:quiet][:set]==:on
+ puts "warning, incorrect node and or parent level"
+ end
+ @collapsed_lv6=@collapsed_lv1+1
node1
else
0
end
+ collapsed_level=@collapsed_lv6
node,ocn_sp=node6,"h#{ocnh}"
end
else
@@ -938,7 +981,7 @@ module SiSU_DAL_DocumentStructureExtract
end
end
if dob.is==:heading
- dob.ln,dob.node,dob.ocn,dob.odv,dob.osp,dob.parent=ln,node,ocn,ocn_dv,ocn_sp,parent
+ dob.ln,dob.node,dob.ocn,dob.odv,dob.osp,dob.parent,dob.lc=ln,node,ocn,ocn_dv,ocn_sp,parent,collapsed_level
else
if dob.of !=:meta \
&& dob.of !=:comment \
@@ -1067,7 +1110,9 @@ module SiSU_DAL_DocumentStructureExtract
end
tuned_file << o
end
- puts_tag_close(0,hs) if @md.opt.act[:verbose_plus][:set]==:on
+ if @md.opt.act[:verbose_plus][:set]==:on
+ puts_tag_close(0,hs)
+ end
tuned_file << tag_close(0,hs)
tuned_file=tuned_file.flatten
end