diff options
author | Ralph Amissah <ralph@amissah.com> | 2012-02-14 20:33:26 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2012-02-14 20:33:26 -0500 |
commit | 8138e2301b94ad697109c9e00da24710840b94c6 (patch) | |
tree | 141fe18d68e6361d895cf07b477821541a62d202 /lib | |
parent | v2: vim syntax highlighting, patch from Thilo Six <T.Six@gmx.de> applied (diff) |
v3dv: sysenv, output_dir_structure, rewritten, affected code modified
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v3dv/cgi_pgsql.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v3dv/cgi_sql_common.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v3dv/cgi_sqlite.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v3dv/dal_expand_insertions.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v3dv/param.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v3dv/sysenv.rb | 68 |
6 files changed, 34 insertions, 48 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/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/param.rb b/lib/sisu/v3dv/param.rb index fc2ac877..f9734da3 100644 --- a/lib/sisu/v3dv/param.rb +++ b/lib/sisu/v3dv/param.rb @@ -963,7 +963,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/sysenv.rb b/lib/sisu/v3dv/sysenv.rb index 1b1a5857..7374d88f 100644 --- a/lib/sisu/v3dv/sysenv.rb +++ b/lib/sisu/v3dv/sysenv.rb @@ -405,56 +405,42 @@ 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'] =~/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 + end end 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 |