diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-06-19 21:18:05 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-06-19 21:18:05 -0400 |
commit | c7eddcb1c6ab5b1bc79cf72cf8b229e58665b7fd (patch) | |
tree | 0385e26dba70cdfdb9d05a51f7066aa3eb61ea08 /lib | |
parent | v6: docbook, tables (diff) |
v6: docbook, images
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v6/xml_docbook5.rb | 28 | ||||
-rw-r--r-- | lib/sisu/v6/xml_shared.rb | 3 |
2 files changed, 27 insertions, 4 deletions
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 '</docinfo>' ].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 =~/<figure id=/m + out=out.gsub(/:spaces0:/m, + %{#{spaces*(splv)}#{spaces}}). + gsub(/:spaces1:/m, + %{#{spaces*(splv)}#{spaces*2}}) + filename_docbook.puts out + filename_docbook.puts "#{spaces*3}#{ocn}" + else + unless out.empty? + filename_docbook.puts SiSU_TextUtils::Wrap.new(out,80,(splv*2+2),nil).line_wrap + filename_docbook.puts "#{spaces*3}#{ocn}" + end + end + end + else + filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj,80,(splv*2+2),nil,ocn).line_wrap + end + 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) @@ -230,7 +252,7 @@ module SiSU_XML_Docbook_Book #{spaces*o.lc}<title#{id}> } 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}</title>} 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)}<para#{id}>" - 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)}</para>" end elsif o.of ==:para filename_docbook.puts "#{spaces*(@splv)}<para#{id}>" - 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)}</para>" end end diff --git a/lib/sisu/v6/xml_shared.rb b/lib/sisu/v6/xml_shared.rb index aeb73f22..b1ebc95f 100644 --- a/lib/sisu/v6/xml_shared.rb +++ b/lib/sisu/v6/xml_shared.rb @@ -476,7 +476,8 @@ module SiSU_XML_Munge gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>'). gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>'). gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd - gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m,'<image xl:href="../../_sisu/image/\1" />'). #taken unmodified except path from fictionbook + gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m, + %{#{Xx[:split]}:spaces0:<figure id="\\1">\n:spaces1:<title></title>\n:spaces1:<graphic fileref="images/\\1" align="center" width="50%"></graphic>\n:spaces0:</figure>#{Xx[:split]}}). gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}"). gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>'). gsub(/#{Mx[:gl_bullet]}/m,'● '). # not available |