aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/sysenv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/sysenv.rb')
-rw-r--r--lib/sisu/v3/sysenv.rb323
1 files changed, 208 insertions, 115 deletions
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 23f88ad7..acc38507 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2012, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<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>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -1738,47 +1737,6 @@ WOK
'./'
end
end
- def default_output_css
- 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?
- '../'
- else
- '../'
- end
- end
- def html_scroll_css
- default_output_css
- end
- def xhtml_css
- default_output_css
- end
- def xml_css
- default_output_css
- end
- def html_seg_css
- if @env.output_dir_structure.by_language_code?
- '../../../'
- elsif @env.output_dir_structure.by_filetype?
- '../../'
- else
- '../'
- end
- end
- def manifest_css
- if @env.output_dir_structure.by_language_code?
- '../../_sisu/css'
- elsif @env.output_dir_structure.by_filetype?
- ''
- else
- '../'
- end
- end
self
end
def read_source_file(fns)
@@ -1927,7 +1885,11 @@ WOK
r=Px[:lng_lst].join('|')
u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
base_stub=@sys.pwd.gsub(u,'\1')
- "#{path.webserv}/#{base_stub}"
+ if Dir.pwd =~/\/sisupod\/[^\/]+\/sisupod\/doc/
+ "#{path.webserv}/doc"
+ else
+ "#{path.webserv}/#{base_stub}"
+ end
end
def feed
(defined? @rc['webserv']['feed']) \
@@ -3555,14 +3517,14 @@ WOK
def doc_rc #document rc, make instructions
@md.make
end
- def cmd_rc #command-line rc
- @cmd_rc=@md.opt.opt_act
+ def cmd_rc_act #command-line rc
+ @cmd_rc_act=@md.opt.opt_act
end
def build
def ocn?
- if cmd_rc[:ocn][:set]==:on
+ if cmd_rc_act[:ocn][:set]==:on
true
- elsif cmd_rc[:ocn][:set]==:off
+ elsif cmd_rc_act[:ocn][:set]==:off
false
elsif defined? @md.make.ocn? \
and @md.make.ocn? ==:off
@@ -3574,9 +3536,9 @@ WOK
end
end
def toc?
- if cmd_rc[:toc][:set]==:on
+ if cmd_rc_act[:toc][:set]==:on
true
- elsif cmd_rc[:toc][:set]==:off
+ elsif cmd_rc_act[:toc][:set]==:off
false
elsif defined? @md.make.toc? \
and @md.make.toc? ==:off
@@ -3588,9 +3550,9 @@ WOK
end
end
def manifest?
- if cmd_rc[:manifest][:set]==:on
+ if cmd_rc_act[:manifest][:set]==:on
true
- elsif cmd_rc[:manifest][:set]==:off
+ elsif cmd_rc_act[:manifest][:set]==:off
false
elsif defined? @md.make.manifest? \
and @md.make.manifest? ==:off
@@ -3602,9 +3564,9 @@ WOK
end
end
def links_to_manifest?
- if cmd_rc[:links_to_manifest][:set]==:on
+ if cmd_rc_act[:links_to_manifest][:set]==:on
true
- elsif cmd_rc[:links_to_manifest][:set]==:off
+ elsif cmd_rc_act[:links_to_manifest][:set]==:off
false
elsif defined? @md.make.links_to_manifest? \
and @md.make.links_to_manifest? ==:off
@@ -3616,9 +3578,9 @@ WOK
end
end
def metadata?
- if cmd_rc[:metadata][:set]==:on
+ if cmd_rc_act[:metadata][:set]==:on
true
- elsif cmd_rc[:metadata][:set]==:off
+ elsif cmd_rc_act[:metadata][:set]==:off
false
elsif defined? @md.make.metadata? \
and @md.make.metadata? ==:off
@@ -3632,9 +3594,9 @@ WOK
def minitoc?
if html_top_band? == false #one form of navigation necessary
true
- elsif cmd_rc[:minitoc][:set]==:on
+ elsif cmd_rc_act[:minitoc][:set]==:on
true
- elsif cmd_rc[:minitoc][:set]==:off
+ elsif cmd_rc_act[:minitoc][:set]==:off
false
elsif defined? @md.make.minitoc? \
and @md.make.minitoc? ==:off
@@ -3648,11 +3610,11 @@ WOK
def manifest_minitoc?
if html_top_band? == false #one form of navigation necessary
true
- elsif cmd_rc[:manifest_minitoc][:set]==:on \
- || cmd_rc[:minitoc][:set]==:on
+ elsif cmd_rc_act[:manifest_minitoc][:set]==:on \
+ || cmd_rc_act[:minitoc][:set]==:on
true
- elsif cmd_rc[:manifest_minitoc][:set]==:off \
- || cmd_rc[:minitoc][:set]==:off
+ elsif cmd_rc_act[:manifest_minitoc][:set]==:off \
+ || cmd_rc_act[:minitoc][:set]==:off
false
elsif defined? @md.make.manifest_minitoc? \
and (@md.make.manifest_minitoc? ==:off \
@@ -3670,11 +3632,11 @@ WOK
def html_minitoc?
if html_top_band? == false #one form of navigation necessary
true
- elsif cmd_rc[:html_minitoc][:set]==:on \
- || cmd_rc[:minitoc][:set]==:on
+ elsif cmd_rc_act[:html_minitoc][:set]==:on \
+ || cmd_rc_act[:minitoc][:set]==:on
true
- elsif cmd_rc[:html_minitoc][:set]==:off \
- || cmd_rc[:minitoc][:set]==:off
+ elsif cmd_rc_act[:html_minitoc][:set]==:off \
+ || cmd_rc_act[:minitoc][:set]==:off
false
elsif defined? @md.make.html_minitoc? \
and (@md.make.html_minitoc? ==:off \
@@ -3690,9 +3652,9 @@ WOK
end
end
def html_top_band?
- if cmd_rc[:html_top_band][:set]==:on
+ if cmd_rc_act[:html_top_band][:set]==:on
true
- elsif cmd_rc[:html_top_band][:set]==:off
+ elsif cmd_rc_act[:html_top_band][:set]==:off
false
elsif defined? @md.make.html_top_band? \
and @md.make.html_top_band? ==:off
@@ -3704,9 +3666,9 @@ WOK
end
end
def html_navigation?
- if cmd_rc[:html_navigation][:set]==:on
+ if cmd_rc_act[:html_navigation][:set]==:on
true
- elsif cmd_rc[:html_navigation][:set]==:off
+ elsif cmd_rc_act[:html_navigation][:set]==:off
false
elsif defined? @md.make.html_navigation? \
and @md.make.html_navigation? ==:off
@@ -3718,9 +3680,9 @@ WOK
end
end
def html_navigation_bar?
- if cmd_rc[:html_navigation_bar][:set]==:on
+ if cmd_rc_act[:html_navigation_bar][:set]==:on
true
- elsif cmd_rc[:html_navigation_bar][:set]==:off
+ elsif cmd_rc_act[:html_navigation_bar][:set]==:off
false
elsif defined? @md.make.html_navigation_bar? \
and @md.make.html_navigation_bar? ==:off
@@ -3732,9 +3694,9 @@ WOK
end
end
def search_form?
- if cmd_rc[:search_form][:set]==:on
+ if cmd_rc_act[:search_form][:set]==:on
true
- elsif cmd_rc[:search_form][:set]==:off
+ elsif cmd_rc_act[:search_form][:set]==:off
false
elsif defined? @md.make.html_search_form? \
and @md.make.search_form? ==:off
@@ -3746,11 +3708,11 @@ WOK
end
end
def html_search_form?
- if cmd_rc[:html_search_form][:set]==:on \
- || cmd_rc[:search_form][:set]==:on
+ if cmd_rc_act[:html_search_form][:set]==:on \
+ || cmd_rc_act[:search_form][:set]==:on
true
- elsif cmd_rc[:html_search_form][:set]==:off \
- || cmd_rc[:search_form][:set]==:off
+ elsif cmd_rc_act[:html_search_form][:set]==:off \
+ || cmd_rc_act[:search_form][:set]==:off
false
elsif defined? @md.make.html_search_form? \
and (@md.make.html_search_form? ==:off \
@@ -3766,9 +3728,9 @@ WOK
end
end
def html_right_pane?
- if cmd_rc[:html_right_pane][:set]==:on
+ if cmd_rc_act[:html_right_pane][:set]==:on
true
- elsif cmd_rc[:html_right_pane][:set]==:off
+ elsif cmd_rc_act[:html_right_pane][:set]==:off
false
elsif defined? @md.make.html_right_pane? \
and @md.make.html_right_pane? ==:off
@@ -3780,9 +3742,9 @@ WOK
end
end
def segsubtoc?
- if cmd_rc[:segsubtoc][:set]==:on
+ if cmd_rc_act[:segsubtoc][:set]==:on
true
- elsif cmd_rc[:segsubtoc][:set]==:off
+ elsif cmd_rc_act[:segsubtoc][:set]==:off
false
elsif defined? @md.make.segsubtoc? \
and @md.make.segsubtoc? ==:off
@@ -3797,27 +3759,54 @@ WOK
end
def output_dir_structure
def by_language_code?
- env_rc.output_dir_structure.by_language_code?
+ if cmd_rc_act[:output_by][:set] == :language
+ true
+ elsif cmd_rc_act[:output_by][:set] == :filetype \
+ or cmd_rc_act[:output_by][:set] == :filename
+ false
+ elsif cmd_rc_act[:output_by][:set] == :language
+ true
+ else
+ env_rc.output_dir_structure.by_language_code?
+ end
end
def by_filetype?
- env_rc.output_dir_structure.by_filetype?
+ if cmd_rc_act[:output_by][:set] == :filetype
+ true
+ elsif cmd_rc_act[:output_by][:set] == :language \
+ or cmd_rc_act[:output_by][:set] == :filename
+ false
+ elsif cmd_rc_act[:output_by][:set] == :filetype
+ true
+ else
+ env_rc.output_dir_structure.by_filetype?
+ end
end
def by_filename?
- env_rc.output_dir_structure.by_filename?
+ if cmd_rc_act[:output_by][:set] == :filename
+ true
+ elsif cmd_rc_act[:output_by][:set] == :language \
+ or cmd_rc_act[:output_by][:set] == :filetype
+ false
+ elsif cmd_rc_act[:output_by][:set] == :filename
+ true
+ else
+ env_rc.output_dir_structure.by_filename?
+ end
end
def multilingual?
by_language_code?
end
def dump?
- ((cmd_rc[:dump][:bool] \
- && cmd_rc[:dump][:inst]) \
+ ((cmd_rc_act[:dump][:bool] \
+ && cmd_rc_act[:dump][:inst]) \
|| (env_rc.output_dir_structure.dump?)) \
? true
: false
end
def redirect?
- ((cmd_rc[:redirect][:bool] \
- && cmd_rc[:redirect][:inst]) \
+ ((cmd_rc_act[:redirect][:bool] \
+ && cmd_rc_act[:redirect][:inst]) \
|| (env_rc.output_dir_structure.redirect?)) \
? true
: false
@@ -3998,6 +3987,86 @@ WOK
FileUtils::mkdir_p(@env.processing_path.dal) unless FileTest.directory?(@env.processing_path.dal)
FileUtils::mkdir_p(@env.processing_path.tune) unless FileTest.directory?(@env.processing_path.tune)
end
+ def path_rel_links
+ def html_scroll_2
+ if output_dir_structure.by_language_code?
+ '../../'
+ elsif output_dir_structure.by_filetype?
+ '../'
+ else
+ '../'
+ end
+ end
+ def html_seg_2
+ if output_dir_structure.by_language_code?
+ '../../../'
+ elsif output_dir_structure.by_filetype?
+ '../../'
+ else
+ '../'
+ end
+ end
+ def html_scroll_1
+ if output_dir_structure.by_language_code?
+ '../'
+ elsif output_dir_structure.by_filetype?
+ '../'
+ else
+ './'
+ end
+ end
+ def html_seg_1
+ if output_dir_structure.by_language_code?
+ '../../'
+ elsif output_dir_structure.by_filetype?
+ '../../'
+ else
+ './'
+ end
+ end
+ def default_output_css
+ 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 output_dir_structure.by_language_code?
+ '../../'
+ elsif output_dir_structure.by_filetype?
+ '../'
+ else
+ '../'
+ end
+ end
+ def html_scroll_css
+ default_output_css
+ end
+ def xhtml_css
+ default_output_css
+ end
+ def xml_css
+ default_output_css
+ end
+ def html_seg_css
+ if output_dir_structure.by_language_code?
+ '../../../'
+ elsif output_dir_structure.by_filetype?
+ '../../'
+ else
+ '../'
+ end
+ end
+ def manifest_css
+ if output_dir_structure.by_language_code?
+ '../../_sisu/css'
+ elsif output_dir_structure.by_filetype?
+ ''
+ else
+ '../'
+ end
+ end
+ self
+ end
def mkdir
txt_path="#{output_path.base.dir}/#{@md.fnb}"
def output
@@ -5677,7 +5746,8 @@ WOK
"#{@md.doc_css}_html.css"
elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html.css")
"#{@env.path.stub_pwd}_html.css"
- else SiSU_Env::CSS_Default.new.html
+ else
+ SiSU_Env::CSS_Default.new.html
end
end
def html_tables
@@ -5868,28 +5938,51 @@ WOK
css=SiSU_Style::CSS.new
path_style="#{@env.path.output}/#{@env.path.style}"
FileUtils::mkdir_p(path_style) unless FileTest.directory?(path_style)
- style=File.new("#{path_style}/#{fn_css.homepage}",'w')
- style << css.homepage
- style.close
- style=File.new("#{path_style}/#{fn_css.html_tables}",'w')
- style << css.html_tables
- style.close
- style=File.new("#{path_style}/#{fn_css.html}",'w')
- style << css.html
- style.close
- style=File.new("#{path_style}/#{fn_css.xml_sax}",'w')
- style << css.xml_sax
- style.close
- style=File.new("#{path_style}/#{fn_css.xml_dom}",'w')
- style << css.xml_dom
- style=File.new("#{path_style}/#{fn_css.docbook_xml}",'w')
- style << css.docbook_xml
- style.close
- style=File.new("#{path_style}/#{fn_css.xhtml}",'w')
- style << css.xhtml
- style=File.new("#{path_style}/#{fn_css.harvest}",'w')
- style << css.harvest
- style.close
+ if @cmd =~/C/ \
+ or not FileTest.file?("#{path_style}/#{fn_css.homepage}")
+ style=File.new("#{path_style}/#{fn_css.homepage}",'w')
+ style << css.homepage
+ style.close
+ end
+ if @cmd =~/C/ \
+ or not FileTest.file?("#{path_style}/#{fn_css.html_tables}")
+ style=File.new("#{path_style}/#{fn_css.html_tables}",'w')
+ style << css.html_tables
+ style.close
+ end
+ if @cmd =~/C/ \
+ or not FileTest.file?("#{path_style}/#{fn_css.html}")
+ style=File.new("#{path_style}/#{fn_css.html}",'w')
+ style << css.html
+ style.close
+ end
+ if @cmd =~/C/ \
+ or not FileTest.file?("#{path_style}/#{fn_css.harvest}")
+ style=File.new("#{path_style}/#{fn_css.harvest}",'w')
+ style << css.harvest
+ style.close
+ end
+ if @cmd =~/C/ \
+ or (@cmd =~/[x]/ \
+ and not FileTest.file?("#{path_style}/#{fn_css.xml_sax}"))
+ style=File.new("#{path_style}/#{fn_css.xml_sax}",'w')
+ style << css.xml_sax
+ style.close
+ end
+ if @cmd =~/C/ \
+ or (@cmd =~/[X]/ \
+ and not FileTest.file?("#{path_style}/#{fn_css.xml_dom}"))
+ style=File.new("#{path_style}/#{fn_css.xml_dom}",'w')
+ style << css.xml_dom
+ style.close
+ end
+ if @cmd =~/C/ \
+ or (@cmd =~/[b]/ \
+ and not FileTest.file?("#{path_style}/#{fn_css.xhtml}"))
+ style=File.new("#{path_style}/#{fn_css.xhtml}",'w')
+ style << css.xhtml
+ style.close
+ end
end
end
end