class SiSU_AO_DocumentStructure::ObjectHeading
Attributes
autonum_[RW]
digest[RW]
idx[RW]
is[RW]
lc[RW]
ln[RW]
lv[RW]
name[RW]
node[RW]
note_[RW]
obj[RW]
ocn[RW]
ocn_[RW]
odv[RW]
of[RW]
osp[RW]
parent[RW]
tmp[RW]
use_[RW]
Public Class Methods
new()
click to toggle source
# File lib/sisu/ao_doc_objects.rb, line 96 def initialize @of=:para @is=@obj=@lv=@ln=@lc=@use_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil @tags=[] end
Public Instance Methods
heading(h,o=nil)
click to toggle source
# File lib/sisu/ao_doc_objects.rb, line 129 def heading(h,o=nil) if not h[:ln] \ and (h[:lv] and h[:lv]=~/[1-6A-D]/) h[:ln]=heading_ln(h[:lv]) elsif not h[:lv] \ and (h[:ln] and h[:ln].to_s=~/[0-9]/) h[:lv]=heading_lv(h[:ln]) end of = @of #Symbol, classification - group is = :heading #Symbol, 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-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) 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? ((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 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, 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,@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
heading_insert(h,o=nil)
click to toggle source
# File lib/sisu/ao_doc_objects.rb, line 175 def heading_insert(h,o=nil) heading(h,o=nil) @is = :heading_insert #String, classification - specific type self end
heading_ln(lv)
click to toggle source
# File lib/sisu/ao_doc_objects.rb, line 101 def heading_ln(lv) case lv when /A/ then 0 when /B/ then 1 when /C/ then 2 when /D/ then 3 when /1/ then 4 when /2/ then 5 when /3/ then 6 when /4/ then 7 when /5/ then 8 when /6/ then 9 end end
heading_lv(ln)
click to toggle source
# File lib/sisu/ao_doc_objects.rb, line 115 def heading_lv(ln) case ln.to_s when /0/ then 'A' when /1/ then 'B' when /2/ then 'C' when /3/ then 'D' when /4/ then '1' when /5/ then '2' when /6/ then '3' when /7/ then '4' when /8/ then '5' when /9/ then '6' end end