aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3dv
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3dv')
-rw-r--r--lib/sisu/v3dv/cgi_pgsql.rb2
-rw-r--r--lib/sisu/v3dv/cgi_sql_common.rb4
-rw-r--r--lib/sisu/v3dv/cgi_sqlite.rb2
-rw-r--r--lib/sisu/v3dv/concordance.rb4
-rw-r--r--lib/sisu/v3dv/css.rb92
-rw-r--r--lib/sisu/v3dv/dal_doc_str.rb5
-rw-r--r--lib/sisu/v3dv/dal_expand_insertions.rb4
-rw-r--r--lib/sisu/v3dv/defaults.rb2
-rw-r--r--lib/sisu/v3dv/epub_segments.rb4
-rw-r--r--lib/sisu/v3dv/html.rb27
-rw-r--r--lib/sisu/v3dv/html_format.rb116
-rw-r--r--lib/sisu/v3dv/html_segments.rb15
-rw-r--r--lib/sisu/v3dv/hub.rb8
-rw-r--r--lib/sisu/v3dv/manifest.rb70
-rw-r--r--lib/sisu/v3dv/options.rb94
-rw-r--r--lib/sisu/v3dv/param.rb7
-rw-r--r--lib/sisu/v3dv/shared_images.rb125
-rw-r--r--lib/sisu/v3dv/sisupod_make.rb2
-rw-r--r--lib/sisu/v3dv/sysenv.rb597
-rw-r--r--lib/sisu/v3dv/xhtml.rb4
-rw-r--r--lib/sisu/v3dv/xml.rb4
-rw-r--r--lib/sisu/v3dv/xml_dom.rb4
-rw-r--r--lib/sisu/v3dv/xml_format.rb6
23 files changed, 954 insertions, 244 deletions
diff --git a/lib/sisu/v3dv/cgi_pgsql.rb b/lib/sisu/v3dv/cgi_pgsql.rb
index 26a85874..8b3f0224 100644
--- a/lib/sisu/v3dv/cgi_pgsql.rb
+++ b/lib/sisu/v3dv/cgi_pgsql.rb
@@ -68,7 +68,7 @@ module SiSU_CGI_PgSQL
@image_src="#{@env.url.webserv_cgi}/_sisu/image_sys"
@common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env)
@db=SiSU_Env::InfoDb.new
- @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by}_pgsql.cgi"
+ @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_pgsql.cgi"
end
def pgsql
serve=[]
diff --git a/lib/sisu/v3dv/cgi_sql_common.rb b/lib/sisu/v3dv/cgi_sql_common.rb
index 0f17bb79..8a7c126f 100644
--- a/lib/sisu/v3dv/cgi_sql_common.rb
+++ b/lib/sisu/v3dv/cgi_sql_common.rb
@@ -841,7 +841,7 @@ module SiSU_CGI_SQL
end
def dir_structure
case @opt.dir_structure_by
- when /language/
+ when :language
<<-'WOK_SQL'
def path_manifest(fn,ln=nil)
"#{@hostpath}/#{ln}/manifest/#{fn}.html"
@@ -862,7 +862,7 @@ module SiSU_CGI_SQL
"#{@hostpath}/#{ln}/html/#{fn}.html"
end
WOK_SQL
- when /filetype/
+ when :filetype
<<-'WOK_SQL'
def path_manifest(fn,ln=nil)
"#{@hostpath}/manifest/#{fn}.#{ln}.html"
diff --git a/lib/sisu/v3dv/cgi_sqlite.rb b/lib/sisu/v3dv/cgi_sqlite.rb
index 31ba44c4..9c2a6a8d 100644
--- a/lib/sisu/v3dv/cgi_sqlite.rb
+++ b/lib/sisu/v3dv/cgi_sqlite.rb
@@ -66,7 +66,7 @@ module SiSU_CGI_SQLite
@env=SiSU_Env::InfoEnv.new('',opt)
@image_src="#{@env.url.webserv_cgi}/_sisu/image_sys"
@common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env)
- @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by}_sqlite.cgi"
+ @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_sqlite.cgi"
end
def sqlite
serve=[]
diff --git a/lib/sisu/v3dv/concordance.rb b/lib/sisu/v3dv/concordance.rb
index 82c53e7a..7ec234bc 100644
--- a/lib/sisu/v3dv/concordance.rb
+++ b/lib/sisu/v3dv/concordance.rb
@@ -121,7 +121,7 @@ WOK
def create
head_banner=SiSU_HTML_Format::HeadToc.new(@md)
minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,@data).songsheet.join("\n")
- @css=SiSU_Env::CSS_Stylesheet.new(@md)
+ stylesheet=SiSU_Style::CSS_HeadInfo.new(@md).stylesheet
toc='<div class="toc">' + minitoc + '</div>'
<<WOK
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@@ -136,7 +136,7 @@ WOK
<meta name="generator" content="SiSU (Linux &amp; Ruby!)">
<link rel="generator" href="http://www.jus.uio.no/sisu" />
<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
- #{@css.html_seg}
+ #{stylesheet.css_head_seg}
#{@vz.js_head}
</head>
<body>
diff --git a/lib/sisu/v3dv/css.rb b/lib/sisu/v3dv/css.rb
index 522aae7e..cdcd16cd 100644
--- a/lib/sisu/v3dv/css.rb
+++ b/lib/sisu/v3dv/css.rb
@@ -59,6 +59,98 @@
module SiSU_Style
require_relative 'sysenv' # sysenv.rb
require_relative 'defaults' # defaults.rb
+ class CSS_HeadInfo
+ def initialize(md,ft='html')
+ @md,@ft=md,ft
+ @env=SiSU_Env::InfoEnv.new('',md)
+ @fn_css ||=SiSU_Env::CSS_Default.new
+ @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure
+ css_copy
+ end
+ def stylesheet
+ def css_path
+ SiSU_Env::CSS_Stylesheet.new(@md)
+ end
+ def css_embed_content
+ @css_embed_content ||=SiSU_Style::CSS.new
+ end
+ def css_embed?
+ if @ft=='html' \
+ && @o_str.dump_or_redirect?
+ true
+ else
+ false
+ end
+ end
+ def css_embed(css)
+ <<-WOK
+ <style TYPE="text/css">
+ #{css}
+ </style>
+ WOK
+ end
+ def css_action
+ style_css=SiSU_Style::CSS.new
+ css=case @ft
+ when 'html'
+ css=css_embed_content.html
+ css_embed(css)
+ when 'xhtml'
+ css_path.xhtml
+ when 'xml_sax'
+ css_path.xml_sax
+ when 'xml_dom'
+ css_path.xml_dom
+ else
+ css_embed_content.html
+ end
+ end
+ def css_head
+ (css_embed?) \
+ ? css_action\
+ : "#{css_path.html}#{css_path.html_seg}"
+ end
+ def css_head_seg
+ (css_embed?) \
+ ? css_action \
+ : css_path.html_seg
+ end
+ def css_head_xml
+ css_action
+ end
+ self
+ end
+ def css_copy
+ if @o_str.dump_or_redirect?
+ css=SiSU_Style::CSS.new
+ if @o_str.dump?
+ css_pth="#{@md.opt.opt_act[:dump][:inst]}/#{@env.path.style}"
+ elsif @o_str.redirect?
+ css_pth="#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}/#{@env.path.style}"
+ end
+ FileUtils::mkdir_p(css_pth) unless FileTest.directory?(css_pth)
+ case @ft
+ when 'html'
+ style=File.new("#{css_pth}/#{@fn_css.html}",'w')
+ style << css.html
+ style.close
+ when 'xhtml'
+ style=File.new("#{css_pth}/#{@fn_css.xhtml}",'w')
+ style << css.xhtml
+ style.close
+ when 'xml_sax'
+ style=File.new("#{css_pth}/#{@fn_css.xml_sax}",'w')
+ style << css.xml_sax
+ style.close
+ when 'xml_dom'
+ style=File.new("#{css_pth}/#{@fn_css.xml_dom}",'w')
+ style << css.xml_dom
+ style.close
+ css_path.xml_dom
+ end
+ end
+ end
+ end
class CSS
def initialize
@vz=SiSU_Env::GetInit.instance.skin
diff --git a/lib/sisu/v3dv/dal_doc_str.rb b/lib/sisu/v3dv/dal_doc_str.rb
index a3c697e0..b4a98edd 100644
--- a/lib/sisu/v3dv/dal_doc_str.rb
+++ b/lib/sisu/v3dv/dal_doc_str.rb
@@ -502,11 +502,6 @@ module SiSU_DAL_DocumentStructureExtract
tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
h={ ln: 4, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false }
tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
- tuned_file << @pb
- h={ ln: 2, obj: 'Manifest', autonum_: false, ocn_: false }
- tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
- h={ ln: 4, obj: 'SiSU Manifest, alternative outputs etc.', name: 'sisu_manifest', autonum_: false, ocn_: false }
- tuned_file << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading_insert(h)
tuned_file
h={ obj: 'eof' }
meta=SiSU_DAL_DocumentStructure::ObjectMetadata.new.metadata(@metadata)
diff --git a/lib/sisu/v3dv/dal_expand_insertions.rb b/lib/sisu/v3dv/dal_expand_insertions.rb
index 8ec52065..9e675bc4 100644
--- a/lib/sisu/v3dv/dal_expand_insertions.rb
+++ b/lib/sisu/v3dv/dal_expand_insertions.rb
@@ -289,7 +289,7 @@ module SiSU_DAL_Insertions
end
lnk={}
case @md.opt.dir_structure_by
- when /language/
+ when :language
lnk={
manifest: by_language(linked_doc,linked_doc_lang).manifest,
html_toc: by_language(linked_doc,linked_doc_lang).html_toc,
@@ -307,7 +307,7 @@ module SiSU_DAL_Insertions
sisupod: by_language(linked_doc,linked_doc_lang,source).sisupod,
source: by_language(linked_doc,linked_doc_lang,source).source,
}
- when /filetype/
+ when :filetype
lnk={
manifest: by_filetype(linked_doc,linked_doc_lang).manifest,
html_toc: by_filetype(linked_doc,linked_doc_lang).html_toc,
diff --git a/lib/sisu/v3dv/defaults.rb b/lib/sisu/v3dv/defaults.rb
index 1c9dd94f..eab42b71 100644
--- a/lib/sisu/v3dv/defaults.rb
+++ b/lib/sisu/v3dv/defaults.rb
@@ -1040,7 +1040,7 @@ module SiSU_Viz
def png_book
%{<img border="2" height="15" width="15" src="#{url_path_image_sys}/#{icon_book}" alt="Cameron May Books" />}
end
- #% png_nav
+ #% png_nav #not currently used
def png_nav_home
end
def png_nav_toc
diff --git a/lib/sisu/v3dv/epub_segments.rb b/lib/sisu/v3dv/epub_segments.rb
index 55c6c1f9..96abfdc0 100644
--- a/lib/sisu/v3dv/epub_segments.rb
+++ b/lib/sisu/v3dv/epub_segments.rb
@@ -247,10 +247,10 @@ WOK
SiSU_EPUB_Seg::Seg.new.reinitialise
heading_art(dob)
head(dob)
- if @@seg_name_xhtml[tracking]=='sisu_manifest' # this is for manifest, includes navigation bug
+ if @@seg_name_xhtml[tracking] =='metadata'
segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{Sfx[:epub_xhtml]}"
output_epub_cont_seg=File.new(segfilename,'w')
- SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'sisu_manifest').output
+ SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'metadata').output
SiSU_EPUB_Seg::Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX
end
#@output_epub_cont_seg.close #%(((( EOF )))) -->
diff --git a/lib/sisu/v3dv/html.rb b/lib/sisu/v3dv/html.rb
index ec7b0573..75d89382 100644
--- a/lib/sisu/v3dv/html.rb
+++ b/lib/sisu/v3dv/html.rb
@@ -138,14 +138,10 @@ module SiSU_HTML
def link_images
@symlnk.images
end
- def directories
- title=File.basename(@md.fns,'.rb')
- end
def tuned_file_instructions
@tell=SiSU_Screen::Ansi.new(@md.opt.cmd)
@md.opt.cmd=@md.opt.cmd.gsub(/H/,'h')
- @md.file_type='html' if @md.opt.cmd =~/[hon]/
- directories
+ @md.file_type='html' if @md.opt.cmd =~/[hw]/
newfilename=%{#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_segtoc}} if @md.file_type =~/html/
dal_array=@particulars.dal_array # dal file drawn here
@tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet
@@ -611,7 +607,8 @@ WOK
class Output
def initialize(data='',md='')
@data,@md=data,md
- @file=SiSU_Env::FileOp.new(@md)
+ @file=SiSU_Env::FileOp.new(md)
+ @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure
end
def scroll
begin
@@ -646,15 +643,17 @@ WOK
rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error
ensure
@filename_html_segtoc.close
- unless FileTest.file?("#{@file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg_index}")
- pwd_set=Dir.pwd
- idx_lnk=@file.base_filename.html_segtoc
- mlnk=@file.base_filename.html_seg_index
- Dir.chdir(@file.output_path.html_seg.dir)
- FileUtils::rm_f(mlnk)
- FileUtils::ln_s(idx_lnk, mlnk)
- Dir.chdir(pwd_set)
+ pwd_set=Dir.pwd
+ idx_lnk=if @o_str.dump_or_redirect?
+ @file.base_filename.manifest
+ else
+ @file.base_filename.html_segtoc
end
+ mlnk=@file.base_filename.html_seg_index
+ Dir.chdir(@file.output_path.html_seg.dir)
+ FileUtils::rm_f(mlnk)
+ FileUtils::ln_s(idx_lnk,mlnk)
+ Dir.chdir(pwd_set)
end
end
end
diff --git a/lib/sisu/v3dv/html_format.rb b/lib/sisu/v3dv/html_format.rb
index 29d1bfcb..d8b44760 100644
--- a/lib/sisu/v3dv/html_format.rb
+++ b/lib/sisu/v3dv/html_format.rb
@@ -96,6 +96,7 @@ module SiSU_HTML_Format
end
end
class HeadInformation
+ require_relative 'css' # css.rb
require_relative 'shared_xml' # shared_xml.rb
include SiSU_Viz
attr_reader :md,:rdf,:vz
@@ -103,12 +104,61 @@ module SiSU_HTML_Format
@md=md
# DublinCore 1 - title
@vz=SiSU_Env::GetInit.instance.skin
- @css=SiSU_Env::CSS_Stylesheet.new(md)
@seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || [])
@seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || [])
- @toc,@index='toc','index'
@metalink='#metadata'
@tocband_scroll,@tocband_segtoc=nil,nil
+ @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
+ @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure
+ @index='index'
+ @toc="#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}"
+ end
+ def url_path_image_sys
+ (@o_str.dump_or_redirect?) \
+ ? './image'
+ : "#{Xx[:html_relative2]}_sisu/image_sys"
+ end
+ def icon
+ def up
+ 'arrow_up_red.png'
+ end
+ def next
+ 'arrow_next_red.png'
+ end
+ def previous
+ 'arrow_prev_red.png'
+ end
+ def dot_clear
+ 'dot_clear.png'
+ end
+ def dot_white
+ 'dot_white.png'
+ end
+ def dot
+ dot_white
+ end
+ self
+ end
+ def png_nav
+ def toc
+ %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.up}" alt="TOC" />}
+ end
+ def pre
+ %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.previous}" alt="&lt;&lt;&nbsp;previous" />}
+ end
+ def nxt
+ %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.next}" alt="next&nbsp;&gt;&gt;" />}
+ end
+ def dot_toc
+ %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt="&#094;" />}
+ end
+ def dot_pre
+ %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt="&lt;" />}
+ end
+ def dot_nxt
+ %{<img border="0" width="100%" height="20" src="#{url_path_image_sys}/#{icon.dot}" alt="&gt;" />}
+ end
+ self
end
def doc_types #used in toc & seg_nav_band
scroll=seg=''
@@ -154,8 +204,9 @@ module SiSU_HTML_Format
super(md)
@md=md
@cf_defaults=SiSU_Env::InfoProcessingFlag.new
- @env=SiSU_Env::InfoEnv.new(@md.fns)
- @file=SiSU_Env::FileOp.new(@md)
+ @env=SiSU_Env::InfoEnv.new(md.fns)
+ @file=SiSU_Env::FileOp.new(md)
+ @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure
end
def home
%{<td align="center" bgcolor=#{@vz.color_band2}>
@@ -187,16 +238,19 @@ module SiSU_HTML_Format
env.widget.search_form('sisusearch',nil,nil,true)
end
def manifest
- manifest_lnk=if @file.output_dir_structure.by_language_code? \
- or @file.output_dir_structure.by_filetype?
- "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}"
- else @file.base_filename.manifest
- end
+ if not @o_str.dump_or_redirect?
+ manifest_lnk=if @file.output_dir_structure.by_language_code? \
+ or @file.output_dir_structure.by_filetype?
+ "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}"
+ else @file.base_filename.manifest
+ end
%{<td align="center" bgcolor=#{@vz.color_band2}>
<a href="#{manifest_lnk}" target="_top" #{@vz.js_manifest}>
#{@vz.nav_txt_manifest}
</a>
</td>}
+ else ''
+ end
end
def pdf #retired 2.7.9
pdf=if @md.programs[:pdf] \
@@ -267,6 +321,7 @@ module SiSU_HTML_Format
def initialize(md)
super(md)
@md=md
+ @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure
end
def scroll_head_navigation_band
pdf=if @md.programs[:pdf]
@@ -293,14 +348,14 @@ WOK
</td>
<td width="20%" align="right">
&nbsp;<a href="toc.html" target="_top" alt="-&gt;">
- #{@vz.png_nav_toc}
+ #{png_nav.toc}
</a>&nbsp;
#{@vz.table_close}
<p />}
end
def seg_head_navigation_band(type='')
firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="-&gt;">
- #{@vz.png_nav_nxt}
+ #{png_nav.nxt}
</a>} if @md.firstseg =~/\S+/
%{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
<tr><td width="20%">
@@ -319,7 +374,7 @@ WOK
@tocband_segtoc=make_scroll_seg_pdf
end
firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="-&gt;">
- #{@vz.png_nav_nxt}
+ #{png_nav.nxt}
</a>} if @md.firstseg =~/\S+/
%{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}>
<tr><td width="20%">
@@ -394,7 +449,7 @@ WOK
</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
#{rdf.metatag_html}
-#{@css.html}#{@css.html_seg}
+#{@stylesheet.css_head}
</head>
#{@vz.color_body}
<a name="top" id="top"></a>
@@ -529,12 +584,15 @@ WOK
#{@vz.table_close}}
end
def manifest #check structure
- manifest=manifest_link(@vz.nav_txt_manifest)
- %{#{@vz.margin_txt_3}
+ if not @o_str.dump_or_redirect?
+ manifest=manifest_link(@vz.nav_txt_manifest)
+ %{#{@vz.margin_txt_3}
#{@vz.paragraph_font_small}
#{manifest}
</font>
#{@vz.table_close}}
+ else ''
+ end
end
def concordance #check structure
concord=concordance_link(@vz.nav_txt_concordance)
@@ -618,14 +676,14 @@ WOK
end
end
class HeadSeg < HeadInformation
- def initialize(md) #(md='')
+ def initialize(md)
super(md)
end
def title_banner(title,subtitle,creator)
end
def dot_control_pre_next
pre="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:html]}"
- up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}"
+ up=@toc
nxt="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}"
if nxt=~/sisu_manifest\.html/
@file=SiSU_Env::FileOp.new(@md) if @md
@@ -637,56 +695,56 @@ WOK
%{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">
<tr><td align="left">
<a href="#{pre}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_dot_pre}
+ #{png_nav.dot_pre}
</a>
</td>
<td align="center">
<a href="#{up}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_dot_toc}
+ #{png_nav.dot_toc}
</a>
</td>
<td align="right">
<a href="#{nxt}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_dot_nxt}
+ #{png_nav.dot_nxt}
</a>
#{@vz.table_close}}
end
def dot_control_pre
pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}"
- up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}"
+ up=@toc
nxt="#{@md.file.base_filename.html_segtoc}"
%{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center">
<tr><td align="left">
<a href="#{pre}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_dot_pre}
+ #{png_nav.dot_pre}
</a>
</td>
<td align="center">
<a href="#{up}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_dot_toc}
+ #{png_nav.dot_toc}
</a>
</td>
<td align="right">
<a href="#{nxt}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_dot_nxt}
+ #{png_nav.dot_nxt}
</a>
#{@vz.table_close}}
end
def toc_nav(f_pre=false,f_nxt=false,use=1)
pre=nxt=''
toc=%{<td align="center" bgcolor=#{@vz.color_band1}>
- <a href="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" #{@vz.js_toc}>
- #{@vz.png_nav_toc}
+ <a href="#{@toc}" target="_top" #{@vz.js_toc}>
+ #{png_nav.toc}
</a>
</td>}
pre=%{<td align="center" bgcolor=#{@vz.color_band1}>
<a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" #{@vz.js_prev}>
- #{@vz.png_nav_pre}
+ #{png_nav.pre}
</a>
</td>} if f_pre==true
nxt=%{<td align="center" bgcolor=#{@vz.color_band1}>
<a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" #{@vz.js_next}>
- #{@vz.png_nav_nxt}
+ #{png_nav.nxt}
</a>
</td>} if f_nxt==true
if nxt =~/sisu_manifest.html/
@@ -853,7 +911,7 @@ WOK
</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
#{rdf.metatag_html}
-#{@css.html_seg}
+#{@stylesheet.css_head_seg}
</head>
#{@vz.color_body}
<a name="top" id="top"></a>
diff --git a/lib/sisu/v3dv/html_segments.rb b/lib/sisu/v3dv/html_segments.rb
index eca87b12..b20d2271 100644
--- a/lib/sisu/v3dv/html_segments.rb
+++ b/lib/sisu/v3dv/html_segments.rb
@@ -138,6 +138,7 @@ module SiSU_HTML_Seg
@seg_name_html=@@seg_name_html || nil
@seg_name_html_tracker=@@tracker || nil
@env=SiSU_Env::InfoEnv.new(@md.fns) if @md
+ @make=SiSU_Env::InfoSet.new(@md) if @md
if @md
@title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner?
end
@@ -244,7 +245,7 @@ module SiSU_HTML_Seg
SiSU_HTML_Seg::Seg.new(@md).tail
segfilename="#{@file.output_path.html_seg.dir}/#{@@seg_name_html[tracking-1]}#{@md.lang_code_insert}#{Sfx[:html]}"
output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1]
- minitoc=(@env.html_minitoc?) \
+ minitoc=(@make.html_minitoc?) \
? @minitoc
: ''
if dob.is==:heading \
@@ -266,12 +267,12 @@ module SiSU_HTML_Seg
heading_art(dob)
head(dob)
#keep use for last segment, eg if metadata is last segment
- #if @@seg_name_html[tracking] =~/metadata/ # this is for metadata
- # segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}"
- # output_seg_file=File.new(segfilename,'w')
- # SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'metadata').output
- # Seg.new.reinitialise
- #end
+ if @@seg_name_html[tracking] =='metadata' # this is for metadata
+ segfilename="#{@file.output_path.html_seg.dir}/#{@@seg_name_html[tracking]}#{@md.lang_code_insert}#{Sfx[:html]}"
+ output_seg_file=File.new(segfilename,'w')
+ SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'metadata').output
+ Seg.new.reinitialise
+ end
end
if tracking==0
heading_art(dob)
diff --git a/lib/sisu/v3dv/hub.rb b/lib/sisu/v3dv/hub.rb
index 4924297a..fd7909ec 100644
--- a/lib/sisu/v3dv/hub.rb
+++ b/lib/sisu/v3dv/hub.rb
@@ -202,7 +202,7 @@ module SiSU
when /^share_src$/; SiSU_Markup::Source.new(@opt).read # -s share_src.rb
when /^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S sisupod_make.rb
# when /^source_kdissert$/; SiSU_KdiSource::Source.new(@opt).read # -S share_src_kdissert.rb
- when /^digests$/; SiSU_DigestView::Source.new(@opt).read # -N digests.rb
+ when /^digests$/; SiSU_DigestView::Source.new(@opt).read # -N digests.rb
when /^plaintext$/; SiSU_Plaintext::Source.new(@opt).read # -t -a plaintext.rb
when /^po4a$/; SiSU_Po4a::Source.new(@opt).read # -P po4a.rb
#when /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g
@@ -216,6 +216,7 @@ module SiSU
when /^xhtml$/; SiSU_XHTML::Source.new(@opt).read # -b xhtml.rb
when /^xml$/; SiSU_XML_SAX::Source.new(@opt).read # -x xml.rb
when /^xml_dom$/; SiSU_XML_DOM::Source.new(@opt).read # -X xml_dom.rb
+ when /^shared_images$/; SiSU_Images::Source.new(@opt).read # -j shared_images.rb
#when /^xml_fictionbook$/; SiSU_XML_Fictionbook::Source.new(@opt).read # -f
when /^xml_scaffold$/; SiSU_XML_Scaffold::Source.new(@opt).read # -k xml_scaffold.rb
when /^embedded$/; SiSU_Embedded::Source.new(@opt).read # -m embedded.rb (image and other content) #check
@@ -357,7 +358,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
SiSU_Harvest::Source.new(@opt).read # -h -H html.rb
elsif @opt.mod.inspect =~/--convert|--to|--from/
require_relative 'sst_convert_markup' # sst_convert_markup.rb
- elsif @opt.cmd =~/([abCcDdeFGgHhIikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \
+ elsif @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \
and @opt.cmd =~/^-/ \
and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \
or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/
@@ -518,6 +519,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
if @opt.act[:xhtml][:bool] #% --xhtml, -b xhtml
op('xhtml','xhtml sax')
end
+ if @opt.act[:images][:bool] #% --images, -j
+ op('shared_images','images')
+ end
if @opt.act[:concordance][:bool] #% --concordance, -w
op('concordance','Concordance')
end
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,
diff --git a/lib/sisu/v3dv/options.rb b/lib/sisu/v3dv/options.rb
index 4cd071ac..b2b7ff15 100644
--- a/lib/sisu/v3dv/options.rb
+++ b/lib/sisu/v3dv/options.rb
@@ -362,6 +362,7 @@ module SiSU_Commandline
when /^--(?:xhtml)$/; c=c+'b'
when /^--(?:xml-sax)$/; c=c+'x'
when /^--(?:xml-dom)$/; c=c+'X'
+ when /^--(?:images)$/; c=c+'j'
when /^--(?:hash-digests)$/; c=c+'N'
when /^--(?:po4a|pot?)$/; c=c+'P'
when /^--(?:termsheet)$/; c=c+'T'
@@ -406,6 +407,13 @@ module SiSU_Commandline
else ''
end
end
+ if cmd !~/j/
+ extra+=if cmd =~/[bHhwXxyz]/ \
+ and cmd !~/[j]/
+ 'j' #% copy images
+ else ''
+ end
+ end
if cmd !~/y/
extra+=if cmd =~/[abeHhIiNopsSstwXxz]/ \
and cmd !~/y/
@@ -435,10 +443,26 @@ module SiSU_Commandline
: { bool: false }
act[:rc]=if mod.inspect =~/"--rc=/
x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'')
- { bool: true, inst: x }
+ { bool: true, inst: x }
else
{ bool: false, inst: '' }
end
+ act[:dump]=if mod.inspect =~/"--dump=/
+ base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
+ { bool: true, inst: base_pth }
+ elsif mod.inspect =~/"--dump/
+ { bool: true, inst: @base_path }
+ else
+ { bool: false, inst: nil }
+ end
+ act[:redirect]=if mod.inspect =~/"--redirect=/
+ base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
+ { bool: true, inst: base_pth }
+ elsif mod.inspect =~/"--redirect/
+ { bool: true, inst: @base_path }
+ else
+ { bool: false, inst: nil }
+ end
act[:verbose]=(cmd =~/v/ \
|| mod.inspect =~/"--verbose"/) \
? { bool: true }
@@ -462,8 +486,68 @@ module SiSU_Commandline
|| mod.inspect =~/"--maintenance|--keep-processing-files"/) \
? { bool: true }
: { bool: false }
- act[:ocn]=if mod.inspect =~/"--no-ocn"/
- { bool: false }
+ act[:switch]=if mod.inspect =~/"--switch-off=/
+ off_list=mod.join(';').gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1')
+ off_list=off_list.scan(/[^,;\s]+/)
+ { bool: false, off: off_list}
+ else { bool: true, off: [] }
+ end
+ act[:ocn]=if mod.inspect =~/"--no-ocn"/ \
+ || act[:switch][:off].inspect =~/"ocn"/
+ { bool: false }
+ else { bool: true }
+ end
+ act[:toc]=if mod.inspect =~/"--no-toc"/ \
+ || act[:switch][:off].inspect =~/"toc"/
+ { bool: false }
+ else { bool: true }
+ end
+ act[:manifest]=if mod.inspect =~/"--no-manifest"/ \
+ || act[:switch][:off].inspect =~/"manifest"/
+ #|| mod.inspect =~/"--(?:redirect|dump)/
+ { bool: false }
+ else { bool: true }
+ end
+ act[:manifest_links]=if mod.inspect =~/"--no-manifest-links"/ \
+ || act[:switch][:off].inspect =~/"manifest_links"/ \
+ || mod.inspect =~/"--(?:redirect|dump)/
+ { bool: false }
+ else { bool: true }
+ end
+ act[:manifest_minitoc]=if mod.inspect =~/"--no-manifest-minitoc"/ \
+ || act[:switch][:off].inspect =~/"manifest_minitoc"|"minitoc"/
+ #|| mod.inspect =~/"--(?:redirect|dump)/
+ { bool: false }
+ else { bool: true }
+ end
+ act[:metadata]=if mod.inspect =~/"--no-metadata"/ \
+ || act[:switch][:off].inspect =~/"metadata"/
+ { bool: false }
+ else { bool: true }
+ end
+ act[:html_minitoc]=if mod.inspect =~/"--no-html-minitoc"/ \
+ || act[:switch][:off].inspect =~/"html_minitoc"|"minitoc"/
+ { bool: false }
+ else { bool: true }
+ end
+ act[:html_navigation]=if mod.inspect =~/"--no-html-navigation"/ \
+ || act[:switch][:off].inspect =~/"html_navigation"|"nav"/
+ { bool: false }
+ else { bool: true }
+ end
+ act[:html_navigation_bar]=if mod.inspect =~/"--no-html-navigation-bar"/ \
+ || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/
+ { bool: false }
+ else { bool: true }
+ end
+ act[:html_search_form]=if mod.inspect =~/"--no-html-search-form"/ \
+ || act[:switch][:off].inspect =~/"html_search_form"|"search"/
+ { bool: false }
+ else { bool: true }
+ end
+ act[:html_right_column]=if mod.inspect =~/"--no-html-right-column"/ \
+ || act[:switch][:off].inspect =~/"html_right_column"|"promo"/
+ { bool: false }
else { bool: true }
end
act[:dal]=(cmd =~/m/ \
@@ -478,6 +562,10 @@ module SiSU_Commandline
|| mod.inspect =~/"--concordance"/) \
? { bool: true }
: { bool: false }
+ act[:images]=(cmd =~/j/ \
+ || mod.inspect =~/"--images"/) \
+ ? { bool: true }
+ : { bool: false }
act[:pdf]=(cmd =~/p/ \
|| mod.inspect =~/"--pdf"/) \
? { bool: true }
diff --git a/lib/sisu/v3dv/param.rb b/lib/sisu/v3dv/param.rb
index fc2ac877..8d3379b7 100644
--- a/lib/sisu/v3dv/param.rb
+++ b/lib/sisu/v3dv/param.rb
@@ -783,7 +783,6 @@ module SiSU_Param
{ str: '\b(?:' + x + ')\b', regx: y, i: i }
else nil
end
- z
end
def italics
m=@h['italics']
@@ -796,7 +795,6 @@ module SiSU_Param
{ str: '\b(?:' + x + ')\b', regx: y, i: i }
else nil
end
- z
end
def emphasis
if @h['emphasis'] =~/bold/; 'bold'
@@ -813,6 +811,9 @@ module SiSU_Param
else nil
end
end
+ def omit_list
+ m=@h['omit']
+ end
def texpdf_font
def main
@h['texpdf_font'] \
@@ -963,7 +964,7 @@ module SiSU_Param
@flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]}
@authors,@topic_register_array,@papersize_array=[],[],[]
@lvs=[nil,0,0,0,0,0,0]
- @lang_code_insert=(@opt.dir_structure_by =~/language/) \
+ @lang_code_insert=(@opt.dir_structure_by ==:language) \
? ''
: ".#{@opt.lng}"
@rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m
diff --git a/lib/sisu/v3dv/shared_images.rb b/lib/sisu/v3dv/shared_images.rb
new file mode 100644
index 00000000..a61fdd38
--- /dev/null
+++ b/lib/sisu/v3dv/shared_images.rb
@@ -0,0 +1,125 @@
+# encoding: utf-8
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997 - 2012, Ralph Amissah, All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/licenses/gpl.html>
+
+ <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
+ <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
+ <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.jus.uio.no/sisu/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: common file for xml generation
+=end
+module SiSU_Images
+ class Source
+ def initialize(opt)
+ @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
+ end
+ def read
+ SiSU_Images::Source::Place.new(@particulars).songsheet
+ end
+ class Place
+ def initialize(particulars)
+ @particulars=particulars
+ @md=@particulars.md
+ @env=@particulars.env
+ @o_str ||=SiSU_Env::OutputStructure.new(@md).output_dir_structure
+ end
+ def songsheet
+ images_set.select_sisu_base
+ images_set.select_with_document
+ end
+ def images_set
+ @pwd=ENV['PWD']
+ def copy(src_path,dest_path,images=nil)
+ if FileTest.directory?(src_path)
+ FileUtils::cd(src_path)
+ unless images
+ images=Dir.glob("*.{png,jpg,gif,ico}")
+ end
+ FileUtils::mkdir_p(dest_path) unless FileTest.directory?(dest_path)
+ FileUtils::chmod(0755,dest_path)
+ if images.length > 0
+ images.each do |i|
+ FileUtils::cp_r(i,"#{dest_path}/#{i}")
+ FileUtils::chmod(0644,"#{dest_path}/#{i}")
+ end
+ end
+ FileUtils::cd(@pwd)
+ else puts "\tWARN, did not find - #{src_path}"
+ end
+ end
+ def dest_path(image_type)
+ pth=if image_type==:image_sys
+ pth=(@o_str.dump_or_redirect?) \
+ ? "#{@md.file.output_path.html.dir}/image" \
+ : "#{@env.path.webserv}/_sisu/image_sys"
+ elsif image_type==:image
+ pth=(@o_str.dump_or_redirect?) \
+ ? "#{@md.file.output_path.html.dir}/image" \
+ : "#{@env.path.webserv}/_sisu/image"
+ end
+ end
+ def select_with_document
+ images=@md.ec[:image]
+ src_path="#{@pwd}/_sisu/image"
+ dest=dest_path(:image)
+ copy(src_path,dest,images)
+ end
+ def select_sisu_base
+ images=%w[arrow_next_red.png arrow_prev_red.png arrow_up_red.png dot_clear.png dot_white.png b_doc.png b_epub.png b_odf.png b_pdf.png b_toc.png]
+ src_path="#{@env.path.share}/image"
+ dest=dest_path(:image_sys)
+ copy(src_path,dest,images)
+ end
+ self
+ end
+ end
+ end
+end
+__END__
diff --git a/lib/sisu/v3dv/sisupod_make.rb b/lib/sisu/v3dv/sisupod_make.rb
index 4b1a5ef9..ac584925 100644
--- a/lib/sisu/v3dv/sisupod_make.rb
+++ b/lib/sisu/v3dv/sisupod_make.rb
@@ -293,7 +293,7 @@ module SiSU_Doc
tar -cJf #{@zipfile}.txz sisupod
#echo "#{@file.place_file.sisupod.dir}"
})
- FileUtils::mv("#{@zipfile}.txz", @file.place_file.sisupod.dir)
+ FileUtils::mv("#{@zipfile}.txz",@file.place_file.sisupod.dir)
FileUtils::rm_r(Dir.glob("sisupod/*"))
Dir.chdir(@env.path.pwd)
SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz").blue_tab unless @opt.cmd =~/q/
diff --git a/lib/sisu/v3dv/sysenv.rb b/lib/sisu/v3dv/sysenv.rb
index 1b1a5857..fcfc234b 100644
--- a/lib/sisu/v3dv/sysenv.rb
+++ b/lib/sisu/v3dv/sysenv.rb
@@ -405,56 +405,62 @@ module SiSU_Env
@fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz
end
def output_dir_structure
- def by_language_code?
- x=if defined? @rc['output_dir_structure_by'] \
- and @rc['output_dir_structure_by'] =~/language/
- true
- elsif defined? @rc['output_structure']['by_language'] \
- and @rc['output_structure']['by_language'] ==true
- true
- else false
+ def by?
+ output_structure=:filename #set default output structure
+ output_structure=if defined? @rc['output_dir_structure_by']
+ output_structure=if (@rc['output_dir_structure_by'] =~/dump/) \
+ or ((defined? @rc['output_structure']['dump']) \
+ && @rc['output_structure']['dump'] ==true)
+ :dump
+ elsif (@rc['output_dir_structure_by'] =~/redirect/) \
+ or ((defined? @rc['output_structure']['redirect']) \
+ && @rc['output_structure']['redirect'] ==true)
+ :redirect
+ elsif (@rc['output_dir_structure_by'] =~/language/) \
+ or ((defined? @rc['output_structure']['by_language']) \
+ && @rc['output_structure']['by_language'] ==true)
+ :language
+ elsif (@rc['output_dir_structure_by'] =~/filetype/) \
+ or ((defined? @rc['output_structure']['by_filetype']) \
+ && @rc['output_structure']['by_filetype'] ==true)
+ :filetype
+ elsif (@rc['output_dir_structure_by'] =~/filename/) \
+ or ((defined? @rc['output_structure']['by_filename']) \
+ && @rc['output_structure']['by_filename'] ==true)
+ :filename
+ else #recheck current default
+ :language
+ end
end
end
+ def dump?
+ ((by?) ==:dump) \
+ ? true \
+ : false
+ end
+ def redirect?
+ ((by?) ==:redirect) \
+ ? true \
+ : false
+ end
+ def by_language_code?
+ ((by?) ==:language) \
+ ? true \
+ : false
+ end
def by_filetype?
- x=if by_language_code?
- false
- elsif defined? @rc['output_dir_structure_by'] \
- and @rc['output_dir_structure_by'] =~/filetype/
- true
- elsif defined? @rc['output_structure']['by_filetype'] \
- and @rc['output_structure']['by_filetype'] ==true
- true
- else false
- end
+ ((by?) ==:filetype) \
+ ? true \
+ : false
end
def by_filename?
- x=if by_language_code?
- false
- elsif by_filetype?
- false
- elsif defined? @rc['output_dir_structure_by'] \
- and @rc['output_dir_structure_by'] =~/filename/
- true
- elsif defined? @rc['output_structure']['by_filename'] \
- and @rc['output_structure']['by_filename'] ==true
- true
- else true
- end
+ ((by?) ==:filename) \
+ ? true \
+ : false
end
def multilingual?
by_language_code?
end
- def by?
- by=if by_language_code?
- 'language'
- elsif by_filetype?
- 'filetype'
- elsif by_filename?
- 'filename'
- else
- 'filename'
- end
- end
self
end
def document_language_versions_found #REVISIT
@@ -1193,6 +1199,129 @@ module SiSU_Env
else false
end
end
+ def manifest_minitoc?
+ flag=if (defined? @rc['manifest']['minitoc'] \
+ and not @rc['manifest']['minitoc'].nil?)
+ @rc['manifest']['minitoc']
+ else false
+ end
+ end
+ def build
+ def omit_list
+ @off_list ||=if (defined? @rc['omit_list'] \
+ and not @rc['omit_list'].nil?)
+ @rc['omit_list']
+ elsif (defined? @rc['omit']['list'] \
+ and not @rc['omit']['list'].nil?)
+ @rc['omit']['list']
+ else
+ nil
+ end
+ end
+ def listed?(test) #fix
+ listed=if omit_list
+ x=(omit_list.scan(/\b#{test}\b/)).join
+ test==x \
+ ? true \
+ : false
+ else
+ false
+ end
+ listed
+ end
+ def ocn?
+ flag=if (defined? @rc['omit']['ocn'] \
+ and not @rc['omit']['ocn'].nil?) \
+ or listed?('ocn')
+ false
+ else
+ true
+ end
+ end
+ def toc?
+ flag=if (defined? @rc['omit']['toc'] \
+ and not @rc['omit']['toc'].nil?) \
+ or listed?('toc')
+ false
+ else
+ true
+ end
+ end
+ def manifest?
+ flag=if (defined? @rc['omit']['manifest'] \
+ and not @rc['omit']['manifest'].nil?) \
+ or listed?('manifest')
+ false
+ else
+ true
+ end
+ end
+ def manifest_links?
+ flag=if (defined? @rc['omit']['manifest_links'] \
+ and not @rc['omit']['manifest_links'].nil?) \
+ or listed?('manifest_links')
+ false
+ else
+ true
+ end
+ end
+ def manifest_minitoc?
+ flag=if (defined? @rc['omit']['manifest_minitoc'] \
+ and not @rc['omit']['manifest_minitoc'].nil?) \
+ or listed?('manifest_minitoc')
+ false
+ else
+ true
+ end
+ end
+ def html_minitoc?
+ flag=if (defined? @rc['omit']['html_minitoc'] \
+ and not @rc['omit']['html_minitoc'].nil?) \
+ or (listed?('html_minitoc') \
+ || listed?('minitoc'))
+ false
+ else
+ true
+ end
+ end
+ def html_navigation?
+ flag=if (defined? @rc['omit']['html_navigation'] \
+ and not @rc['omit']['html_navigation'].nil?) \
+ or listed?('html_navigation')
+ false
+ else
+ true
+ end
+ end
+ def html_navigation_bar?
+ flag=if (defined? @rc['omit']['html_navigation_bar'] \
+ and not @rc['omit']['html_navigation_bar'].nil?) \
+ or listed?('html_navigation_bar')
+ false
+ else
+ true
+ end
+ end
+ def html_search_form?
+ flag=if (defined? @rc['omit']['html_search_form'] \
+ and not @rc['omit']['html_search_form'].nil?) \
+ or listed?('html_search_form')
+ false
+ else
+ true
+ end
+ end
+ def html_right_column?
+ flag=if (defined? @rc['omit']['html_right_column'] \
+ and not @rc['omit']['html_right_column'].nil?) \
+ or listed?('html_right_column')
+ false
+ else
+ true
+ end
+ end
+ self
+ end
def odt_ocn?
((defined? @rc['odt']['ocn']) \
&& @rc['odt']['ocn']==true) \
@@ -1582,7 +1711,12 @@ WOK
end
end
def default_output_css
- if @env.output_dir_structure.by_language_code?
+ if (@md.opt.opt_act[:dump][:bool] \
+ && @md.opt.opt_act[:dump][:inst]) \
+ || (@md.opt.opt_act[:redirect][:bool] \
+ && @md.opt.opt_act[:redirect][:inst])
+ './'
+ elsif @env.output_dir_structure.by_language_code?
'../../'
elsif @env.output_dir_structure.by_filetype?
'../'
@@ -1678,7 +1812,14 @@ WOK
defaults[:sisu_share]
end
def style
- defaults[:stylesheet_stub]
+ if (@md.opt.opt_act[:dump][:bool] \
+ && @md.opt.opt_act[:dump][:inst]) \
+ || (@md.opt.opt_act[:redirect][:bool] \
+ && @md.opt.opt_act[:redirect][:inst])
+ 'css'
+ else
+ defaults[:stylesheet_stub]
+ end
end
def sample_data #sample data repository source directory
defaults[:sample_data_path]
@@ -3326,14 +3467,10 @@ WOK
end
end
end
- class FileOp <InfoFile #todo unify with CreateFile
- def initialize(md,fno='')
- begin
- @md,@fno=md,fno
- @env=SiSU_Env::InfoEnv.new(@md.fns)
- rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue
- ensure
- end
+ class OutputStructure
+ def initialize(md)
+ @md=md
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
end
def output_dir_structure
def by_language_code?
@@ -3346,11 +3483,57 @@ WOK
@env.output_dir_structure.by_filename?
end
def multilingual?
- @env.output_dir_structure.by_language_code?
- #by_language_code?
+ by_language_code?
+ end
+ def dump?
+ ((@md.opt.opt_act[:dump][:bool] \
+ && @md.opt.opt_act[:dump][:inst]) \
+ || (@env.output_dir_structure.dump?)) \
+ ? true \
+ : false
+ end
+ def redirect?
+ ((@md.opt.opt_act[:redirect][:bool] \
+ && @md.opt.opt_act[:redirect][:inst]) \
+ || (@env.output_dir_structure.redirect?)) \
+ ? true \
+ : false
+ end
+ def dump_or_redirect?
+ ((dump?) || (redirect?)) \
+ ? true \
+ : false
+ end
+ def by?
+ if dump?
+ :dump
+ elsif redirect?
+ :redirect
+ elsif by_language_code?
+ :language
+ elsif by_filetype?
+ :filetype
+ elsif by_filename?
+ :filename
+ else #recheck current default
+ :language
+ end
end
self
end
+ end
+ class FileOp <InfoFile #todo unify with CreateFile
+ def initialize(md,fno='')
+ begin
+ @md,@fno=md,fno
+ @env=SiSU_Env::InfoEnv.new(@md.fns)
+ rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue
+ ensure
+ end
+ end
+ def output_dir_structure
+ OutputStructure.new(@md).output_dir_structure
+ end
def mkdir_initialize # not used but consider using
FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir)
FileUtils::mkdir_p("#{output_path.base.dir}/#{@md.fnb}") unless FileTest.directory?("#{output_path.base.dir}/#{@md.fnb}")
@@ -3400,8 +3583,9 @@ WOK
@@filename_html_scroll=File.new(p_fn,'w+')
end
def html_seg_index
- pth=(by_filename?) \
- ? "#{output_path.html.dir}"
+ pth=((by_filename?) \
+ || (output_dir_structure.dump?)) \
+ ? "#{output_path.html.dir}" \
: "#{output_path.html.dir}/#{@md.fnb}"
fn=base_filename.html_seg_index
make_path(pth)
@@ -3409,8 +3593,9 @@ WOK
@@filename_html_index=File.new(p_fn,'w+')
end
def html_segtoc
- pth=(by_filename?) \
- ? "#{output_path.html.dir}"
+ pth=((by_filename?) \
+ || (output_dir_structure.dump?)) \
+ ? "#{output_path.html.dir}" \
: "#{output_path.html.dir}/#{@md.fnb}"
fn=base_filename.html_segtoc
make_path(pth)
@@ -3719,9 +3904,9 @@ WOK
def base_filename
def txt
ft='.txt'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else
'plain' + @md.lang_code_insert + ft
@@ -3729,9 +3914,9 @@ WOK
end
def html_scroll
ft='.html'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else
'scroll' + @md.lang_code_insert + ft
@@ -3739,7 +3924,7 @@ WOK
end
def html_seg_index
ft='.html'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
'index' + ft
else
'index' + @md.lang_code_insert + ft
@@ -3747,7 +3932,9 @@ WOK
end
def html_segtoc
ft='.html'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.dump_or_redirect?
+ @md.fnb + '.toc' + ft
+ elsif output_dir_structure.by_language_code?
'toc' + ft
else
'toc' + @md.lang_code_insert + ft
@@ -3755,7 +3942,7 @@ WOK
end
def html_book_index
ft='.html'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
'book_index' + ft
else
'book_index' + @md.lang_code_insert + ft
@@ -3763,7 +3950,9 @@ WOK
end
def html_concordance
ft='.html'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.dump_or_redirect?
+ @md.fnb + '.concordance' + ft
+ elsif output_dir_structure.by_language_code?
'concordance' + ft
else
'concordance' + @md.lang_code_insert + ft
@@ -3771,9 +3960,9 @@ WOK
end
def xhtml
ft= '.xhtml'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else
'scroll' + @md.lang_code_insert + ft
@@ -3781,7 +3970,7 @@ WOK
end
def epub
ft='.epub'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + ft
else
@md.fnb + @md.lang_code_insert + ft
@@ -3789,9 +3978,9 @@ WOK
end
def odt
ft='.odt'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else
'opendocument' + @md.lang_code_insert + ft
@@ -3799,9 +3988,9 @@ WOK
end
def xml_sax
ft='.sax.xml'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else
'scroll' + @md.lang_code_insert + ft
@@ -3809,22 +3998,22 @@ WOK
end
def xml_dom
ft='.dom.xml'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else
'scroll' + @md.lang_code_insert + ft
end
end
def pdf_p
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + '.portrait.'
else 'portrait' + @md.lang_code_insert + '.'
end
end
def pdf_l
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + '.landscape.'
else 'landscape' + @md.lang_code_insert + '.'
end
@@ -3861,7 +4050,7 @@ WOK
end
def manpage
ft='1'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + '.' + ft
else
@md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft
@@ -3869,7 +4058,7 @@ WOK
end
def info
ft='info'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + '.' + ft
else
@md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft
@@ -3877,7 +4066,7 @@ WOK
end
def texinfo
ft='texinfo'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + '.' + ft
else
@md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft
@@ -3885,9 +4074,9 @@ WOK
end
def hash_digest
ft='.txt'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + '.hash_digest' + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else
'digest' + @md.lang_code_insert + ft
@@ -3895,9 +4084,9 @@ WOK
end
def sitemap
ft='.xml'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + '.sitemap' + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else
'sitemap' + @md.lang_code_insert + ft
@@ -3905,9 +4094,9 @@ WOK
end
def qrcode_title
ft='.title.png'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else #fix
'sisu_manifest' + @md.lang_code_insert + ft
@@ -3915,9 +4104,9 @@ WOK
end
def qrcode_md
ft='.md.png'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else #fix
'sisu_manifest' + @md.lang_code_insert + ft
@@ -3925,9 +4114,9 @@ WOK
end
def manifest_txt
ft='.txt'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
@md.fnb + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else #fix
'sisu_manifest' + @md.lang_code_insert + ft
@@ -3935,9 +4124,11 @@ WOK
end
def manifest
ft='.html'
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.dump_or_redirect?
+ @md.fnb + '.manifest' + ft
+ elsif output_dir_structure.by_language_code?
@md.fnb + ft
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
@md.fnb + @md.lang_code_insert + ft
else #fix
'sisu_manifest' + @md.lang_code_insert + ft
@@ -3967,52 +4158,70 @@ WOK
@ft=ft
def dir
def abc
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.redirect?
+ "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}"
+ elsif output_dir_structure.dump?
+ @md.opt.opt_act[:dump][:inst]
+ elsif output_dir_structure.by_language_code?
"#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}"
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
"#{output_path.base.dir}/#{@ft}"
else
"#{output_path.base.dir}/#{@md.fnb}"
end
end
def ab
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.redirect?
+ "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}"
+ elsif output_dir_structure.dump?
+ @md.opt.opt_act[:dump][:inst]
+ elsif output_dir_structure.by_language_code?
"#{output_path.base.dir}/#{@md.opt.lng}/#{@ft}"
else
"#{output_path.base.dir}/#{@ft}"
end
end
def ab_src
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.redirect?
+ "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}"
+ elsif output_dir_structure.dump?
+ @md.opt.opt_act[:dump][:inst]
+ elsif output_dir_structure.by_language_code?
"#{output_path.base.dir}/#{@ft}/#{@md.opt.lng}"
else
"#{output_path.base.dir}/#{@ft}"
end
end
def ab_pod
- "#{output_path.base.dir}/#{@ft}"
+ if output_dir_structure.redirect?
+ "#{@md.opt.opt_act[:redirect][:inst]}/#{@md.fnb}"
+ elsif output_dir_structure.dump?
+ @md.opt.opt_act[:dump][:inst]
+ else
+ "#{output_path.base.dir}/#{@ft}"
+ end
end
self
end
def url
def abc
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
"#{output_path.base.url}/#{@md.opt.lng}/#{@ft}"
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
"#{output_path.base.url}/#{@ft}"
else
"#{output_path.base.url}/#{@md.fnb}"
end
end
def ab
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
"#{output_path.base.url}/#{@md.opt.lng}/#{@ft}"
else
"#{output_path.base.url}/#{@ft}"
end
end
def ab_src
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
"#{output_path.base.url}/#{@ft}/#{@md.opt.lng}"
else
"#{output_path.base.url}/#{@ft}"
@@ -4025,30 +4234,32 @@ WOK
end
def rel
def abc
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
"#{@md.opt.lng}/#{@ft}"
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
"#{@ft}"
else
"#{@md.fnb}"
end
end
def ab
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
"#{@md.opt.lng}/#{@ft}"
else
"#{@ft}"
end
end
def ab_src
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.dump_or_redirect?
+ "."
+ elsif output_dir_structure.by_language_code?
"#{@ft}/#{@md.opt.lng}"
else
"#{@ft}"
end
end
def ab_pod
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
"#{@ft}"
else
"#{@ft}"
@@ -4058,30 +4269,36 @@ WOK
end
def rel_sm
def abc
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
"#{@md.opt.lng}/#{@ft}"
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
"#{@ft}"
else
"#{@md.fnb}"
end
end
def ab
- if @env.output_dir_structure.by_language_code?
- "#{@md.opt.lng}/#{@ft}"
- else
- "#{@ft}"
+ if output_dir_structure.dump_or_redirect?
+ '.'
+ elsif output_dir_structure.by_language_code? \
+ or output_dir_structure.by_filetype?
+ '../' + @ft
+ else '.'
end
end
def ab_src
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.dump_or_redirect?
+ '.'
+ elsif output_dir_structure.by_language_code?
"#{@ft}/#{@md.opt.lng}"
else
"#{@ft}"
end
end
def ab_pod
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.dump_or_redirect?
+ '.'
+ elsif output_dir_structure.by_language_code?
"../../#{@ft}/#{@md.opt.lng}"
else
"../#{@ft}"
@@ -4091,16 +4308,16 @@ WOK
end
def rcp
def abc
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
"#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}"
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
"#{output_path.stub.rcp}/#{@ft}"
else
"#{output_path.stub.rcp}/#{@md.fnb}"
end
end
def ab
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
"#{output_path.stub.rcp}/#{@md.opt.lng}/#{@ft}"
else
"#{output_path.stub.rcp}/#{@ft}"
@@ -4108,16 +4325,6 @@ WOK
end
self
end
- def rel_sm
- def ab
- if @env.output_dir_structure.by_language_code? \
- or @env.output_dir_structure.by_filetype?
- '../' + @ft
- else '.'
- end
- end
- self
- end
self
end
def output_path
@@ -4151,9 +4358,18 @@ WOK
end
self
end
+ def webserver_path
+ if output_dir_structure.dump?
+ @md.opt.opt_act[:dump][:inst]
+ elsif output_dir_structure.redirect?
+ @md.opt.opt_act[:redirect][:inst]
+ else
+ "#{@env.path.webserv}"
+ end
+ end
def base
def dir
- "#{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}"
+ "#{webserver_path}/#{@md.opt.f_pth[:pth_stub]}"
end
def url
"#{@env.url.webserv}/#{@md.opt.f_pth[:pth_stub]}"
@@ -4313,9 +4529,11 @@ WOK
set_path(ft).rel_sm.ab
end
def rel_image
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.dump_or_redirect?
+ './image'
+ elsif output_dir_structure.by_language_code?
'../../_sisu/image'
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
'../_sisu/image'
else
'../_sisu/image'
@@ -4343,9 +4561,11 @@ WOK
set_path(ft).rel_sm.ab
end
def rel_image
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.dump_or_redirect?
+ './image'
+ elsif output_dir_structure.by_language_code?
'../../../_sisu/image'
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
'../../_sisu/image'
else
'../_sisu/image'
@@ -4377,9 +4597,9 @@ WOK
set_path(ft).rel_sm.ab
end
def rel_image
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
'../../_sisu/image'
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
'../_sisu/image'
else
'../_sisu/image'
@@ -4564,6 +4784,9 @@ WOK
def rcp
set_path(ft).rcp.abc
end
+ def rel_sm
+ set_path(ft).rel_sm.ab
+ end
self
end
def harvest
@@ -4583,9 +4806,9 @@ WOK
set_path(ft).rcp.ab
end
def rel_sm
- if @env.output_dir_structure.by_language_code?
+ if output_dir_structure.by_language_code?
''
- elsif @env.output_dir_structure.by_filetype?
+ elsif output_dir_structure.by_filetype?
''
else
''
@@ -4726,6 +4949,104 @@ WOK
self
end
end
+ class InfoSet #<InfoEnv
+ def initialize(md)
+ @md=md
+ @env=SiSU_Env::InfoEnv.new(md.fns)
+ end
+ def heading_omit_list
+ @md.make.omit_list
+ end
+ def not_heading_make_omit_listed?(test) #fix
+ listed=if heading_omit_list
+ x=(heading_omit_list.scan(/\b#{test}\b/)).join
+ test==x \
+ ? false \
+ : true
+ else
+ true
+ end
+ listed
+ end
+ def ocn?
+ @md.opt.opt_act[:ocn][:bool] \
+ && (@env.build.ocn?) \
+ ? true \
+ : false
+ end
+ def toc?
+ @md.opt.opt_act[:toc][:bool] \
+ && (not_heading_make_omit_listed?('ocn')) \
+ && (@env.build.toc?) \
+ ? true \
+ : false
+ end
+ def manifest?
+ @md.opt.opt_act[:manifest][:bool] \
+ && (not_heading_make_omit_listed?('manifest')) \
+ && (@env.build.manifest?) \
+ ? true \
+ : false
+ end
+ def manifest_links?
+ @md.opt.opt_act[:manifest_links][:bool] \
+ && (not_heading_make_omit_listed?('manifest_links')) \
+ && (@env.build.manifest_links?) \
+ ? true \
+ : false
+ end
+ def manifest_minitoc?
+ @md.opt.opt_act[:manifest_minitoc][:bool] \
+ && (not_heading_make_omit_listed?('manifest_minitoc')) \
+ && (@env.build.manifest_minitoc?) \
+ ? true \
+ : false
+ end
+ def metadata?
+ @md.opt.opt_act[:metadata][:bool] \
+ && (not_heading_make_omit_listed?('metadata')) \
+ && (@env.build.metadata?) \
+ ? true \
+ : false
+ end
+ def html_minitoc?
+ @md.opt.opt_act[:html_minitoc][:bool] \
+ && ((not_heading_make_omit_listed?('html_minitoc')) \
+ || (not_heading_make_omit_listed?('minitoc'))) \
+ && (@env.build.html_minitoc?) \
+ ? true \
+ : false
+ end
+ def html_navigation?
+ @md.opt.opt_act[:html_navigation][:bool] \
+ && (not_heading_make_omit_listed?('html_navigation')) \
+ && (@env.build.html_navigation?) \
+ ? true \
+ : false
+ end
+ def html_navigation_bar?
+ @md.opt.opt_act[:html_navigation_bar][:bool] \
+ && (not_heading_make_omit_listed?('html_navigation_bar')) \
+ && (@env.build.html_navigation_bar?) \
+ ? true \
+ : false
+ end
+ def html_search_form?
+ @md.opt.opt_act[:html_search_form][:bool] \
+ && (not_heading_make_omit_listed?('html_search_form')) \
+ && (@env.build.html_search_form?) \
+ ? true \
+ : false
+ end
+ def html_right_column?
+ @md.opt.opt_act[:html_right_column][:bool] \
+ && ((not_heading_make_omit_listed?('html_right_column')) \
+ || (not_heading_make_omit_listed?('html_promo'))) \
+ && (@env.build.html_right_column?) \
+ ? true \
+ : false
+ end
+ end
class CreateFile <InfoEnv #todo unify with FileOp
def initialize(fns)
begin
@@ -5045,7 +5366,7 @@ WOK
class CSS_Select < InfoEnv
def initialize(md)
@md=md
- @env=SiSU_Env::InfoEnv.new
+ @env=SiSU_Env::InfoEnv.new('',@md)
end
def html
css=if @md.doc_css \
@@ -5115,7 +5436,7 @@ WOK
def initialize(md)
@md=md
@css=SiSU_Env::CSS_Select.new(@md)
- @env=SiSU_Env::InfoEnv.new
+ @env=SiSU_Env::InfoEnv.new('',@md)
@file=SiSU_Env::FileOp.new(@md)
end
def html
@@ -5203,7 +5524,7 @@ WOK
def cp_external_images
src="#{@env.processing_path.processing}/external_document/image"
dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
- if FileTest.directory?(src)
+ if FileTest.directory?(src)
cp_images(src,dest)
end
end
diff --git a/lib/sisu/v3dv/xhtml.rb b/lib/sisu/v3dv/xhtml.rb
index 5d17128c..c537275c 100644
--- a/lib/sisu/v3dv/xhtml.rb
+++ b/lib/sisu/v3dv/xhtml.rb
@@ -359,11 +359,11 @@ WOK
rdf=SiSU_XML_Tags::RDF.new(@md)
dir=SiSU_Env::InfoEnv.new
@@xml[:head],@@xml[:body]=[],[]
- css=SiSU_Env::CSS_Stylesheet.new(@md)
+ stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xhtml').stylesheet
encoding=(@sys.locale =~/utf-?8/i) ? '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' : '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
@@xml[:open] =<<WOK
#{encoding}
-#{css.xhtml}
+#{stylesheet.css_head_xml}
#{rdf.comment_xml}
<document>
WOK
diff --git a/lib/sisu/v3dv/xml.rb b/lib/sisu/v3dv/xml.rb
index 1187e02e..aa75e139 100644
--- a/lib/sisu/v3dv/xml.rb
+++ b/lib/sisu/v3dv/xml.rb
@@ -396,13 +396,13 @@ WOK
rdf=SiSU_XML_Tags::RDF.new(@md)
dir=SiSU_Env::InfoEnv.new
@@xml[:head],@@xml[:body]=[],[]
- css=SiSU_Env::CSS_Stylesheet.new(@md)
+ stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_sax').stylesheet
encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
else '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
end
@@xml[:open] =<<WOK
#{encoding}
-#{css.xml_sax}
+#{stylesheet.css_head_xml}
#{rdf.comment_xml}
<document>
WOK
diff --git a/lib/sisu/v3dv/xml_dom.rb b/lib/sisu/v3dv/xml_dom.rb
index e63f7ad7..6b8c4e5c 100644
--- a/lib/sisu/v3dv/xml_dom.rb
+++ b/lib/sisu/v3dv/xml_dom.rb
@@ -470,13 +470,13 @@ WOK
def pre
rdf=SiSU_XML_Tags::RDF.new(@md)
dir=SiSU_Env::InfoEnv.new
- css=SiSU_Env::CSS_Stylesheet.new(@md)
+ stylesheet=SiSU_Style::CSS_HeadInfo.new(@md,'xml_dom').stylesheet
encoding=if @sys.locale =~/utf-?8/i; '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
else '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>'
end
@@xml[:open] =<<WOK
#{encoding}
-#{css.xml_dom}
+#{stylesheet.css_head_xml}
#{rdf.comment_xml}
<document>
WOK
diff --git a/lib/sisu/v3dv/xml_format.rb b/lib/sisu/v3dv/xml_format.rb
index 50a9f5ac..0b1e9eef 100644
--- a/lib/sisu/v3dv/xml_format.rb
+++ b/lib/sisu/v3dv/xml_format.rb
@@ -374,7 +374,7 @@ WOK
@rdf=SiSU_XML_Tags::RDF.new(md)
# DublinCore 1 - title
@vz=SiSU_Env::GetInit.instance.skin
- @css=SiSU_Env::CSS_Stylesheet.new(md)
+ @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet
@seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || [])
@seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || [])
@index='index'
@@ -544,7 +544,7 @@ WOK
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
#{@rdf.rdftoc}
#{@rdf.metatag_html}
-#{@css.html}
+#{@stylesheet.css_head}
</head>
#{@vz.color_body}
<a name="top" id="top"></a>
@@ -938,7 +938,7 @@ WOK
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
#{@rdf.rdfseg}
#{@rdf.metatag_html}
-#{@css.html}
+#{@stylesheet.css_head}
</head>
#{@vz.color_body}
<a name="top" id="top"></a>