aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3dv/dal_numbering.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3dv/dal_numbering.rb')
-rw-r--r--lib/sisu/v3dv/dal_numbering.rb40
1 files changed, 23 insertions, 17 deletions
diff --git a/lib/sisu/v3dv/dal_numbering.rb b/lib/sisu/v3dv/dal_numbering.rb
index 332db4bf..f5a09ef6 100644
--- a/lib/sisu/v3dv/dal_numbering.rb
+++ b/lib/sisu/v3dv/dal_numbering.rb
@@ -77,8 +77,10 @@ module SiSU_DAL_Numbering
def number_plaintext_para(data)
@tuned_file=[]
data.each do |dob|
- if dob.of !~/(?:block|comment|layout)/ \
- and dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX
+ if (dob.of !=:block \
+ && dob.of !=:comment \
+ && dob.of !=:layout) \
+ && dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX
dob.obj=dob.obj.gsub(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks
end
unless dob.obj.class==Array
@@ -139,8 +141,8 @@ module SiSU_DAL_Numbering
data.each do |dob| #@md.seg_names << [additions to segment names]
title_no=nil
dob=SiSU_DAL_DocumentStructureExtract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require
- if dob.is =='heading' \
- and dob.autonum_ \
+ if dob.is ==:heading \
+ && dob.autonum_ \
and defined? @md.make.num_top \
and @md.make.num_top !~/^$/
if dob.lv=='1' \
@@ -206,7 +208,7 @@ module SiSU_DAL_Numbering
dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
dob.name.gsub(/^([a-z_\.]+)-$/,'\1')
end
- elsif dob.is =='heading' \
+ elsif dob.is ==:heading \
and dob.autonum_ \
and @md.markup =~/num_extract/ #AS DANGEROUS force enable with document, note already does this type of numbering for cisg, locate and coordinate logic, is currently misplaced in code, chengwei inspired 2004w23/4
#here lies a bug, as is nil when run from -Dv --update, FIX
@@ -240,11 +242,14 @@ module SiSU_DAL_Numbering
number_small,letter_small=0,0
letter=%w( a b c d e f g h i j k l m n o p q r s t u v w x y z )
data.each do |dob|
- if dob.of =~/heading|para|block/
- if dob.is =='heading' \
+ if dob.of ==:heading \
+ || dob.of ==:heading_insert \
+ || dob.of ==:para \
+ || dob.of ==:block
+ if dob.is ==:heading \
and dob.ln.to_s=~/^[1-9]/ #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later)
number_small,letter_small=0,0
- elsif dob.is =~/para/
+ elsif dob.is ==:para
if dob.obj =~/^#[ 1]/ \
and dob.obj !~/^#\s+(?:~#)?$/
letter_small=0
@@ -286,8 +291,8 @@ module SiSU_DAL_Numbering
end
ocn_html_seg=[]
data.each do |dob|
- if dob.is=='heading' \
- and dob.ln \
+ if dob.is==:heading \
+ && dob.ln \
and dob.ln.to_s =~/^[456]/
if dob.ln==4 \
and not dob.name \
@@ -333,12 +338,13 @@ module SiSU_DAL_Numbering
puts "e r r o r -\t#{__FILE__}::#{__LINE__}\n#{dob.inspect}"
end
end
- if dob.is =~/heading/ \
- and dob.ln==4
+ if (dob.is ==:heading \
+ || dob.is ==:heading_insert) \
+ && dob.ln==4
@seg=dob.name
end
- @tuned_file << if dob.is=='heading' \
- and (@md.pagenew or @md.pagebreak)
+ @tuned_file << if dob.is==:heading \
+ && (@md.pagenew || @md.pagebreak)
m=dob.ln.to_s
dob_tmp=[]
if @md.pagenew.inspect =~/#{m}/
@@ -353,11 +359,11 @@ module SiSU_DAL_Numbering
end
if defined? dob.ocn \
and dob.ocn
- @segname=((dob.is=='heading'|| dob.is=='heading_insert') && dob.ln==4 && (defined? dob.name)) \
+ @segname=((dob.is==:heading || dob.is==:heading_insert) && dob.ln==4 && (defined? dob.name)) \
? (dob.name)
: @segname
tags["#{dob.ocn}"]={ segname: @segname }
- ocn_html_seg[dob.ocn]=if dob.is =~/heading/
+ ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert)
x=if dob.ln =~/[1-3]/
{ seg: nil, level: dob.ln }
else #elsif dob.ln =~/[4-6]/
@@ -428,7 +434,7 @@ module SiSU_DAL_Numbering
unless @md.set_heading_seg
if defined? dob.ln and dob.ln.to_s !~/^[123]/m \
and dob.obj !~/\A\s*\Z/m \
- and dob.is !='layout'
+ and dob.is !=:layout
@md.set_heading_seg=true
head=if @md.title.main ; dob.ln,dob.name,dob.obj=4,'seg',@md.title.main
else dob.ln,dob.name,dob.obj=4,'seg','[segment]'