diff options
Diffstat (limited to 'lib/sisu/v5/ao_doc_objects.rb')
-rw-r--r-- | lib/sisu/v5/ao_doc_objects.rb | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb index 556304d4..70696d37 100644 --- a/lib/sisu/v5/ao_doc_objects.rb +++ b/lib/sisu/v5/ao_doc_objects.rb @@ -8,7 +8,8 @@ * Author: Ralph Amissah * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: @@ -107,36 +108,38 @@ module SiSU_AO_DocumentStructure end def heading_ln(lv) case lv - when /A/; 1 - when /B/; 2 - when /C/; 3 - when /1/; 4 - when /2/; 5 - when /3/; 6 - when /4/; 7 - when /5/; 8 - when /6/; 9 + 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 def heading_lv(ln) case ln.to_s - when /1/; 'A' - when /2/; 'B' - when /3/; 'C' - when /4/; '1' - when /5/; '2' - when /6/; '3' - when /7/; '4' - when /8/; '5' - when /9/; '6' + 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 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 @@ -150,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) @@ -400,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] |