aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3dv/manifest.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3dv/manifest.rb')
-rw-r--r--lib/sisu/v3dv/manifest.rb70
1 files changed, 48 insertions, 22 deletions
diff --git a/lib/sisu/v3dv/manifest.rb b/lib/sisu/v3dv/manifest.rb
index 3310fa98..19fdc65c 100644
--- a/lib/sisu/v3dv/manifest.rb
+++ b/lib/sisu/v3dv/manifest.rb
@@ -106,6 +106,12 @@ module SiSU_Manifest
@fnb=@md.fnb
@base_url="#{@env.url.root}/#{@fnb}"
@f=SiSU_Env::FileOp.new(@md)
+ @o_str=SiSU_Env::OutputStructure.new(md).output_dir_structure
+ @image_path=if @o_str.dump_or_redirect?
+ %{./image}
+ else
+ %{#{@f.path_rel_links.html_scroll_2}_sisu/image_sys}
+ end
@base_path=@f.output_path.manifest.dir
@@dg ||=SiSU_Env::InfoEnv.new.digest.type
@dg=@@dg
@@ -113,6 +119,7 @@ module SiSU_Manifest
@language=l[:n]
@translate=SiSU_Translate::Source.new(@md,@language)
@brace_url=SiSU_Viz::Skin.new.url_decoration
+ @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
end
def output
manifest=@f.write_file.manifest
@@ -122,17 +129,26 @@ module SiSU_Manifest
manifest << x
end
end
+ def url_make(url,file,src=nil)
+ if @o_str.dump_or_redirect?
+ ''
+ elsif :src
+ %{<br />#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}}
+ else
+ %{<p class="tiny">#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p>}
+ end
+ end
def summarize(id,file,pth='',rel='',url='',img='● ')
size=(File.size("#{pth}/#{file}")/1024.00).to_s
kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
@manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p><p class="tiny">#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
+ @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
end
def summarize_html_seg(id,file,pth='',rel='',url='',img='● ')
size=(File.size("#{pth}/#{file}")/1024.00).to_s
kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
@manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p><p class="tiny">#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
+ @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{img}#{id}</a></p></th><td><p class="small"><a href="#{rel}/#{file}">#{file}</a></p>#{url_make(url,file)}</td><td class="right"><p class="right">#{kb}</p></td></tr>\n}
end
def summarize_sources(id,file,pth,rel,url)
sys=SiSU_Env::SystemCall.new
@@ -143,7 +159,7 @@ module SiSU_Manifest
size=(File.size("#{pth}/#{file}")/1024.00).to_s
kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
@manifest[:txt] << "#{file} #{id} #{kb}\n"
- @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="#{rel}/#{file}">#{file}</a> &nbsp;&nbsp;#{dgst[1]}<br />#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n} if kb and kb =~/\d+/
+ @manifest[:html] << %{<tr><th class="left"><p class="norm"><a href="#{rel}/#{file}">#{id}</a></p></th><td class="right"><p class="tiny"><a href="#{rel}/#{file}">#{file}</a> &nbsp;&nbsp;#{dgst[1]}#{url_make(url,file,:src)}</p></td><td class="right"><p class="right">#{kb}</p></td></tr>\n} if kb and kb =~/\d+/
end
def published_manifests?
@f=SiSU_Env::FileOp.new(@md) #.base_filename
@@ -153,7 +169,13 @@ module SiSU_Manifest
mp,mn,mt,mr=nil,nil,nil,nil
ln=SiSU_i18n::Languages.new.language.list
Px[:lng_lst].each do |lc|
- if @env.output_dir_structure.by_language_code?
+ if @o_str.dump_or_redirect? #does not work for --redirect or --dump
+ mp="#{@f.output_path.base.dir}"
+ mn="#{@md.fnb}.html"
+ mt="#{mp}/#{mn}"
+ mr="../../#{lc}/manifest/#{mn}"
+ mu="#{url}/#{mn}"
+ elsif @env.output_dir_structure.by_language_code?
mp="#{@f.output_path.base.dir}/#{lc}/manifest"
mn="#{@md.fnb}.html"
mt="#{mp}/#{mn}"
@@ -212,7 +234,7 @@ module SiSU_Manifest
end
def output_tests
if FileTest.file?(@f.place_file.html_segtoc.dir)==true
- img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_toc.png" alt="TOC linked" /> }
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_toc.png" alt="TOC linked" /> }
pth=@f.output_path.html_seg.dir
rel=@f.output_path.html_seg.rel_sm
url=@f.output_path.html_seg.url
@@ -220,7 +242,7 @@ module SiSU_Manifest
summarize_html_seg(id,file,pth,rel,url,img)
end
if FileTest.file?(@f.place_file.html_scroll.dir)==true
- img=%{<img border="0" height="15" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_doc.png" alt="Full Text" /> }
+ img=%{<img border="0" height="15" width="15" src="#{@image_path}/b_doc.png" alt="Full Text" /> }
pth=@f.output_path.html_scroll.dir
rel=@f.output_path.html_scroll.rel_sm
url=@f.output_path.html_scroll.url
@@ -242,7 +264,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url)
end
if FileTest.file?(@f.place_file.epub.dir)==true
- img=%{<img border="0" height="18" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_epub.png" alt="EPUB" /> }
+ img=%{<img border="0" height="18" width="18" src="#{@image_path}/b_epub.png" alt="EPUB" /> }
id,file='EPUB (Electronic Publication, e-book standard)',@f.base_filename.epub
pth=@f.output_path.epub.dir
rel=@f.output_path.epub.rel_sm
@@ -250,7 +272,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url,img)
end
if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_letter}")==true
- img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> }
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
pth=@f.output_path.pdf.dir
rel=@f.output_path.pdf.rel_sm
url=@f.output_path.pdf.url
@@ -258,7 +280,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url,img)
end
if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_letter}")==true
- img=%{<img border="0" height="15" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> }
+ img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
pth=@f.output_path.pdf.dir
rel=@f.output_path.pdf.rel_sm
url=@f.output_path.pdf.url
@@ -266,7 +288,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url,img)
end
if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a4}")==true
- img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> }
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
pth=@f.output_path.pdf.dir
rel=@f.output_path.pdf.rel_sm
url=@f.output_path.pdf.url
@@ -274,7 +296,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url,img)
end
if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a4}")==true
- img=%{<img border="0" height="15" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> }
+ img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
pth=@f.output_path.pdf.dir
rel=@f.output_path.pdf.rel_sm
url=@f.output_path.pdf.url
@@ -282,7 +304,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url,img)
end
if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a5}")==true
- img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> }
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
pth=@f.output_path.pdf.dir
rel=@f.output_path.pdf.rel_sm
url=@f.output_path.pdf.url
@@ -290,7 +312,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url,img)
end
if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a5}")==true
- img=%{<img border="0" height="15" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> }
+ img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
pth=@f.output_path.pdf.dir
rel=@f.output_path.pdf.rel_sm
url=@f.output_path.pdf.url
@@ -298,7 +320,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url,img)
end
if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_b5}")==true
- img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> }
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
pth=@f.output_path.pdf.dir
rel=@f.output_path.pdf.rel_sm
url=@f.output_path.pdf.url
@@ -306,7 +328,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url,img)
end
if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_b5}")==true
- img=%{<img border="0" height="15" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> }
+ img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
pth=@f.output_path.pdf.dir
rel=@f.output_path.pdf.rel_sm
url=@f.output_path.pdf.url
@@ -314,7 +336,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url,img)
end
if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_legal}")==true
- img=%{<img border="0" height="18" width="15" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF portrait" /> }
+ img=%{<img border="0" height="18" width="15" src="#{@image_path}/b_pdf.png" alt="PDF portrait" /> }
pth=@f.output_path.pdf.dir
rel=@f.output_path.pdf.rel_sm
url=@f.output_path.pdf.url
@@ -322,7 +344,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url,img)
end
if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_legal}")==true
- img=%{<img border="0" height="15" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_pdf.png" alt="PDF landscape" /> }
+ img=%{<img border="0" height="15" width="18" src="#{@image_path}/b_pdf.png" alt="PDF landscape" /> }
pth=@f.output_path.pdf.dir
rel=@f.output_path.pdf.rel_sm
url=@f.output_path.pdf.url
@@ -330,7 +352,7 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url,img)
end
if FileTest.file?(@f.place_file.odt.dir)==true
- img=%{<img border="0" height="18" width="18" src="#{@f.path_rel_links.html_scroll_2}_sisu/image_sys/b_odf.png" alt="ODF/ODT" /> }
+ img=%{<img border="0" height="18" width="18" src="#{@image_path}/b_odf.png" alt="ODF/ODT" /> }
pth=@f.output_path.odt.dir
rel=@f.output_path.odt.rel_sm
url=@f.output_path.odt.url
@@ -416,8 +438,11 @@ module SiSU_Manifest
end
def qrc_image
fn=@md.fnb
- img_md="qrcode/#{fn}.md.png"
- img_title="qrcode/#{fn}.title.png"
+ pth=(@o_str.dump_or_redirect?) \
+ ? '.' \
+ : 'qrcode'
+ img_md="#{pth}/#{fn}.md.png"
+ img_title="#{pth}/#{fn}.title.png"
if FileTest.file?(@f.place_file.qrcode_md.dir)==true
@manifest[:html] <<<<WOK
<tr><td class="left">
@@ -763,13 +788,14 @@ SiSU manifest: #{@md.title.full}
<meta name="sourcefile" content="#{@md.fns}" />
<link rel="generator" href="http://www.jus.uio.no/sisu" />
<link rel="shortcut icon" href="#{@f.path_rel_links.html_scroll_css}_sisu/image_sys/rb7.ico" />
-<link rel="stylesheet" href="#{@f.path_rel_links.html_scroll_css}_sisu/css/html.css" type="text/css" />
+#{@stylesheet.css_head}
</head>
<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">
#{banner_table}
WOK
if @env.manifest_minitoc?
- if @env.output_dir_structure.by_language_code? \
+ if @o_str.dump_or_redirect?
+ elsif @env.output_dir_structure.by_language_code? \
or @env.output_dir_structure.by_filetype?
minitoc=minitoc.gsub(/<a href="(\S+?)"/m,%{<a href="../html/#{@md.fnb}/\\1"}).
gsub(/<a href="\.\.\/html\/#{@md.fnb}\/(?:sisu_manifest\.html|#{@f.base_filename.manifest})"/m,