From 83137da0f259e8366eba7f626319b5a5b9b27d6d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 19 Jun 2014 19:17:23 -0400 Subject: v5 v6: indent spaces, minor --- lib/sisu/v6/xml_docbook5.rb | 74 ++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'lib/sisu/v6/xml_docbook5.rb') diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index f5dba87a..bc4ad233 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -127,8 +127,8 @@ module SiSU_XML_Docbook_Book structure_build_collapsed(data) #tail end - def space - ' ' + def spaces + Ax[:spaces] end def tags # collapsed --> @@ -176,7 +176,7 @@ module SiSU_XML_Docbook_Book end def output(o,comment='') puts o.lc == (0..6) \ - ? "#{space*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}#{comment}" + ? "#{spaces*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}#{comment}" : "<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}#{comment}" end def structure_collapsed(data) @@ -213,21 +213,21 @@ module SiSU_XML_Docbook_Book @splv=o.lc tag_id=o.tags[0] ? %{ id="#{o.tags[0]}" } : '' if doc_position ==:head - filename_docbook.puts %{#{space*o.lc}} + filename_docbook.puts %{#{spaces*o.lc}} doc_position=:body_and_tail else filename_docbook.puts structure_build_tag_close(o.lc,h) - filename_docbook.puts %{#{space*(o.lc)}<#{tags.docbook(o.lc,chlv)}#{tag_id}> -#{space*o.lc} + filename_docbook.puts %{#{spaces*(o.lc)}<#{tags.docbook(o.lc,chlv)}#{tag_id}> +#{spaces*o.lc} } end filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap - filename_docbook.puts %{#{space*o.lc}} + filename_docbook.puts %{#{spaces*o.lc}} h=o.lc elsif (o.of ==:para or o.of ==:block) - filename_docbook.puts "#{space*(@splv)}" + filename_docbook.puts "#{spaces*(@splv)}" filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap - filename_docbook.puts "#{space*(@splv)}" + filename_docbook.puts "#{spaces*(@splv)}" end end filename_docbook.puts structure_build_tag_close(0,h) @@ -237,40 +237,40 @@ module SiSU_XML_Docbook_Book x=[] case h when 0 - x << "#{space*0}" if (lc <= 0) + x << "#{spaces*0}" if (lc <= 0) when 1 - x << "#{space*1}" if (lc <= 1) - x << "#{space*0}" if (lc <= 0) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) when 2 - x << "#{space*2}" if (lc <= 2) - x << "#{space*1}" if (lc <= 1) - x << "#{space*0}" if (lc <= 0) + x << "#{spaces*2}" if (lc <= 2) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) when 3 - x << "#{space*3}" if (lc <= 3) - x << "#{space*2}" if (lc <= 2) - x << "#{space*1}" if (lc <= 1) - x << "#{space*0}" if (lc <= 0) + x << "#{spaces*3}" if (lc <= 3) + x << "#{spaces*2}" if (lc <= 2) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) when 4 - 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) + x << "#{spaces*4}" if (lc <= 4) + x << "#{spaces*3}" if (lc <= 3) + x << "#{spaces*2}" if (lc <= 2) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) when 5 - 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) + x << "#{spaces*5}" if (lc <= 5) + x << "#{spaces*4}" if (lc <= 4) + x << "#{spaces*5}" if (lc <= 3) + x << "#{spaces*2}" if (lc <= 2) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) when 6 - 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) + x << "#{spaces*6}" if (lc <= 6) + x << "#{spaces*5}" if (lc <= 5) + x << "#{spaces*4}" if (lc <= 4) + x << "#{spaces*3}" if (lc <= 3) + x << "#{spaces*2}" if (lc <= 2) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) end x.join("\n") end -- cgit v1.2.3 From 4f5b055e9eb95cc4078cc776398d8239fe65c8ba Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 19 Jun 2014 19:38:14 -0400 Subject: v6: docbook, tags (name touch) --- lib/sisu/v6/xml_docbook5.rb | 60 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'lib/sisu/v6/xml_docbook5.rb') diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index bc4ad233..a835288a 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -135,7 +135,7 @@ module SiSU_XML_Docbook_Book def collapsed %w[ 0 1 2 3 4 5 ] end - def docbook(lc,chlv='') + def docbook_tag(lc,chlv='') case lc when 0 then 'book' when 1 then lc==chlv ? 'chapter' : 'section' @@ -217,7 +217,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 %{#{spaces*(o.lc)}<#{tags.docbook(o.lc,chlv)}#{tag_id}> + filename_docbook.puts %{#{spaces*(o.lc)}<#{tags.docbook_tag(o.lc,chlv)}#{tag_id}> #{spaces*o.lc} } end @@ -237,40 +237,40 @@ module SiSU_XML_Docbook_Book x=[] case h when 0 - x << "#{spaces*0}" if (lc <= 0) + x << "#{spaces*0}" if (lc <= 0) when 1 - x << "#{spaces*1}" if (lc <= 1) - x << "#{spaces*0}" if (lc <= 0) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) when 2 - x << "#{spaces*2}" if (lc <= 2) - x << "#{spaces*1}" if (lc <= 1) - x << "#{spaces*0}" if (lc <= 0) + x << "#{spaces*2}" if (lc <= 2) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) when 3 - x << "#{spaces*3}" if (lc <= 3) - x << "#{spaces*2}" if (lc <= 2) - x << "#{spaces*1}" if (lc <= 1) - x << "#{spaces*0}" if (lc <= 0) + x << "#{spaces*3}" if (lc <= 3) + x << "#{spaces*2}" if (lc <= 2) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) when 4 - x << "#{spaces*4}" if (lc <= 4) - x << "#{spaces*3}" if (lc <= 3) - x << "#{spaces*2}" if (lc <= 2) - x << "#{spaces*1}" if (lc <= 1) - x << "#{spaces*0}" if (lc <= 0) + x << "#{spaces*4}" if (lc <= 4) + x << "#{spaces*3}" if (lc <= 3) + x << "#{spaces*2}" if (lc <= 2) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) when 5 - x << "#{spaces*5}" if (lc <= 5) - x << "#{spaces*4}" if (lc <= 4) - x << "#{spaces*5}" if (lc <= 3) - x << "#{spaces*2}" if (lc <= 2) - x << "#{spaces*1}" if (lc <= 1) - x << "#{spaces*0}" if (lc <= 0) + x << "#{spaces*5}" if (lc <= 5) + x << "#{spaces*4}" if (lc <= 4) + x << "#{spaces*5}" if (lc <= 3) + x << "#{spaces*2}" if (lc <= 2) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) when 6 - x << "#{spaces*6}" if (lc <= 6) - x << "#{spaces*5}" if (lc <= 5) - x << "#{spaces*4}" if (lc <= 4) - x << "#{spaces*3}" if (lc <= 3) - x << "#{spaces*2}" if (lc <= 2) - x << "#{spaces*1}" if (lc <= 1) - x << "#{spaces*0}" if (lc <= 0) + x << "#{spaces*6}" if (lc <= 6) + x << "#{spaces*5}" if (lc <= 5) + x << "#{spaces*4}" if (lc <= 4) + x << "#{spaces*3}" if (lc <= 3) + x << "#{spaces*2}" if (lc <= 2) + x << "#{spaces*1}" if (lc <= 1) + x << "#{spaces*0}" if (lc <= 0) end x.join("\n") end -- cgit v1.2.3 From e0c38cb8d044e0b3dc449e10d1aa14ef3b6900ad Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 19 Jun 2014 21:13:06 -0400 Subject: v6: docbook, ocn & footnote numbers (as xml comments) --- lib/sisu/v6/xml_docbook5.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/sisu/v6/xml_docbook5.rb') diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index a835288a..3f5333b2 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -200,7 +200,7 @@ module SiSU_XML_Docbook_Book data.each_with_index do |o,i| if (defined? o.ocn and not o.ocn.nil?) ocn=(@make.build.ocn?) \ - ? "\n#{Dx[:ocn_o]}#{o.ocn}#{Dx[:ocn_c]}" + ? "" : '' id=%{ id="o#{o.ocn}" } else @@ -221,7 +221,7 @@ module SiSU_XML_Docbook_Book #{spaces*o.lc} } end - filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap + filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj,80,(@splv*2+2),nil,ocn).line_wrap filename_docbook.puts %{#{spaces*o.lc}} h=o.lc elsif (o.of ==:para or o.of ==:block) -- cgit v1.2.3 From beb28d69dcf076b73dda47096353fd7404565fa8 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 19 Jun 2014 21:14:34 -0400 Subject: v6: docbook, metadata header (docinfo) --- lib/sisu/v6/xml_docbook5.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/sisu/v6/xml_docbook5.rb') diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index 3f5333b2..75764043 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -70,6 +70,7 @@ module SiSU_XML_Docbook_Book include SiSU_TextUtils require_relative 'xml_shared' # xml_shared.rb include SiSU_XML_Munge + require_relative 'shared_metadata' # shared_metadata.rb class Source def initialize(opt) @opt=opt @@ -189,6 +190,13 @@ module SiSU_XML_Docbook_Book end #def chapterlevel #end + def xml_head + [ + '', + SiSU_Metadata::Summary.new(@md).xml_docbook.metadata, + '' + ].flatten + end def structure_build_collapsed(data) #output_file=@md.file.output_path.xml_docbook_book.dir + '/' + @md.file.base_filename.xml_docbook_book file=SiSU_Env::FileOp.new(@md) @@ -197,6 +205,7 @@ module SiSU_XML_Docbook_Book @chlv=chlv=0 doc_position=:head filename_docbook.puts head + filename_docbook.puts xml_head data.each_with_index do |o,i| if (defined? o.ocn and not o.ocn.nil?) ocn=(@make.build.ocn?) \ -- cgit v1.2.3 From 16380ed1aa129cb3059b0f5eb23bc1a3f20bf08c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 19 Jun 2014 21:15:36 -0400 Subject: v6: docbook, quotes (blockquote) --- lib/sisu/v6/xml_docbook5.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/sisu/v6/xml_docbook5.rb') diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index 75764043..28b7fc4a 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -163,7 +163,7 @@ module SiSU_XML_Docbook_Book end def markup_text(data) data.each_with_index do |o,i| - if o.is ==:heading || o.is ==:para + if o.is ==:heading || o.is ==:para || o.is ==:open_close_tags o=@trans.markup_docbook(o) #unless o.obj==nil end end @@ -233,6 +233,16 @@ module SiSU_XML_Docbook_Book filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj,80,(@splv*2+2),nil,ocn).line_wrap filename_docbook.puts %{#{spaces*o.lc}} h=o.lc + elsif o.of ==:layout \ + and o.is ==:open_close_tags + xml_tag=case o.sym + when :quote_open then '
' + when :quote_close then '
' + else '' + end + unless xml_tag.empty? + filename_docbook.puts "#{spaces*(@splv)}#{xml_tag}" + end elsif (o.of ==:para or o.of ==:block) filename_docbook.puts "#{spaces*(@splv)}" filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap -- cgit v1.2.3 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 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/sisu/v6/xml_docbook5.rb') 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)}" -- cgit v1.2.3 From c7eddcb1c6ab5b1bc79cf72cf8b229e58665b7fd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 19 Jun 2014 21:18:05 -0400 Subject: v6: docbook, images --- lib/sisu/v6/xml_docbook5.rb | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'lib/sisu/v6/xml_docbook5.rb') diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index db6e7eb0..28fa25ed 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -197,6 +197,28 @@ module SiSU_XML_Docbook_Book '' ].flatten end + def adjust_output(o,ocn,filename_docbook,splv) + if o.obj =~/#{Xx[:split]}/ + outs=o.obj.split(/#{Xx[:split]}/) + outs.each do |out| + if out =~/
} end - filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj,80,(@splv*2+2),nil,ocn).line_wrap + adjust_output(o,ocn,filename_docbook,@splv) filename_docbook.puts %{#{spaces*o.lc}} h=o.lc elsif o.of ==:layout \ @@ -248,12 +270,12 @@ module SiSU_XML_Docbook_Book 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 + adjust_output(o,ocn,filename_docbook,@splv) 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 + adjust_output(o,ocn,filename_docbook,@splv) filename_docbook.puts "#{spaces*(@splv)}" end end -- cgit v1.2.3 From e7ce3d1c446e63853068380e7d025ba991817146 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 19 Jun 2014 21:19:17 -0400 Subject: v6: docbook, code block --- lib/sisu/v6/xml_docbook5.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/sisu/v6/xml_docbook5.rb') diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb index 28fa25ed..b3e9e035 100644 --- a/lib/sisu/v6/xml_docbook5.rb +++ b/lib/sisu/v6/xml_docbook5.rb @@ -197,6 +197,9 @@ module SiSU_XML_Docbook_Book '' ].flatten end + def code_output(o,ocn,filename_docbook) + filename_docbook.puts o.obj.gsub(/\n?(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\n?/m,"\n") + end def adjust_output(o,ocn,filename_docbook,splv) if o.obj =~/#{Xx[:split]}/ outs=o.obj.split(/#{Xx[:split]}/) @@ -268,6 +271,12 @@ module SiSU_XML_Docbook_Book elsif o.of ==:block if o.is ==:table filename_docbook.puts SiSU_Tables::TableXMLdocbook.new(o,id).table.obj + elsif o.is ==:code + filename_docbook.puts "#{spaces*(@splv)}" + filename_docbook.puts "#{spaces*(@splv+1)}" + code_output(o,ocn,filename_docbook) + filename_docbook.puts "#{spaces*(@splv+1)}" + filename_docbook.puts "#{spaces*(@splv)}" else filename_docbook.puts "#{spaces*(@splv)}" adjust_output(o,ocn,filename_docbook,@splv) -- cgit v1.2.3