aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/ao_doc_objects.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-05-25 10:01:43 -0400
committerRalph Amissah <ralph@amissah.com>2014-05-25 10:01:43 -0400
commit16c30474f06ed3774ad524a38b55b7840de057d0 (patch)
tree03f20a30c1853b3d5cb893556aa633be2407a4d8 /lib/sisu/v5/ao_doc_objects.rb
parentv5 v6: version & changelog (& rakefile) (diff)
v5: merge v6 to v5, version bump to 5.4.*, reason adds structure checksisu_5.4.0
* ao, document structure check, stop processing on major error (with error message & text at location of failure) [reason for version bump the addition of structure check] * utils, add ok code marker * ao, heading with no ocn, distinguish ~# from -# * ~# is general & means no ocn (for any object to which it is applied) * -# is relevant only for 1~ dummy headings & instructs that they should be removed from output where possible * applied so far to pdf, odt & plaintext * ao_images, reduce warnings when ruby RMagic absent as program used directly * reduced dependency on ruby RMagic library (as some time way back had issues) * ao, document markup structure check, skip processing file on major error * with error message & text at location of failure * texpdf, urls in creator cause breakage * texpdf, mailto markup links set for normal text objects * texpdf, '&' in heading breaks toc (now removed from toc (not heading)), bug * revisit, bug * texpdf, for urls switch to sans serif (small fontsize) * instead of typewriter, latex default * texpdf, pdf colored hyperlinks configurable * --pdf-hyperlinks-color --pdf-hyperlinks-no-color or --pdf-hyperlinks-monochrome * ['default']['pdf_hyperlinks']='color' (other options switch hyperlink color off 'no-color' 'color-off' 'monochrome') * texpdf, pdf default font size configurable (cli & sisurc.yml) (no fractions) * --pdf-fontsize-12 --pdf-fontsize-8 * default: texpdf_fontsize: 12 * texpdf, headings and table of contents representation * fixes 1~ and 2~ result in the same formatting 1~ 2~ & 3~ now differentiated, see discussion in sisu.org under #744383 * fixes :A smaller formatted than :B A~ B~ C~ now the same size, see discussion in sisu.org under #744383 * :B and :C result in the same formatting, issue explained see sisu.org * texpdf, (internal coding) fontface, rename texpdf_font texpdf_fontface * texpdf, (internal coding) use symbols to identify page orientation * param, metadata rights, line-breaks instead of semicolons separating rights * fixes remove trailing semicolon after :copyright: * digests sha512 option implemented * options sha512 sha256 md5 * command line --sha512 * rcconf.yml ['defsault']['digest'] = sha512 * xml object citation numbering (docbook fictionbook)
Diffstat (limited to 'lib/sisu/v5/ao_doc_objects.rb')
-rw-r--r--lib/sisu/v5/ao_doc_objects.rb38
1 files changed, 23 insertions, 15 deletions
diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb
index e711a7d8..216349c1 100644
--- a/lib/sisu/v5/ao_doc_objects.rb
+++ b/lib/sisu/v5/ao_doc_objects.rb
@@ -94,16 +94,16 @@ module SiSU_AO_DocumentStructure
tag= h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
@of,@is,@tag,@obj,@digest,@tmp=of,is,tag,obj,digest,tmp
self
end
end
class ObjectHeading
- attr_accessor :obj,:is,:tags,:of,:lv,:ln,:lc,:toc_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp
+ attr_accessor :obj,:is,:tags,:of,:lv,:ln,:lc,:use_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp
def initialize
@of=:para
- @is=@obj=@lv=@ln=@lc=@toc_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil
+ @is=@obj=@lv=@ln=@lc=@use_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil
@tags=[]
end
def heading_ln(lv)
@@ -156,7 +156,15 @@ module SiSU_AO_DocumentStructure
lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6
ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure)
- toc_= h[:toc_] || ((defined? o.toc_) ? o.toc_ : false) #Bool, do not include in toc, (relevant to headings)
+ use_=if lv \
+ and lv == '1'
+ h[:use_] || ((defined? o.use_) ? o.use_ : :ok)
+ elsif not lv.empty? \
+ and lv =~ /[A-D2-3]/
+ :ok
+ else
+ h[:use_] || ((defined? o.use_) ? o.use_ : :ok)
+ end
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
@@ -164,9 +172,9 @@ module SiSU_AO_DocumentStructure
else h[:autonum_]
end
note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@lv,@ln,@lc,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@toc_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,lc,name,tags,obj,idx,ocn,odv,osp,node,parent,toc_,ocn_,note_,autonum_,digest,tmp
+ @of,@is,@lv,@ln,@lc,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@use_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,lc,name,tags,obj,idx,ocn,odv,osp,node,parent,use_,ocn_,note_,autonum_,digest,tmp
self
end
def heading_insert(h,o=nil)
@@ -201,7 +209,7 @@ 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
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp
self
@@ -225,7 +233,7 @@ 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
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp
self
@@ -254,7 +262,7 @@ module SiSU_AO_DocumentStructure
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
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, 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_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,number_,note_,ocn_,num,digest,tmp
self
@@ -274,7 +282,7 @@ module SiSU_AO_DocumentStructure
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
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, 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_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp
self
@@ -294,7 +302,7 @@ module SiSU_AO_DocumentStructure
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
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, 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_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp
self
@@ -314,7 +322,7 @@ module SiSU_AO_DocumentStructure
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
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, 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_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp
self
@@ -333,7 +341,7 @@ module SiSU_AO_DocumentStructure
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
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, 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_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp
@h=nil
@@ -365,7 +373,7 @@ module SiSU_AO_DocumentStructure
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
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, 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_,@num,@digest,@tmp=of,is,tags,cols,widths,obj,idx,ocn,odv,osp,parent,head_,note_,ocn_,num,digest,tmp
self
@@ -393,7 +401,7 @@ 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
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@tags,@obj,@size,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,size,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
self