diff options
author | Ralph Amissah <ralph@amissah.com> | 2012-01-23 21:52:37 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2012-01-23 21:52:37 -0500 |
commit | dc5c01b1033cfc9e09fd4fc29666e826e67cd7bb (patch) | |
tree | e53a389c4f669d79b5b82ce6fd1853da6b25f85d /lib/sisu/v3dv/dal_hash_digest.rb | |
parent | debian/changelog (3.1.11-1) (diff) | |
parent | v3dv: replace use of most ruby exclamation (!) method actions (diff) |
Merge commit 'sisu_3.1.12' into debian/sid
Diffstat (limited to 'lib/sisu/v3dv/dal_hash_digest.rb')
-rw-r--r-- | lib/sisu/v3dv/dal_hash_digest.rb | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/sisu/v3dv/dal_hash_digest.rb b/lib/sisu/v3dv/dal_hash_digest.rb index 8353b5a0..40f81197 100644 --- a/lib/sisu/v3dv/dal_hash_digest.rb +++ b/lib/sisu/v3dv/dal_hash_digest.rb @@ -68,14 +68,13 @@ module SiSU_DAL_Hash # 2. endnotes clean/stripped text digest only (there may be several endnotes within a paragraph) # 3. whole object, text with markup and any endnotes, (question: with or without the endnote digests??? presumption better without, [however may be easier to check with?]) # [digests should not include other digests] - data=@data + data=@data.compact @tuned_file=[] - data.compact! sha_ =(@env.digest.type=='sha256' ? true : false) sha_ ? (require 'digest/sha2') : (require 'digest/md5') data.each do |t_o| unless t_o.obj.class==Array - t_o.obj.strip! + t_o.obj=t_o.obj.strip end if t_o.of !~/structure|comment|layout/ \ and t_o.ocn.class==Fixnum @@ -125,7 +124,7 @@ module SiSU_DAL_Hash case t_o.obj when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m en_and_t_o,en_and_t_o_digest=[],[] - t_o.obj.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch + t_o.obj=t_o.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch t_o_plus_en=t_o.obj.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m) t_o_tail=if t_o.obj =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+.*/m.match(t_o.obj)[1] @@ -144,11 +143,11 @@ module SiSU_DAL_Hash def strip_clean_extra_spaces(s) # dal output tuned s=s.dup s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ - s=s.gsub(/ [ ]+/,' ') - s=s.gsub(/^ [ ]+/,'') - s=s.gsub(/ [ ]+$/,'') - s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') - s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') + s=s.gsub(/ [ ]+/,' '). + gsub(/^ [ ]+/,''). + gsub(/ [ ]+$/,''). + gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2'). + gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') end end end |