diff options
-rw-r--r-- | data/doc/sisu/CHANGELOG_v6 | 1 | ||||
-rw-r--r-- | lib/sisu/v6/xml_docbook5.rb | 28 | ||||
-rw-r--r-- | lib/sisu/v6/xml_shared.rb | 3 |
3 files changed, 28 insertions, 4 deletions
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 29f5be22..9152019a 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -44,6 +44,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.8.orig.tar.xz * metadata header (docinfo) * quotes (blockquote) * tables + * images %% 6.0.7.orig.tar.xz (2014-05-25:20/7) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_6.0.7 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 |