aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/ao_doc_objects.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-07-01 00:33:49 -0400
committerRalph Amissah <ralph@amissah.com>2014-07-01 00:33:52 -0400
commit954419b5ae79efb032d28b145ee40d0b61c80c23 (patch)
tree6076bfea3c7a0d93c387a9d4d3bfe1e479aac6d3 /lib/sisu/v5/ao_doc_objects.rb
parentsisu.org minor (diff)
v5: merge what was sisu_6.0.8 into v5
* ao, * syntax, able optionally to indicate the language syntax of a code block * syntax, introduce box text block/group * syntax, introduce tics quotes markup (blockquote equivalent) * docbook, * ocn & footnote numbers (as xml comments) * metadata header (docinfo) * quotes (blockquote) * tables * images * code block * vim syntax, add * code block, language syntax, optional * box block * quote block
Diffstat (limited to 'lib/sisu/v5/ao_doc_objects.rb')
-rw-r--r--lib/sisu/v5/ao_doc_objects.rb49
1 files changed, 41 insertions, 8 deletions
diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb
index c53c60d6..dd0a44cd 100644
--- a/lib/sisu/v5/ao_doc_objects.rb
+++ b/lib/sisu/v5/ao_doc_objects.rb
@@ -184,10 +184,10 @@ module SiSU_AO_DocumentStructure
end
end
class ObjectPara
- attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp
+ attr_accessor :obj,:is,:tags,:of,:name,:idx,:quote_,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp
def initialize
@of=:para
- @is=@obj=@name=@idx=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil
+ @is=@obj=@name=@idx=@quote_=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil
@tags=[]
end
def paragraph(h,o=nil)
@@ -204,6 +204,7 @@ module SiSU_AO_DocumentStructure
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?
+ quote_= h[:quote_] || ((defined? o.quote_) ? o.quote_ : false) #Bool, quote (blockquote)?
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
@@ -211,7 +212,7 @@ module SiSU_AO_DocumentStructure
end
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
+ @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@quote_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,quote_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp
self
end
def docinfo(h,o=nil)
@@ -240,10 +241,10 @@ module SiSU_AO_DocumentStructure
end
end
class ObjectBlockTxt
- attr_accessor :obj,:is,:of,:tags,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp
+ attr_accessor :obj,:is,:of,:tags,:lngsyn,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp
def initialize
@of=:block
- @is=@obj=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil
+ @is=@obj=@lngsyn=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil
@tags=[]
end
def code(h,o=nil)
@@ -251,6 +252,7 @@ module SiSU_AO_DocumentStructure
is= :code #Symbol, 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
+ lngsyn= h[:lngsyn] || ((defined? o.lngsyn) ? o.lngsyn : :txt) #symbol, code lngsyn
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)
@@ -264,7 +266,27 @@ module SiSU_AO_DocumentStructure
num= h[:num] || ((defined? o.num) ? o.num : nil)
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
+ @of,@is,@tags,@obj,@lngsyn,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,lngsyn,idx,ocn,odv,osp,parent,number_,note_,ocn_,num,digest,tmp
+ self
+ end
+ def box(h,o=nil)
+ of= @of #Symbol, classification - group
+ is= :box #Symbol, 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? 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, 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
end
def block(h,o=nil)
@@ -455,10 +477,10 @@ module SiSU_AO_DocumentStructure
end
end
class ObjectLayout
- attr_accessor :obj,:is,:of,:from,:tmp
+ attr_accessor :obj,:sym,:attr,:is,:of,:from,:tmp,:num
def initialize
@of=:layout
- @is=@obj=@from=@tmp=nil
+ @is=@obj=@from=@tmp=@num=nil
end
def break(h,f=nil) #decide how to deal with
of= @of #Symbol, classification - group
@@ -477,6 +499,17 @@ module SiSU_AO_DocumentStructure
@of,@is,@obj,@tmp=of,is,obj,tmp
self
end
+ def open_close(h,o=nil) #useful for poem & quote
+ of= @of #Symbol, classification - group
+ is= :open_close_tags #Symbol, classification - specific type
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ sym= h[:sym] || ((defined? o.sym) ? o.sym : nil) #Symbol tag_open, tag_close
+ attr= h[:attr] || ((defined? o.attr) ? o.attr : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ num= h[:num] || ((defined? o.num) ? o.num : nil)
+ @of,@is,@obj,@sym,@attr,@tmp,@num=of,is,obj,sym,attr,tmp,num
+ self
+ end
end
class ObjectComment
attr_accessor :obj,:is,:of,:tmp