aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/digests.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/digests.rb')
-rw-r--r--lib/sisu/v5/digests.rb70
1 files changed, 46 insertions, 24 deletions
diff --git a/lib/sisu/v5/digests.rb b/lib/sisu/v5/digests.rb
index b3dd40bd..6cea7c3e 100644
--- a/lib/sisu/v5/digests.rb
+++ b/lib/sisu/v5/digests.rb
@@ -108,9 +108,14 @@ module SiSU_DigestView
private
class Scroll <Source
@@dl=nil
- @@ds={}
- @@description,@@ds[:digests],@@ds[:tree],@@ds[:summary],@@sc_info=[],[],[],[],[]
- def initialize(particulars) #data='',md='')
+ @@ds={
+ digests_clean: [],
+ digests_with_markup: [],
+ tree: [],
+ summary: [],
+ }
+ @@description,@@sc_info=[],[]
+ def initialize(particulars)
@particulars=particulars
@data,@env,@md=@particulars.ao_array,@particulars.env,@particulars.md
SiSU_Env::FileOp.new(@md).mkdir
@@ -123,7 +128,7 @@ module SiSU_DigestView
@sp=' '
end
def songsheet
- @@description,@@ds[:digests],@@ds[:tree],@@ds[:summary],@@sc_info=[],[],[],[],[]
+ @@description,@@ds[:digests_clean],@@ds[:digests_with_markup],@@ds[:tree],@@ds[:summary],@@sc_info=[],[],[],[],[],[]
message_digest
ao_structure
supplementary
@@ -133,9 +138,13 @@ module SiSU_DigestView
puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on
@@description << f << e
end
- def digests(f,e='')
+ def digests_clean(f,e='')
puts f if @md.opt.act[:verbose_plus][:set]==:on
- @@ds[:digests] << f + "\n"
+ @@ds[:digests_clean] << f + "\n"
+ end
+ def digests_with_markup(f)
+ puts f if @md.opt.act[:verbose_plus][:set]==:on
+ @@ds[:digests_with_markup] << f + "\n"
end
def ao_structure_tree(f,e='')
puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on
@@ -152,14 +161,15 @@ module SiSU_DigestView
def output
file=SiSU_Env::FileOp.new(@md)
filename_digest=file.write_file.hash_digest
- filename_digest << @@description.join << @@ds[:digests].join << @@ds[:tree].join << @@ds[:summary].join << @@sc_info.join
+ filename_digest << @@description.join << @@ds[:digests_clean].join << @@ds[:digests_with_markup].join << @@ds[:tree].join << @@ds[:summary].join << @@sc_info.join
end
def rgx_txt(txt)
txt=txt.gsub(/([()])/,"\\\\\\1")
end
def message_digest
+ @p=[]
+ @g,@v,@r='','',''
manifest="#{@env.url.root}/#{@md.fnb}/sisu_manifest.html"
- a=%{ocn digest clean (no markup/notes),#{@sp*33}digest all (includes markup & endnotes)\n}
description("#{@md.title.full}\n")
description("#{@md.author}\n")
description("#{@md.fns}\n")
@@ -171,39 +181,51 @@ module SiSU_DigestView
description("Sourcefile digest: #{@md.dgst[1]}\n")
description(" source filename: #{@md.fns}\n")
description("available outputs: #{manifest}\n")
- #description(" time generated: #{@g}\n")
- #description(" SiSU version used: #{@v}\n")
- #description(" Ruby version used: #{@r}\n")
description("------------\n")
description("Document Digests\n")
- description(a)
end
def ao_structure
+ a=%{\nocn digests (#{@dg}) clean text (stripped markup)}
+ digests_clean(a)
data=@data
endnotes=nil
data.each do |t_o|
dgst=SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst
if dgst
if t_o.is==:heading
- digests("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}")
+ digests_clean("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:is]} #{t_o.lv}")
elsif t_o.is==:heading_insert
- digests("#{@sp*0}[#{dgst[:ocn]}]#{@sp*(6-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}")
+ digests_clean("#{@sp*0}[#{dgst[:ocn]}]#{@sp*(6-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:is]} #{t_o.lv}")
else
- digests("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]}")
+ digests_clean("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:is]}")
if dgst[:images]
dgst[:images].each do |img|
- digests("#{@sp*8}#{img[:img_dgst]}#{@sp*66}#{img[:img_type]} #{img[:img_name]}")
+ digests_clean("#{@sp*8}#{img[:img_dgst]}#{@sp*66}#{img[:img_type]} #{img[:img_name]}")
end
end
end
if dgst[:endnotes]
dgst[:endnotes].each do |en|
- digests("#{@sp*8}#{en[:note_dgst]}#{@sp*66}note [#{en[:note_number]}]")
+ digests_clean("#{@sp*8}#{en[:note_dgst]} note [#{en[:note_number]}]")
endnotes=en[:note_number]
end
end
end
end
+ b=%{\nocn object (#{@dg}) digests (object includes its markup & endnotes (if any))}
+ digests_with_markup(b)
+ data.each do |t_o|
+ dgst=SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst
+ if dgst
+ if t_o.is==:heading
+ digests_with_markup("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}")
+ elsif t_o.is==:heading_insert
+ digests_with_markup("#{@sp*0}[#{dgst[:ocn]}]#{@sp*(6-dgst[:ocn].to_s.length)}#{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}")
+ else
+ digests_with_markup("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_markedup_txt]} #{dgst[:is]}")
+ end
+ end
+ end
l=Hash.new(0)
ocn=nil
ao_structure_tree("------------\n")
@@ -211,19 +233,19 @@ module SiSU_DigestView
data.each do |t_o|
if t_o.is==:heading
x=case t_o.ln
- when 1 then l[0] +=1 #fix Mx[:lv_o]
+ when 0 then l[0] +=1
' '*0 << ':A'
- when 1 then l[1] +=1 #fix Mx[:lv_o]
+ when 1 then l[1] +=1
' '*1 << ':B'
- when 2 then l[2] +=1 #fix Mx[:lv_o]
+ when 2 then l[2] +=1
' '*2 << ':C'
- when 3 then l[3] +=1 #fix Mx[:lv_o]
+ when 3 then l[3] +=1
' '*3 << ':D'
- when 4 then l[4] +=1 #fix Mx[:lv_o]
+ when 4 then l[4] +=1
' '*4 << '1'
- when 5 then l[5] +=1 #fix Mx[:lv_o]
+ when 5 then l[5] +=1
' '*5 << '2'
- when 6 then l[6] +=1 #fix Mx[:lv_o]
+ when 6 then l[6] +=1
' '*6 << '3'
else nil
end