aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--data/doc/sisu/CHANGELOG_v53
-rw-r--r--lib/sisu/v5/ao_doc_objects.rb20
-rw-r--r--lib/sisu/v5/ao_doc_str.rb54
3 files changed, 46 insertions, 31 deletions
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index 38e16325..cb955c8f 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -33,6 +33,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.2.1.orig.tar.xz
sisu_5.2.1.orig.tar.xz
sisu_5.2.1-1.dsc
+* ao, add counter for various grouped / blocked texts & tables, of particular
+ use for poems which are broken into verse
+
* texinfo, fixes
* texpdf, report on pdf output, provide a working link to a generated file-size
diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb
index 70696d37..e711a7d8 100644
--- a/lib/sisu/v5/ao_doc_objects.rb
+++ b/lib/sisu/v5/ao_doc_objects.rb
@@ -253,9 +253,10 @@ module SiSU_AO_DocumentStructure
ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
+ num= h[:num] || ((defined? o.num) ? o.num : nil)
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,number_,note_,ocn_,digest,tmp
+ @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,number_,note_,ocn_,num,digest,tmp
self
end
def block(h,o=nil)
@@ -272,9 +273,10 @@ module SiSU_AO_DocumentStructure
ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
+ num= h[:num] || ((defined? o.num) ? o.num : nil)
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
+ @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp
self
end
def group(h,o=nil)
@@ -291,9 +293,10 @@ module SiSU_AO_DocumentStructure
ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
+ num= h[:num] || ((defined? o.num) ? o.num : nil)
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
+ @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp
self
end
def alt(h,o=nil) #see block
@@ -310,9 +313,10 @@ module SiSU_AO_DocumentStructure
ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
+ num= h[:num] || ((defined? o.num) ? o.num : nil)
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
+ @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp
self
end
def verse(h,o=nil) #part of poem decide how you deal with this
@@ -328,9 +332,10 @@ module SiSU_AO_DocumentStructure
ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
+ num= h[:num] || ((defined? o.num) ? o.num : nil)
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
+ @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp
@h=nil
self
end
@@ -339,7 +344,7 @@ module SiSU_AO_DocumentStructure
attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp
def initialize
@of=:block
- @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@digest=@tmp=nil
+ @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@num=@digest=@tmp=nil
@tags=[]
end
def table(h,o=nil)
@@ -359,9 +364,10 @@ module SiSU_AO_DocumentStructure
ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
+ num= h[:num] || ((defined? o.num) ? o.num : nil)
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@digest,@tmp=of,is,tags,cols,widths,obj,idx,ocn,odv,osp,parent,head_,note_,ocn_,digest,tmp
+ @of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,cols,widths,obj,idx,ocn,odv,osp,parent,head_,note_,ocn_,num,digest,tmp
self
end
end
diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb
index 31479252..f7168c26 100644
--- a/lib/sisu/v5/ao_doc_str.rb
+++ b/lib/sisu/v5/ao_doc_str.rb
@@ -222,7 +222,7 @@ module SiSU_AO_DocumentStructureExtract
def identify_parts
tuned_file=[]
@tuned_block,@tuned_code=[],[]
- @@counter,@verse_count=0,0
+ @@counter,@verse_count,@num_code_block,@num_poem,@num_group,@num_block,@num_alt,@num_table=0,0,0,0,0,0,0,0
@metadata={}
@data.each do |t_o|
if t_o =~/^--([+~-])[#]$/
@@ -408,7 +408,8 @@ module SiSU_AO_DocumentStructureExtract
end
@@counter=1
@codeblock_numbered=(t_o =~/^(?:code\{#|[`]{3}\s+code\s[#])/) ? true : false
- h={ obj: 'code block start' } #introduce a counter
+ @num_code_block +=1
+ h={ obj: "code block start #{@num_code_block}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif t_o =~/^(?:poem\{|[`]{3}\s+poem)/
@@flag[:poem]=case t_o
@@ -416,7 +417,8 @@ module SiSU_AO_DocumentStructureExtract
when /^[`]{3}\s+poem/ then :tics
else @@flag[:poem] #error
end
- h={ obj: 'poem start' } #introduce a counter
+ @num_poem +=1
+ h={ obj: "poem start #{@num_poem}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
elsif t_o =~/^(?:group\{|[`]{3}\s+group)/
@@ -425,7 +427,8 @@ module SiSU_AO_DocumentStructureExtract
when /^[`]{3}\s+group/ then :tics
else @@flag[:group] #error
end
- h={ obj: 'group text start' } #introduce a counter
+ @num_group +=1
+ h={ obj: "group text start #{@num_group}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
elsif t_o =~/^(?:block\{|[`]{3}\s+block)/
@@ -434,7 +437,8 @@ module SiSU_AO_DocumentStructureExtract
when /^[`]{3}\s+block/ then :tics
else @@flag[:block] #error
end
- h={ obj: 'block text start' } #introduce a counter
+ @num_block +=1
+ h={ obj: "block text start #{@num_block}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
elsif t_o =~/^(?:alt\{|[`]{3}\s+alt)/
@@ -443,11 +447,13 @@ module SiSU_AO_DocumentStructureExtract
when /^[`]{3}\s+alt/ then :tics
else @@flag[:alt] #error
end
- h={ obj: 'alt text start' } #introduce a counter
+ @num_alt +=1
+ h={ obj: "alt text start #{@num_alt}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
elsif t_o =~/^(?:table\{|[`]{3}\s+table|\{table)[ ~]/
- h={ obj: 'table start' } #introduce a counter
+ @num_table +=1
+ h={ obj: "table start #{@num_table}" }
ins=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << ins
if t_o=~/^table\{(?:~h)?\s+/
@@ -501,10 +507,10 @@ module SiSU_AO_DocumentStructureExtract
width=100.00/cols
cols.times { col << width }
end
- h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags }
+ h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: 'table end' } #introduce a counter
+ h={ obj: "table end #{@num_table}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
elsif t_o=~/^[`]{3}\s+table(?:~h)?\s+/
@@ -524,10 +530,10 @@ module SiSU_AO_DocumentStructureExtract
r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
rows += r + Mx[:tc_c]
end
- h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags }
+ h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: 'table end' } #introduce a counter
+ h={ obj: "table end #{@num_table}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
elsif t_o=~/^\{table(?:~h)?\s+/
@@ -547,10 +553,10 @@ module SiSU_AO_DocumentStructureExtract
r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
rows += r + Mx[:tc_c]
end
- h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags }
+ h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: 'table end' } #introduce a counter
+ h={ obj: "table end #{@num_table}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
end
@@ -568,7 +574,7 @@ module SiSU_AO_DocumentStructureExtract
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(@h)
tuned_file << t_o
@h,@rows=nil,''
- h={ obj: 'table end' } #introduce a counter
+ h={ obj: "table end #{@num_table}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
else
@@ -587,11 +593,11 @@ module SiSU_AO_DocumentStructureExtract
@@flag[:code]=:off
obj=@tuned_code.join("\n")
tags=[]
- h={ obj: obj, tags: tags, number_: @codeblock_numbered }
+ h={ obj: obj, tags: tags, num: @num_code_block, number_: @codeblock_numbered }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.code(h)
@tuned_code=[]
tuned_file << t_o
- h={ obj: 'code block end' } #introduce a counter
+ h={ obj: "code block end #{@num_code_block}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
end
if (@@flag[:code]==:curls or @@flag[:code]==:tics) \
@@ -610,37 +616,37 @@ module SiSU_AO_DocumentStructureExtract
if (@@flag[:poem]==:curls and t_o =~/^\}poem/) \
or (@@flag[:poem]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:poem]=:off
- h={ obj: 'poem end' } #introduce a counter
+ h={ obj: "poem end #{@num_poem}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:group]==:curls and t_o =~/^\}group/) \
or (@@flag[:group]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:group]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags }
+ h={ obj: obj, tags: tags, num: @num_group }
@tuned_block=[]
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.group(h)
tuned_file << t_o
- h={ obj: 'group text end' } #introduce a counter
+ h={ obj: "group text end #{@num_group}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:block]==:curls and t_o =~/^\}block/) \
or (@@flag[:block]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:block]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags }
+ h={ obj: obj, tags: tags, num: @num_block }
@tuned_block=[]
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.block(h)
tuned_file << t_o
- h={ obj: 'block text end' } #introduce a counter
+ h={ obj: "block text end #{@num_block}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:alt]==:curls and t_o =~/^\}alt/) \
or (@@flag[:alt]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:alt]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags }
+ h={ obj: obj, tags: tags, num: @num_alt }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.alt(h)
@tuned_block=[]
tuned_file << t_o
- h={ obj: 'alt text end' } #introduce a counter
+ h={ obj: "alt text end #{@num_alt}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
end
if (@@flag[:poem]==:curls or @@flag[:poem]==:tics \
@@ -657,7 +663,7 @@ module SiSU_AO_DocumentStructureExtract
poem.each do |v|
v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n")
obj,tags=extract_tags(v)
- h={ obj: obj, tags: tags }
+ h={ obj: obj, tags: tags, num: @num_poem }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.verse(h)
tuned_file << t_o
end