From dc0648fefb0f43e6432d55d05416a1b38bafeb95 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 10 May 2008 01:38:12 -0400 Subject: addition of a couple of multiline search tags, and minor rearrangement --- lib/sisu/v0/dal.rb | 10 +++++----- lib/sisu/v0/dal_doc_str.rb | 14 ++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 577c3b9e..c5a07f9c 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -663,7 +663,7 @@ module SiSU_DAL @tuned_file=[] object_array=SiSU_document_structure::OCN.new(@md,data).ocn object_array.each do |o| - @tuned_file <<= if o.ocn; "#{o.txt} <~#{o.ocn};#{o.lv};#{o.type}>" + @tuned_file <<= if o.ocn; "#{o.txt} <~#{o.ocn};#{o.lv};#{o.type}>" #main ocn descriptor else o.txt end end @@ -1112,10 +1112,10 @@ module SiSU_DAL if en_plus =~/~\{.+?\}~|~\[.+?\]~/ para_txt,en_open,en_txt,en_close=/(.*?)(~\{|~\[)(.+?)(\}~|\]~)/m.match(en_plus)[1..4] stripped_en=strip_clean_of_markup(en_txt) - if @env.digest.type =~/sha256/ - digest_en_strip=Digest::SHA256.hexdigest(stripped_en) + digest_en_strip=if @env.digest.type =~/sha256/ + Digest::SHA256.hexdigest(stripped_en) else - digest_en_strip=Digest::MD5.hexdigest(stripped_en) + Digest::MD5.hexdigest(stripped_en) end para_txt + en_open + en_txt + '<' + digest_en_strip + '>' + en_close else puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up @@ -1136,7 +1136,7 @@ module SiSU_DAL def strip_clean_of_markup(s) # used for digest, define rules, make same as in db clean #consider: <\/?[ib]>|<(?:\/ )?br>|(.+?)<\/del> s=s.dup - s=s.gsub(/(?:<\/?[ib]>|<~\d+;(?:\w|[0-6]:)\d+;\w\d+>|<#@dp:#@dp>|^[1-6]~\S+|~\{\d+\s.+?\}~)/,'') # markup and endnotes removed + s=s.gsub(/(?:<\/?[ib]>|<~\d+;(?:\w|[0-6]:)\d+;\w\d+>|<#@dp:#@dp>|^[1-6]~\S+|~\{\d+\s.+?\}~)/m,'') # markup and endnotes removed #% same as db clean --> s=s.gsub(/(.+?)<\/del>/,'DELETED(\1)') # deletions s=s.gsub(/(\d+)<\/sup>/,'[\1]') diff --git a/lib/sisu/v0/dal_doc_str.rb b/lib/sisu/v0/dal_doc_str.rb index 27e37826..ebaa8625 100644 --- a/lib/sisu/v0/dal_doc_str.rb +++ b/lib/sisu/v0/dal_doc_str.rb @@ -142,8 +142,6 @@ module SiSU_document_structure data=@data @o_array=[] node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnm=ocnu=ocnk=0 # h heading, o other, t table, g group, i image - 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 ) node_count_flag=false headings='' #where headings omitted an alternative form of ocn heading numbering is required for html and other linking... #headings=if @md.ocn.inspect =~/skip=headings/; '^(?:[A-C]|[1-9])~\S* |' @@ -173,7 +171,7 @@ module SiSU_document_structure ocnh+=1 if para=~/^1~(?:\s+|\S)/ \ or para =~@md.lv1 - ocnh1+=1 + ocnh1+=1 #heading ocn_dv,ocn_sp="1:#{ocnh1}","h#{ocnh}" elsif para=~/^2~(?:\s+|\S)/ \ or para =~@md.lv2; ocnh2+=1 @@ -193,15 +191,15 @@ module SiSU_document_structure end else ocno+=1 - if para=~//; ocnt+=1 #tables + if para=~//; ocnt+=1 #table ocn_dv,ocn_sp="o#{ocno}","t#{ocnt}" - elsif para=~/^<:code>/; ocnc+=1 + elsif para=~/^<:code>/; ocnc+=1 #code block ocn_dv,ocn_sp="o#{ocno}","c#{ocnc}" - elsif para=~/^<:(?:group|alt|verse)>/; ocng+=1 + elsif para=~/^<:(?:group|alt|verse)>/; ocng+=1 #group, poem ocn_dv,ocn_sp="o#{ocno}","g#{ocng}" - elsif para=~/\{\S+?\.(?:png|jpg|gif)\s+/m; ocni+=1 + elsif para=~/\{\S+?\.(?:png|jpg|gif)\s+/m; ocni+=1 #image ocn_dv,ocn_sp="o#{ocno}","i#{ocni}" - else ocnp+=1 + else ocnp+=1 #paragraph ocn_dv,ocn_sp="o#{ocno}","p#{ocnp}" end end -- cgit v1.2.3