From 2e1d0030e11b5b5a9b434baa9cf033e9066c842b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 12 Mar 2012 18:41:44 -0400 Subject: v3dv: lib, clean trailing whitespace --- lib/sisu/v3dv/dal_expand_insertions.rb | 8 ++++---- lib/sisu/v3dv/defaults.rb | 4 ++-- lib/sisu/v3dv/harvest.rb | 2 +- lib/sisu/v3dv/harvest_authors.rb | 4 ++-- lib/sisu/v3dv/harvest_topics.rb | 4 ++-- lib/sisu/v3dv/qrcode.rb | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3dv/dal_expand_insertions.rb b/lib/sisu/v3dv/dal_expand_insertions.rb index 9e675bc4..ef25fcdd 100644 --- a/lib/sisu/v3dv/dal_expand_insertions.rb +++ b/lib/sisu/v3dv/dal_expand_insertions.rb @@ -141,7 +141,7 @@ module SiSU_DAL_Insertions def xml_dom "#{@base_path}/xml/#{@linked_doc}.xml" end - def txt + def txt "#{@base_path}/txt/#{@linked_doc}.txt" end def digest @@ -241,7 +241,7 @@ module SiSU_DAL_Insertions def xml_dom "#{@base_path}/scroll.#{@lng}.dom.xml" end - def txt + def txt "#{@base_path}/plain.#{@lng}.txt" end def digest @@ -277,10 +277,10 @@ module SiSU_DAL_Insertions pre=pre.strip elsif /\{(?.+?)\s\[(?\d[sS]*)\]\}(?(?\S+?)\.ss[tm]\b)(?.*)/m =~ para end - if linked_doc =~ /(\S+?)\/(\S+)/ + if linked_doc =~ /(\S+?)\/(\S+)/ linked_doc,linked_doc_lang=$1,$2 else - linked_doc,linked_doc_lang=linked_doc,@md.opt.lng_base + linked_doc,linked_doc_lang=linked_doc,@md.opt.lng_base end else puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}" diff --git a/lib/sisu/v3dv/defaults.rb b/lib/sisu/v3dv/defaults.rb index eab42b71..e74ff83c 100644 --- a/lib/sisu/v3dv/defaults.rb +++ b/lib/sisu/v3dv/defaults.rb @@ -1890,7 +1890,7 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, P ---

- License, SiSU is licensed under + License, SiSU is licensed under GPLv3 or later @@ -2032,7 +2032,7 @@ as a developers tool it is flexible and extensible


-SiSU at <www.sisudoc.org> or <www.jus.uio.no/sisu/>

+SiSU at <www.sisudoc.org> or <www.jus.uio.no/sisu/>

diff --git a/lib/sisu/v3dv/harvest.rb b/lib/sisu/v3dv/harvest.rb index 6bd87777..71adb0f0 100644 --- a/lib/sisu/v3dv/harvest.rb +++ b/lib/sisu/v3dv/harvest.rb @@ -78,7 +78,7 @@ module SiSU_Harvest def help puts < Date: Mon, 12 Mar 2012 18:42:33 -0400 Subject: v3dv: texinfo, fix (break holding back 3.2 merge) * proposed next version starts 3.2, (merge dev branch after 3.1.15) --- lib/sisu/v3dv/texinfo.rb | 28 ++++++++--------- lib/sisu/v3dv/texinfo_format.rb | 69 ++++++++++++++++++----------------------- 2 files changed, 43 insertions(+), 54 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3dv/texinfo.rb b/lib/sisu/v3dv/texinfo.rb index 145712e1..2496ce7a 100644 --- a/lib/sisu/v3dv/texinfo.rb +++ b/lib/sisu/v3dv/texinfo.rb @@ -140,11 +140,10 @@ module SiSU_TexInfo data=@data data=pre(data) data=endnote(data) - data=markup(data) - objects=tail(data) - #output(objects) - output(@tex_file) - #output(data.compact) + data,head=markup(data) + objs_txt=tail(data) + doc_txt=[head,objs_txt] + output(doc_txt) makeinfo #KEEP reinstate when fixed #% place_info rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.opt.cmd,$!,$@).rescue @@ -340,14 +339,9 @@ module SiSU_TexInfo end #%case with endnotes dob.obj=dob.obj.gsub(/\s*[0-8]\\+(\S+)?\s+/,' ') if dob.obj - if dob.obj \ - && (dob.is !=:structure \ - && dob.is !=:comment) - @tex_file << dob.obj - end data_new << dob end - data_new + [data_new, @tex_file] end def number_titles data,data_new=@data,[] @@ -376,12 +370,16 @@ module SiSU_TexInfo end def tail(data) tex=SiSU_TexInfoFormat::Texinfo.new(@md) - objects=[] + objs_txt=[] data.each do |dob| - objects << dob.obj if dob.obj + if dob.obj \ + && (dob.is !=:structure \ + && dob.is !=:comment) + objs_txt << dob.obj if dob.obj + end end - objects << tex.dublincore << tex.tail - objects + objs_txt << tex.dublincore << tex.tail + objs_txt end def output(data) filename_texinfo=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo} diff --git a/lib/sisu/v3dv/texinfo_format.rb b/lib/sisu/v3dv/texinfo_format.rb index 0555809d..fa5390b6 100644 --- a/lib/sisu/v3dv/texinfo_format.rb +++ b/lib/sisu/v3dv/texinfo_format.rb @@ -261,43 +261,34 @@ WOK relation="Relation: #{relation}\n\n" if relation #dc coverage="Coverage: #{coverage}\n\n" if coverage #dc rights="Rights: #{rights}\n\n" if rights #dc - "@node Dublin Core\n" + - "@unnumbered Dublin Core\n" + - "@cindex chapter, Dublin Core\n\n" + - "#{full_title}" + - "#{author}" + - "#{subject}" + - "#{description}" + - "#{publisher}" + - "#{contributor}" + - "#{date}" + - "#{date_created}" + - "#{date_issued}" + - "#{date_available}" + - "#{date_valid}" + - "#{date_modified}" + - "#{format}" + - "#{identifier}" + - "#{source}" + - "#{language}" + - "#{relation}" + - "#{coverage}" + - "#{rights}" + - "\n\n" + </,'').strip + dob.obj=dob.obj.gsub(/\n/m,' '). + gsub(/<:#>/,''). + gsub(/,\s+/,' - '). + strip dob end def menu @@ -310,52 +301,52 @@ WOK def level1 dob=clean(@dob) nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') - dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n" + dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" dob end def level2 dob=clean(@dob) nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') - dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n" + dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" dob end def level3 dob=clean(@dob) nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') - dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n" + dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" dob end def level4 dob=clean(@dob) nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') - dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n" + dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" dob end def level5 dob=clean(@dob) nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') - dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n" + dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" dob end def level6 dob=clean(@dob) nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'') - dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n" + dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n" dob end def submenu @dob.obj=@dob.obj.join("\n") @dob.obj=@dob.obj.gsub(/[5]\\+~\S+/,'') dob=clean(@dob) - dob.obj="@menu\n#{dob.obj}\n@end menu\n\n" - dob.obj=dob.obj.gsub(/.+/m,"#{dob.obj}") + dob.obj="@menu\n#{dob.obj}\n@end menu\n\n". + gsub(/.+/m,"#{dob.obj}") end def subsubmenu @dob.obj=@dob.obj.join("\n") @dob.obj=@dob.obj.gsub(/[6]\\+~\S+/,'') dob=clean(@dob) - dob.obj="@menu\n#{dob.obj}\n@end menu\n\n" - dob.obj=dob.obj.gsub(/.+/m,"#{dob.obj}") + dob.obj="@menu\n#{dob.obj}\n@end menu\n\n". + gsub(/.+/m,"#{dob.obj}") end def indent1 @dob.obj=@dob.obj.gsub(/<:i1>(.*)/,'\1') -- cgit v1.2.3 From 4cdfa555d7e07d032bff270a962415b96c3b8741 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 12 Mar 2012 18:43:27 -0400 Subject: v3dv: sysenv, param, options, output control hooks code modified * for config file, document headers, & command line * requiring downstream code changes (in commit that follows) --- lib/sisu/v3dv/options.rb | 303 ++++++++++++++++------------ lib/sisu/v3dv/param.rb | 82 +++++++- lib/sisu/v3dv/sysenv.rb | 503 ++++++++++++++++++++++++++++++++--------------- 3 files changed, 597 insertions(+), 291 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3dv/options.rb b/lib/sisu/v3dv/options.rb index b2b7ff15..44eb1020 100644 --- a/lib/sisu/v3dv/options.rb +++ b/lib/sisu/v3dv/options.rb @@ -435,47 +435,47 @@ module SiSU_Commandline act={} act[:license]=(cmd =~/L/ \ || mod.inspect =~/"--license/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:site_init]=(cmd =~/C/ \ || mod.inspect =~/"--init-site/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:rc]=if mod.inspect =~/"--rc=/ x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'') - { bool: true, inst: x } + { bool: true, set: :on, inst: x } else - { bool: false, inst: '' } + { bool: false, set: :na, inst: '' } end act[:dump]=if mod.inspect =~/"--dump=/ base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, inst: base_pth } + { bool: true, set: :on, inst: base_pth } elsif mod.inspect =~/"--dump/ - { bool: true, inst: @base_path } + { bool: true, set: :on, inst: @base_path } else - { bool: false, inst: nil } + { bool: false, set: :na, inst: nil } end act[:redirect]=if mod.inspect =~/"--redirect=/ base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, inst: base_pth } + { bool: true, set: :on, inst: base_pth } elsif mod.inspect =~/"--redirect/ - { bool: true, inst: @base_path } + { bool: true, set: :on, inst: @base_path } else - { bool: false, inst: nil } + { bool: false, set: :na, inst: nil } end act[:verbose]=(cmd =~/v/ \ || mod.inspect =~/"--verbose"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:quiet]=(cmd =~/q/ \ || mod.inspect =~/"--quiet"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ - { bool: true } + { bool: true, set: :on } elsif mod.inspect =~/"--color-off"/ - { bool: false } - else { bool: true } #fix default color + { bool: false, set: :off } + else { bool: true, set: :na } #fix default color end # act[:color_toggle]=if cmd =~/c/ \ # or mod.inspect =~/"--color-toggle"/ @@ -484,202 +484,253 @@ module SiSU_Commandline # end act[:maintenance]=(cmd =~/M/ \ || mod.inspect =~/"--maintenance|--keep-processing-files"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:switch]=if mod.inspect =~/"--switch-off=/ off_list=mod.join(';').gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1') off_list=off_list.scan(/[^,;\s]+/) - { bool: false, off: off_list} - else { bool: true, off: [] } + { bool: false, set: :off, off: off_list} + else { bool: true, set: :na, off: [] } end - act[:ocn]=if mod.inspect =~/"--no-ocn"/ \ + act[:ocn]= + if mod.inspect =~/"--inc-ocn"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-ocn"/ \ || act[:switch][:off].inspect =~/"ocn"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:toc]=if mod.inspect =~/"--no-toc"/ \ + act[:toc]=if mod.inspect =~/"--inc-toc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-toc"/ \ || act[:switch][:off].inspect =~/"toc"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:manifest]=if mod.inspect =~/"--no-manifest"/ \ + act[:minitoc]=if mod.inspect =~/"--inc-minitoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-minitoc"/ \ + || act[:switch][:off].inspect =~/"minitoc"/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:manifest]=if mod.inspect =~/"--inc-manifest"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \ || act[:switch][:off].inspect =~/"manifest"/ - #|| mod.inspect =~/"--(?:redirect|dump)/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:manifest_links]=if mod.inspect =~/"--no-manifest-links"/ \ - || act[:switch][:off].inspect =~/"manifest_links"/ \ + act[:links_to_manifest]=if mod.inspect =~/"--inc-links-to-manifest"|"--inc-manifest-links"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \ + || act[:switch][:off].inspect =~/"links_to_manifest"|"manifest_links"/ \ || mod.inspect =~/"--(?:redirect|dump)/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:manifest_minitoc]=if mod.inspect =~/"--no-manifest-minitoc"/ \ + act[:manifest_minitoc]=if mod.inspect =~/"--inc-manifest-minitoc"|"--inc-minitoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-manifest-minitoc"|"--(?:exc|no)-minitoc"/ \ || act[:switch][:off].inspect =~/"manifest_minitoc"|"minitoc"/ #|| mod.inspect =~/"--(?:redirect|dump)/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:metadata]=if mod.inspect =~/"--no-metadata"/ \ + act[:metadata]=if mod.inspect =~/"--inc-metadata"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-metadata"/ \ || act[:switch][:off].inspect =~/"metadata"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_minitoc]=if mod.inspect =~/"--no-html-minitoc"/ \ + act[:html_minitoc]=if mod.inspect =~/"--inc-html-minitoc"|"--inc-minitoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-minitoc"|"--(?:exc|no)-minitoc"/ \ || act[:switch][:off].inspect =~/"html_minitoc"|"minitoc"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_navigation]=if mod.inspect =~/"--no-html-navigation"/ \ + act[:html_navigation]=if mod.inspect =~/"--inc-html-navigation"|"--inc-navigation"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-navigation"|"--(?:exc|no)-navigation"/ \ || act[:switch][:off].inspect =~/"html_navigation"|"nav"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_navigation_bar]=if mod.inspect =~/"--no-html-navigation-bar"/ \ + act[:html_navigation_bar]=if mod.inspect =~/"--inc-html-navigation-bar"|"--inc-navigation-bar"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \ || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:segsubtoc]=if mod.inspect =~/"--inc-segsubtoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-segsubtoc"/ \ + || act[:switch][:off].inspect =~/"segsubtoc"/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:search_form]=if mod.inspect =~/"--inc-search-form"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-search-form"/ \ + || act[:switch][:off].inspect =~/"search_form"|"search"/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:html_search_form]=if mod.inspect =~/"--inc-html-search-form"|"--inc-search-form"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-search-form"|"--(?:exc|no)-search-form"/ \ + || act[:switch][:off].inspect =~/"html_search_form"|"search_form"|"search"/ + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_search_form]=if mod.inspect =~/"--no-html-search-form"/ \ - || act[:switch][:off].inspect =~/"html_search_form"|"search"/ - { bool: false } - else { bool: true } + act[:html_right_pane]=if mod.inspect =~/"--inc-html-right-pane"|"--inc-right-pane"|"--inc-html-right-column"|"--inc-right-column"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-right-pane"|"--(?:exc|no)-right-pane"|"--(?:exc|no)-html-right-column"|"--(?:exc|no)-right-column"/ \ + || act[:switch][:off].inspect =~/"html_right_pane"|"html_right_column"|"promo"/ + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_right_column]=if mod.inspect =~/"--no-html-right-column"/ \ - || act[:switch][:off].inspect =~/"html_right_column"|"promo"/ - { bool: false } - else { bool: true } + act[:html_top_band]=if mod.inspect =~/"--inc-html-top-band"|"--inc-top-band"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-top-band"|"--(?:exc|no)-top-band"/ \ + || act[:switch][:off].inspect =~/"html-top-band"|"top-band"/ + { bool: false, set: :off } + else { bool: true, set: :na } end act[:dal]=(cmd =~/m/ \ || mod.inspect =~/"--dal"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:html]=(cmd =~/h/ \ || mod.inspect =~/"--html"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:concordance]=(cmd =~/w/ \ || mod.inspect =~/"--concordance"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:images]=(cmd =~/j/ \ || mod.inspect =~/"--images"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:pdf]=(cmd =~/p/ \ || mod.inspect =~/"--pdf"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:epub]=(cmd =~/e/ \ || mod.inspect =~/"--epub"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:odt]=(cmd =~/o/ \ || mod.inspect =~/"--odf"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:xml_sax]=(cmd =~/x/ \ || mod.inspect =~/"--xml-sax"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:xml_dom]=(cmd =~/X/ \ || mod.inspect =~/"--xml-dom"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:xhtml]=(cmd =~/b/ \ || mod.inspect =~/"--xhtml"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:txt]=(cmd =~/[at]/ \ || mod.inspect =~/"--txt"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:manpage]=(cmd =~/i/ \ || mod.inspect =~/"--manpage"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:texinfo]=(cmd =~/I/ \ || mod.inspect =~/"--texinfo"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:fictionbook]=(cmd =~/f/ \ || mod.inspect =~/"--fictionbook"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:psql]=(cmd =~/D/ \ || mod.inspect =~/"--pg"|"--pgsql"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sqlite]=(cmd =~/d/ \ || mod.inspect =~/"--sqlite"/) \ - ? { bool: true } - : { bool: false } + && (mod.inspect =~/"--createdb"|"--create"|"--recreate"|"--dropall"|"--recreate"|"--import"|"--update"|"--remove"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:harvest]=(mod.inspect =~/"--harvest"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:po4a]=(cmd =~/P/ \ || mod.inspect =~/"--po4a"|"--pot?"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:git]=(cmd =~/g/ \ || mod.inspect =~/"--git"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:hash_digests]=(cmd =~/N/ \ || mod.inspect =~/"--hash-digests"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sample_search_form]=(cmd =~/F/ \ || mod.inspect =~/"--sample-search-form"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:webrick]=(cmd =~/W/ \ || mod.inspect =~/"--webrick"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:share_source]=(cmd =~/s/ \ || mod.inspect =~/"--source"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sisupod]=(cmd =~/S/ \ || mod.inspect =~/"--sisupod"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:scp]=(cmd =~/r/ \ || mod.inspect =~/"--scp"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:rsync]=(cmd =~/R/ \ || mod.inspect =~/"--rsync"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:delete_output]=(cmd =~/z/ \ || mod.inspect =~/"--delete"|"--zap"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:urls_all]=(cmd =~/U/ \ || mod.inspect =~/"--urls-all"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:urls_seleted]=(cmd =~/u/ \ || mod.inspect =~/"--urls"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sitemap]=(cmd =~/Y/ \ || mod.inspect =~/"--sitemap"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:qrcode]=(cmd =~/Q/ \ || mod.inspect =~/"--qrcode"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:manifest]=(cmd =~/y/ \ || mod.inspect =~/"--manifest"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:help]=(mod.inspect =~/"--help/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } @act=act end def cmd diff --git a/lib/sisu/v3dv/param.rb b/lib/sisu/v3dv/param.rb index 8d3379b7..5563f780 100644 --- a/lib/sisu/v3dv/param.rb +++ b/lib/sisu/v3dv/param.rb @@ -811,8 +811,88 @@ module SiSU_Param else nil end end - def omit_list + def omit m=@h['omit'] + @m=m ? (m.split(/,\s+/)) : nil + def list + @m + end + self + end + def ocn? + (omit.list.inspect =~/"ocn"/) \ + ? :off + : :na + end + def toc? + (omit.list.inspect =~/"toc"/) \ + ? :off + : :na + end + def manifest? + (omit.list.inspect =~/"manifest"/) \ + ? :off + : :na + end + def links_to_manifest? + (omit.list.inspect =~/"manifest_links"|"links_to_manifest"/) \ + ? :off + : :na + end + def metadata? + (omit.list.inspect =~/"metadata"/) \ + ? :off + : :na + end + def minitoc? + (omit.list.inspect =~/"minitoc"/) \ + ? :off + : :na + end + def html_minitoc? + (omit.list.inspect =~/"html_minitoc"/) \ + ? :off + : :na + end + def html_top_band? + (omit.list.inspect =~/"html_top_band"/) \ + ? :off + : :na + end + def html_navigation? + (omit.list.inspect =~/"html_navigation"/) \ + ? :off + : :na + end + def html_navigation_bar? + (omit.list.inspect =~/"html_navigation_bar"/) \ + ? :off + : :na + end + def segsubtoc? + (omit.list.inspect =~/"segsubtoc"/) \ + ? :off + : :na + end + def search_form? + (omit.list.inspect =~/"search_form"/) \ + ? :off + : :na + end + def html_search_form? + (omit.list.inspect =~/"html_search_form"/) \ + ? :off + : :na + end + def html_right_pane? + (omit.list.inspect =~/"html_right_column"|"html_right_pane"/) \ + ? :off + : :na + end + def manifest_minitoc? + (omit.list.inspect =~/"manifest_minitoc"/) \ + ? :off + : :na end def texpdf_font def main diff --git a/lib/sisu/v3dv/sysenv.rb b/lib/sisu/v3dv/sysenv.rb index fcfc234b..95ebf6d9 100644 --- a/lib/sisu/v3dv/sysenv.rb +++ b/lib/sisu/v3dv/sysenv.rb @@ -435,27 +435,27 @@ module SiSU_Env end def dump? ((by?) ==:dump) \ - ? true \ + ? true : false end def redirect? ((by?) ==:redirect) \ - ? true \ + ? true : false end def by_language_code? ((by?) ==:language) \ - ? true \ + ? true : false end def by_filetype? ((by?) ==:filetype) \ - ? true \ + ? true : false end def by_filename? ((by?) ==:filename) \ - ? true \ + ? true : false end def multilingual? @@ -804,9 +804,10 @@ module SiSU_Env end def makeinfo #texinfo program='makeinfo' + options='' #'--force' #'' program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/" (program_found?(program)) \ - ? system("#{program} #{@input}\n") + ? system("#{program} #{options} #{@input}\n") : (puts "\tWARN: #{program} is not installed #{program_ref}") end def scp @@ -1192,13 +1193,6 @@ module SiSU_Env else false end end - def manifest_minitoc? - flag=if defined? @rc['manifest']['minitoc'] \ - and not @rc['manifest']['minitoc'].nil? - @rc['manifest']['minitoc'] - else false - end - end def manifest_minitoc? flag=if (defined? @rc['manifest']['minitoc'] \ and not @rc['manifest']['minitoc'].nil?) @@ -1222,7 +1216,7 @@ module SiSU_Env listed=if omit_list x=(omit_list.scan(/\b#{test}\b/)).join test==x \ - ? true \ + ? true : false else false @@ -1230,48 +1224,67 @@ module SiSU_Env listed end def ocn? - flag=if (defined? @rc['omit']['ocn'] \ + if (defined? @rc['omit']['ocn'] \ and not @rc['omit']['ocn'].nil?) \ or listed?('ocn') - false + :off else - true + :na end end def toc? - flag=if (defined? @rc['omit']['toc'] \ + if (defined? @rc['omit']['toc'] \ and not @rc['omit']['toc'].nil?) \ or listed?('toc') - false + :off else - true + :na end end def manifest? - flag=if (defined? @rc['omit']['manifest'] \ + if (defined? @rc['omit']['manifest'] \ and not @rc['omit']['manifest'].nil?) \ or listed?('manifest') - false + :off else - true + :na end end - def manifest_links? - flag=if (defined? @rc['omit']['manifest_links'] \ - and not @rc['omit']['manifest_links'].nil?) \ - or listed?('manifest_links') - false + def links_to_manifest? + flag=if (defined? @rc['omit']['links_to_manifest'] \ + and not @rc['omit']['links_to_manifest'].nil?) \ + or (listed?('links_to_manifest') \ + || listed?('manifest_links')) + :off else - true + :na + end + end + def metadata? + if (defined? @rc['omit']['metadata'] \ + and not @rc['omit']['metadata'].nil?) \ + or listed?('metadata') + :off + else + :na + end + end + def minitoc? + flag=if (defined? @rc['omit']['minitoc'] \ + and not @rc['omit']['minitoc'].nil?) \ + or (listed?('minitoc')) + :off + else + :na end end def manifest_minitoc? flag=if (defined? @rc['omit']['manifest_minitoc'] \ and not @rc['omit']['manifest_minitoc'].nil?) \ or listed?('manifest_minitoc') - false + :off else - true + :na end end def html_minitoc? @@ -1279,45 +1292,72 @@ module SiSU_Env and not @rc['omit']['html_minitoc'].nil?) \ or (listed?('html_minitoc') \ || listed?('minitoc')) - false + :off else - true + :na end end def html_navigation? flag=if (defined? @rc['omit']['html_navigation'] \ and not @rc['omit']['html_navigation'].nil?) \ or listed?('html_navigation') - false + :off else - true + :na end end def html_navigation_bar? flag=if (defined? @rc['omit']['html_navigation_bar'] \ and not @rc['omit']['html_navigation_bar'].nil?) \ or listed?('html_navigation_bar') - false + :off else - true + :na end end - def html_search_form? - flag=if (defined? @rc['omit']['html_search_form'] \ - and not @rc['omit']['html_search_form'].nil?) \ - or listed?('html_search_form') - false + def segsubtoc? + flag=if (defined? @rc['omit']['segsubtoc'] \ + and not @rc['omit']['segsubtoc'].nil?) \ + or listed?('segsubtoc') + :off else - true + :na end end - def html_right_column? - flag=if (defined? @rc['omit']['html_right_column'] \ - and not @rc['omit']['html_right_column'].nil?) \ - or listed?('html_right_column') - false + def html_right_pane? + flag=if (defined? @rc['omit']['html_right_pane'] \ + and not @rc['omit']['html_right_pane'].nil?) \ + or listed?('html_right_pane') + :off else - true + :na + end + end + def html_top_band? + flag=if (defined? @rc['omit']['html_top_band'] \ + and not @rc['omit']['html_top_band'].nil?) \ + or listed?('html_top_band') + :off + else + :na + end + end + def search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line + flag=if (defined? @rc['omit']['search_form'] \ + and not @rc['omit']['search_form'].nil?) \ + or listed?('search_form') + :off + else + :na + end + end + def html_search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line + flag=if (defined? @rc['omit']['html_search_form'] \ + and not @rc['omit']['html_search_form'].nil?) \ + or listed?('html_search_form') + :off + else + :na end end self @@ -3467,41 +3507,274 @@ WOK end end end - class OutputStructure + class ProcessingSettings def initialize(md) @md=md - @env=SiSU_Env::InfoEnv.new(@md.fns) + end + def cnf_rc #sisurc.yml + @rc=SiSU_Env::GetInit.instance.sisu_yaml.rc + end + def env_rc #env rc (including sisurc.yml) + @env_rc ||=SiSU_Env::InfoEnv.new(@md.fns) + end + def doc_rc #document rc, make instructions + @md.make + end + def cmd_rc #command-line rc + @cmd_rc=@md.opt.opt_act + end + def build + def ocn? + if cmd_rc[:ocn][:set]==:on + true + elsif cmd_rc[:ocn][:set]==:off + false + elsif @md.make.ocn? ==:off + false + elsif env_rc.build.ocn? ==:off + false + else + true + end + end + def toc? + if cmd_rc[:toc][:set]==:on + true + elsif cmd_rc[:toc][:set]==:off + false + elsif @md.make.toc? ==:off + false + elsif env_rc.build.toc? ==:off + false + else + true + end + end + def manifest? + if cmd_rc[:manifest][:set]==:on + true + elsif cmd_rc[:manifest][:set]==:off + false + elsif @md.make.manifest? ==:off + false + elsif env_rc.build.manifest? ==:off + false + else + true + end + end + def links_to_manifest? + if cmd_rc[:links_to_manifest][:set]==:on + true + elsif cmd_rc[:links_to_manifest][:set]==:off + false + elsif @md.make.links_to_manifest? ==:off + false + elsif env_rc.build.links_to_manifest? ==:off + false + else + true + end + end + def metadata? + if cmd_rc[:metadata][:set]==:on + true + elsif cmd_rc[:metadata][:set]==:off + false + elsif @md.make.metadata? ==:off + false + elsif env_rc.build.metadata? ==:off + false + else + true + end + end + def minitoc? + if html_top_band? == false #one form of navigation necessary + true + elsif cmd_rc[:minitoc][:set]==:on + true + elsif cmd_rc[:minitoc][:set]==:off + false + elsif @md.make.minitoc? ==:off + false + elsif env_rc.build.minitoc? ==:off + false + else + true + end + end + 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 + true + elsif cmd_rc[:manifest_minitoc][:set]==:off \ + || cmd_rc[:minitoc][:set]==:off + false + elsif @md.make.manifest_minitoc? ==:off \ + || @md.make.minitoc? ==:off + false + elsif env_rc.build.manifest_minitoc? ==:off \ + || env_rc.build.minitoc? ==:off + false + elsif minitoc? == false + false + else + true + end + end + 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 + true + elsif cmd_rc[:html_minitoc][:set]==:off \ + || cmd_rc[:minitoc][:set]==:off + false + elsif @md.make.html_minitoc? ==:off \ + || @md.make.minitoc? ==:off + false + elsif env_rc.build.html_minitoc? ==:off \ + || env_rc.build.minitoc? ==:off + false + elsif minitoc? == false + false + else + true + end + end + def html_top_band? + if cmd_rc[:html_top_band][:set]==:on + true + elsif cmd_rc[:html_top_band][:set]==:off + false + elsif @md.make.html_top_band? ==:off + false + elsif env_rc.build.html_top_band? ==:off + false + else + true + end + end + def html_navigation? + if cmd_rc[:html_navigation][:set]==:on + true + elsif cmd_rc[:html_navigation][:set]==:off + false + elsif @md.make.html_navigation? ==:off + false + elsif env_rc.build.html_navigation? ==:off + false + else + true + end + end + def html_navigation_bar? + if cmd_rc[:html_navigation_bar][:set]==:on + true + elsif cmd_rc[:html_navigation_bar][:set]==:off + false + elsif @md.make.html_navigation_bar? ==:off + false + elsif env_rc.build.html_navigation_bar? ==:off + false + else + true + end + end + def search_form? + if cmd_rc[:search_form][:set]==:on + true + elsif cmd_rc[:search_form][:set]==:off + false + elsif @md.make.search_form? ==:off + false + elsif env_rc.build.search_form? ==:off + false + else + true + end + end + def html_search_form? + if cmd_rc[:html_search_form][:set]==:on \ + || cmd_rc[:search_form][:set]==:on + true + elsif cmd_rc[:html_search_form][:set]==:off \ + || cmd_rc[:search_form][:set]==:off + false + elsif @md.make.html_search_form? ==:off \ + || @md.make.search_form? ==:off + false + elsif env_rc.build.html_search_form? ==:off \ + || env_rc.build.search_form? ==:off + false + elsif search_form? == false + false + else + true + end + end + def html_right_pane? + if cmd_rc[:html_right_pane][:set]==:on + true + elsif cmd_rc[:html_right_pane][:set]==:off + false + elsif @md.make.html_right_pane? ==:off + false + elsif env_rc.build.html_right_pane? ==:off + false + else + true + end + end + def segsubtoc? + if cmd_rc[:segsubtoc][:set]==:on + true + elsif cmd_rc[:segsubtoc][:set]==:off + false + elsif @md.make.segsubtoc? ==:off + false + elsif env_rc.build.segsubtoc? ==:off + false + else + true + end + end + self end def output_dir_structure def by_language_code? - @env.output_dir_structure.by_language_code? + env_rc.output_dir_structure.by_language_code? end def by_filetype? - @env.output_dir_structure.by_filetype? + env_rc.output_dir_structure.by_filetype? end def by_filename? - @env.output_dir_structure.by_filename? + env_rc.output_dir_structure.by_filename? end def multilingual? by_language_code? end def dump? - ((@md.opt.opt_act[:dump][:bool] \ - && @md.opt.opt_act[:dump][:inst]) \ - || (@env.output_dir_structure.dump?)) \ - ? true \ + ((cmd_rc[:dump][:bool] \ + && cmd_rc[:dump][:inst]) \ + || (env_rc.output_dir_structure.dump?)) \ + ? true : false end def redirect? - ((@md.opt.opt_act[:redirect][:bool] \ - && @md.opt.opt_act[:redirect][:inst]) \ - || (@env.output_dir_structure.redirect?)) \ - ? true \ + ((cmd_rc[:redirect][:bool] \ + && cmd_rc[:redirect][:inst]) \ + || (env_rc.output_dir_structure.redirect?)) \ + ? true : false end def dump_or_redirect? ((dump?) || (redirect?)) \ - ? true \ + ? true : false end def by? @@ -3532,7 +3805,7 @@ WOK end end def output_dir_structure - OutputStructure.new(@md).output_dir_structure + ProcessingSettings.new(@md).output_dir_structure end def mkdir_initialize # not used but consider using FileUtils::mkdir_p(output_path.base.dir) unless FileTest.directory?(output_path.base.dir) @@ -3585,7 +3858,7 @@ WOK def html_seg_index pth=((by_filename?) \ || (output_dir_structure.dump?)) \ - ? "#{output_path.html.dir}" \ + ? "#{output_path.html.dir}" : "#{output_path.html.dir}/#{@md.fnb}" fn=base_filename.html_seg_index make_path(pth) @@ -3595,7 +3868,7 @@ WOK def html_segtoc pth=((by_filename?) \ || (output_dir_structure.dump?)) \ - ? "#{output_path.html.dir}" \ + ? "#{output_path.html.dir}" : "#{output_path.html.dir}/#{@md.fnb}" fn=base_filename.html_segtoc make_path(pth) @@ -4949,104 +5222,6 @@ WOK self end end - class InfoSet # Date: Mon, 12 Mar 2012 18:45:04 -0400 Subject: v3dv: start using output control hooks * for config file, document headers, & command line * v3dv: sysenv, ProcessingSettings, start to use hooks to make it possible to control (via: the command line; the document markup header, or; the configuration file) the likes of: ocn, toc, segsubtoc, minitoc, links-to-manifest, search-form, html-navigation, html-navigation-bar, html-right-pane, html-top-band; these are switched on by default and may be switched off in omit lists within configuration file, the document markup header, or command line. The command line takes precedence & may switch on or off overriding settings within the document markup header or the sisu configuration file. * --inc- on by default, but if switched off in doc header or configuration, the command line --inc- has precedence; for each possible exclude configuration the --inc- switch that overrides configuration settings * --exc- == --no-; exclude/switch off feature (but --inc- include has precedence) * document header @build: :omit: [list output features to be omitted] * configuration (sisurc.yml) omit: exclude output feature, overrides configuration settings (omit --dev development branch modifier once merged back to main) --exc-ocn, html (seg, scroll), epub, xml, pdf sisu --dev --exc-ocn --html --epub --xml-sax --xml-dom --xhtml -v \ filename.sst --exc-toc, html (scroll), epub, pdf sisu --dev --exc-toc --html --epub --pdf -v filename.sst --exc-segsubtoc html (seg), epub sisu --dev --exc-segsubtoc --html --epub -v filename.sst --exc-minitoc, html (seg), concordance, manifest sisu --dev --exc-minitoc --html --concordance -v filename.sst --exc-manifest-minitoc, manifest sisu --dev --exc-manifest-minitoc --html -v filename.sst --exc-links_to_manifest, --exc-manifest-links, html (seg, scroll) sisu --dev --exc-manifest-links --html -v filename.sst --exc-search-form, html (seg, scroll), manifest sisu --dev --exc-search-form --html -v filename.sst --exc-html-minitoc, html (seg), concordance sisu --dev --exc-html-minitoc --html --concordance -v filename.sst --exc-html-navigation, html (seg, scroll)? sisu --dev --exc-html-navigation --html -v filename.sst --exc-html-navigation-bar, html (seg) sisu --dev --exc-html-navigation-bar --html -v filename.sst --exc-html-search-form, html (seg, scroll) sisu --dev --exc-html-search-form --html -v filename.sst --exc-html-right-pane, html (seg, scroll) sisu --dev --exc-html-right-pane --html -v filename.sst --exc-html-top-band, html (seg, scroll), concordance (minitoc is forced on to provide seg navigation) sisu --dev --exc-html-top-band --html --concordance -v filename.sst --- lib/sisu/v3dv/concordance.rb | 17 ++++- lib/sisu/v3dv/css.rb | 16 ++--- lib/sisu/v3dv/epub.rb | 58 +++++++---------- lib/sisu/v3dv/epub_format.rb | 142 ++++------------------------------------- lib/sisu/v3dv/epub_segments.rb | 20 +++--- lib/sisu/v3dv/html.rb | 8 ++- lib/sisu/v3dv/html_format.rb | 91 ++++++++++++-------------- lib/sisu/v3dv/html_promo.rb | 21 ++++-- lib/sisu/v3dv/html_segments.rb | 63 +++++++++++++----- lib/sisu/v3dv/manifest.rb | 22 +++++-- lib/sisu/v3dv/shared_images.rb | 7 +- lib/sisu/v3dv/texpdf.rb | 37 +++++------ lib/sisu/v3dv/texpdf_format.rb | 6 +- lib/sisu/v3dv/xml_format.rb | 31 ++++----- 14 files changed, 228 insertions(+), 311 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3dv/concordance.rb b/lib/sisu/v3dv/concordance.rb index 7ec234bc..3d8ab38a 100644 --- a/lib/sisu/v3dv/concordance.rb +++ b/lib/sisu/v3dv/concordance.rb @@ -122,7 +122,18 @@ WOK head_banner=SiSU_HTML_Format::HeadToc.new(@md) minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,@data).songsheet.join("\n") stylesheet=SiSU_Style::CSS_HeadInfo.new(@md).stylesheet - toc='

' + minitoc + '
' + make=SiSU_Env::ProcessingSettings.new(@md) + if make.build.manifest_minitoc? + toc='
' + minitoc + '
' + div_class='content' + else + toc='' + div_class='content0' + end + top_band=if make.build.html_top_band? + head_banner.concordance_navigation_band('pdf') + else '' + end < @@ -141,9 +152,9 @@ WOK #{@vz.js_top} - #{head_banner.concordance_navigation_band('pdf')} + #{top_band} #{toc} -
+
#{@doc_details}

Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.
[For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]

(The word listing/index is Case sensitive: Capitalized words appear before lower case)

diff --git a/lib/sisu/v3dv/css.rb b/lib/sisu/v3dv/css.rb index cdcd16cd..cbbd05ca 100644 --- a/lib/sisu/v3dv/css.rb +++ b/lib/sisu/v3dv/css.rb @@ -64,7 +64,7 @@ module SiSU_Style @md,@ft=md,ft @env=SiSU_Env::InfoEnv.new('',md) @fn_css ||=SiSU_Env::CSS_Default.new - @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure + @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure css_copy end def stylesheet @@ -107,12 +107,12 @@ module SiSU_Style end def css_head (css_embed?) \ - ? css_action\ + ? css_action : "#{css_path.html}#{css_path.html_seg}" end def css_head_seg (css_embed?) \ - ? css_action \ + ? css_action : css_path.html_seg end def css_head_xml @@ -1534,12 +1534,12 @@ WOK padding-left: 1em; padding-right: 1em; } -/* - div.content { - margin-left: 1em; - margin-right: 1em; + div.content0, div.main_column0 { + margin: 0; + padding: 0; + border-left: 0% solid #ffffff; + padding-left: 5%; } -*/ div.scroll { margin: 0; padding: 0; diff --git a/lib/sisu/v3dv/epub.rb b/lib/sisu/v3dv/epub.rb index 7d90883b..e9aeb4de 100644 --- a/lib/sisu/v3dv/epub.rb +++ b/lib/sisu/v3dv/epub.rb @@ -192,6 +192,7 @@ module SiSU_EPUB @vz=SiSU_Env::GetInit.instance.skin @epub=SiSU_EPUB_Format::HeadInformation.new(@md) @tell=SiSU_Screen::Ansi.new(@md.opt.cmd) if @md + @make=SiSU_Env::ProcessingSettings.new(@md) end def songsheet #extracts toc for scroll & seg SiSU_Screen::Ansi.new(@md.opt.cmd,'Toc').txt_grey if @md.opt.cmd =~/[MVv]/ @@ -211,8 +212,10 @@ module SiSU_EPUB @@toc[:seg] << %{
\n
} @@toc[:scr] << %{
\n
} md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc - md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc - md_opf_a_guide << @epub.metadata_opf.guide_sisu_toc + if @make.build.toc? + md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc + md_opf_a_guide << @epub.metadata_opf.guide_sisu_toc + end @ncxo=[nil,false,false,false,false,false,false] @dob_toc2,@dob_toc3=nil,nil @ncx_cls=[] @@ -234,7 +237,8 @@ module SiSU_EPUB @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4]=true,false,false,false @epub.sections(dob_toc,name_s_a) @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_a) if dob_toc - if @level_a_first_occurrence + if @level_a_first_occurrence \ + && @make.build.toc? @nav_no+=1 @@toc[:ncx] << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc @level_a_first_occurrence=false @@ -298,7 +302,6 @@ module SiSU_EPUB begin @@toc[:seg] << toc[:seg] @@toc[:scr] << toc[:seg] - @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini] rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error end end @@ -323,10 +326,6 @@ module SiSU_EPUB @md.firstseg=@@firstseg @@toc end - def minitoc - minitoc=@@toc[:seg_mini].join("\n") - '
' + minitoc + '
' - end protected def level_1 dob=@data @@ -348,14 +347,6 @@ module SiSU_EPUB format_toc.lev0 else format_toc.lev1 end - toc[:seg_mini]=if dob.name =~/^meta/ \ - and dob.obj =~/Document Information/ #check - x=if @md.concord_make - format_toc.mini_concord_tail - else format_toc.mini_tail - end - else format_toc.mini_lev1 - end title=if dob.ocn ==0 if dob.name =~/^meta/ \ and dob.obj =~/Document Information/ @@ -389,7 +380,6 @@ module SiSU_EPUB format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev2 - toc[:seg_mini]=format_toc.mini_lev2 if p_num title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } @@ -409,7 +399,6 @@ module SiSU_EPUB format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev3 - toc[:seg_mini]=format_toc.mini_lev3 if p_num title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } @@ -437,7 +426,6 @@ module SiSU_EPUB format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev4 - toc[:seg_mini]=format_toc.mini_lev4 title=%{#{p_num.goto}#{linkname}} if p_num txt_obj={ txt: title } format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) @@ -457,7 +445,6 @@ module SiSU_EPUB txt_obj={ txt: lnk_n_txt } format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:seg]=format_toc.lev5 - toc[:seg_mini]=format_toc.mini_lev5 title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) @@ -478,7 +465,6 @@ module SiSU_EPUB txt_obj={ txt: lnk_n_txt } format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) toc[:seg]=format_toc.lev6 - toc[:seg_mini]=format_toc.mini_lev6 title=%{#{p_num.goto}#{linkname}} txt_obj={ txt: title } format_toc=SiSU_EPUB_Format::FormatToc.new(@md,txt_obj) @@ -582,7 +568,8 @@ module SiSU_EPUB @md,@output=md,output @epub_doc="#{@md.fnb}.epub" @epub_header=SiSU_EPUB_Format::HeadInformation.new(@md) - @make=SiSU_Env::CreateFile.new(@md.fns) + @make=SiSU_Env::ProcessingSettings.new(@md) + @make_file=SiSU_Env::CreateFile.new(@md.fns) end def songsheet mimetype @@ -593,23 +580,23 @@ module SiSU_EPUB output_zip end def mimetype - out=@make.epub.mimetype + out=@make_file.epub.mimetype out<<@epub_header.mimetype out.close end def metainf_container #container.xml file in META-INF directory - out=@make.epub.metainf_cont + out=@make_file.epub.metainf_cont out<<@epub_header.metainf_container out.close end def css - out=@make.epub.xhtml_css + out=@make_file.epub.xhtml_css out << SiSU_EPUB_Format::CSS.new.css_epub_xhtml out.close end def epub_toc_ncx begin - out=@make.epub.toc_ncx + out=@make_file.epub.toc_ncx @output.each do |para| unless para =~/\A\s*\Z/ out.puts para @@ -621,7 +608,7 @@ module SiSU_EPUB end def epub_metadata_opf begin - out=@make.epub.metadata + out=@make_file.epub.metadata @output.each do |para| unless para =~/\A\s*\Z/ out.puts para @@ -663,17 +650,16 @@ module SiSU_EPUB end def segtoc begin - filename_html_segtoc=@make.epub.xhtml_segtoc - filename_html_index=@make.epub.xhtml_index - @output.each do |para| - para=para.strip - unless para =~/\A\s*\Z/ - filename_html_segtoc.puts para,"\n" - filename_html_index.puts para,"\n" + if @make.build.toc? + filename_html_index=@make_file.epub.xhtml_index + @output.each do |para| + para=para.strip + unless para =~/\A\s*\Z/ + filename_html_index.puts para,"\n" + end end + filename_html_index.close end - filename_html_segtoc.close - filename_html_index.close rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error end end diff --git a/lib/sisu/v3dv/epub_format.rb b/lib/sisu/v3dv/epub_format.rb index f88b6745..e11f5d3d 100644 --- a/lib/sisu/v3dv/epub_format.rb +++ b/lib/sisu/v3dv/epub_format.rb @@ -63,26 +63,22 @@ module SiSU_EPUB_Format @md,@ocn=md,ocn.to_s @ocn ||='' vz=SiSU_Env::GetInit.instance.skin - @skin_no_ocn=if defined? vz.ocn_display_off \ - and vz.ocn_display_off==true - true - else false - end end def ocn_display - if @md.markup.inspect =~/no_ocn/ \ - or @md.opt.mod.inspect =~/--no-ocn/ \ - or @skin_no_ocn - ocn_class='ocn_off' - @ocn.gsub(/^(\d+|)$/, - %{}) - elsif @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{}) - else + @make=SiSU_Env::ProcessingSettings.new(@md) + if @make.build.ocn? ocn_class='ocn' + if @ocn.to_i==0 + @ocn.gsub(/^(\d+|)$/, + %{}) + else + @ocn.gsub(/^(\d+|)$/, + %{}) + end + else + ocn_class='ocn_off' @ocn.gsub(/^(\d+|)$/, - %{}) + %{}) end end def name @@ -1198,36 +1194,6 @@ module SiSU_EPUB_Format background-color: #f9f9aa; } - .minitoc { - font-weight: normal; - margin-top: 2px; - margin-bottom: 2px; - } - h1.minitoc, h2.minitoc, h3.minitoc { - margin-left: 0em; - font-weight: bold; - text-align: left; - font-size: 90%; - margin-top: 4px; - margin-bottom: 4px; - } - h4.minitoc { - margin-left: 0em; - font-size: 90%; - } - h5.minitoc { - margin-left: 1em; - font-size: 85%; - } - h6.minitoc { - margin-left: 2em; - font-size: 85%; - } - h0.minitoc { - margin-left: 0em; - font-size: 90%; - } - h1.c, h2.c, h3.c, h4.c, h5.c, h6.c, p.c { text-align: center } @@ -2123,52 +2089,6 @@ WOK def initialize(md,txt) super(md,txt) end - def navigation_toc_lev1_advert - %{#{@banner.home_button}\n -

-#{@txt} -#{@two} -

} - end - def navigation_toc_lev1 - %{#{@banner.nav_toc}} - end - def navigation_toc_lev2 #change bold use css - %{ - -
- - - #{@txt} - -

-#{@vz.table_close}} - end - def navigation_toc_lev3 #change bold use css - %{ - -
- - - #{@txt} - -

-#{@vz.table_close}} - end - def navigation_toc_lev4 - %{ - - WOK - else '' - end - %{
- -

- #{@txt} -

-#{@vz.table_close}} - end - def navigation_toc_lev5 - end - def navigation_toc_lev6 - end def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408 fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info %{ @@ -2298,44 +2218,6 @@ WOK def lev0 #docinfo lev('h0','toc') end - def mini_lev1 - lev('h1','minitoc') - end - def mini_lev2 - lev('h2','minitoc') - end - def mini_lev3 - lev('h3','minitoc') - end - def mini_lev4 - lev('h4','minitoc') - end - def mini_lev5 - lev('h5','minitoc') - end - def mini_lev6 - lev('h6','minitoc') - end - def mini_lev0 #docinfo - lev('h0','minitoc') - end - def mini_tail - %{ -

- Manifest (alternative outputs) -

-} - end - def mini_concord_tail - %{ -

- Concordance (wordlist) -

-

- Manifest (alternative outputs) -

-} - end end end __END__ diff --git a/lib/sisu/v3dv/epub_segments.rb b/lib/sisu/v3dv/epub_segments.rb index 96abfdc0..262fde3c 100644 --- a/lib/sisu/v3dv/epub_segments.rb +++ b/lib/sisu/v3dv/epub_segments.rb @@ -61,8 +61,8 @@ module SiSU_EPUB_Seg require_relative 'epub' # epub.rb require_relative 'shared_metadata' # shared_metadata.rb class Output - def initialize(md,outputfile,seg,minitoc,type='') - @md,@output_epub_cont_seg,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type + def initialize(md,outputfile,seg,type='') + @md,@output_epub_cont_seg,@seg,@type=md,outputfile,seg,type end def output #CONSIDER if @seg[:title] =~/\S/ @@ -132,10 +132,10 @@ WOK @vz=SiSU_Env::GetInit.instance.skin @seg_name_xhtml=@@seg_name_xhtml || nil @seg_name_xhtml_tracker=@@tracker || nil + @make=SiSU_Env::ProcessingSettings.new(@md) if @md end def songsheet begin - @minitoc=SiSU_EPUB::Source::Toc.new(@md,@data).minitoc data=get_subtoc_endnotes(@data) data=articles(data) SiSU_EPUB_Seg::Seg.new.cleanup # (((( added )))) @@ -231,15 +231,15 @@ WOK output_epub_cont_seg=File.new(segfilename,'w') if @@seg_name_xhtml[tracking-1] if dob.is==:heading \ or @@seg_name_xhtml[tracking-1] !~/endnotes|book_index|metadata/ - SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc).output + SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg).output elsif dob.is==:heading_insert if @@seg_name_xhtml[tracking-1]=='endnotes' - SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'endnotes').output + SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'endnotes').output elsif @@seg_name_xhtml[tracking-1]=='book_index' - SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'idx').output + SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'idx').output @@seg[:idx]=[] elsif @@seg_name_xhtml[tracking-1]=='metadata' # navigation bug FIX - SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'metadata').output + SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'metadata').output else puts "#{__FILE__}::#{__LINE__}" end else puts "#{__FILE__}::#{__LINE__}" @@ -250,7 +250,7 @@ WOK if @@seg_name_xhtml[tracking] =='metadata' segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{Sfx[:epub_xhtml]}" output_epub_cont_seg=File.new(segfilename,'w') - SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'metadata').output + SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,'metadata').output SiSU_EPUB_Seg::Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX end #@output_epub_cont_seg.close #%(((( EOF )))) --> @@ -411,7 +411,9 @@ WOK and dob.ln==4 @@seg[:main] << %{\n
\n} @@seg[:main] << dob_xhtml - @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc + if @make.build.segsubtoc? + @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc + end else @@seg[:main] << dob_xhtml end diff --git a/lib/sisu/v3dv/html.rb b/lib/sisu/v3dv/html.rb index 75d89382..fee51f2c 100644 --- a/lib/sisu/v3dv/html.rb +++ b/lib/sisu/v3dv/html.rb @@ -510,6 +510,7 @@ WOK def initialize(md='',toc='',links_guide_toc='') @md,@toc,@links_guide_toc=md,toc,links_guide_toc @vz=SiSU_Env::GetInit.instance.skin + @make=SiSU_Env::ProcessingSettings.new(@md) end def in_common toc_shared=[] @@ -566,8 +567,9 @@ WOK if defined? @md.prefix_b toc_shared << prefix_b end - #Table of Contents added/appended here - toc_shared << @toc[:scr] + scr_toc=if @make.build.toc? #Table of Contents added/appended here + toc_shared << @toc[:scr] + end @segtoc << @links_guide_toc @segtoc << @toc[:seg] if defined? @md.rights.all \ @@ -608,7 +610,7 @@ WOK def initialize(data='',md='') @data,@md=data,md @file=SiSU_Env::FileOp.new(md) - @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure + @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure end def scroll begin diff --git a/lib/sisu/v3dv/html_format.rb b/lib/sisu/v3dv/html_format.rb index d8b44760..56360455 100644 --- a/lib/sisu/v3dv/html_format.rb +++ b/lib/sisu/v3dv/html_format.rb @@ -62,27 +62,22 @@ module SiSU_HTML_Format def initialize(md,ocn) @md,@ocn=md,ocn.to_s @ocn ||='' - vz=SiSU_Env::GetInit.instance.skin - @skin_no_ocn=if defined? vz.ocn_display_off \ - and vz.ocn_display_off==true - true - else false - end end def ocn_display - if @md.markup.inspect =~/no_ocn/ \ - or @md.opt.mod.inspect =~/--no-ocn/ \ - or @skin_no_ocn + @make=SiSU_Env::ProcessingSettings.new(@md) + if @make.build.ocn? + ocn_class='ocn' + if @ocn.to_i==0 + @ocn.gsub(/^(\d+|)$/, + %{}) + else + @ocn.gsub(/^(\d+|)$/, + %{}) + end + else ocn_class='ocn_off' @ocn.gsub(/^(\d+|)$/, %{}) - elsif @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{}) - else - ocn_class='ocn' - @ocn.gsub(/^(\d+|)$/, - %{}) end end def name @@ -109,7 +104,7 @@ module SiSU_HTML_Format @metalink='#metadata' @tocband_scroll,@tocband_segtoc=nil,nil @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet - @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure + @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure @index='index' @toc="#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}" end @@ -206,7 +201,8 @@ module SiSU_HTML_Format @cf_defaults=SiSU_Env::InfoProcessingFlag.new @env=SiSU_Env::InfoEnv.new(md.fns) @file=SiSU_Env::FileOp.new(md) - @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure + @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure + @make=SiSU_Env::ProcessingSettings.new(@md) end def home %{
@@ -234,11 +230,15 @@ module SiSU_HTML_Format } end def search - env=SiSU_Env::InfoEnv.new(@md.fns,@md) - env.widget.search_form('sisusearch',nil,nil,true) + if @make.build.html_search_form? + env=SiSU_Env::InfoEnv.new(@md.fns,@md) + env.widget.search_form('sisusearch',nil,nil,true) + else '' + end end def manifest - if not @o_str.dump_or_redirect? + if @make.build.links_to_manifest? \ + and not @o_str.dump_or_redirect? manifest_lnk=if @file.output_dir_structure.by_language_code? \ or @file.output_dir_structure.by_filetype? "#{Xx[:html_relative1]}manifest/#{@file.base_filename.manifest}" @@ -321,28 +321,30 @@ module SiSU_HTML_Format def initialize(md) super(md) @md=md - @o_str ||=SiSU_Env::OutputStructure.new(md).output_dir_structure + @o_str ||=SiSU_Env::ProcessingSettings.new(md).output_dir_structure + @make=SiSU_Env::ProcessingSettings.new(@md) end def scroll_head_navigation_band - pdf=if @md.programs[:pdf] - < - #{make_seg_scroll_pdf} + #{make_scroll_search_form_and_manifest_link}
+ %{
#{pdf} +#{search_and_manifest}
#{@vz.banner_band} -   #{@vz.table_close}

} + else '' + end end def concordance_navigation_band(type='') - %{ + if @make.build.html_top_band? + %{
@@ -352,6 +354,8 @@ WOK   #{@vz.table_close}

} + else '' + end end def seg_head_navigation_band(type='') firstseg=%{ @@ -367,25 +371,6 @@ WOK

#{@vz.banner_band}  #{firstseg}  #{@vz.table_close} -

} - end - def seg_head_navigation_band_bottom(type='') #retired 2.7.9 - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{ - #{png_nav.nxt} - } if @md.firstseg =~/\S+/ - %{ - - -" + else '' + end banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ \ and vz.banner_home_button_only !~ /sisu\.home\.png/ < - +#{search_form}
-   - - #{@tocband_segtoc} - -  #{firstseg}  -#{@vz.table_close}

} end def manifest_link(text) @@ -404,7 +389,7 @@ WOK else '' end end - def make_seg_scroll_pdf + def make_scroll_search_form_and_manifest_link wgt=SiSU_HTML_Format::Widget.new(@md) scroll=%{

#{@vz.nav_txt_doc_link} @@ -992,6 +977,7 @@ WOK end @p_num=ParagraphNumber.new(@md,@ocn) @vz=SiSU_Env::GetInit.instance.skin + @make=SiSU_Env::ProcessingSettings.new(@md) end def nametags_scroll(dob) tags='' @@ -1134,8 +1120,11 @@ WOK heading_normal('h6','norm') end def title_heading(tag,attrib) + cl=(@make.build.html_minitoc?) \ + ? 'content' + : 'content0' %{ -
+
<#{tag} class="#{attrib}"> #{@named}#{@txt} diff --git a/lib/sisu/v3dv/html_promo.rb b/lib/sisu/v3dv/html_promo.rb index 7617b52c..f53211e9 100644 --- a/lib/sisu/v3dv/html_promo.rb +++ b/lib/sisu/v3dv/html_promo.rb @@ -67,22 +67,33 @@ module SiSU_HTML_Promo @ad=SiSU_Env::GetInit.instance.ads @vz=SiSU_Env::GetInit.instance.skin @flag=@env.widget.promo? + @make=SiSU_Env::ProcessingSettings.new(@md) end def div def major - @flag[:ad] ? '
' : '' + (@make.build.html_right_pane? \ + && @flag[:ad]) \ + ? '
' + : '' end def minor - @flag[:ad] ? '
' : '' + (@make.build.html_right_pane? \ + && @flag[:ad]) \ + ? '
' + : '' end def close - @flag[:ad] ? '
' : '' + (@make.build.html_right_pane? \ + && @flag[:ad]) \ + ? '
' + : '' end self end - def display #(type=nil,id=nil) + def display ads_array,promo_array=[],[] - if @flag[:ad] + if @make.build.html_right_pane? \ + && @flag[:ad] ads=if @md.promo && @md.promo.length > 0 #promo set in document promo_array=@md.promo elsif @flag[:sk] #promo set in associated skin diff --git a/lib/sisu/v3dv/html_segments.rb b/lib/sisu/v3dv/html_segments.rb index b20d2271..b1dbf73f 100644 --- a/lib/sisu/v3dv/html_segments.rb +++ b/lib/sisu/v3dv/html_segments.rb @@ -66,11 +66,19 @@ module SiSU_HTML_Seg @md,@output_seg_file,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type @title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner? @file=SiSU_Env::FileOp.new(@md) + @make=SiSU_Env::ProcessingSettings.new(@md) + @cl=(@make.build.html_minitoc?) \ + ? 'content' + : 'content0' end def output if @seg[:title] =~/\S/ filename_seg=[] - filename_seg << @seg[:title] << @seg[:tocband_banner] + if @make.build.html_top_band? + filename_seg << @seg[:title] << @seg[:tocband_banner] + else + filename_seg << @seg[:title] + end if @type=='endnotes' @seg[:headings]=[] format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md) @@ -80,7 +88,7 @@ module SiSU_HTML_Seg txt_obj={ txt: 'Endnotes', ocn_display: '' } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 - filename_seg << @seg[:heading_endnotes] << @minitoc << @seg[:headings] << %{\n
\n} << @seg[:endnote_all] << '
' # << '
' + filename_seg << @seg[:heading_endnotes] << @minitoc << @seg[:headings] << %{\n
\n} << @seg[:endnote_all] << '
' # << '
' elsif @type=='idx' @seg[:headings]=[] format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md) @@ -90,7 +98,7 @@ module SiSU_HTML_Seg txt_obj={ txt: 'Index', ocn_display: '' } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 - filename_seg << @seg[:heading_idx] << @minitoc << @seg[:headings] << %{\n
\n} << @seg[:idx] << '
' # << '
' + filename_seg << @seg[:heading_idx] << @minitoc << @seg[:headings] << %{\n
\n} << @seg[:idx] << '
' # << '
' elsif @type=='metadata' metadata=SiSU_Metadata::Summary.new(@md).xhtml_display.metadata @seg[:headings]=[] @@ -101,11 +109,19 @@ module SiSU_HTML_Seg txt_obj={ txt: 'Metadata', ocn_display: '' } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 - filename_seg << @seg[:heading_idx] << @minitoc << @seg[:headings] << %{\n
\n} << metadata << '
' # << '' + filename_seg << @seg[:heading_idx] << @minitoc << @seg[:headings] << %{\n
\n} << metadata << '
' # << '' + else + if @make.build.html_top_band? + filename_seg << @minitoc << @seg[:headings] << @seg[:main] << "\n\n" + else + filename_seg << @minitoc << @seg[:main] << "\n\n" + end + end + filename_seg <<=if @make.build.html_top_band? + @seg[:tail] << @seg[:tocband_bannerless] << @seg[:credits] else - filename_seg << @minitoc << @seg[:headings] << @seg[:main] << "\n\n" + @seg[:tail] << @seg[:credits] end - filename_seg << @seg[:tail] << @seg[:tocband_bannerless] << @seg[:credits] filename_seg=filename_seg.flatten.compact #watch filename_seg.each do |str| unless str =~/\A\s*\Z/ @@ -138,7 +154,13 @@ module SiSU_HTML_Seg @seg_name_html=@@seg_name_html || nil @seg_name_html_tracker=@@tracker || nil @env=SiSU_Env::InfoEnv.new(@md.fns) if @md - @make=SiSU_Env::InfoSet.new(@md) if @md + if @md + @make=SiSU_Env::ProcessingSettings.new(@md) + @cl=(@make.build.html_minitoc?) \ + ? 'content' + : 'content0' + else @cl='content' + end if @md @title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner? end @@ -245,7 +267,7 @@ module SiSU_HTML_Seg SiSU_HTML_Seg::Seg.new(@md).tail segfilename="#{@file.output_path.html_seg.dir}/#{@@seg_name_html[tracking-1]}#{@md.lang_code_insert}#{Sfx[:html]}" output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] - minitoc=(@make.html_minitoc?) \ + minitoc=(@make.build.html_minitoc?) \ ? @minitoc : '' if dob.is==:heading \ @@ -306,12 +328,19 @@ module SiSU_HTML_Seg end def heading_art(dob) format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md) - if (dob.is==:heading \ - || dob.is==:heading_insert) \ - && (dob.ln.to_s =~/^[1-6]/) - if @@tracker < @@seg_total-1; @@seg[:dot_nav]=format_head_seg.dot_control_pre_next - else @@seg[:dot_nav]=format_head_seg.dot_control_pre + @@seg[:dot_nav]=if (@make.build.html_navigation?) \ + && (@make.build.html_navigation_bar?) + x=if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && (dob.ln.to_s =~/^[1-6]/) + x=if @@tracker < @@seg_total-1 + format_head_seg.dot_control_pre_next + else + format_head_seg.dot_control_pre + end + else @@seg[:dot_nav] end + else @@seg[:dot_nav]='' end ads=SiSU_HTML_Promo::Ad.new(@md) @@seg[:title]=format_head_seg.head_seg << ads.div.major @@ -458,9 +487,11 @@ module SiSU_HTML_Seg if (dob.is==:heading \ || dob.is==:heading_insert) \ && dob.ln==4 - @@seg[:main] << %{\n
\n} + @@seg[:main] << %{\n
\n} @@seg[:main] << dob_html - @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc + if @make.build.segsubtoc? + @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc + end else @@seg[:main] << dob_html #unless @@flag_alt==true end @@ -469,7 +500,7 @@ module SiSU_HTML_Seg def tail format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md) if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn] - @@seg[:tail] << %{\n
\n
\n} + @@seg[:tail] << %{\n
\n
\n} if @@seg_endnotes[@@get_hash_fn].flatten.length > 0 @@seg[:tail] << format_head_seg.endnote_mark @@seg[:tail] << @@seg_endnotes[@@get_hash_fn].flatten #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES| diff --git a/lib/sisu/v3dv/manifest.rb b/lib/sisu/v3dv/manifest.rb index 19fdc65c..0eb580b3 100644 --- a/lib/sisu/v3dv/manifest.rb +++ b/lib/sisu/v3dv/manifest.rb @@ -103,10 +103,11 @@ module SiSU_Manifest @manifest={ txt: [], html: [] } @md,@fns=md,md.fns @env=SiSU_Env::InfoEnv.new(@md.fns) + @make=SiSU_Env::ProcessingSettings.new(@md) @fnb=@md.fnb @base_url="#{@env.url.root}/#{@fnb}" @f=SiSU_Env::FileOp.new(@md) - @o_str=SiSU_Env::OutputStructure.new(md).output_dir_structure + @o_str=SiSU_Env::ProcessingSettings.new(md).output_dir_structure @image_path=if @o_str.dump_or_redirect? %{./image} else @@ -395,6 +396,13 @@ module SiSU_Manifest id,file='Manpage',@f.base_filename.manpage summarize(id,file,pth,rel,url) end + if FileTest.file?(@f.place_file.sqlite_discreet.dir)==true + id,file='SQLite3 file',@f.base_filename.sqlite_discreet + pth=@f.output_path.sqlite_discreet.dir + rel=@f.output_path.sqlite_discreet.rel_sm + url=@f.output_path.sqlite_discreet.url + summarize(id,file,pth,rel,url) + end if FileTest.file?(@f.place_file.txt.dir)==true if @md.opt.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)' elsif @md.opt.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)' @@ -439,7 +447,7 @@ module SiSU_Manifest def qrc_image fn=@md.fnb pth=(@o_str.dump_or_redirect?) \ - ? '.' \ + ? '.' : 'qrcode' img_md="#{pth}/#{fn}.md.png" img_title="#{pth}/#{fn}.title.png" @@ -758,13 +766,17 @@ WOK minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n") id,file='','' vz=SiSU_Env::GetInit.instance.skin + search_form=if @make.build.search_form? + "
#{@env.widget_static.search_form}
#{vz.banner_band}

#{@brace_url.xml_open}#{@base_url}/#{file}#{@brace_url.xml_close}

#{@env.widget_static.search_form}
WOK else @@ -772,7 +784,7 @@ WOK - +#{search_form}
SiSU -->

#{@brace_url.xml_open}#{@base_url}/#{file}#{@brace_url.xml_close}

#{@env.widget_static.search_form}
WOK end @@ -793,7 +805,7 @@ SiSU manifest: #{@md.title.full} #{banner_table} WOK - if @env.manifest_minitoc? + if @make.build.manifest_minitoc? if @o_str.dump_or_redirect? elsif @env.output_dir_structure.by_language_code? \ or @env.output_dir_structure.by_filetype? diff --git a/lib/sisu/v3dv/shared_images.rb b/lib/sisu/v3dv/shared_images.rb index a61fdd38..1d398213 100644 --- a/lib/sisu/v3dv/shared_images.rb +++ b/lib/sisu/v3dv/shared_images.rb @@ -56,6 +56,7 @@ ** Description: common file for xml generation =end module SiSU_Images + require_relative 'particulars' # particulars.rb class Source def initialize(opt) @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) @@ -68,7 +69,7 @@ module SiSU_Images @particulars=particulars @md=@particulars.md @env=@particulars.env - @o_str ||=SiSU_Env::OutputStructure.new(@md).output_dir_structure + @o_str ||=SiSU_Env::ProcessingSettings.new(@md).output_dir_structure end def songsheet images_set.select_sisu_base @@ -97,11 +98,11 @@ module SiSU_Images def dest_path(image_type) pth=if image_type==:image_sys pth=(@o_str.dump_or_redirect?) \ - ? "#{@md.file.output_path.html.dir}/image" \ + ? "#{@md.file.output_path.html.dir}/image" : "#{@env.path.webserv}/_sisu/image_sys" elsif image_type==:image pth=(@o_str.dump_or_redirect?) \ - ? "#{@md.file.output_path.html.dir}/image" \ + ? "#{@md.file.output_path.html.dir}/image" : "#{@env.path.webserv}/_sisu/image" end end diff --git a/lib/sisu/v3dv/texpdf.rb b/lib/sisu/v3dv/texpdf.rb index c69f7b9c..f0fb6b99 100644 --- a/lib/sisu/v3dv/texpdf.rb +++ b/lib/sisu/v3dv/texpdf.rb @@ -285,16 +285,11 @@ module SiSU_TeX @vz=SiSU_Env::GetInit.instance.skin @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern @brace_url=SiSU_Viz::Skin.new.url_decoration - vz=SiSU_Env::GetInit.instance.skin l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language @language=l[:n] @translate=SiSU_Translate::Source.new(@md,@language) - @skin_no_ocn=if defined? vz.ocn_display_off \ - and vz.ocn_display_off==true - true - else false - end @codeblock_box='listings' #alternative 'boites' + @make ||=SiSU_Env::ProcessingSettings.new(@md) end def songsheet begin @@ -324,12 +319,6 @@ module SiSU_TeX if @md.flag_tables #WORK ON 2009 data=tables(data) #uncomment to start experimenting with tables end - ocn=if @md.markup.inspect =~/no_ocn/ \ - or @md.opt.mod.inspect =~/--no-ocn/ \ - or @skin_no_ocn - false - else true - end data=number_paras(data) data=markup(data) output(data) @@ -741,12 +730,20 @@ WOK @tex_file << @@prefix_b if defined? @md.creator.prefix_b and @md.creator.prefix_b end x={} - x[:l] =< 0 # insert tags "hypertargets" @@ -827,6 +819,7 @@ WOK # end #end "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{dob.ocn}}#{tags}\\end{tiny}}}" #ocn object citation numbering + else '' end dob.tmp = paranumber_display + dob.tmp end diff --git a/lib/sisu/v3dv/texpdf_format.rb b/lib/sisu/v3dv/texpdf_format.rb index fdcdc3d1..ae277ec6 100644 --- a/lib/sisu/v3dv/texpdf_format.rb +++ b/lib/sisu/v3dv/texpdf_format.rb @@ -104,9 +104,13 @@ module SiSU_TeX_Pdf @brace_rel=SiSU_Viz::Skin.new.rel_decoration @env ||=SiSU_Env::InfoEnv.new(@md.fns) @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine + @make ||=SiSU_Env::ProcessingSettings.new(@md) end def ocn_display(dob) - "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{dob.ocn}}\\end{tiny}}}" #ocn object citation numbering + show_ocn=(@make.build.ocn?) \ + ? dob.ocn + : '' + "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{show_ocn}}\\end{tiny}}}" #ocn object citation numbering end def table_special_characters(r) r=r.gsub(/#{Mx[:tc_p]}|$/u,'&'). diff --git a/lib/sisu/v3dv/xml_format.rb b/lib/sisu/v3dv/xml_format.rb index 0b1e9eef..b40efc18 100644 --- a/lib/sisu/v3dv/xml_format.rb +++ b/lib/sisu/v3dv/xml_format.rb @@ -331,29 +331,22 @@ WOK def initialize(md,ocn) @md,@ocn=md,ocn.to_s @ocn ||='' - vz=SiSU_Env::GetInit.instance.skin - @skin_no_ocn=if not ocn - true - elsif defined? vz.ocn_display_off \ - and vz.ocn_display_off==true - true - else false - end end def ocn_display - if @md.markup.inspect =~/no_ocn/ \ - or @md.opt.mod.inspect =~/--no-ocn/ \ - or @skin_no_ocn - ocn_class='ocn_off' - @ocn.gsub(/^(\d+|)$/, - %{}) - elsif @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{}) - else + @make=SiSU_Env::ProcessingSettings.new(@md) + if @make.build.ocn? ocn_class='ocn' + if @ocn.to_i==0 + @ocn.gsub(/^(\d+|)$/, + %{}) + else + @ocn.gsub(/^(\d+|)$/, + %{}) + end + else + ocn_class='ocn_off' @ocn.gsub(/^(\d+|)$/, - %{}) + %{}) end end def name -- cgit v1.2.3 From 86b767b0f9a5aeac4708e48231d2010215b35e2b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 12 Mar 2012 18:49:49 -0400 Subject: v3dv: sqlite3 discreet .sql.db file for each document (possibility added) * in addition to existing possibility of a shared db in sqlite3 or postgresql --- lib/sisu/v3dv/db_create.rb | 4 +- lib/sisu/v3dv/db_dbi.rb | 12 +- lib/sisu/v3dv/db_drop.rb | 2 +- lib/sisu/v3dv/db_select.rb | 50 ++++---- lib/sisu/v3dv/dbi.rb | 2 +- lib/sisu/v3dv/dbi_discreet.rb | 158 ++++++++++++++++++++++++ lib/sisu/v3dv/hub.rb | 8 +- lib/sisu/v3dv/options.rb | 6 + lib/sisu/v3dv/sysenv.rb | 276 ++++++++++++++++++++++++++---------------- lib/sisu/v3dv/urls.rb | 2 +- 10 files changed, 377 insertions(+), 143 deletions(-) create mode 100644 lib/sisu/v3dv/dbi_discreet.rb (limited to 'lib') diff --git a/lib/sisu/v3dv/db_create.rb b/lib/sisu/v3dv/db_create.rb index 6420c3ec..627f0ea5 100644 --- a/lib/sisu/v3dv/db_create.rb +++ b/lib/sisu/v3dv/db_create.rb @@ -81,9 +81,9 @@ module SiSU_DbCreate def create_db @env=SiSU_Env::InfoEnv.new(@opt.fns) tell=(@sql_type=='sqlite') \ - ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create Sqlite db tables in:',%{"#{@env.path.output}/sisu_sqlite.db"}) + ? SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create Sqlite db tables in:',%{"#{@file}"}) : SiSU_Screen::Ansi.new(@opt.cmd,'invert','Create PG db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) - tell.colorize if @opt.cmd =~/vVM/ + tell.colorize if @opt.cmd =~/[vVM]/ SiSU_Env::SystemCall.new.create_pg_db(@env.path.stub_pwd) if @sql_type=='pg' #watch use of path.stub_pwd instead of stub end def output_dir? diff --git a/lib/sisu/v3dv/db_dbi.rb b/lib/sisu/v3dv/db_dbi.rb index f15b2456..0c19578f 100644 --- a/lib/sisu/v3dv/db_dbi.rb +++ b/lib/sisu/v3dv/db_dbi.rb @@ -69,17 +69,17 @@ module SiSU_DbDBI require_relative 'db_import' # db_import.rb class ColumnSize < SiSU_DbColumns::ColumnSize # db_columns.rb end - class Test < SiSU_DbTests::Test # db_tests.rb + class Test < SiSU_DbTests::Test # db_tests.rb end - class Create . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: postgresql module, dbi import frame + +=end +module SiSU_DBI_Discreet #% database building + require_relative 'help' # help.rb + require_relative 'sysenv' # sysenv.rb + include SiSU_Env; include SiSU_Screen + require_relative 'param' # param.rb + include SiSU_Param + require_relative 'db_dbi' # db_dbi.rb + include SiSU_DbDBI + require_relative 'shared_html_lite' # shared_html_lite.rb + include SiSU_FormatShared + require 'fileutils' + include FileUtils::Verbose + class SQL + def initialize(opt) + SiSU_Env::Load.new('dbi',true).prog + @opt=opt + @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) + @md=@particulars.md + if @opt.cmd =~/[d]/ \ + or @opt.mod.inspect =~/--((?:sq)?lite)/ + @sql_type='sqlite' + maintenance_check(@opt,__FILE__,__LINE__) if @opt.cmd.inspect =~/M/ + end + @output_path=@md.file.output_path.sqlite_discreet.dir + @filename=@md.file.base_filename.sqlite_discreet + @file="#{@output_path}/#{@filename}" + end + def build + prepare + create_and_populate + end + def maintenance_check(opt,file,line) + p opt.mod + p opt.cmd + p "at #{file} #{line}" + end + def prepare + if not FileTest.directory?(@output_path) + FileUtils::mkdir_p(@output_path) + elsif @file + FileUtils::rm_rf(@file) + end + end + def db_exist?(db,conn) + msg=%{no connection with sqlite database established, createdb "#{db.sqlite.db}"?} + if (not (FileTest.file?(db.sqlite.db)) \ + or FileTest.zero?(db.sqlite.db)) + puts msg + exit + end + if conn.class==NilClass + puts msg + exit + end + end + def create_and_populate + db=SiSU_Env::DbOp.new(@md) + conn=db.sqlite_discreet.conn_sqlite3 + sdb=SiSU_DbDBI::Create.new(@opt,conn,@file,'sqlite') + sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@file,'sqlite') + sdb.output_dir? + begin + sdb.create_db + sdb.create_table.metadata_and_text + sdb.create_table.doc_objects + sdb.create_table.endnotes + sdb.create_table.endnotes_asterisk + sdb.create_table.endnotes_plus + sdb.create_table.urls + sdb_index.create_indexes + db_exist?(db,conn) + sdb_import=SiSU_DbDBI::Import.new(@opt,conn,@file,'sqlite') + sdb_import.marshal_load + tell=SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{db.sqlite.db} database?") + tell.puts_grey if @opt.cmd =~/v/ + rescue; SiSU_Errors::InfoError.new($!,$@,'-d').error; sdb.output_dir? + end + end + def read_sqlite + begin + @conn=@db.sqlite.conn_sqlite3 + rescue + ensure + end + end + def connect + begin + sql_type='sqlite' + SiSU_Screen::Ansi.new(@opt.cmd,"DBI (#{@sql_type}) #{@opt.mod}",@opt.fns).dbi_title unless @opt.cmd =~/q/ + @db.sqlite_discreet.conn_sqlite3 + rescue + SiSU_Errors::InfoError.new($!,$@,@cf,@opt.fns).error + ensure + end + end + def populate + end + end +end +__END__ diff --git a/lib/sisu/v3dv/hub.rb b/lib/sisu/v3dv/hub.rb index fd7909ec..5f256314 100644 --- a/lib/sisu/v3dv/hub.rb +++ b/lib/sisu/v3dv/hub.rb @@ -224,7 +224,8 @@ module SiSU when /^qrcode$/; SiSU_QRcode::Source.new(@opt).read # -Q qrcode.rb when /^sitemaps$/; SiSU_Sitemaps::Source.new(@opt).read # -Y sitemaps.rb when /^zap$/; SiSU_Zap::Source.new(@opt).read # -Z zap.rb - when /^dbi$/; SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + when /^dbi$/; SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + when /^dbi_discreet$/; SiSU_DBI_Discreet::SQL.new(@opt).build # -d dbi_discreet.rb end @n_do=@n_do+1 SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/ @@ -255,7 +256,7 @@ module SiSU end end end - elsif @req =~/^dbi$/; SiSU_DBI::SQL.new(@opt).connect # -D -d + elsif @req =~/^dbi$/; SiSU_DBI::SQL.new(@opt).connect # -D -d elsif @req=~/^sisupod_make$/; SiSU_Doc::Source.new(@opt).read # -S end SiSU::Operations.new.counter @@ -564,6 +565,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ if @opt.act[:psql][:bool] #% --pg, -D DB postgresql op('dbi','postgresql') end + if @opt.act[:sqlite_discreet][:bool] #% --sqlite, -d DB sqlite + op('dbi_discreet','sqlite') + end if @opt.act[:sqlite][:bool] #% --sqlite, -d DB sqlite op('dbi','sqlite') end diff --git a/lib/sisu/v3dv/options.rb b/lib/sisu/v3dv/options.rb index 44eb1020..11d03e1d 100644 --- a/lib/sisu/v3dv/options.rb +++ b/lib/sisu/v3dv/options.rb @@ -665,6 +665,12 @@ module SiSU_Commandline && (mod.inspect =~/"--createdb"|"--create"|"--recreate"|"--dropall"|"--recreate"|"--import"|"--update"|"--remove"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } + act[:sqlite_discreet]=(cmd =~/d/ \ + || mod.inspect =~/"--sql"|"--sqlite"/) \ + && (mod.inspect =~/"--both"/ \ + || mod.inspect !~/"--createdb"|"--create"|"--recreate"|"--dropall"|"--recreate"|"--import"|"--update"|"--remove"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:harvest]=(mod.inspect =~/"--harvest"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } diff --git a/lib/sisu/v3dv/sysenv.rb b/lib/sisu/v3dv/sysenv.rb index 95ebf6d9..4383a893 100644 --- a/lib/sisu/v3dv/sysenv.rb +++ b/lib/sisu/v3dv/sysenv.rb @@ -2733,7 +2733,7 @@ WOK and not (@rc['flag']['default'].nil? \ or @rc['flag']['default'].empty?) @rc['flag']['default'] - else '-NQhewpotbxXyYv' + else '-NQhewpotbxXdyYv' end end def cf_1 #processing flag shortcuts @@ -2749,7 +2749,7 @@ WOK and not (@rc['flag']['ii'].nil? \ or @rc['flag']['ii'].empty?) @rc['flag']['ii'] - else '-NQhewpotbxXy' + else '-NQhewpotbxXdy' end end def cf_3 #processing flag shortcuts @@ -2757,7 +2757,7 @@ WOK and not (@rc['flag']['iii'].nil? \ or @rc['flag']['iii'].empty?) @rc['flag']['iii'] - else '-NQhewpotbxXyY' + else '-NQhewpotbxXdyY' end end def cf_4 #processing flag shortcuts @@ -2765,7 +2765,7 @@ WOK and not (@rc['flag']['iv'].nil? \ or @rc['flag']['iv'].empty?) @rc['flag']['iv'] - else '-NQhewpotbxXDyY --update' + else '-NQhewpotbxXdDyY --update' end end def cf_5 #processing flag shortcuts @@ -2773,7 +2773,7 @@ WOK and not (@rc['flag']['v'].nil? \ or @rc['flag']['v'].empty?) @rc['flag']['v'] - else '-NQhewpotbxXDyYv --update' + else '-NQhewpotbxXdDyYv --update' end end end @@ -3795,6 +3795,134 @@ WOK self end end + class InfoDb < InfoEnv + @@rc=nil + def initialize + @@pwd ||=Dir.pwd + @pwd=Dir.pwd + @env=SiSU_Env::InfoEnv.new + pt=Pathname.new(@pwd) + r=Px[:lng_lst].join('|') + u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ + @pwd_stub=pt.realpath.to_s[u,1] + @rc=@@rc ||=GetInit.instance.sisu_yaml.rc + @defaults=SiSU_Env::InfoEnv.new.defaults + end + def share_source? + ((defined? @rc['db']['share_source']) \ + && @rc['db']['share_source']==true) \ + ? @rc['db']['share_source'] + : false + end + def engine + def default + ((defined? @rc['db']['engine']['default']) \ + && @rc['db']['engine']['default']=~/postgresql|sqlite/) \ + ? @rc['db']['engine']['default'] + : 'sqlite' + end + self + end + def psql + def user + ((defined? @rc['db']['postgresql']['user']) \ + && @rc['db']['postgresql']['user']=~/\S+/) \ + ? @rc['db']['postgresql']['user'] + : @env.user + end + def db #db_name + "#{Db[:name_prefix]}#{@pwd_stub}" + end + def port #PGPORT + ((defined? @rc['db']['postgresql']['port']) \ + && ( @rc['db']['postgresql']['port'] =~/\d+/ \ + || @rc['db']['postgresql']['port'].class==Fixnum)) \ + ? @rc['db']['postgresql']['port'] + : (@defaults[:postgresql_port]) + end + def password + ((defined? @rc['db']['postgresql']['password']) \ + && @rc['db']['postgresql']['password']=~/\S+/) \ + ? @rc['db']['postgresql']['password'] + : '' + end + def host + ((defined? @rc['db']['postgresql']['host']) \ + && @rc['db']['postgresql']['host']=~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ + ? @rc['db']['postgresql']['host'] + : '' + end + def dbi + (psql.host =~/(?:\S{1,3}\.){3}\S{1,3}|\S+?\.\S+/) \ + ? "DBI:Pg:database=#{psql.db};host=#{psql.host};port=#{psql.port}" + : "DBI:Pg:database=#{psql.db};port=#{psql.port}" + end + def conn_dbi + DBI.connect(psql.dbi,psql.user,psql.db) + end + self + end + def mysql + def db + #"#{Db[:name_prefix]}#{@pwd_stub}" + end + def port + '**' + end + def dbi + "dbi:Mysql:database=#{mysql.db};port=#{mysql.port}" + end + self + end + def sqlite + def db + "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db" + end + def db_discreet(md) + # "#{@env.path.webserv}/#{@pwd_stub}/sisu_sqlite.db" + end + def dbi + "DBI:SQLite3:#{sqlite.db}" #sqlite3 ? + end + def sqlite3 + sqlite.db #sqlite3 ? + end + def conn_dbi + DBI.connect(sqlite.dbi) + end + def conn_sqlite3 + SQLite3::Database.new(sqlite.sqlite3) + end + self + end + end + class DbOp