From 7432be8dad0ea16d001c9b244b141338c14b4883 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 2 Jul 2007 11:33:44 +0100 Subject: * dal, auto-numbering (minor) fix for segments/headings * cosmetic fixes, * screen output of project name * screen output when generating tex pdf * debian documents skins * html indent levels, regular and bulleted text --- lib/sisu/v0/dal.rb | 66 +++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'lib/sisu/v0/dal.rb') 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~ -- cgit v1.2.3