From 5fb49b575a548313b827fd66fd7ecce514fe0e45 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 6 Jan 2014 23:02:50 -0500 Subject: v5: heading recalibration, code (downstream) changes * here no doubt remains breakage (test, fix & test again) --- lib/sisu/v5/xml_docbook5.rb | 60 ++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'lib/sisu/v5/xml_docbook5.rb') diff --git a/lib/sisu/v5/xml_docbook5.rb b/lib/sisu/v5/xml_docbook5.rb index dc5de48a..0dddf264 100644 --- a/lib/sisu/v5/xml_docbook5.rb +++ b/lib/sisu/v5/xml_docbook5.rb @@ -132,18 +132,20 @@ module SiSU_XML_Docbook_Book def tags # collapsed --> def collapsed - %w[ 0 1 2 3 4 5 6 ] + %w[ 0 1 2 3 4 5 ] end def docbook(lc,chlv='') case lc - when 1 + when 0 'book' + when 1 + lc==chlv ? 'chapter' : 'section' when 2 lc==chlv ? 'chapter' : 'section' when 3 lc==chlv ? 'chapter' : 'section' when 4 - lc==chlv ? 'chapter' : 'section' + 'section' when 5 'section' when 6 @@ -219,7 +221,7 @@ module SiSU_XML_Docbook_Book doc_position=:body_and_tail else filename_docbook.puts structure_build_tag_close(o.lc,h) - filename_docbook.puts %{#{space*(o.lc-1)}<#{tags.docbook(o.lc,chlv)}#{tag_id}> + filename_docbook.puts %{#{space*(o.lc)}<#{tags.docbook(o.lc,chlv)}#{tag_id}> #{space*o.lc} } end @@ -238,33 +240,41 @@ module SiSU_XML_Docbook_Book def structure_build_tag_close(lc,h) x=[] case h + when 0 + x << "#{space*0}" if (lc <= 0) when 1 - x << "#{space*0}" if (lc <= 1) + x << "#{space*1}" if (lc <= 1) + x << "#{space*0}" if (lc <= 0) when 2 - x << "#{space*1}" if (lc <= 2) - x << "#{space*0}" if (lc <= 1) + x << "#{space*2}" if (lc <= 2) + x << "#{space*1}" if (lc <= 1) + x << "#{space*0}" if (lc <= 0) when 3 - x << "#{space*2}" if (lc <= 3) - x << "#{space*1}" if (lc <= 2) - x << "#{space*0}" if (lc <= 1) + x << "#{space*3}" if (lc <= 3) + x << "#{space*2}" if (lc <= 2) + x << "#{space*1}" if (lc <= 1) + x << "#{space*0}" if (lc <= 0) when 4 - x << "#{space*3}" if (lc <= 4) - x << "#{space*2}" if (lc <= 3) - x << "#{space*1}" if (lc <= 2) - x << "#{space*0}" if (lc <= 1) + x << "#{space*4}" if (lc <= 4) + x << "#{space*3}" if (lc <= 3) + x << "#{space*2}" if (lc <= 2) + x << "#{space*1}" if (lc <= 1) + x << "#{space*0}" if (lc <= 0) when 5 - x << "#{space*4}" if (lc <= 5) - x << "#{space*3}" if (lc <= 4) - x << "#{space*2}" if (lc <= 3) - x << "#{space*1}" if (lc <= 2) - x << "#{space*0}" if (lc <= 1) + x << "#{space*5}" if (lc <= 5) + x << "#{space*4}" if (lc <= 4) + x << "#{space*5}" if (lc <= 3) + x << "#{space*2}" if (lc <= 2) + x << "#{space*1}" if (lc <= 1) + x << "#{space*0}" if (lc <= 0) when 6 - x << "#{space*5}" if (lc <= 6) - x << "#{space*4}" if (lc <= 5) - x << "#{space*3}" if (lc <= 4) - x << "#{space*2}" if (lc <= 3) - x << "#{space*1}" if (lc <= 2) - x << "#{space*0}" if (lc <= 1) + x << "#{space*6}" if (lc <= 6) + x << "#{space*5}" if (lc <= 5) + x << "#{space*4}" if (lc <= 4) + x << "#{space*3}" if (lc <= 3) + x << "#{space*2}" if (lc <= 2) + x << "#{space*1}" if (lc <= 1) + x << "#{space*0}" if (lc <= 0) end x.join("\n") end -- cgit v1.2.3