diff options
Diffstat (limited to 'lib/sisu/v3/manifest.rb')
-rw-r--r-- | lib/sisu/v3/manifest.rb | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index 20983d7f..58f2d8eb 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -87,7 +87,7 @@ module SiSU_Manifest url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" @opt.cmd=~/[MVvz]/ \ ? SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}").green_hi_blue - : SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").grey_title_hi + : SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"[#{@opt.f_pth[:lng_is]}]", "#{url_html}").grey_title_grey_blue SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i end data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions @@ -111,7 +111,7 @@ module SiSU_Manifest @base_url="#{@env.url.root}/#{@fnb}" @o_str=SiSU_Env::FileOp.new(md).output_dir_structure @image_path=if @o_str.dump_or_redirect? - %{./image} + './image' else %{#{@f.path_rel_links.html_scroll_2}_sisu/image_sys} end @@ -155,9 +155,9 @@ module SiSU_Manifest end def summarize_sources(id,file,pth,rel,url) sys=SiSU_Env::SystemCall.new - dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{pth}/#{file}") - else sys.md5("#{pth}/#{file}") - end + dgst=(@dg =~/^sha(?:2|256)$/) \ + ? sys.sha256("#{pth}/#{file}") + : sys.md5("#{pth}/#{file}") SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/ size=(File.size("#{pth}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @@ -225,13 +225,13 @@ module SiSU_Manifest end end def metadata(id,info) - info=info.to_s.gsub(/#{Mx[:br_line]}/,'<br />') + info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'<br />') @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td><p class="left">#{info}</p></td></tr>\n} end def links(url,lnk,target) - static=if url =~/^\.\//; url.gsub(/^\.(\.)?/,@base_url) - elsif url =~/^\.\.\//; url.gsub(/^\.(\.)?/,@env.url.root) - else url + static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url) + elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root) + else url end @manifest[:html] << %{<tr><th class="right" width=5%><p class="norm">●</p></th><td class="left"><p class="norm"><a href="#{url}">#{lnk}</a></p><p class="tiny"> #{@brace_url.xml_open}<a href="#{static}">#{static}</a>#{@brace_url.xml_close}</p></td></tr>\n} end @@ -406,11 +406,11 @@ module SiSU_Manifest summarize(id,file,pth,rel,url) end if FileTest.file?(@f.place_file.txt.dir)==true - if @md.opt.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)' - elsif @md.opt.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)' - elsif @md.opt.cmd =~/A/; id='Plaintext (dos (UTF-8) with footnotes)' - elsif @md.opt.cmd =~/E/; id='Plaintext (dos (UTF-8) with endnotes)' - else id='Plaintext (UTF-8)' + id=if @md.opt.cmd =~/a/ then 'Plaintext (Unix (UTF-8) with footnotes)' + elsif @md.opt.cmd =~/e/ then 'Plaintext (Unix (UTF-8) with endnotes)' + elsif @md.opt.cmd =~/A/ then 'Plaintext (dos (UTF-8) with footnotes)' + elsif @md.opt.cmd =~/E/ then 'Plaintext (dos (UTF-8) with endnotes)' + else 'Plaintext (UTF-8)' end pth=@f.output_path.txt.dir rel=@f.output_path.txt.rel_sm @@ -697,9 +697,15 @@ WOK @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{@translate.topic_register}:</p></th><td>\n} @md.topic_register_array.each do |t| t.each_with_index do |st,i| - if st.class==Array + if st.is_a?(Array) st.each do |v| - @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n} + if v.is_a?(Array) + v.each do |w,i| + @manifest[:html] << %{<p class="it#{i}">#{w}</p>\n} + end + else + @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n} + end end else @manifest[:html] << %{<p class="it#{i}">#{st}</p>\n} end @@ -749,9 +755,9 @@ WOK and @md.lnk @md.lnk.each do |l| if defined? l[:say] - target=if l[:url] !~/^\.(\.)?\//; 'external' - else '_top' - end + target=(l[:url] !~/^\.(\.)?\//) \ + ? 'external' + : '_top' url,lnk=l[:url],l[:say] unless url.nil? \ or url.empty? |