From 8ed75b2bfd615c863e14b9c540ec15c429c06e98 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 19 Jun 2014 21:16:33 -0400 Subject: v6: docbook, tables --- lib/sisu/v6/xml_docbook5.rb | 10 +++++++- lib/sisu/v6/xml_tables.rb | 58 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index 28b7fc4a..db6e7eb0 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -243,7 +243,15 @@ module SiSU_XML_Docbook_Book unless xml_tag.empty? filename_docbook.puts "#{spaces*(@splv)}#{xml_tag}" end - elsif (o.of ==:para or o.of ==:block) + elsif o.of ==:block + if o.is ==:table + filename_docbook.puts SiSU_Tables::TableXMLdocbook.new(o,id).table.obj + else + filename_docbook.puts "#{spaces*(@splv)}" + filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap + filename_docbook.puts "#{spaces*(@splv)}" + end + elsif o.of ==:para filename_docbook.puts "#{spaces*(@splv)}" filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap filename_docbook.puts "#{spaces*(@splv)}" diff --git a/lib/sisu/v6/xml_tables.rb b/lib/sisu/v6/xml_tables.rb index a994e402..6967bb86 100644 --- a/lib/sisu/v6/xml_tables.rb +++ b/lib/sisu/v6/xml_tables.rb @@ -122,6 +122,64 @@ module SiSU_Tables @parablock end end + class TableXMLdocbook + @@tablehead=0 + @@tablefoot=[] #watch + def initialize(table,id='') + @table_obj,@id=table,id + @vz=SiSU_Viz::Defaults.new + end + def spaces + Ax[:spaces] + end + def table + table_obj=@table_obj + if table_obj.obj !~/^/,'
') + trc <<= if table_obj.head_ and nr==0 + %{#{spaces*6}#{c}\n} + else %{#{spaces*6}#{c}\n} + end + nc+=1 + end + trc=(trc.is_a?(Array)) ? trc.flatten.join : trc + trc = if table_obj.head_ and nr==0 + "#{spaces*4}\n#{spaces*5}\n#{trc}#{spaces*5}\n#{spaces*4}\n#{spaces*4}\n" + else + "#{spaces*5}\n#{trc}#{spaces*5}\n" + end + nr+=1 + table_rows << trc + end + tbody_close=if table_obj.head_ + "#{spaces*4}" + else '' + end + table_rows=table_rows.flatten.join + # include table_id + table_obj.obj=%{#{spaces*3} +#{spaces*4}
+#{spaces*4} +#{table_rows}#{tbody_close} +#{spaces*4} +#{spaces*4}
+#{spaces*3}} + table_obj + end + end class TableXMLexp