diff options
author | Ralph Amissah <ralph@amissah.com> | 2013-08-08 00:19:39 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2013-08-08 00:19:45 -0400 |
commit | 2635b72eaa5e22cc7f16a43aa292c22496f7c19c (patch) | |
tree | 0ea520ea857cfce09a55bb3adb0cac26d30394ed /lib/sisu/v4/cgi_sql_common.rb | |
parent | v5: output structure by, multilingual, monolingual filenames tweak (diff) |
v4: merge v5 lib (5.0.10)sisu_4.1.10
* output structure by, add monolingual alt for :filetype & :filename, step 1
* output structure by, monolingual alternative for :filetype or :filename
without language code, if document is in default language
* set a default language, 'en' or as specified
* set in rc file or from command line instruction
* command line e.g.
sisu -hv --monolingual --by-filename sisu_markup.sst
sisu -3v --monolingual --by-filetype sisu_manual.ssm
* sisurc.yml lingual: 'mono' | 'multi' lingual: 'mono'
* note: output by :filetype is roughly equivalent to what monolingual output
by :language would be
* allow command line setting of default language using language code
--default-language='en' --default-lang-en if used together with
--monolingual and --by-filetype or --by-filename the selected default
language document will not have a language code in the output filename
* output structure by, monolingual alternative, documentation
* cgi helper script, sample search form, single form, monolingual option
* single cgi form, (with different internal variables set for output types)
Diffstat (limited to 'lib/sisu/v4/cgi_sql_common.rb')
-rw-r--r-- | lib/sisu/v4/cgi_sql_common.rb | 113 |
1 files changed, 59 insertions, 54 deletions
diff --git a/lib/sisu/v4/cgi_sql_common.rb b/lib/sisu/v4/cgi_sql_common.rb index a6639fb3..2597b4a2 100644 --- a/lib/sisu/v4/cgi_sql_common.rb +++ b/lib/sisu/v4/cgi_sql_common.rb @@ -845,72 +845,77 @@ module SiSU_CGI_SQL @hostpath="#{@hosturl_files}/#{@stub}" WOK_SQL end - def dir_structure - case @opt.dir_structure_by - when :language - <<-'WOK_SQL' - def path_manifest(fn,ln=nil) - "#{@hostpath}/#{ln}/manifest/#{fn}.html" - end - def path_html_seg(fn,ln=nil) - "#{@hostpath}/#{ln}/html/#{fn}" - end - def path_toc(fn,ln=nil) - "#{path_html_seg(fn,ln)}/toc.html" - end - def path_filename(fn,seg,ln=nil) - "#{path_html_seg(fn,ln)}/#{seg}.html" - end - def path_endnotes(fn,ln=nil) - "#{path_html_seg(fn,ln)}/endnotes.html" - end - def path_html_doc(fn,ln=nil) - "#{@hostpath}/#{ln}/html/#{fn}.html" - end - WOK_SQL - when :filetype - <<-'WOK_SQL' - def path_manifest(fn,ln=nil) - "#{@hostpath}/manifest/#{fn}.#{ln}.html" - end - def path_html_seg(fn,ln=nil) - "#{@hostpath}/html/#{fn}" - end - def path_toc(fn,ln=nil) - "#{path_html_seg(fn,ln)}/toc.#{ln}.html" - end - def path_filename(fn,seg,ln=nil) - "#{path_html_seg(fn,ln)}/#{seg}.#{ln}.html" - end - def path_endnotes(fn,ln=nil) - "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html" - end - def path_html_doc(fn,ln=nil) - "#{@hostpath}/html/#{fn}.#{ln}.html" - end - WOK_SQL - else - <<-'WOK_SQL' + def dir_structure #@opt.dir_structure_by + <<-'WOK_SQL' def path_manifest(fn,ln=nil) - "#{@hostpath}/#{fn}/sisu_manifest.#{ln}.html" + case @output_dir_structure_by + when 'filename' + @lingual =='mono' \ + ? "#{@hostpath}/#{fn}/sisu_manifest.html" + : "#{@hostpath}/#{fn}/sisu_manifest.#{ln}.html" + when 'filetype' + @lingual =='mono' \ + ? "#{@hostpath}/manifest/#{fn}.html" + : "#{@hostpath}/manifest/#{fn}.#{ln}.html" + else + "#{@hostpath}/#{ln}/manifest/#{fn}.html" + end end def path_html_seg(fn,ln=nil) - "#{@hostpath}/#{fn}" + case @output_dir_structure_by + when 'filename' + "#{@hostpath}/#{fn}" + when 'filetype' + "#{@hostpath}/html/#{fn}" + else + "#{@hostpath}/#{ln}/html/#{fn}" + end end def path_toc(fn,ln=nil) - "#{path_html_seg(fn,ln)}/toc.#{ln}.html" + if @output_dir_structure_by =='filename' \ + or @output_dir_structure_by =='filetype' + @lingual =='mono' \ + ? "#{path_html_seg(fn,ln)}/toc.html" + : "#{path_html_seg(fn,ln)}/toc.#{ln}.html" + else + "#{path_html_seg(fn,ln)}/toc.html" + end end def path_filename(fn,seg,ln=nil) - "#{path_html_seg(fn,ln)}/#{seg}.#{ln}.html" + if @output_dir_structure_by =='filename' \ + or @output_dir_structure_by =='filetype' + @lingual =='mono' \ + ? "#{path_html_seg(fn,ln)}/#{seg}.html" + : "#{path_html_seg(fn,ln)}/#{seg}.#{ln}.html" + else + "#{path_html_seg(fn,ln)}/#{seg}.html" + end end def path_endnotes(fn,ln=nil) - "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html" + if @output_dir_structure_by =='filename' \ + or @output_dir_structure_by =='filetype' + @lingual =='mono' \ + ? "#{path_html_seg(fn,ln)}/endnotes.html" + : "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html" + else + "#{path_html_seg(fn,ln)}/endnotes.html" + end end def path_html_doc(fn,ln=nil) - "#{path_html_seg(fn,ln)}/scroll.#{ln}.html" + case @output_dir_structure_by + when 'filename' + @lingual =='mono' \ + ? "#{path_html_seg(fn,ln)}/scroll.html" + : "#{path_html_seg(fn,ln)}/scroll.#{ln}.html" + when 'filetype' + @lingual =='mono' \ + ? "#{@hostpath}/html/#{fn}.html" + : "#{@hostpath}/html/#{fn}.#{ln}.html" + else + "#{@hostpath}/#{ln}/html/#{fn}.html" + end end - WOK_SQL - end + WOK_SQL end def main3 <<-'WOK_SQL' |