From 864e90c1391cbf01bfd296a6452f9f4fd13d2f65 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 30 Jul 2013 21:20:27 -0400 Subject: v4 v5: version & changelog --- data/doc/sisu/CHANGELOG_v4 | 7 +++++++ data/doc/sisu/CHANGELOG_v5 | 7 +++++++ data/sisu/v4/v/version.yml | 6 +++--- data/sisu/v5/v/version.yml | 6 +++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 11af12e9..d98123b8 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -23,6 +23,13 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 4.1.8.orig.tar.xz (2013-07-30:30/2) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.1.8 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.1.8-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_4.1.8.orig.tar.xz + sisu_4.1.8.orig.tar.xz + sisu_4.1.8-1.dsc + %% 4.1.7.orig.tar.xz (2013-06-25:25/2) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.1.7 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.1.7-1 diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index eafa4447..953f6296 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -23,6 +23,13 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 5.0.8.orig.tar.xz (2013-07-30:30/2) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.8 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.8-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.8.orig.tar.xz + sisu_5.0.8.orig.tar.xz + sisu_5.0.8-1.dsc + %% 5.0.7.orig.tar.xz (2013-06-25:25/2) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.7 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.7-1 diff --git a/data/sisu/v4/v/version.yml b/data/sisu/v4/v/version.yml index c2c1b122..b9171cef 100644 --- a/data/sisu/v4/v/version.yml +++ b/data/sisu/v4/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 4.1.7 -:date_stamp: 2013w25/2 -:date: "2013-06-25" +:version: 4.1.8 +:date_stamp: 2013w30/2 +:date: "2013-07-30" :project: SiSU diff --git a/data/sisu/v5/v/version.yml b/data/sisu/v5/v/version.yml index 9dacb8c5..3f34748c 100644 --- a/data/sisu/v5/v/version.yml +++ b/data/sisu/v5/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 5.0.7 -:date_stamp: 2013w25/2 -:date: "2013-06-25" +:version: 5.0.8 +:date_stamp: 2013w30/2 +:date: "2013-07-30" :project: SiSU -- cgit v1.2.3 From 74c5828574ef20c2082adf848c9d7b914598732f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 30 Jul 2013 21:23:59 -0400 Subject: v4 (v5): misc, minor --- bin/sisu | 2 +- lib/sisu/v4/db_columns.rb | 2 +- lib/sisu/v4/db_import.rb | 4 ++-- lib/sisu/v5/db_import.rb | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/sisu b/bin/sisu index 4914890c..f6e2725e 100644 --- a/bin/sisu +++ b/bin/sisu @@ -42,7 +42,7 @@ WOK ruby_version_ok?(rbv_sisu_dev) end def require_hub_path(sisu_path_specified_lib_) - sisu_path_lib=if sisu_path_specified_lib_ \ + if sisu_path_specified_lib_ \ && FileTest.file?("#{sisu_path_specified_lib_}/#{SiSU_lib}/hub.rb") "#{sisu_path_specified_lib_}/#{SiSU_lib}" else diff --git a/lib/sisu/v4/db_columns.rb b/lib/sisu/v4/db_columns.rb index 5223aed8..488df7c5 100644 --- a/lib/sisu/v4/db_columns.rb +++ b/lib/sisu/v4/db_columns.rb @@ -50,7 +50,7 @@ * Git - + * Ralph Amissah diff --git a/lib/sisu/v4/db_import.rb b/lib/sisu/v4/db_import.rb index eb46e795..4f77cdb0 100644 --- a/lib/sisu/v4/db_import.rb +++ b/lib/sisu/v4/db_import.rb @@ -643,8 +643,8 @@ module SiSU_DbImport if FileTest.file?("#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}")==true f[:txt],u[:txt]='plaintext,', "'#{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}'," end - if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg}")==true - f[:html_toc],u[:html_toc]='html_toc,', "'#{@md.file.output_path.html_seg.url}/#{@md.file.base_filename.html_seg}'," + if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}")==true + f[:html_toc],u[:html_toc]='html_toc,', "'#{@md.file.output_path.html_seg.url}/#{@md.file.base_filename.html_segtoc}'," end if FileTest.file?("#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}")==true f[:html_doc],u[:html_doc]='html_doc,', "'#{@md.file.output_path.html_scroll.url}/#{@md.file.base_filename.html_scroll}'," diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb index a4edfab7..9025b359 100644 --- a/lib/sisu/v5/db_import.rb +++ b/lib/sisu/v5/db_import.rb @@ -643,8 +643,8 @@ module SiSU_DbImport if FileTest.file?("#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}")==true f[:txt],u[:txt]='plaintext,', "'#{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}'," end - if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg}")==true - f[:html_toc],u[:html_toc]='html_toc,', "'#{@md.file.output_path.html_seg.url}/#{@md.file.base_filename.html_seg}'," + if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}")==true + f[:html_toc],u[:html_toc]='html_toc,', "'#{@md.file.output_path.html_seg.url}/#{@md.file.base_filename.html_segtoc}'," end if FileTest.file?("#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}")==true f[:html_doc],u[:html_doc]='html_doc,', "'#{@md.file.output_path.html_scroll.url}/#{@md.file.base_filename.html_scroll}'," -- cgit v1.2.3 From 363a1c71795d6034a996eb3b4a52b20c6dedca95 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 30 Jul 2013 21:25:48 -0400 Subject: v5: output structure by, add monolingual alt for :filetype & :filename, step 1 --- data/doc/sisu/CHANGELOG_v5 | 2 ++ lib/sisu/v5/hub.rb | 1 + lib/sisu/v5/options.rb | 26 +++++++++++++++++++++---- lib/sisu/v5/param.rb | 11 +---------- lib/sisu/v5/sysenv.rb | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+), 14 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 953f6296..56307de2 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -30,6 +30,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.8.orig.tar.xz sisu_5.0.8.orig.tar.xz sisu_5.0.8-1.dsc +* output structure by, add monolingual alternative for :filetype or :filename + %% 5.0.7.orig.tar.xz (2013-06-25:25/2) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.7 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.7-1 diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 8b146d4b..c84c84cd 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -89,6 +89,7 @@ module SiSU end end class OptionLoopFiles + attr_reader :opt def initialize(opt) @opt=opt @r=Px[:lng_lst_rgx] diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index b7bf98a6..031258af 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -137,7 +137,7 @@ module SiSU_Commandline end end class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod + attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod @@act=nil def initialize(a) @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','','','' @@ -145,6 +145,7 @@ module SiSU_Commandline @env=SiSU_Env::InfoEnv.new @lng_base=@env.language_default_set @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? + @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? @@sisu_call_origin_path ||=Dir.pwd @base_path=@@sisu_call_origin_path r=Px[:lng_lst_rgx] @@ -217,7 +218,7 @@ module SiSU_Commandline end end end - r=Px[:lng_lst_rgx].gsub(/\|#{@lng_base}\|/,'|') + r=Px[:lng_lst_rgx].gsub(/\|#{lng_base}\|/,'|') @lang_regx=%r{(?:#{r})} if find_flag (f.length > 0) \ @@ -225,7 +226,7 @@ module SiSU_Commandline : find_all(find_flag,b) elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \ && a.inspect =~/"#{@lang_regx}\/?"/ \ - && a.inspect =~/"#{@lng_base}\/\S+?\.ss[tm]"/ + && a.inspect =~/"#{lng_base}\/\S+?\.ss[tm]"/ init_selected_lang_dirs(a) else b end @@ -235,7 +236,7 @@ module SiSU_Commandline def init_selected_lang_dirs(a) @z=[] a.each do |y| - if y =~/^#{@lng_base}\/(\S+?\.ss[tm])$/ + if y =~/^#{lng_base}\/(\S+?\.ss[tm])$/ @fn=$1 @z << y elsif y =~/^#{@lang_regx}\/?$/ @@ -670,11 +671,28 @@ module SiSU_Commandline { bool: false, set: :off, off: off_list} else { bool: true, set: :na, off: [] } end + act[:default_language]=if mod.inspect =~/"--(?:default-)?language[-=](\S{2})"/ + { set: :on, code: $1 } + elsif lng_base + { set: :on, code: lng_base } + else { set: :na, code: 'en' } + end + act[:i18n]=if mod.inspect =~/"(?:--monolingual|--i18n-mono(?:lingual)?)"/ #if monolingual possible outputs output_by :filename & :filetype only, without language code in default language name; give warning of conflict settings if monolingual & :language selected + @lingual=:mono + { set: :mono } + elsif mod.inspect =~/"(?:--multilingual|--i18n-multi(?:lingual)?)"/ + @lingual=:multi + { set: :multi } + else { set: :na } + end act[:output_by]=if mod.inspect =~/"--(?:output-)?by-language"/ + @dir_structure_by=:language { set: :language } elsif mod.inspect =~/"--(?:output-)?by-filename"/ + @dir_structure_by=:filename { set: :filename } elsif mod.inspect =~/"--(?:output-)?by-filetype"/ + @dir_structure_by=:filetype { set: :filetype } else { set: :na } end diff --git a/lib/sisu/v5/param.rb b/lib/sisu/v5/param.rb index 18e9721e..0e24b419 100644 --- a/lib/sisu/v5/param.rb +++ b/lib/sisu/v5/param.rb @@ -841,16 +841,7 @@ module SiSU_Param @authors,@topic_register_array,@papersize_array=[],[],[] @lvs=[nil,0,0,0,0,0,0] @emphasis_set_to='bold' - @lang_code_insert=if @opt.act[:output_by][:set]==:language - '' - elsif @opt.act[:output_by][:set]==:filetype \ - or @opt.act[:output_by][:set]==:filename - ".#{@opt.lng}" - elsif @opt.dir_structure_by ==:language - '' - else - ".#{@opt.lng}" - end + @lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt).language_code_insert @footer_links= { left: { say: '', url: '' }, center: { say: '', url: '' } } @rgx_image=/(?:^|[^_\\])\{(?:\s*|\~\^\s+)(\S+?\.(?:png|jpg|gif)\b)/m @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/ diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 973e0dcc..dcf0a671 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -441,6 +441,32 @@ module SiSU_Env end @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz end + def default_language? + if @rc + if defined? @rc['language_default'] \ + && (@rc['language_default'] =~/#{Px[:lng_lst_rgx]}/) + @rc['language_default'] + else + 'en' + end + else + 'en' + end + end + def mono_multi_lingual? + if @rc + if defined? @rc['lingual'] \ + && (@rc['lingual'] =~/mono(?:lingual)?/) + :mono + elsif defined? @rc['lingual'] \ + && (@rc['lingual'] =~/multi(?:lingual)?/) + :multi + else + :multi + end + else :multi + end + end def output_dir_structure def by? output_structure=:filename #set default output structure @@ -5703,6 +5729,28 @@ WOK self end end + class FilenameLanguageCodeInsert + def initialize(opt,lng=nil) + @opt,@lng=opt,lng + @opt=opt + @lng=lng ||=@opt.lng + end + def language_code_insert + if @opt.dir_structure_by ==:language \ + or ((@opt.dir_structure_by ==:filetype \ + || @opt.dir_structure_by ==:filename) \ + and (@opt.lingual ==:mono \ + && @opt.lng == @opt.act[:default_language][:code])) + '' + elsif (@opt.dir_structure_by ==:filetype \ + || @opt.dir_structure_by ==:filename) \ + and not @opt.lingual ==:mono + ".#{@lng}" + else + ".#{@lng}" + end + end + end class CreateFile Date: Tue, 30 Jul 2013 21:30:36 -0400 Subject: v5: output structure by, monolingual alternative for :filetype or :filename * 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 --- data/doc/sisu/CHANGELOG_v5 | 14 + lib/sisu/v5/concordance.rb | 27 +- lib/sisu/v5/constants.rb | 17 +- lib/sisu/v5/dal_expand_insertions.rb | 141 ++++++-- lib/sisu/v5/harvest_authors.rb | 5 +- lib/sisu/v5/harvest_topics.rb | 5 +- lib/sisu/v5/html.rb | 31 +- lib/sisu/v5/html_minitoc.rb | 31 +- lib/sisu/v5/html_segments.rb | 14 +- lib/sisu/v5/sysenv.rb | 680 +++++++++++++++++++++++++---------- 10 files changed, 705 insertions(+), 260 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 56307de2..f34a4537 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -31,6 +31,20 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.8.orig.tar.xz sisu_5.0.8-1.dsc * output structure by, add monolingual alternative for :filetype or :filename + * 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 %% 5.0.7.orig.tar.xz (2013-06-25:25/2) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.7 diff --git a/lib/sisu/v5/concordance.rb b/lib/sisu/v5/concordance.rb index f2143bb8..48ac1aac 100644 --- a/lib/sisu/v5/concordance.rb +++ b/lib/sisu/v5/concordance.rb @@ -239,15 +239,26 @@ WOK %{#{wordlocation}; } end def location_seg(wordlocation,show) ##fix - @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:html]}#\\2") unless wordlocation.nil? case wordlocation - when @rxp_t1 - %{[H]#{show}, } - when @rxp_t2 - %{[H]#{show}, } - when @rxp_t3 - %{[H]#{show}, } - else %{#{show}, } + when /@rxp_t1|@rxp_t2|@rxp_t3/ + fnh={ + fn: 'doc', + lng: @md.lang_code_insert + } + fn=@md.file.base_filename.html_seg(fnh) + %{[H]#{show}, } + else + if not wordlocation.nil? \ + and wordlocation =~ /(.+?)\#(\d+)/ + seg,loc=/(.+?)\#(\d+)/.match(wordlocation)[1,2] + fnh={ + fn: seg, + lng: @md.lang_code_insert + } + fn=@md.file.base_filename.html_seg(fnh) + word_location_seg=%{#{fn}##{loc}} + %{#{show}, } + end end end def map_para diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index d72049e9..6f9d4580 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -62,7 +62,22 @@ =end #Ax,Xx,Mx,Rx,Hx,Dx,Px,Ep,Db,Gt,Tex=Array.new(11){{}} YEAR='2013' -Sfx={ txt: '.txt', html: '.html', xhtml: '.xhtml', xml: '.xml', epub: '.epub', epub_xhtml: '.xhtml', odt: '.odt', pdf: '.pdf'} +Sfx={ + txt: '.txt', + html: '.html', + xhtml: '.xhtml', + xml: '.xml', + xml_sax: '.sax.xml', + xml_dom: '.dom.xml', + epub: '.epub', + epub_xhtml: '.xhtml', + odt: '.odt', + pdf: '.pdf', + manpage: '.1', + info: '.info', + texinfo: '.texinfo', + sql: '.sql.db', +} Ax={ tab: "\t", } diff --git a/lib/sisu/v5/dal_expand_insertions.rb b/lib/sisu/v5/dal_expand_insertions.rb index 77e4934c..d0595482 100644 --- a/lib/sisu/v5/dal_expand_insertions.rb +++ b/lib/sisu/v5/dal_expand_insertions.rb @@ -111,44 +111,66 @@ module SiSU_DAL_Insertions def by_language(linked_doc,lng,src=nil) @linked_doc,@lng,@src=linked_doc,lng,src @base_path="#{@md.file.output_path.base.url}/#{@lng}" + def fnh(ft) + { + fn: @linked_doc, + ft: ft, + } + end + def path_and_file(fn,pth) + "#{@base_path}/#{pth}/#{fn}" + end def manifest - "#{@base_path}/manifest/#{@linked_doc}.html" + fn=@md.file.base_filename.manifest(fnh(Sfx[:html])) + path_and_file(fn,'manifest') end def html_toc - "#{@base_path}/html/#{@linked_doc}.html" + fn=@md.file.base_filename.html_segtoc(fnh(Sfx[:html])) + "#{@base_path}/html/#{@linked_doc}/#{fn}" end def html_doc - "#{@base_path}/html/#{@linked_doc}.html" + fn=@md.file.base_filename.html_scroll(fnh(Sfx[:html])) + path_and_file(fn,'html') end def html_concordance - "#{@base_path}/html/#{@linked_doc}.html" + fn=@md.file.base_filename.html_concordance + "#{@base_path}/html/#{@linked_doc}/#{fn}" end def epub - "#{@base_path}/epub/#{@linked_doc}.epub" + fn=@md.file.base_filename.epub(fnh(Sfx[:epub])) + path_and_file(fn,'epub') end def pdf_landscape - "#{@base_path}/pdf/#{@linked_doc}.pdf" + fn=@md.file.base_filename.pdf_l_a4(fnh(Sfx[:pdf])) + path_and_file(fn,'pdf') end def pdf_portrait - "#{@base_path}/pdf/#{@linked_doc}.pdf" + fn=@md.file.base_filename.pdf_p_a4(fnh(Sfx[:pdf])) + path_and_file(fn,'pdf') end def odt - "#{@base_path}/odt/#{@linked_doc}.odt" + fn=@md.file.base_filename.odt(fnh(Sfx[:odt])) + path_and_file(fn,'odt') end def xhtml - "#{@base_path}/xhtml/#{@linked_doc}.xhtml" + fn=@md.file.base_filename.xhtml(fnh(Sfx[:xhtml])) + path_and_file(fn,'xhtml') end def xml_sax - "#{@base_path}/xml/#{@linked_doc}.xml" + fn=@md.file.base_filename.xml_sax(fnh(Sfx[:xml_sax])) + path_and_file(fn,'xml_sax') end def xml_dom - "#{@base_path}/xml/#{@linked_doc}.xml" + fn=@md.file.base_filename.xml_dom(fnh(Sfx[:xml_dom])) + path_and_file(fn,'xml_dom') end def txt - "#{@base_path}/txt/#{@linked_doc}.txt" + fn=@md.file.base_filename.txt(fnh(Sfx[:txt])) + path_and_file(fn,'txt') end def digest - "#{@base_path}/digest/#{@linked_doc}.txt" + fn=@md.file.base_filename.hash_digest(fnh(Sfx[:txt])) + path_and_file(fn,'digest') end def source "#{@base_path}/src/#{@src}" @@ -161,44 +183,66 @@ module SiSU_DAL_Insertions def by_filetype(linked_doc,lng,src=nil) @linked_doc,@lng,@src=linked_doc,lng,src @base_path="#{@md.file.output_path.base.url}" + def fnh + { + fn: @linked_doc, + lng: ".#{@lng}" + } + end + def path_and_file(fn,pth) + "#{@base_path}/#{pth}/#{fn}" + end def manifest - "#{@base_path}/manifest/#{@linked_doc}.#{@lng}.html" + fn=@md.file.base_filename.manifest(fnh) + path_and_file(fn,'manifest') end def html_toc - "#{@base_path}/html/#{@linked_doc}.#{@lng}.html" + fn=@md.file.base_filename.html_segtoc(fnh) + path_and_file(fn,'html') end def html_doc - "#{@base_path}/html/#{@linked_doc}.#{@lng}.html" + fn=@md.file.base_filename.html_scroll(fnh) + path_and_file(fn,'html') end def html_concordance - "#{@base_path}/html/#{@linked_doc}.#{@lng}.html" + fn=@md.file.base_filename.html_concordance + path_and_file(fn,'html') end def epub - "#{@base_path}/epub/#{@linked_doc}.#{@lng}.epub" + fn=@md.file.base_filename.epub(fnh) + path_and_file(fn,'epub') end def pdf_landscape - "#{@base_path}/pdf/#{@linked_doc}.#{@lng}.pdf" + fn=@md.file.base_filename.pdf_l_a4(fnh) + path_and_file(fn,'pdf') end def pdf_portrait - "#{@base_path}/pdf/#{@linked_doc}.#{@lng}.pdf" + fn=@md.file.base_filename.pdf_p_a4(fnh) + path_and_file(fn,'pdf') end def odt - "#{@base_path}/odt/#{@linked_doc}.#{@lng}.odt" + fn=@md.file.base_filename.odt(fnh) + path_and_file(fn,'odt') end def xhtml - "#{@base_path}/xhtml/#{@linked_doc}.#{@lng}.xhtml" + fn=@md.file.base_filename.xhtml(fnh) + path_and_file(fn,'xhtml') end def xml_sax - "#{@base_path}/xml_sax/#{@linked_doc}.#{@lng}.xml" + fn=@md.file.base_filename.xml_sax(fnh) + path_and_file(fn,'xml_sax') end def xml_dom - "#{@base_path}/xml_dom/#{@linked_doc}.#{@lng}.xml" + fn=@md.file.base_filename.xml_dom(fnh) + path_and_file(fn,'xml_dom') end def txt - "#{@base_path}/txt/#{@linked_doc}.#{@lng}.txt" + fn=@md.file.base_filename.txt(fnh) + path_and_file(fn,'txt') end def digest - "#{@base_path}/digest/#{@linked_doc}.#{@lng}.txt" + fn=@md.file.base_filename.hash_digest(fnh) + path_and_file(fn,'digest') end def source "#{@base_path}/src/#{@src}" @@ -211,44 +255,65 @@ module SiSU_DAL_Insertions def by_filename(linked_doc,lng,src=nil) @linked_doc,@lng,@src=linked_doc,lng,src @base_path="#{@md.file.output_path.base.url}/#{@linked_doc}" + def fnh + { + fn: @linked_doc, + lng: ".#{@lng}" + } + end + def path_and_file(fn) + "#{@base_path}/#{fn}" + end def manifest - "#{@base_path}/sisu_manifest.#{@lng}.html" + fn=@md.file.base_filename.manifest(fnh) + path_and_file(fn) end def html_toc - "#{@base_path}/toc.#{@lng}.html" + fn=@md.file.base_filename.html_segtoc(fnh) + path_and_file(fn) end def html_doc - "#{@base_path}/scroll.#{@lng}.html" + fn=@md.file.base_filename.html_scroll(fnh) + path_and_file(fn) end def html_concordance - "#{@base_path}/concordance.#{@lng}.html" + fn=@md.file.base_filename.html_concordance + path_and_file(fn) end def epub "#{@base_path}/epub/#{@linked_doc}.#{@lng}.epub" end def pdf_landscape - "#{@base_path}/landscape.#{@lng}.a4.pdf" + fn=@md.file.base_filename.pdf_l_a4(fnh) + path_and_file(fn) end def pdf_portrait - "#{@base_path}/portrait.#{@lng}.a4.pdf" + fn=@md.file.base_filename.pdf_p_a4(fnh) + path_and_file(fn) end def odt - "#{@base_path}/opendocument.#{@lng}.odt" + fn=@md.file.base_filename.odt(fnh) + path_and_file(fn) end def xhtml - "#{@base_path}/scroll.#{@lng}.xhtml" + fn=@md.file.base_filename.xhtml(fnh) + path_and_file(fn) end def xml_sax - "#{@base_path}/scroll.#{@lng}.sax.xml" + fn=@md.file.base_filename.xml_sax(fnh) + path_and_file(fn) end def xml_dom - "#{@base_path}/scroll.#{@lng}.dom.xml" + fn=@md.file.base_filename.xml_dom(fnh) + path_and_file(fn) end def txt - "#{@base_path}/plain.#{@lng}.txt" + fn=@md.file.base_filename.txt(fnh) + path_and_file(fn) end def digest - "#{@base_path}/digest.#{@lng}.txt" + fn=@md.file.base_filename.hash_digest(fnh) + path_and_file(fn) end def source "#{@base_path}/#{@src}" diff --git a/lib/sisu/v5/harvest_authors.rb b/lib/sisu/v5/harvest_authors.rb index c20558df..c78971e4 100644 --- a/lib/sisu/v5/harvest_authors.rb +++ b/lib/sisu/v5/harvest_authors.rb @@ -364,12 +364,13 @@ WOK @output[lng][:html_mnt] << x end @output[lng][:html] << x + lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt,lng).language_code_insert works=[] a[1][:md].each do |i| manifest_at=if @env.output_dir_structure.by? == :language - i[:file] + '.html' + i[:file] + Sfx[:html] elsif @env.output_dir_structure.by? == :filetype - i[:file] + '.' + lng + '.html' + i[:file] + '.' + lang_code_insert + Sfx[:html] elsif @env.output_dir_structure.by? == :filename "./#{i[:file]}/#{i[:page]}" else '' #error diff --git a/lib/sisu/v5/harvest_topics.rb b/lib/sisu/v5/harvest_topics.rb index d3189639..eef5a2e2 100644 --- a/lib/sisu/v5/harvest_topics.rb +++ b/lib/sisu/v5/harvest_topics.rb @@ -737,10 +737,11 @@ WOK end end def do_hash_md(lng,attrib,hash) + lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt,lng).language_code_insert manifest_at=if @env.output_dir_structure.by? == :language - hash[:file] + '.html' + hash[:file] + Sfx[:html] elsif @env.output_dir_structure.by? == :filetype - hash[:file] + '.' + lng + '.html' + hash[:file] + lang_code_insert + Sfx[:html] elsif @env.output_dir_structure.by? == :filename "./#{hash[:file]}/#{hash[:page]}" else '' #error diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index ff4d149d..f7e2b813 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -418,14 +418,23 @@ WOK linkname,ocn=dob.obj.strip,dob.ocn p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) if ocn if dob.ln ==4 - seg_link=%{ + fnh={ + fn: dob.name, + lng: @md.lang_code_insert + } + f=@md.file.base_filename.html_seg(fnh) + seg_link=%{ #{dob.obj} } @@seg_url=dob.name elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ - seg_link=dob.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, - %{\\1 \\2 }) + fn,hd=/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/.match(dob.obj)[1,2] + fnh={ + fn: fn, + lng: @md.lang_code_insert + } + f=@md.file.base_filename.html_seg(fnh) + seg_link=%{#{fn} #{hd} } end p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) if ocn @file=SiSU_Env::FileOp.new(@md) if @md @@ -459,8 +468,13 @@ WOK toc={} if ocn \ and ocn !~/#/ + fnh={ + fn: @@seg_url, + lng: @md.lang_code_insert + } + f=@md.file.base_filename.html_seg(fnh) p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } @@ -480,8 +494,13 @@ WOK toc={} if ocn \ and ocn !~/#/ + fnh={ + fn: @@seg_url, + lng: @md.lang_code_insert + } + f=@md.file.base_filename.html_seg(fnh) p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v5/html_minitoc.rb b/lib/sisu/v5/html_minitoc.rb index 99f11d87..fcbffc73 100644 --- a/lib/sisu/v5/html_minitoc.rb +++ b/lib/sisu/v5/html_minitoc.rb @@ -153,14 +153,23 @@ txt=@data unless txt =~/~metadata/ if txt.ln ==4 - seg_link=%{ + fnh={ + fn: txt.name, + lng: @md.lang_code_insert + } + f=@md.file.base_filename.html_seg(fnh) + seg_link=%{ #{txt.obj} } @@seg_url=txt.name elsif txt.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ - seg_link=txt.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, - %{\\1 \\2 }) + fn,hd=/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/.match(dob.obj)[1,2] + fnh={ + fn: fn, + lng: @md.lang_code_insert + } + f=@md.file.base_filename.html_seg(fnh) + seg_link=%{#{fn} #{hd} } end txt_obj={ txt: seg_link } format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) @@ -175,7 +184,12 @@ && txt.ocn !=0 txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') end - lnk_n_txt=%{ + fnh={ + fn: @@seg_url, + lng: @md.lang_code_insert + } + f=@md.file.base_filename.html_seg(fnh) + lnk_n_txt=%{ #{txt.obj} } txt_obj={ txt: lnk_n_txt } @@ -190,7 +204,12 @@ && txt.ocn !=0 txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') end - lnk_n_txt=%{ + fnh={ + fn: @@seg_url, + lng: @md.lang_code_insert + } + f=@md.file.base_filename.html_seg(fnh) + lnk_n_txt=%{ #{txt.obj} } txt_obj={ txt: lnk_n_txt } diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb index 54292175..ec604327 100644 --- a/lib/sisu/v5/html_segments.rb +++ b/lib/sisu/v5/html_segments.rb @@ -273,7 +273,12 @@ module SiSU_HTML_Seg FileUtils::mkdir_p(@file.output_path.html_seg.dir) if File.writable?("#{@file.output_path.base.dir}/.") end 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]}" + fnh={ + fn: @@seg_name_html[tracking-1], + lng: @md.lang_code_insert + } + fn=@md.file.base_filename.html_seg(fnh) + segfilename="#{@file.output_path.html_seg.dir}/#{fn}" output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] minitoc=(@make.build.html_minitoc?) \ ? @minitoc @@ -298,7 +303,12 @@ module SiSU_HTML_Seg head(dob) #keep use for last segment, eg if metadata is last segment 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]}" + fnh={ + fn: @@seg_name_html[tracking], + lng: @md.lang_code_insert + } + fn=@md.file.base_filename.html_seg(fnh) + segfilename="#{@file.output_path.html_seg.dir}/#{fn}" output_seg_file=File.new(segfilename,'w') SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'metadata').output Seg.new.reinitialise diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index dcf0a671..63981be3 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -470,27 +470,31 @@ module SiSU_Env def output_dir_structure 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 + if @rc + 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 #set default + :language + end else #set default :language end @@ -4657,245 +4661,531 @@ WOK self end def base_filename - def txt - ft='.txt' - if output_dir_structure.by_language_code? - @md.fnb + ft - elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft + def i18n(f) + f=default_hash.merge(f) + (@md.opt.act[:i18n][:set]==:mono \ + || ((mono_multi_lingual? ==:mono)) \ + && (@md.opt.lng == default_language?)) \ + || f[:lng]==nil \ + ? f[:fn] + f[:ft] + : f[:fn] + f[:lng] + f[:ft] + end + def default_hash + { + fn: @md.fnb, + lng: @md.lang_code_insert, + } + end + def default_hash_build(fh,sfx) + if fh.is_a?(Hash) + fh[:fn] ||=@md.fnb + fh[:lng] ||= @md.lang_code_insert + fh[:ft]=sfx + fh else - 'plain' + @md.lang_code_insert + ft - end - end - def html_scroll - ft='.html' - if output_dir_structure.by_language_code? - @md.fnb + ft + { + fn: @md.fnb, + lng: @md.lang_code_insert, + ft: sfx, + } + end + end + def txt(fh=nil) + fh=default_hash_build(fh,Sfx[:txt]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } + elsif output_dir_structure.by_filetype? + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } + else + { + fn: 'plain', + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def html_scroll(fh=nil) + fh=default_hash_build(fh,Sfx[:html]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } else - 'scroll' + @md.lang_code_insert + ft - end - end - def html_seg_index - ft='.html' - if output_dir_structure.by_language_code? - 'index' + ft + { + fn: 'scroll', + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def html_seg_index(fh=nil) + fh=default_hash_build(fh,Sfx[:html]) + fnh=if output_dir_structure.by_language_code? + { + fn: 'index', + ft: fh[:ft], + } else - 'index' + @md.lang_code_insert + ft - end - end - def html_segtoc - ft='.html' - if output_dir_structure.dump_or_redirect? - @md.fnb + '.toc' + ft + { + fn: 'index', + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def html_segtoc(fh=nil) + fh=default_hash_build(fh,Sfx[:html]) + fnh=if output_dir_structure.dump_or_redirect? + { + fn: fh[:fn] + '.toc', + ft: fh[:ft], + } elsif output_dir_structure.by_language_code? - 'toc' + ft + { + fn: 'toc', + ft: fh[:ft], + } else - 'toc' + @md.lang_code_insert + ft + { + fn: 'toc', + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def html_seg(fh) + fh=default_hash_build(fh,Sfx[:html]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft] + } + elsif output_dir_structure.by_filetype? + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng] + } + else + { + fn: 'scroll', + ft: fh[:ft], + lng: fh[:lng] + } end + i18n(fnh) end def html_book_index - ft='.html' - if output_dir_structure.by_language_code? - 'book_index' + ft + ft=Sfx[:html] + fnh=if output_dir_structure.by_language_code? + { + fn: 'book_index', + ft: ft, + } else - 'book_index' + @md.lang_code_insert + ft + { + fn: 'book_index', + ft: ft, + lng: @md.lang_code_insert + } end + i18n(fnh) end def html_concordance - ft='.html' - if output_dir_structure.dump_or_redirect? + ft=Sfx[:html] + fnh=if output_dir_structure.dump_or_redirect? @md.fnb + '.concordance' + ft elsif output_dir_structure.by_language_code? - 'concordance' + ft + { + fn: 'concordance', + ft: ft, + } else - 'concordance' + @md.lang_code_insert + ft - end - end - def xhtml - ft= '.xhtml' - if output_dir_structure.by_language_code? - @md.fnb + ft + { + fn: 'concordance', + ft: ft, + lng: @md.lang_code_insert + } + end + i18n(fnh) + end + def xhtml(fh=nil) + fh=default_hash_build(fh,Sfx[:xhtml]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng] + } else - 'scroll' + @md.lang_code_insert + ft - end - end - def epub - ft='.epub' - if output_dir_structure.by_language_code? - @md.fnb + ft + { + fn: 'scroll', + ft: fh[:ft], + lng: fh[:lng] + } + end + i18n(fnh) + end + def epub(fh=nil) + fh=default_hash_build(fh,Sfx[:epub]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } else - @md.fnb + @md.lang_code_insert + ft - end - end - def odt - ft='.odt' - if output_dir_structure.by_language_code? - @md.fnb + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def odt(fh=nil) + fh=default_hash_build(fh,Sfx[:odt]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } else - 'opendocument' + @md.lang_code_insert + ft - end - end - def xml_sax - ft='.sax.xml' - if output_dir_structure.by_language_code? - @md.fnb + ft + { + fn: 'opendocument', + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def xml_sax(fh=nil) + fh=default_hash_build(fh,Sfx[:xml_sax]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } else - 'scroll' + @md.lang_code_insert + ft - end - end - def xml_dom - ft='.dom.xml' - if output_dir_structure.by_language_code? - @md.fnb + ft + { + fn: 'scroll', + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def xml_dom(fh=nil) + fh=default_hash_build(fh,Sfx[:xml_dom]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } else - 'scroll' + @md.lang_code_insert + ft + { + fn: 'scroll', + ft: fh[:ft], + lng: fh[:lng], + } end + i18n(fnh) end - def pdf_p + def pdf_p(fh=nil) + fh=default_hash_build(fh,Sfx[:pdf]) if output_dir_structure.by_language_code? - @md.fnb + '.portrait.' - else 'portrait' + @md.lang_code_insert + '.' + fh[:fn] + '.portrait.' + else + (@md.opt.lingual==:mono \ + && (@md.opt.lng == default_language?)) \ + ? ('portrait' + '.') + : ('portrait' + fh[:lng] + '.') end end - def pdf_l + def pdf_l(fh=nil) + fh=default_hash_build(fh,Sfx[:pdf]) if output_dir_structure.by_language_code? - @md.fnb + '.landscape.' - else 'landscape' + @md.lang_code_insert + '.' + fh[:fn] + '.landscape.' + else + (@md.opt.lingual==:mono \ + && (@md.opt.lng == default_language?)) \ + ? ('landscape' + '.') + : ('landscape' + fh[:lng] + '.') + #'landscape' + @md.lang_code_insert + '.' end end - def pdf_p_a4 - pdf_p + @md.fn[:pdf_p_a4] + def pdf_p_a4(fh=nil) + pdf_p(fh) + @md.fn[:pdf_p_a4] end - def pdf_p_a5 - pdf_p + @md.fn[:pdf_p_a5] + def pdf_p_a5(fh=nil) + pdf_p(fh) + @md.fn[:pdf_p_a5] end - def pdf_p_b5 - pdf_p + @md.fn[:pdf_p_b5] + def pdf_p_b5(fh=nil) + pdf_p(fh) + @md.fn[:pdf_p_b5] end - def pdf_p_letter - pdf_p + @md.fn[:pdf_p_letter] + def pdf_p_letter(fh=nil) + pdf_p(fh) + @md.fn[:pdf_p_letter] end - def pdf_p_legal - pdf_p + @md.fn[:pdf_p_legal] + def pdf_p_legal(fh=nil) + pdf_p(fh) + @md.fn[:pdf_p_legal] end - def pdf_l_a4 - pdf_l + @md.fn[:pdf_l_a4] + def pdf_l_a4(fh=nil) + pdf_l(fh) + @md.fn[:pdf_l_a4] end - def pdf_l_a5 - pdf_l + @md.fn[:pdf_l_a5] + def pdf_l_a5(fh=nil) + pdf_l(fh) + @md.fn[:pdf_l_a5] end - def pdf_l_b5 - pdf_l + @md.fn[:pdf_l_b5] + def pdf_l_b5(fh=nil) + pdf_l(fh) + @md.fn[:pdf_l_b5] end - def pdf_l_letter - pdf_l + @md.fn[:pdf_l_letter] + def pdf_l_letter(fh=nil) + pdf_l(fh) + @md.fn[:pdf_l_letter] end - def pdf_l_legal - pdf_l + @md.fn[:pdf_l_legal] + def pdf_l_legal(fh=nil) + pdf_l(fh) + @md.fn[:pdf_l_legal] end - def manpage - ft='1' - if output_dir_structure.by_language_code? - @md.fnb + '.' + ft + def manpage(fh=nil) + fh=default_hash_build(fh,Sfx[:manpage]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } else - @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft - end - end - def info - ft='info' - if output_dir_structure.by_language_code? - @md.fnb + '.' + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def info(fh=nil) + fh=default_hash_build(fh,Sfx[:info]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } else - @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft - end - end - def texinfo - ft='texinfo' - if output_dir_structure.by_language_code? - @md.fnb + '.' + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def texinfo(fh=nil) + fh=default_hash_build(fh,Sfx[:texinfo]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } else - @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft - end - end - def sqlite_discrete - ft='.sql.db' - if output_dir_structure.by_language_code? - @md.fnb + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def sqlite_discrete(fh=nil) + fh=default_hash_build(fh,Sfx[:sql]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } else - @md.fnb + @md.lang_code_insert + ft - end - end - def hash_digest - ft='.txt' - if output_dir_structure.by_language_code? - @md.fnb + '.hash_digest' + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def hash_digest(fh=nil) + fh=default_hash_build(fh,Sfx[:txt]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn] + '.hash_digest', + ft: fh[:ft], + } elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } else - 'digest' + @md.lang_code_insert + ft - end - end - def sitemap - ft='.xml' - if output_dir_structure.by_language_code? - @md.fnb + '.sitemap' + ft + { + fn: 'digest', + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def sitemap(fh=nil) + fh=default_hash_build(fh,Sfx[:xml]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn] + '.sitemap', + ft: fh[:ft], + } elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } else - 'sitemap' + @md.lang_code_insert + ft + { + fn: 'sitemap', + ft: fh[:ft], + lng: fh[:lng], + } end + i18n(fnh) end def qrcode_title + fn=@md.fnb ft='.title.png' - if output_dir_structure.by_language_code? - @md.fnb + ft + fnh=if output_dir_structure.by_language_code? + { + fn: fn, + ft: ft, + } elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft - else #fix - 'sisu_manifest' + @md.lang_code_insert + ft + { + fn: fn, + ft: ft, + lng: @md.lang_code_insert + } + else + { + fn: 'sisu_manifest', + ft: ft, + lng: @md.lang_code_insert + } end + i18n(fnh) end def qrcode_md + fn=@md.fnb ft='.md.png' - if output_dir_structure.by_language_code? - @md.fnb + ft + fnh=if output_dir_structure.by_language_code? + { + fn: fn, + ft: ft, + } elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft - else #fix - 'sisu_manifest' + @md.lang_code_insert + ft - end - end - def manifest_txt - ft='.txt' - if output_dir_structure.by_language_code? - @md.fnb + ft + { + fn: fn, + ft: ft, + lng: @md.lang_code_insert + } + else + { + fn: 'sisu_manifest', + ft: ft, + lng: @md.lang_code_insert + } + end + i18n(fnh) + end + def manifest_txt(fh=nil) + fh=default_hash_build(fh,Sfx[:txt]) + fnh=if output_dir_structure.by_language_code? + { + fn: fh[:fn], + ft: fh[:ft], + } elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft - else #fix - 'sisu_manifest' + @md.lang_code_insert + ft - end - end - def manifest - ft='.html' - if output_dir_structure.dump_or_redirect? - @md.fnb + '.manifest' + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } + else + { + fn: 'sisu_manifest', + ft: fh[:ft], + lng: fh[:lng], + } + end + i18n(fnh) + end + def manifest(fh=nil) + fh=default_hash_build(fh,Sfx[:html]) + fnh=if output_dir_structure.dump_or_redirect? + { + fn: fh[:fn] + '.manifest', + ft: fh[:ft], + } elsif output_dir_structure.by_language_code? - @md.fnb + ft + { + fn: fh[:fn], + ft: fh[:ft], + } elsif output_dir_structure.by_filetype? - @md.fnb + @md.lang_code_insert + ft - else #fix - 'sisu_manifest' + @md.lang_code_insert + ft + { + fn: fh[:fn], + ft: fh[:ft], + lng: fh[:lng], + } + else + { + fn: 'sisu_manifest', + ft: fh[:ft], + lng: fh[:lng], + } end + i18n(fnh) end def src @md.fno -- cgit v1.2.3 From 9dffba29dd1000452563204e4e6887df1d5bb2c9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 30 Jul 2013 21:36:53 -0400 Subject: v5: output structure by, monolingual alternative, documentation --- data/doc/sisu/CHANGELOG_v5 | 1 + data/doc/sisu/html/sisu.1.html | 235 ++++++++++++--------- .../sisu_manual/_sisu/rc/sisurc_by_fn.yml | 2 + .../sisu_manual/_sisu/rc/sisurc_by_ft.yml | 2 + .../markup-samples/sisu_manual/sisu_commands.sst | 13 ++ man/man1/sisu.1 | 41 ++-- 6 files changed, 185 insertions(+), 109 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index f34a4537..9b092a5d 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -45,6 +45,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.8.orig.tar.xz --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 + * documentation %% 5.0.7.orig.tar.xz (2013-06-25:25/2) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.7 diff --git a/data/doc/sisu/html/sisu.1.html b/data/doc/sisu/html/sisu.1.html index 6f4eb681..65a92c9a 100644 --- a/data/doc/sisu/html/sisu.1.html +++ b/data/doc/sisu/html/sisu.1.html @@ -285,12 +285,14 @@ on to provide seg navigation)); --exc-segsubtoc (exclude sub table of contents, affects html (seg), epub) ; see also --inc-*
-F [--webserv=webrick]
-
see --sample-search-form
+
see --sample-search-form +
-f [optional string part of filename]
see --find
-
--find [optional string part of filename]
+
--find [optional string part +of filename]
without match string, glob all .sst .ssm files in directory (including language subdirectories). With match string, find files that match given string in directory (including language subdirectories). Alias @@ -299,7 +301,8 @@ match given string in directory (including language subdirectories). Alias
-G [optional string part of filename]
see --find
-
-g [filename/wildcard]
+
-g [filename/wildcard] +
see --git
--git [filename/wildcard]
@@ -311,7 +314,8 @@ structure in a git repo (experimental and subject to change). Alias -g
see --find
-h [filename/wildcard]
-
see --html
+
see --html +
--harvest *.ss[tm]
makes two lists of sisu output based on the sisu markup @@ -347,100 +351,122 @@ and --html
see --texinfo
-i [filename/wildcard]
-
see --manpage
+
see --manpage +
+ +
--i18n-*
+
these flags affect output by filetype and filename): --i18n-mono (--monolingual) +output filenames without language code for default language (’en’ or as set); +--i18n-multi (--multilingual) language code provided as part of the output filename, +this is the default. Where output is in one language only the language code +may not be desired. see also --output-by-*
--inc-*
-
include output feature, overrides configuration settings, (usually -the default if none set), has precedence over --exc-* (exclude output feature). -Some detail provided under --exc-*, see --exc-*
+
include output feature, overrides +configuration settings, (usually the default if none set), has precedence +over --exc-* (exclude output feature). Some detail provided under --exc-*, see +--exc-*
-j [filename/wildcard]
-
copies images associated with a file for use by html, xhtml & xml outputs (automatically -invoked by --dump & redirect).
+
copies images associated with a file for use +by html, xhtml & xml outputs (automatically invoked by --dump & redirect).
-
-k
+
-k +
see --color-off
--keep-processing-files [filename/wildcard/url]
-
see --maintenance
+
see --maintenance +
-M [filename/wildcard/url]
see --maintenance
-m [filename/wildcard/url]
-
see --dal (document abstraction level/layer)
+
see +--dal (document abstraction level/layer)
-
--machine [filename/wildcard/url]
+
--machine [filename/wildcard/url] +
see --dal (document abstraction level/layer)
-
--maintenance [filename/wildcard/url]
+
--maintenance [filename/wildcard/url] +
maintenance mode, interim processing files are preserved and their locations indicated. (also see -V). Aliases -M and --keep-processing-files.
-
--manpage [filename/wildcard]
+
--manpage [filename/wildcard] +
produces man page of file, not suitable for all outputs. Alias -i
+
--monolingual +
+
see --i18n-*
+ +
--multilingual
+
see --i18n-*
+
-N [filename/wildcard/url]
-
document digest or document content certificate ( DCC ) as md5 digest tree -of the document: the digest for the document, and digests for each object -contained within the document (together with information on software versions -that produced it) (digest.txt). -NV for verbose digest output to screen.
+
document digest +or document content certificate ( DCC ) as md5 digest tree of the document: +the digest for the document, and digests for each object contained within +the document (together with information on software versions that produced +it) (digest.txt). -NV for verbose digest output to screen.
-
-n -[filename/wildcard/url]
-
skip the creation of intermediate processing files -(document abstraction) if they already exist, this skips the equivalent -of -m which is otherwise assumed by most processing flags.
+
-n [filename/wildcard/url] +
+
skip the creation of intermediate processing files (document abstraction) +if they already exist, this skips the equivalent of -m which is otherwise +assumed by most processing flags.
--no-*
see --exc-*
-
-o -[filename/wildcard/url]
+
-o [filename/wildcard/url] +
see --odt
--odf [filename/wildcard/url]
see --odt
-
--odt -[filename/wildcard/url]
-
output basic document in opendocument file format -(opendocument.odt). Alias -o
+
--odt [filename/wildcard/url] +
+
output basic document in opendocument file format (opendocument.odt). Alias +-o
--output-by-*
-
select output directory structure from -3 alternatives: --output-by-language, (language directory (based on language -code) with filetype (html, epub, pdf etc.) subdirectories); --output-by-filetype, -(filetype directories with language code as part of filename); --output-by-filename, -(filename directories with language code as part of filename). This is configurable. -Alias --by-*
+
select output directory structure from 3 alternatives: --output-by-language, +(language directory (based on language code) with filetype (html, epub, +pdf etc.) subdirectories); --output-by-filetype, (filetype directories with +language code as part of filename); --output-by-filename, (filename directories +with language code as part of filename). This is configurable. Alias --by-* +
-P [language_directory/filename language_directory]
see --po4a
-
-p -[filename/wildcard]
+
-p [filename/wildcard] +
see --pdf
--papersize-(a4|a5|b5|letter|legal)
-
in conjunction -with --pdf set pdf papersize, overriding any configuration settings, to set -more than one papersize repeat the option --pdf --papersize-a4 --papersize-letter. -See also --papersize=* -

-

--papersize=a4,a5,b5,letter,legal in conjunction -with --pdf set pdf papersize, overriding any configuration settings, to set -more than one papersize list after the equal sign with a comma separator ---papersize=a4,letter. See also --papersize-*

- -
--pdf [filename/wildcard]
-
produces LaTeX pdf -(portrait.pdf & landscape.pdf). Orientation and papersize may be -set on the command-line. Default paper size is set in config file, or document -header, or provided with additional command line parameter, e.g. --papersize-a4 -preset sizes include: ’A4’, U.S. ’letter’ and ’legal’ and book sizes ’A5’ and ’B5’ -(system defaults to A4), and; --landscape or --portrait, so: e.g. "sisu --pdf-a4 ---pdf-letter --landscape --verbose [filename/wildcard]" or "sisu --pdf --landscape +
in conjunction with --pdf set pdf papersize, +overriding any configuration settings, to set more than one papersize repeat +the option --pdf --papersize-a4 --papersize-letter. See also --papersize=* +

+

--papersize=a4,a5,b5,letter,legal +in conjunction with --pdf set pdf papersize, overriding any configuration +settings, to set more than one papersize list after the equal sign with +a comma separator --papersize=a4,letter. See also --papersize-*

+ +
--pdf [filename/wildcard] +
+
produces LaTeX pdf (portrait.pdf & landscape.pdf). Orientation and papersize +may be set on the command-line. Default paper size is set in config file, +or document header, or provided with additional command line parameter, +e.g. --papersize-a4 preset sizes include: ’A4’, U.S. ’letter’ and ’legal’ and book sizes +’A5’ and ’B5’ (system defaults to A4), and; --landscape or --portrait, so: e.g. "sisu +--pdf-a4 --pdf-letter --landscape --verbose [filename/wildcard]" or "sisu --pdf --landscape --a4 --letter --verbose [filename/wildcard]". --pdf defaults to both landscape & portrait output, and a4 if no other papersizes are configured. Related options --pdf-landscape --pdf-portrait --pdf-papersize-* --pdf-papersize=[list]. Alias -p
@@ -478,7 +504,8 @@ include: --createdb; --create; --dropall; --import [filename]; --update [filenam language_directory]
see --po4a
-
--po4a [language_directory/filename language_directory]
+
--po4a [language_directory/filename language_directory] +
produces .pot and po files for the file in the languages specified by the language directory. SiSU markup is placed in subdirectories named with the language code, e.g. en/ fr/ es/. The sisu config file must set the output @@ -495,13 +522,15 @@ directory structure to multilingual. v3, experimental
generate QR code image of metadata (used in manifest). v3 only.
-
--quiet [filename/wildcard]
+
--quiet [filename/wildcard] +
quiet less output to screen.
-R [filename/wildcard]
see --rsync
-
-r [filename/wildcard]
+
-r [filename/wildcard] +
see --scp
--redirect[=directory_path] [filename/wildcard]
@@ -523,7 +552,8 @@ with other flags, it is not). Also see --scp. Alias -R
-S
see --sisupod
-
-S [filename/wildcard]
+
-S [filename/wildcard] +
see --sisupod
-s [filename/wildcard]
@@ -564,10 +594,11 @@ same output directory base path (possible instructions include: --createdb; see database section below. Alias -d
--sisupod
-
produces a sisupod a zipped sisu directory of markup files including sisu -markup source files and the directories local configuration file, images -and skins. Note: this only includes the configuration files or skins contained -in is tested only with zsh). Alias -S
+
produces a sisupod a zipped +sisu directory of markup files including sisu markup source files and the +directories local configuration file, images and skins. Note: this only +includes the configuration files or skins contained in is tested only +with zsh). Alias -S
--sisupod [filename/wildcard]
produces a zipped file of @@ -589,18 +620,22 @@ the individual files for sending). See the -S option without [filename/wildcard] Alias -S
--source [filename/wildcard]
-
copies sisu markup file to output directory. Alias -s
+
copies sisu markup file to output directory. +Alias -s
-T [filename/wildcard (*.termsheet.rb)]
-
standard form document builder, preprocessing feature
+
standard form document builder, +preprocessing feature
-t [filename/wildcard]
see --txt
-
--texinfo [filename/wildcard]
+
--texinfo [filename/wildcard] +
produces texinfo and info file, (view with pinfo). Alias -I
-
--txt [filename/wildcard]
+
--txt [filename/wildcard] +
produces plaintext with Unix linefeeds and without markup, (object numbers are omitted), has footnotes at end of each paragraph that contains them [ -A for equivalent dos (linefeed) output file] [see -e for endnotes]. (Options @@ -612,10 +647,11 @@ paragraph --unix for unix linefeed (default) --msdos for msdos linefeed). Alias
see --urls
-u [filename/wildcard]
-
provides url mapping of output files for the flags -requested for processing, also see -U
+
provides url mapping +of output files for the flags requested for processing, also see -U
-
--urls [filename/wildcard]
+
--urls +[filename/wildcard]
prints url output list/map for the available processing flags options and resulting files that could be requested, (can be used to get a list of processing options in relation to a file, together with @@ -625,10 +661,11 @@ is running and provides webrick url mappings where appropriate, but these can be switched to file system paths in sisurc.yml. Alias -U
-V
-
on its own, provides SiSU version -and environment information (sisu --help env)
+
on its own, +provides SiSU version and environment information (sisu --help env)
-
-V [filename/wildcard]
+
-V [filename/wildcard] +
even more verbose than the -v flag.
-v
@@ -842,20 +879,21 @@ in the sisu_manual, available at:

The manual can be generated from source, found respectively, either within the SiSU tarball or installed locally at: -

-

/usr/share/doc/sisu/markup-samples/sisu_manual +

./data/doc/sisu/markup-samples/sisu_manual -

move to the respective directory and type e.g.: +

/usr/share/doc/sisu/markup-samples/sisu_manual +

move to the respective +directory and type e.g.:

sisu sisu_manual.ssm -

Sisu -Man Pages

- -

If SiSU is installed on your system usual man commands should -be available, try: -

man sisu -

Most SiSU man pages are generated directly -from sisu documents that are used to prepare the sisu manual, the sources -files for which are located within the SiSU tarball at: +

Sisu Man Pages

+ +

If SiSU is +installed on your system usual man commands should be available, try: +

+ man sisu +

Most SiSU man pages are generated directly from sisu documents +that are used to prepare the sisu manual, the sources files for which are +located within the SiSU tarball at:

./data/doc/sisu/markup-samples/sisu_manual

Once installed, directory equivalent to: @@ -1260,16 +1298,21 @@ first line indented, rest of paragraph no indent

in each case level may

be 0-9 -

live-build A collection of scripts used to build customized Debian
- Livesystems.
+

+

live-build A collection of scripts used to build customized
+ Debian +

Livesystems.
.I live-build
was formerly known as live-helper, and even earlier known as live-package.
-

live-build -

A collection of scripts used to build customized Debian
- Livesystems. live-build was formerly known as live-helper, and even earlier
- known as live-package.
+

+

live-build +

A collection of scripts used to build customized
+ Debian Livesystems.
+ live-build was formerly known as live-helper, and even earlier known as +live-package.
+

Footnotes / Endnotes

Footnotes and endnotes are marked up at the location @@ -2610,8 +2653,7 @@ be created manually and given the same name as working directory, as requested)

sisu -D --create
creates database tables where no database tables existed - -

before +before

sisu -D --Dropall
@@ -2715,8 +2757,7 @@ of the same name).
sisu -d --recreate
destroys existing database and builds - -

a new empty database structure +a new empty database structure

diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn.yml b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn.yml index 34d4a662..9bcc416e 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn.yml +++ b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_fn.yml @@ -96,6 +96,8 @@ db: #% output_dir_structure_by: language (language_and_filetype); filetype; or filename (original v1 & v2) output_dir_structure_by: filename +#% lingual: 'multi' | 'mono' (multi default) +#lingual: multi permission_set: zap: true diff --git a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft.yml b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft.yml index 57440498..bf34d249 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft.yml +++ b/data/doc/sisu/markup-samples/sisu_manual/_sisu/rc/sisurc_by_ft.yml @@ -96,6 +96,8 @@ db: #% output_dir_structure_by: language (language_and_filetype); filetype; or filename (original v1 & v2) output_dir_structure_by: filetype +#% lingual: 'multi' | 'mono' (multi default) +#lingual: multi permission_set: zap: true diff --git a/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst b/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst index 491c03fd..8e8926ad 100644 --- a/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst +++ b/data/doc/sisu/markup-samples/sisu_manual/sisu_commands.sst @@ -156,6 +156,13 @@ see --texinfo !_ -i [filename/wildcard] \\ see --manpage +!_ --i18n-* \\ +these flags affect output by filetype and filename): +--i18n-mono (--monolingual) output filenames without language code for default language ('en' or as set); +--i18n-multi (--multilingual) language code provided as part of the output filename, this is the default. +Where output is in one language only the language code may not be desired. +see also --output-by-* + !_ --inc-* \\ include output feature, overrides configuration settings, (usually the default if none set), has precedence over --exc-* (exclude output feature). Some detail provided under --exc-*, see --exc-* @@ -184,6 +191,12 @@ maintenance mode, interim processing files are preserved and their locations ind !_ --manpage [filename/wildcard] \\ produces man page of file, not suitable for all outputs. Alias -i +!_ --monolingual \\ +see --i18n-* + +!_ --multilingual \\ +see --i18n-* + !_ -N [filename/wildcard/url] \\ document digest or document content certificate ( DCC ) as md5 digest tree of the document: the digest for the document, and digests for each object contained within the document (together with information on software versions that produced it) (digest.txt). -NV for verbose digest output to screen. diff --git a/man/man1/sisu.1 b/man/man1/sisu.1 index 2bafb76b..8292187d 100644 --- a/man/man1/sisu.1 +++ b/man/man1/sisu.1 @@ -1,4 +1,4 @@ -.TH "sisu" "1" "2013-02-22" "4.0.9" "SiSU" +.TH "sisu" "1" "2013-07-25" "4.1.8" "SiSU" .br .SH NAME .br @@ -422,6 +422,13 @@ see --texinfo .B -i [filename/wildcard] see --manpage .TP +.B --i18n-* +these flags affect output by filetype and filename): --i18n-mono +(--monolingual) output filenames without language code for default language +('en' or as set); --i18n-multi (--multilingual) language code provided as part +of the output filename, this is the default. Where output is in one language +only the language code may not be desired. see also --output-by-* (v5) +.TP .B --inc-* include output feature, overrides configuration settings, (usually the default if none set), has precedence over --exc-* (exclude output feature). Some detail @@ -453,6 +460,12 @@ indicated. (also see -V). Aliases -M and --keep-processing-files. .B --manpage [filename/wildcard] produces man page of file, not suitable for all outputs. Alias -i .TP +.B --monolingual +see --i18n-* +.TP +.B --multilingual +see --i18n-* +.TP .B -N [filename/wildcard/url] document digest or document content certificate ( DCC ) as md5 digest tree of the document: the digest for the document, and digests for each object @@ -927,7 +940,7 @@ The most up to date information on sisu should be contained in the sisu_manual, available at: .BR - + .BR The manual can be generated from source, found respectively, either within the @@ -935,16 +948,16 @@ The manual can be generated from source, found respectively, either within the tarball or installed locally at: .BR - ./data/doc/sisu/markup-samples/sisu_manual +\./data/doc/sisu/markup-samples/sisu_manual .BR - /usr/share/doc/sisu/markup-samples/sisu_manual +/usr/share/doc/sisu/markup-samples/sisu_manual .BR move to the respective directory and type e.g.: .BR - sisu sisu_manual.ssm +sisu sisu_manual.ssm .SH SISU MAN PAGES @@ -954,7 +967,7 @@ If is installed on your system usual man commands should be available, try: .BR - man sisu +man sisu .BR Most @@ -1512,7 +1525,9 @@ in each case level may be 0-9 .BR .B live-build - A collection of scripts used to build customized Debian + A collection of scripts used to build customized +.B Debian + Livesystems. .I live-build was formerly known as live-helper, and even earlier known as live-package. @@ -1520,9 +1535,12 @@ in each case level may be 0-9 .BR .B live-build - A collection of scripts used to build customized Debian - Livesystems. live-build was formerly known as live-helper, and even earlier - known as live-package. + A collection of scripts used to build customized +.B Debian + Livesystems. +.I live-build + was formerly known as live-helper, and even earlier known as live-package. + .SH FOOTNOTES / ENDNOTES .BR @@ -1837,8 +1855,7 @@ information in each column .BR .B markup example: -[^18] - +[^17] .nf !_ Table 3.1: Contributors to Wikipedia, January 2001 - June 2005 -- cgit v1.2.3 From 9e8a84f55ed79c58b3309e7fef4ec7242fb4c5e2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 30 Jul 2013 21:38:47 -0400 Subject: v5: cgi helper script, sample search form, single form, monolingual option * single cgi form, (with different internal variables set for output types) * monolingual output search form option --- data/doc/sisu/CHANGELOG_v5 | 4 ++ lib/sisu/v5/cgi_pgsql.rb | 24 ++++----- lib/sisu/v5/cgi_sql_common.rb | 113 ++++++++++++++++++++++-------------------- lib/sisu/v5/cgi_sqlite.rb | 24 +++++---- lib/sisu/v5/sysenv.rb | 4 +- 5 files changed, 91 insertions(+), 78 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 9b092a5d..6ff63e39 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -47,6 +47,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.8.orig.tar.xz language document will not have a language code in the output filename * documentation +* cgi helper script, sample search form + * single cgi form, (with different internal variables set for output types) + * monolingual output search form option + %% 5.0.7.orig.tar.xz (2013-06-25:25/2) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.7 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.7-1 diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index bdb457f3..d44e8993 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -73,11 +73,14 @@ module SiSU_CGI_PgSQL get_init=SiSU_Env::GetInit.new @rc=get_init.sisu_yaml.rc @name_of={} - @name_of[:output_dir_structure]=if defined? @rc['output_dir_structure_by'] \ - and defined? @rc['output_dir_structure_by'] =~/(language|filetype|filename)/ - @rc['output_dir_structure_by'] + @name_of[:output_dir_structure]=if @opt.dir_structure_by.to_s =~/(?:language|filetype|filename)/ + @opt.dir_structure_by.to_s else 'language' end + @name_of[:lingual]=if @opt.lingual.to_s =~/(?:mono|multi)/ + @opt.lingual.to_s + else 'multi' + end if defined? @rc['search'] \ and defined? @rc['search']['sisu'] \ and defined? @rc['search']['sisu']['action'] \ @@ -93,8 +96,7 @@ module SiSU_CGI_PgSQL @name_of[:host_url_docs]=@env.url.webserv_files_from_db(@opt) @name_of[:cgi_script]=@env.url.cgi_sample_search_form_name(@opt) @name_of[:user]=@db.psql.user(@opt) - @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_pgsql.cgi" - @cgi_link_name=@name_of[:cgi_script] #sisu_pgsql.cgi, + @cgi_file_name=@name_of[:cgi_script] @image_src="#{@env.url.webserv_base_cgi(@opt)}/_sisu/image_sys" @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env) end @@ -161,24 +163,19 @@ module SiSU_CGI_PgSQL # if necessary make the directory '/usr/lib/cgi-bin' # here we copy the postgresql search form to cgi-bin # (copy #{@cgi_file_name} to your cgi directory) - # set file permissions to 755, & - # make symbolic link to #{@cgi_link_name} + # set file permissions to 755 WOK a=case @webserv when /pwd/; '' else <<-WOK sudo cp -vi #{Dir.pwd}/#{@cgi_file_name} /usr/lib/cgi-bin/.; \\ - cd /usr/lib/cgi-bin && \\ - sudo chmod -v 755 #{@cgi_file_name}; \\ - sudo rm -vi #{@cgi_link_name}; \\ - sudo ln -s #{@cgi_file_name} #{@cgi_link_name}; \\ - cd - + sudo chmod -v 755 /usr/lib/cgi-bin/#{@cgi_file_name} WOK end SiSU_Screen::Ansi.new(@opt.cmd,a).warn a=<<-WOK - #{@env.webserv_base_cgi(@opt)}/cgi-bin/#{@cgi_link_name} + #{@env.webserv_base_cgi(@opt)}/cgi-bin/#{@cgi_file_name} WOK SiSU_Screen::Ansi.new(@opt.cmd,a).print_blue a="\n\t(to create and populate postgresql database see 'man sisu' and in particular the --pg option)\n\t[the database to be used for this directory (#{@db.psql.db}) will have to be created manually if it does not exist,\n\tusing postgresql tools directly: 'createdb #{@db.psql.db}' for a list of existing databases try 'psql --list']" @@ -202,6 +199,7 @@ module SiSU_CGI_PgSQL @hosturl_cgi='#{@name_of[:host_url_cgi]}' @hosturl_files='#{@name_of[:host_url_docs]}' @output_dir_structure_by='#{@name_of[:output_dir_structure]}' + @lingual='#{@name_of[:lingual]}' @port='#{@db.psql.port}' @db_name_prefix='#{Db[:name_prefix]}' @user='#{@name_of[:user]}' # check user name for access to pg database: e.g. www-data or '#{@env.user}' diff --git a/lib/sisu/v5/cgi_sql_common.rb b/lib/sisu/v5/cgi_sql_common.rb index b551d6c8..0944ab61 100644 --- a/lib/sisu/v5/cgi_sql_common.rb +++ b/lib/sisu/v5/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' diff --git a/lib/sisu/v5/cgi_sqlite.rb b/lib/sisu/v5/cgi_sqlite.rb index e53497e1..62e50c72 100644 --- a/lib/sisu/v5/cgi_sqlite.rb +++ b/lib/sisu/v5/cgi_sqlite.rb @@ -69,8 +69,17 @@ module SiSU_CGI_SQLite @cX=SiSU_Screen::Ansi.new(opt.cmd).cX @env=SiSU_Env::InfoEnv.new('',opt) @image_src="#{@env.url.webserv_cgi(@opt)}/_sisu/image_sys" + @name_of={} + @name_of[:output_dir_structure]=if @opt.dir_structure_by.to_s =~/(?:language|filetype|filename)/ + @opt.dir_structure_by.to_s + else 'language' + end + @name_of[:lingual]=if @opt.lingual.to_s =~/(?:mono|multi)/ + @opt.lingual.to_s + else 'multi' + end @common=SiSU_CGI_SQL::CGI_Common.new(@webserv,@opt,@image_src,@env) - @cgi_file_name="#{Db[:name_prefix_db]}by_#{opt.dir_structure_by.to_s}_sqlite.cgi" + @cgi_file_name=@env.url.cgi_sample_search_form_name(@opt) @name_of_sqlite_db_file='sisu_sqlite.db' end def sqlite @@ -126,26 +135,21 @@ module SiSU_CGI_SQLite # if necessary make the directory '/usr/lib/cgi-bin' # here we copy the postgresql search form to cgi-bin # (copy #{@cgi_file_name} to your cgi directory) - # set file permissions to 755, & - # make symbolic link to #{@cgi_link_name} + # set file permissions to 755 WOK a=case @webserv when /pwd/; '' else <<-WOK sudo cp -vi #{Dir.pwd}/#{@cgi_file_name} /usr/lib/cgi-bin/.; \\ - cd /usr/lib/cgi-bin && \\ - sudo chmod -v 755 #{@cgi_file_name}; \\ - sudo rm -vi #{@env.url.cgi_sample_search_form_name(@opt)}; \\ - sudo ln -sf #{@cgi_file_name} #{@env.url.cgi_sample_search_form_name(@opt)}; \\ - cd - + sudo chmod -v 755 /usr/lib/cgi-bin/#{@cgi_file_name} WOK end b='(to create and populate sisu sqlite database see "man sisu" and in particular the -d flag)' SiSU_Screen::Ansi.new(@opt.cmd,a,b).warn a=<<-WOK - #{@env.webserv_base_cgi(@opt)}/cgi-bin/#{@cgi_link_name} + #{@env.webserv_base_cgi(@opt)}/cgi-bin/#{@cgi_file_name} WOK SiSU_Screen::Ansi.new(@opt.cmd,a).print_blue @@ -167,6 +171,8 @@ module SiSU_CGI_SQLite @image_src='#{@image_src}' @hosturl_cgi='#{@env.url.webserv_base_cgi(@opt)}/cgi-bin' @hosturl_files='#{@env.url.webserv_files_from_db(@opt)}' + @output_dir_structure_by='#{@name_of[:output_dir_structure]}' + @lingual='#{@name_of[:lingual]}' @db_name_prefix='#{Db[:name_prefix]}' @base='#{@env.url.webserv_base_cgi(@opt)}/cgi-bin/#{@env.url.cgi_sample_search_form_name(@opt)}' #fix sqlite WOK_SQL diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 63981be3..9ddc763e 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -2519,8 +2519,8 @@ WOK /(?:https?:\/\/\S+?)\/([^\/]+?\.cgi)$/.match(@rc['search']['sisu']['action'])[1] else (opt.mod.inspect =~/--db[=-]["']?sqlite/) \ - ? 'sisu_sqlite.cgi' \ - : 'sisu_pgsql.cgi' + ? "#{Db[:name_prefix_db]}sqlite.cgi" \ + : "#{Db[:name_prefix_db]}pgsql.cgi" end end def sample_search_form_title(organised_by=:language) -- cgit v1.2.3