From 1832a937713d33517066dc4cf8222871045b2b58 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 6 Jan 2014 22:56:02 -0500 Subject: v5: single document root A~ (recalibrate headings); level D~ possible * :A~ document title, single document root (ln==0) * introduce additional possible heading level, D~ * markup rule change: single document root * breaks much downstream code, recalibrate (fix, test, fix & test again) * v4 & v5 bifurcate (diverge "un-merge-ably") --- lib/sisu/v5/ao_doc_objects.rb | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lib/sisu/v5/ao_doc_objects.rb') diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb index 229edee4..70696d37 100644 --- a/lib/sisu/v5/ao_doc_objects.rb +++ b/lib/sisu/v5/ao_doc_objects.rb @@ -108,9 +108,10 @@ module SiSU_AO_DocumentStructure end def heading_ln(lv) case lv - when /A/ then 1 - when /B/ then 2 - when /C/ then 3 + 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 @@ -121,9 +122,10 @@ module SiSU_AO_DocumentStructure end def heading_lv(ln) case ln.to_s - when /1/ then 'A' - when /2/ then 'B' - when /3/ then 'C' + 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' @@ -134,10 +136,10 @@ module SiSU_AO_DocumentStructure end def heading(h,o=nil) if not h[:ln] \ - and (h[:lv] and h[:lv]=~/[1-6A-C]/) + 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=~/[1-9]/) + and (h[:ln] and h[:ln].to_s=~/[0-9]/) h[:lv]=heading_lv(h[:ln]) end of= @of #String, classification - group @@ -151,7 +153,7 @@ module SiSU_AO_DocumentStructure 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 + 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) @@ -401,7 +403,7 @@ module SiSU_AO_DocumentStructure 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 + 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) node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info] -- cgit v1.2.3