aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/dal.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-07-02 17:11:19 +0100
committerRalph Amissah <ralph@amissah.com>2007-07-02 17:11:19 +0100
commitfe185e84173ddce19bb171fb32e84459acfd5ca4 (patch)
tree1fc2a1017b2784c84ce5433fc4def3897aabb521 /lib/sisu/v0/dal.rb
parentrenamed debian constitution files with default markup, removed '.default' fro... (diff)
minor fixes to go
Diffstat (limited to 'lib/sisu/v0/dal.rb')
-rw-r--r--lib/sisu/v0/dal.rb66
1 files changed, 33 insertions, 33 deletions
diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb
index a70d1880..8880ca9d 100644
--- a/lib/sisu/v0/dal.rb
+++ b/lib/sisu/v0/dal.rb
@@ -516,7 +516,9 @@ module SiSU_DAL
when /^#{num}~#\s*/; para.gsub!(/^#{num}~#\s*/,"#{title_no} ")
when /^#{num}~[a-z_\.]+ /
para.gsub!(/^#{num}~([a-z_\.]+)\s+(.+)/i,%{#{num}~\\1 #{title_no} \\2 <:name##{title_no}>})
- else para.gsub!(/^#{num}~ /,"#{num}~#{title_no} #{title_no} ") #main
+ when /^#{num}~\s+#{title_no}/
+ para.gsub!(/^#{num}~ /,"#{num}~#{title_no} ") #where title contains title number
+ else para.gsub!(/^#{num}~ /,"#{num}~#{title_no} #{title_no} ") #main, where title number is to be provided
end
if @md.toc_lev_limit and @md.toc_lev_limit < num
para.gsub!(/^[5-8]~(?:~\S+)?\s*/,'!_ ')
@@ -649,41 +651,39 @@ module SiSU_DAL
puts 'manual segment names, numbers used as names, risk warning (segmented html)' if not @md.seg_autoname_safe and @md.cmd =~/[MV]/
data.each do |para|
para=SiSU_document_structure::Structure.new(@md,para).structure_markup
- if para !~/^0~/
- if para =~/^[456]~ /
- if para=~/^4/ and not @md.set_heading_seg
- @md.set_heading_seg=true
- end
- if para =~/^[456]~(?:\s\S+)?\s+([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name
- pattern=$1
- pattern.gsub!(/(?:[:,-]|\W)/,'.')
- pattern.gsub!(/\.$/,'')
- if not @md.seg_names.nil? and not @md.seg_names.include?(pattern)
- para.gsub!(/^([456])~\s*/,"\\1~#{pattern} ")
- @md.seg_names << pattern
- else puts 'warn, there may be a conflicting numbering scheme' if @md.cmd =~/[VM]/
- end
+ if para =~/^[456]~ /
+ if para=~/^4/ and not @md.set_heading_seg
+ @md.set_heading_seg=true
+ end
+ if para =~/^[456]~(?:\s\S+)?\s+([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name
+ pattern=$1
+ pattern.gsub!(/(?:[:,-]|\W)/,'.')
+ pattern.gsub!(/\.$/,'')
+ if not @md.seg_names.nil? and not @md.seg_names.include?(pattern)
+ para.gsub!(/^([456])~\s*/,"\\1~#{pattern} ")
+ @md.seg_names << pattern
+ else puts 'warn, there may be a conflicting numbering scheme' if @md.cmd =~/[VM]/
end
- if para =~/^4~\s.+?;4:(\d+);/m #extract segment name from embedded document structure info
- pattern=$1
- pattern.gsub!(/(?:[:,-]|\W)/,'.')
- pattern.gsub!(/\.$/,'')
- if not @md.seg_names.nil? and not @md.seg_names.include?(pattern)
- para.gsub!(/^(4)~\s*/,"\\1~#{pattern} ")
- @md.seg_names << pattern
- else
- para.gsub!(/^(4)~\s*/,"\\1~~#{pattern} ")
- @md.seg_names << "~#{pattern}"
- end
+ end
+ if para =~/^4~\s.+?;4:(\d+);/m #extract segment name from embedded document structure info
+ pattern=$1
+ pattern.gsub!(/(?:[:,-]|\W)/,'.')
+ pattern.gsub!(/\.$/,'')
+ if not @md.seg_names.nil? and not @md.seg_names.include?(pattern)
+ para.gsub!(/^(4)~\s*/,"\\1~#{pattern} ")
+ @md.seg_names << pattern
+ else
+ para.gsub!(/^(4)~\s*/,"\\1~~#{pattern} ")
+ @md.seg_names << "~#{pattern}"
end
- if para =~/^4~\s+/ #if still not segment name, provide a numerical one
- if not @md.seg_names.nil? and not @md.seg_names.include?(art_filename_auto)
- para.gsub!(/^4~\s+/,%{4~_#{art_filename_auto} })
- @md.seg_names << art_filename_auto
- else puts 'segment name (numbering) error'
- end
- art_filename_auto+=1
+ end
+ if para =~/^4~\s+/ #if still not segment name, provide a numerical one
+ if not @md.seg_names.nil? and not @md.seg_names.include?(art_filename_auto)
+ para.gsub!(/^4~\s+/,%{4~_#{art_filename_auto} })
+ @md.seg_names << art_filename_auto
+ else puts 'segment name (numbering) error'
end
+ art_filename_auto+=1
end
end
@tuned_file << if para =~/^([1-6])~/m and (@md.pagenew or @md.pagebreak); m=$1 #watch ref~