aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4/dal_doc_str.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-10-23 23:46:55 -0400
committerRalph Amissah <ralph@amissah.com>2013-10-23 23:46:55 -0400
commitf7da57f46e69dd2fd0ac30eed917b82ea66217f9 (patch)
tree3f540c595852540a84afdc9af631a3faf6e8af5d /lib/sisu/v4/dal_doc_str.rb
parentv5: options & downstream, more use of opt.act instead of opt.cmd (diff)
v4 v5: dal, parent & node info, fix
* used e.g. for mind map type output (last for kdissert output, no longer supported)
Diffstat (limited to 'lib/sisu/v4/dal_doc_str.rb')
-rw-r--r--lib/sisu/v4/dal_doc_str.rb65
1 files changed, 60 insertions, 5 deletions
diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb
index e4a0be2b..552163a2 100644
--- a/lib/sisu/v4/dal_doc_str.rb
+++ b/lib/sisu/v4/dal_doc_str.rb
@@ -843,23 +843,78 @@ module SiSU_DAL_DocumentStructureExtract
elsif ln==2 \
or ln=~@md.lv2; ocnh2+=1
node2="2:#{ocnh2};#{ocn}"
- node,ocn_sp,parent=node2,"h#{ocnh}",node1
+ parent=if node1
+ node1
+ else
+ 0
+ end
+ node,ocn_sp=node2,"h#{ocnh}"
elsif ln==3 \
or ln=~@md.lv3; ocnh3+=1
node3="3:#{ocnh3};#{ocn}"
- node,ocn_sp,parent=node3,"h#{ocnh}",node2
+ parent=if node2
+ 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/
+ node1
+ else
+ puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ 0
+ end
+ node,ocn_sp=node3,"h#{ocnh}"
elsif ln==4 \
or ln=~@md.lv4; ocnh4+=1
node4="4:#{ocnh4};#{ocn}"
- node,ocn_sp,parent=node4,"h#{ocnh}",node3
+ parent=if node3
+ node3
+ elsif node2
+ node2
+ elsif node1
+ node1
+ else
+ puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ 0
+ end
+ node,ocn_sp=node4,"h#{ocnh}"
elsif ln==5 \
or ln=~@md.lv5; ocnh5+=1
node5="5:#{ocnh5};#{ocn}"
- node,ocn_sp,parent=node5,"h#{ocnh}",node4
+ parent=if node4
+ node4
+ elsif node3
+ puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ node3
+ elsif node2
+ puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ node2
+ elsif node1
+ puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ node1
+ else
+ 0
+ end
+ node,ocn_sp=node5,"h#{ocnh}"
elsif ln==6 \
or ln=~@md.lv6; ocnh6+=1
node6="6:#{ocnh6};#{ocn}"
- node,ocn_sp,parent=node6,"h#{ocnh}",node5
+ parent=if node5
+ 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/
+ node4
+ elsif node3
+ puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ node3
+ elsif node2
+ puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ node2
+ elsif node1
+ puts "warning, incorrect node and or parent level" unless @md.opt.cmd=~/q/
+ node1
+ else
+ 0
+ end
+ node,ocn_sp=node6,"h#{ocnh}"
end
else
ocno+=1