diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v3/dal_doc_objects.rb | 282 | ||||
-rw-r--r-- | lib/sisu/v3/dal_numbering.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v3/defaults.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v3/digests.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v3/epub.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v3/epub_format.rb | 18 | ||||
-rw-r--r-- | lib/sisu/v3/epub_segments.rb | 24 | ||||
-rw-r--r-- | lib/sisu/v3/help.rb | 54 | ||||
-rw-r--r-- | lib/sisu/v3/html.rb | 18 | ||||
-rw-r--r-- | lib/sisu/v3/html_format.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v3/html_segments.rb | 24 | ||||
-rw-r--r-- | lib/sisu/v3/manifest.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v3/manpage.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v3/odf_format.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v3/param.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v3/qrcode.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v3/screen_text_color.rb | 15 | ||||
-rw-r--r-- | lib/sisu/v3/sitemaps.rb | 7 | ||||
-rw-r--r-- | lib/sisu/v3/sst_convert_markup.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v3/sst_do_inline_footnotes.rb | 30 | ||||
-rw-r--r-- | lib/sisu/v3/sst_identify_markup.rb | 6 |
21 files changed, 281 insertions, 287 deletions
diff --git a/lib/sisu/v3/dal_doc_objects.rb b/lib/sisu/v3/dal_doc_objects.rb index dd2c9cf0..f77348ec 100644 --- a/lib/sisu/v3/dal_doc_objects.rb +++ b/lib/sisu/v3/dal_doc_objects.rb @@ -71,7 +71,7 @@ module SiSU_DAL_DocumentStructure def metadata(tags) of= @of #String, classification - group is= :meta #String, classification - specific type - tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag + tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag obj= nil @of,@is,@tags,@obj=of,is,tags,obj self @@ -86,10 +86,10 @@ module SiSU_DAL_DocumentStructure def metadata(h,o=nil) of= @of #String, classification - group is= :meta #String, classification - specific type - 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 + 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 @of,@is,@tag,@obj,@digest,@tmp=of,is,tag,obj,digest,tmp self end @@ -135,27 +135,27 @@ module SiSU_DAL_DocumentStructure end of= @of #String, classification - group is= :heading #String, classification - specific type - name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info] - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6 - ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 - toc_= h[:toc_] || ((defined? o.toc_) ? o.toc_ : false) #Bool, do not include in toc, (relevant to headings) - ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? + tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) + node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info] + parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6 + ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 + toc_= h[:toc_] || ((defined? o.toc_) ? o.toc_ : false) #Bool, do not include in toc, (relevant to headings) + 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 - autonum_= if h[:autonum_].nil?; ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses + autonum_= if h[:autonum_].nil? then ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses 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 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + 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 + tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @of,@is,@lv,@ln,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@toc_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,name,tags,obj,idx,ocn,odv,osp,node,parent,toc_,ocn_,note_,autonum_,digest,tmp self end @@ -175,48 +175,48 @@ module SiSU_DAL_DocumentStructure def paragraph(h,o=nil) of= @of #String, classification - group is= :para #String, classification - specific type - name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? + tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] indent= h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level - hang= h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level - bullet_=h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted? - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) - ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + hang= h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level + bullet_=h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted? + note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) + 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 - 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 + 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 end def docinfo(h,o=nil) of= @of #String, classification - group is= :docinfo #String, classification - specific type - name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? - tags= h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? + tags= h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any + obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content idx= nil #String, book index provided? ocn= nil #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] indent= nil #Integer, indent level - hang= nil #Integer, indent level + hang= nil #Integer, indent level bullet_=false #Bool, bulleted? note_= false #Bool, endnotes/footnotes? (processing optimization) - image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) - ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) + 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 - 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 + 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 end @@ -231,95 +231,95 @@ module SiSU_DAL_DocumentStructure def code(h,o=nil) of= @of #String, classification - group #alt 'code' is= :code #String, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - number_= h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not? - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + number_= h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not? + note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + 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 - 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 + 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 self end def block(h,o=nil) of= @of #String, classification - group is= :block #String, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + 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 - 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 + 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 self end def group(h,o=nil) of= @of #String, classification - group is= :group #String, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + 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 - 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 + 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 self end def alt(h,o=nil) #see block of= @of #String, classification - group is= :alt #String, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + 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 - 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 + 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 self end def verse(h,o=nil) #part of poem decide how you deal with this of= @of #String, classification - group is= :verse #String, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + 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 - 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 + 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 @h=nil self @@ -335,22 +335,22 @@ module SiSU_DAL_DocumentStructure def table(h,o=nil) of= @of #String, classification - group is= :table #String, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - cols= h[:cols] || ((defined? o.cols) ? o.cols : nil) - widths= h[:widths] || ((defined? o.widths) ? o.widths : nil) - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - head_= h[:head_] || ((defined? o.head_) ? o.head_ : false) - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + cols= h[:cols] || ((defined? o.cols) ? o.cols : nil) + widths= h[:widths] || ((defined? o.widths) ? o.widths : nil) + obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + head_= h[:head_] || ((defined? o.head_) ? o.head_ : false) + note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + 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 - 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 + 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 self end @@ -365,20 +365,20 @@ module SiSU_DAL_DocumentStructure def image(h,o=nil) #not yet used, and what of a paragraph containing several images, consider of= @of #String, classification - group is= :image #String, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - size= h[:size] || ((defined? o.size) ? o.size : nil) - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + size= h[:size] || ((defined? o.size) ? o.size : nil) + idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + 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 - 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 + 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 end @@ -392,12 +392,12 @@ module SiSU_DAL_DocumentStructure def xml_dom(h,o=nil) of= @of #String, classification - group is= :xml_dom #String, classification - specific type - obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content - lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6 - ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 - node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info] - status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status open or close - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content + lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6 + ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 + node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info] + status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status open or close + tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @of,@is,@obj,@status,@node,@lv,@ln,@tmp=of,is,obj,status,node,lv,ln,tmp self end @@ -411,8 +411,8 @@ module SiSU_DAL_DocumentStructure def comment(h,o=nil) of= @of #String, classification - group is= :comment #String, classification - specific type - 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 + 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 @of,@is,@obj,@tmp=of,is,obj,tmp self end @@ -426,16 +426,16 @@ module SiSU_DAL_DocumentStructure def break(h,o=nil) #decide how to deal with, perhaps no obj? of= @of #String, classification - group is= :break #String, classification - specific type - 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 + 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 @of,@is,@obj,@tmp=of,is,obj,tmp self end def insert(h,o=nil) #decide how to deal with, could mimic paragraph? of= @of #String, classification - group is= :insert #String, classification - specific type - 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 + 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 @of,@is,@obj,@tmp=of,is,obj,tmp self end diff --git a/lib/sisu/v3/dal_numbering.rb b/lib/sisu/v3/dal_numbering.rb index c0bb4cb1..4c7ad642 100644 --- a/lib/sisu/v3/dal_numbering.rb +++ b/lib/sisu/v3/dal_numbering.rb @@ -435,9 +435,9 @@ module SiSU_DAL_Numbering and dob.obj !~/\A\s*\Z/m \ and dob.is !=:layout @md.set_heading_seg=true - head=if @md.title.main ; dob.ln,dob.name,dob.obj=4,'seg',@md.title.main - else dob.ln,dob.name,dob.obj=4,'seg','[segment]' - end + head=@md.title.main \ + ? (dob.ln,dob.name,dob.obj=4,'seg',@md.title.main) + : (dob.ln,dob.name,dob.obj=4,'seg','[segment]') @tuned_file << head end end diff --git a/lib/sisu/v3/defaults.rb b/lib/sisu/v3/defaults.rb index 0c45ecdd..47e3c970 100644 --- a/lib/sisu/v3/defaults.rb +++ b/lib/sisu/v3/defaults.rb @@ -738,9 +738,9 @@ module SiSU_Viz gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided m='\b(' + r + ')\b' make[:str] - make[:regx]=if x =~/i/; /#{m}/i - else /#{m}/ - end + make[:regx]=(x =~/i/) \ + ? (/#{m}/i) + : (/#{m}/) else nil end end @@ -759,9 +759,9 @@ module SiSU_Viz gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided m='\b(' + r + ')\b' make[:str] - make[:regx]=if x =~/i/; /#{m}/i - else /#{m}/ - end + make[:regx]=(x =~/i/) \ + ? (/#{m}/i) + : (/#{m}/) else nil end make diff --git a/lib/sisu/v3/digests.rb b/lib/sisu/v3/digests.rb index 5ffabb58..129b6b10 100644 --- a/lib/sisu/v3/digests.rb +++ b/lib/sisu/v3/digests.rb @@ -208,9 +208,9 @@ module SiSU_DigestView if image_source para_image = image_source + '/' + i @image_name << i - @image_dgst << if @dg =~/^sha(?:2|256)$/; sys.sha256(para_image) - else sys.md5(para_image) - end + @image_dgst << (@dg =~/^sha(?:2|256)$/) \ + ? sys.sha256(para_image) + : sys.md5(para_image) else @image_name << ' '*16 + i + ' [image missing]' @image_dgst << '' diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index 06021574..a3364606 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -357,9 +357,9 @@ module SiSU_EPUB end else @@toc[:scr] << '<br />' - link=if dob.ln; dob.ln - else '' - end + link=(dob.ln) \ + ? dob.ln + : '' %{<b><a href="##{link}">#{linkname}</a></b>} end txt_obj={ txt: title } diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index c08ae492..06a6d623 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1740,9 +1740,9 @@ WOK end end def links_guide_open(type='horizontal') - if type=='vertical'; links_guide_vertical_open - else links_guide_horizontal_open - end + (type=='vertical') \ + ? links_guide_vertical_open + : links_guide_horizontal_open end def prefix_a end @@ -1853,12 +1853,12 @@ WOK if @format and not @format.empty? if @format=~/^\d:(\S+)/ #need more reliable marker #if @format =~ /#{Rx[:lv]}/ headname=$1 #format[/\d~(\S+)/m,1] - @headname=if headname =~/^[a-zA-Z]/; %{<id="#{headname}">} #consider: h_#{headname} - else %{<id="h#{headname}"></a>} - end - @headname=if headname =~/^[a-zA-Z]/; %{<a name="#{headname}" id="#{headname}"></a>} #consider: h_#{headname} - else %{<a name="h#{headname}" id="h#{headname}"></a>} - end + @headname=(headname =~/^[a-zA-Z]/) \ + ? %{<id="#{headname}">} + : %{<id="h#{headname}"></a>} + @headname=(headname =~/^[a-zA-Z]/) \ + ? %{<a name="#{headname}" id="#{headname}"></a>} + : %{<a name="h#{headname}" id="h#{headname}"></a>} end end elsif t_o.class.inspect =~/Object/ diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index 57e6580b..0f45fe23 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -298,9 +298,9 @@ WOK and @md.creator.author @author=%{<b>#{@md.creator.author}</b>\n} end - ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix - else '' - end + ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ? $1 + : '' @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display } format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@ -309,9 +309,9 @@ WOK end if @@is2==1 heading2=@@heading2 - ocn=if heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix - else '' - end + ocn=(heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ? $1 + : '' @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display } format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@ -320,9 +320,9 @@ WOK end if @@is3==1 heading3=@@heading3 - ocn=if heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix - else '' - end + ocn=(heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ? $1 + : '' @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display } format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @@ -331,9 +331,9 @@ WOK end if @@is4==1 heading4=@@heading4 - ocn=if heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix - else '' - end + ocn=(heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ? $1 + : '' @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display } format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) diff --git a/lib/sisu/v3/help.rb b/lib/sisu/v3/help.rb index 9ca8ef20..421594fb 100644 --- a/lib/sisu/v3/help.rb +++ b/lib/sisu/v3/help.rb @@ -63,9 +63,9 @@ module SiSU_Help require_relative 'i18n' # i18n.rb def initialize(request='',color='') @request,@color=request,color - if color =~/color_off/; @cX=SiSU_Screen::Ansi.new('k').cX - else @cX=SiSU_Screen::Ansi.new('yes').cX - end + @cX=(color =~/color_off/) \ + ? (SiSU_Screen::Ansi.new('k').cX) + : (SiSU_Screen::Ansi.new('yes').cX) fns='help_example_dummy_file_name.sst' @env=SiSU_Env::InfoEnv.new(fns) @db=SiSU_Env::InfoDb.new @@ -909,9 +909,9 @@ WOK end else bin,rc='false','false' end - if program; "#{@cX.blue}#{program}#{@cX.off} bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}" - else "bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}" - end + (program) \ + ? ("#{@cX.blue}#{program}#{@cX.off} bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}") + : ("bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}") end def sisu_version version=SiSU_Env::InfoVersion.instance.get_version @@ -925,40 +925,40 @@ WOK @ls=leading_spaces=' '*49 @rhost=SiSU_Env::InfoRemoteHost.new.rhost def r1 - if @rhost.r1; @rhost.r1 + "\n" - else '' - end + (@rhost.r1) \ + ? @rhost.r1 + "\n" + : '' end def r2 - if @rhost.r2; @ls + @rhost.r2 + "\n" - else '' - end + (@rhost.r2) \ + ? @ls + @rhost.r2 + "\n" + : '' end def r3 - if @rhost.r3; @ls + @rhost.r3 + "\n" - else '' - end + (@rhost.r3) \ + ? @ls + @rhost.r3 + "\n" + : '' end def r4 - if @rhost.r4; @ls + @rhost.r4 + "\n" - else '' - end + (@rhost.r4) \ + ? @ls + @rhost.r4 + "\n" + : '' end def r5 - if @rhost.r5; @ls + @rhost.r5 + "\n" - else '' - end + (@rhost.r5) \ + ? @ls + @rhost.r5 + "\n" + : '' end def r6 - if @rhost.r6; @ls + @rhost.r6 + "\n" - else '' - end + (@rhost.r6) \ + ? @ls + @rhost.r6 + "\n" + : '' end def note msg='(remote settings user and host set in sisurc.yml under remote:)' - if @rhost.r1; @ls + msg - else msg - end + (@rhost.r1) \ + ? @ls + msg + : msg end self end diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb index 100916ff..3a2f8a0d 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v3/html.rb @@ -90,9 +90,9 @@ module SiSU_HTML @env=@particulars.env loc=@env.url.output_tell unless @opt.cmd =~/q/ - tool=if @opt.cmd =~/[MVvz]/; "#{@env.program.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}" - else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" - end + tool=(@opt.cmd =~/[MVvz]/) \ + ? ("#{@env.program.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}") + : ("[#{@opt.f_pth[:lng_is]}] #{@opt.fno}") @opt.cmd=~/[MVvz]/ \ ? SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue : SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_title_hi @@ -167,9 +167,9 @@ module SiSU_HTML and @md.lnk @md.lnk.each do |l| if defined? l[:say] - target=if l[:url] !~/^\.(\.)?\//; 'external' - else '_top' - end + target=(l[:url] !~/^\.(\.)?\//) \ + ? 'external' + : '_top' s_lnk_url,s_lnk_lnk=l[:url],l[:say] txt_obj={ lnk_url: s_lnk_url, lnk_txt: s_lnk_lnk, target: target } lev_dob_ocn=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) @@ -350,9 +350,9 @@ WOK end else @@toc[:scr] << '<br />' - link=if dob.ln; dob.ln - else '' - end + link=(dob.ln) \ + ? dob.ln + : '' %{<b><a href="##{link}">#{linkname}</a></b>} end txt_obj={ txt: title } diff --git a/lib/sisu/v3/html_format.rb b/lib/sisu/v3/html_format.rb index 85e47e0b..1b950358 100644 --- a/lib/sisu/v3/html_format.rb +++ b/lib/sisu/v3/html_format.rb @@ -454,9 +454,9 @@ WOK <!- quick ref -!>} end def links_guide_open(type='horizontal') - if type=='vertical'; links_guide_vertical_open - else links_guide_horizontal_open - end + (type=='vertical') \ + ? links_guide_vertical_open + : links_guide_horizontal_open end def links_guide_close insert='' @@ -957,9 +957,9 @@ WOK def headname #check whether used hn=if @t_o.is ==:heading \ and not @t_o.name.empty? #determine use - hn=if @t_o.is ==:heading; %{<a name="h#{@t_o.name}" id="h#{@t_o.name}"></a>} - else %{<a name="#{@t_o.name}" id="#{@t_o.name}"></a>} - end + hn=(@t_o.is ==:heading) \ + ? (%{<a name="h#{@t_o.name}" id="h#{@t_o.name}"></a>}) + : (%{<a name="#{@t_o.name}" id="#{@t_o.name}"></a>}) else nil end hn diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v3/html_segments.rb index b527eaba..bb77cb36 100644 --- a/lib/sisu/v3/html_segments.rb +++ b/lib/sisu/v3/html_segments.rb @@ -374,9 +374,9 @@ module SiSU_HTML_Seg if @title_banner_ @@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'') end - ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix - else '' - end + ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ? $1 + : '' @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @@ -385,9 +385,9 @@ module SiSU_HTML_Seg end if @@is2==1 heading2=@@heading2 - ocn=if heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix - else '' - end + ocn=(heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ? $1 + : '' @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @@ -396,9 +396,9 @@ module SiSU_HTML_Seg end if @@is3==1 heading3=@@heading3 - ocn=if heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix - else '' - end + ocn=(heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ? $1 + : '' @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @@ -407,9 +407,9 @@ module SiSU_HTML_Seg end if @@is4==1 heading4=@@heading4 - ocn=if heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix - else '' - end + ocn=(heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ? $1 + : '' @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index 20983d7f..446a8716 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -155,9 +155,9 @@ module SiSU_Manifest end def summarize_sources(id,file,pth,rel,url) sys=SiSU_Env::SystemCall.new - dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{pth}/#{file}") - else sys.md5("#{pth}/#{file}") - end + dgst=(@dg =~/^sha(?:2|256)$/) \ + ? sys.sha256("#{pth}/#{file}") + : sys.md5("#{pth}/#{file}") SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/ size=(File.size("#{pth}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @@ -749,9 +749,9 @@ WOK and @md.lnk @md.lnk.each do |l| if defined? l[:say] - target=if l[:url] !~/^\.(\.)?\//; 'external' - else '_top' - end + target=(l[:url] !~/^\.(\.)?\//) \ + ? 'external' + : '_top' url,lnk=l[:url],l[:say] unless url.nil? \ or url.empty? diff --git a/lib/sisu/v3/manpage.rb b/lib/sisu/v3/manpage.rb index d292900c..31a64a57 100644 --- a/lib/sisu/v3/manpage.rb +++ b/lib/sisu/v3/manpage.rb @@ -136,9 +136,9 @@ module SiSU_Manpage end notes=@n.flatten notes.each do |e| - util=if e.to_s =~/^\[[\d*+]+\]:/; SiSU_TextUtils::Wrap.new(e.to_s,78,4,1) - else SiSU_TextUtils::Wrap.new(e.to_s,78,0,1) - end + util=(e.to_s =~/^\[[\d*+]+\]:/) \ + ? (SiSU_TextUtils::Wrap.new(e.to_s,78,4,1)) + : (SiSU_TextUtils::Wrap.new(e.to_s,78,0,1)) wrap=util.line_wrap wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m wrap.gsub(/(^| |#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*'). #man page requires diff --git a/lib/sisu/v3/odf_format.rb b/lib/sisu/v3/odf_format.rb index cd998f43..62eae47a 100644 --- a/lib/sisu/v3/odf_format.rb +++ b/lib/sisu/v3/odf_format.rb @@ -167,9 +167,9 @@ module SiSU_ODF_Format end end def table_head_open(count) - type=if @dob.head_; 1 - else 2 - end + type=(@dob.head_) \ + ? 1 + : 2 alpha=case @dob.cols when 1; 'A' when 2; 'B' diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index f6084aab..dbcbcbab 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -1453,9 +1453,9 @@ module SiSU_Param # gsub(/:?C/,'3'). # gsub(/:?B/,'2'). # gsub(/:?A/,'1') - translate=if translate =~/^\d+$/; translate.to_i - else translate - end + translate=(translate =~/^\d+$/) \ + ? translate.to_i + : translate else nil end end diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb index d05bf442..d668c813 100644 --- a/lib/sisu/v3/qrcode.rb +++ b/lib/sisu/v3/qrcode.rb @@ -166,9 +166,9 @@ WOK end def summarize_sources(id,file,pth,rel,url) sys=SiSU_Env::SystemCall.new - dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{pth}/#{file}") - else sys.md5("#{pth}/#{file}") - end + dgst=(@dg =~/^sha(?:2|256)$/) \ + ? (sys.sha256("#{pth}/#{file}")) + : (sys.md5("#{pth}/#{file}")) SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/ size=(File.size("#{pth}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] diff --git a/lib/sisu/v3/screen_text_color.rb b/lib/sisu/v3/screen_text_color.rb index 67022087..cef15585 100644 --- a/lib/sisu/v3/screen_text_color.rb +++ b/lib/sisu/v3/screen_text_color.rb @@ -69,16 +69,11 @@ module SiSU_Screen @color_instruct=txt[0] flag=SiSU_Env::InfoProcessingFlag.new if @cmd - if flag.color #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off - @use_color=if @cmd =~/c/; false - else true - end - else - @use_color=if @cmd =~/c/; true - else false - end - end - if @cmd =~/k/; @use_color=false + #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off + @use_color=(flag.color) \ + ? ((@cmd =~/c/) ? false : true) + : ((@cmd =~/c/) ? true : false) + if @cmd =~/k/ then @use_color=false end else @use_color=false end diff --git a/lib/sisu/v3/sitemaps.rb b/lib/sisu/v3/sitemaps.rb index 86a8e2fb..d45af899 100644 --- a/lib/sisu/v3/sitemaps.rb +++ b/lib/sisu/v3/sitemaps.rb @@ -97,10 +97,9 @@ module SiSU_Sitemaps end end def make_file(path,filename) - if File.writable?("#{path}/."); File.new("#{path}/#{filename}",'w+') - else - SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn - end + (File.writable?("#{path}/.")) \ + ? (File.new("#{path}/#{filename}",'w+')) + : (SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn) end def output_map(sitemap) path=@md.file.output_path.sitemaps.dir diff --git a/lib/sisu/v3/sst_convert_markup.rb b/lib/sisu/v3/sst_convert_markup.rb index 6b224ddb..47426490 100644 --- a/lib/sisu/v3/sst_convert_markup.rb +++ b/lib/sisu/v3/sst_convert_markup.rb @@ -272,13 +272,13 @@ WOK end end end - if y=~/^\s*$/; @empty1=true - else @empty1=false - end + @empty1=(y=~/^\s*$/) \ + ? true + : false @file.puts y unless (@empty1==true and @empty2==true) - if y=~/^\s*$/; @empty2=true - else @empty2=false - end + @empty2=(y=~/^\s*$/) \ + ? true + : false end @file.close else puts "NO conversion match in #{i}" unless @opt.cmd=~/q/ diff --git a/lib/sisu/v3/sst_do_inline_footnotes.rb b/lib/sisu/v3/sst_do_inline_footnotes.rb index 4ceb54fa..08c599ce 100644 --- a/lib/sisu/v3/sst_do_inline_footnotes.rb +++ b/lib/sisu/v3/sst_do_inline_footnotes.rb @@ -107,9 +107,9 @@ module SiSU_ConvertFootnotes @@fns=@opt.fns @@dal_array=[] end - dal=if @@dal_array.empty?; read_fnm - else @@dal_array.dup #check - end + dal=(@@dal_array.empty?) \ + ? read_fnm + : @@dal_array.dup #check rescue SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do __LINE__.to_s + ':' + __FILE__ @@ -145,9 +145,9 @@ module SiSU_ConvertFootnotes end def read_fnm dal=[] - dal=if FileTest.file?(@fnm); File.open(@fnm){ |f| dal=Marshal.load(f)} - else SiSU_ConvertFootnotes::Source.new(@opt).create_dal #watch - end + dal=(FileTest.file?(@fnm)) \ + ? (File.open(@fnm){ |f| dal=Marshal.load(f)}) + : (SiSU_ConvertFootnotes::Source.new(@opt).create_dal) #watch end end class Output @@ -192,9 +192,9 @@ module SiSU_ConvertFootnotes data=data.join.split("\n\n") data_new=[] data.each do |x| - data_new << if x =~ /\n\n/m; x.split(/\n\n+/) - else x - end + data_new << (x =~ /\n\n/m) \ + ? (x.split(/\n\n+/)) + : x end data=data_new.flatten data=SiSU_ConvertFootnotes::Make.new(@md,data).substitutions_and_insertions? @@ -360,9 +360,9 @@ module SiSU_ConvertFootnotes if para !~/^(?:@\S+:|0~\S+)\s/m \ and para !~/\A\s*\Z/m @md.set_heading_top=true - head=if @md.title.full ; ":A~ #{@md.title.full}" - else ':A~ [no title provided]' - end + head=(@md.title.full) \ + ? (":A~ #{@md.title.full}") + : (':A~ [no title provided]') @tuned_file << head end end @@ -382,9 +382,9 @@ module SiSU_ConvertFootnotes and para !~/\A\s*\Z/m \ and para !~/<:p[bn]>/ @md.set_heading_seg=true - head=if @md.title.full ; "1~seg [#{@md.title.full}]" - else '1~seg [segment]' - end + head=(@md.title.full) \ + ? ("1~seg [#{@md.title.full}]") + : ('1~seg [segment]') @tuned_file << head end end diff --git a/lib/sisu/v3/sst_identify_markup.rb b/lib/sisu/v3/sst_identify_markup.rb index 60c28bf5..012475be 100644 --- a/lib/sisu/v3/sst_identify_markup.rb +++ b/lib/sisu/v3/sst_identify_markup.rb @@ -236,9 +236,9 @@ WOK end else puts 'file not found: ' + @opt.fns end - if defined? markup.version; markup.version - else 'markup type/version not determined' - end + (defined? markup.version) \ + ? markup.version + : 'markup type/version not determined' end def markup_version? if @opt.fns.empty? |