Class: SiSU_AO_DocumentStructure::ObjectHeading
- Inherits:
-
Object
- Object
- SiSU_AO_DocumentStructure::ObjectHeading
- Defined in:
- lib/sisu/ao_doc_objects.rb
Instance Attribute Summary collapse
-
#autonum_ ⇒ Object
Returns the value of attribute autonum_.
-
#digest ⇒ Object
Returns the value of attribute digest.
-
#idx ⇒ Object
Returns the value of attribute idx.
-
#is ⇒ Object
Returns the value of attribute is.
-
#lc ⇒ Object
Returns the value of attribute lc.
-
#ln ⇒ Object
Returns the value of attribute ln.
-
#lv ⇒ Object
Returns the value of attribute lv.
-
#name ⇒ Object
Returns the value of attribute name.
-
#node ⇒ Object
Returns the value of attribute node.
-
#note_ ⇒ Object
Returns the value of attribute note_.
-
#obj ⇒ Object
Returns the value of attribute obj.
-
#ocn ⇒ Object
Returns the value of attribute ocn.
-
#ocn_ ⇒ Object
Returns the value of attribute ocn_.
-
#odv ⇒ Object
Returns the value of attribute odv.
-
#of ⇒ Object
Returns the value of attribute of.
-
#osp ⇒ Object
Returns the value of attribute osp.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#tmp ⇒ Object
Returns the value of attribute tmp.
-
#use_ ⇒ Object
Returns the value of attribute use_.
Instance Method Summary collapse
- #heading(h, o = nil) ⇒ Object
- #heading_insert(h, o = nil) ⇒ Object
- #heading_ln(lv) ⇒ Object
- #heading_lv(ln) ⇒ Object
-
#initialize ⇒ ObjectHeading
constructor
A new instance of ObjectHeading.
Constructor Details
#initialize ⇒ ObjectHeading
Returns a new instance of ObjectHeading.
96 97 98 99 100 |
# 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 |
Instance Attribute Details
#autonum_ ⇒ Object
Returns the value of attribute autonum_.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def autonum_ @autonum_ end |
#digest ⇒ Object
Returns the value of attribute digest.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def digest @digest end |
#idx ⇒ Object
Returns the value of attribute idx.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def idx @idx end |
#is ⇒ Object
Returns the value of attribute is.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def is @is end |
#lc ⇒ Object
Returns the value of attribute lc.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def lc @lc end |
#ln ⇒ Object
Returns the value of attribute ln.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def ln @ln end |
#lv ⇒ Object
Returns the value of attribute lv.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def lv @lv end |
#name ⇒ Object
Returns the value of attribute name.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def name @name end |
#node ⇒ Object
Returns the value of attribute node.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def node @node end |
#note_ ⇒ Object
Returns the value of attribute note_.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def note_ @note_ end |
#obj ⇒ Object
Returns the value of attribute obj.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def obj @obj end |
#ocn ⇒ Object
Returns the value of attribute ocn.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def ocn @ocn end |
#ocn_ ⇒ Object
Returns the value of attribute ocn_.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def ocn_ @ocn_ end |
#odv ⇒ Object
Returns the value of attribute odv.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def odv @odv end |
#of ⇒ Object
Returns the value of attribute of.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def of @of end |
#osp ⇒ Object
Returns the value of attribute osp.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def osp @osp end |
#parent ⇒ Object
Returns the value of attribute parent.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def parent @parent end |
#tags ⇒ Object
Returns the value of attribute tags.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def @tags end |
#tmp ⇒ Object
Returns the value of attribute tmp.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def tmp @tmp end |
#use_ ⇒ Object
Returns the value of attribute use_.
95 96 97 |
# File 'lib/sisu/ao_doc_objects.rb', line 95 def use_ @use_ end |
Instance Method Details
#heading(h, o = nil) ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# 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? = h[:tags] || ((defined? o.) ? o. : []) #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, , obj, idx, ocn, odv, osp, node, parent, use_, ocn_, note_, autonum_, digest, tmp self end |
#heading_insert(h, o = nil) ⇒ Object
175 176 177 178 179 |
# 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) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# 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) ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# 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 |