diff options
author | Ralph Amissah <ralph@amissah.com> | 2012-03-12 18:51:21 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2012-03-12 18:51:21 -0400 |
commit | 1b7b1b2aec62cf261faa94ce2fbc05e9c28c83e2 (patch) | |
tree | 52b39f3a8e625db1678c3353a2a88a271379d81f /lib | |
parent | debian/changelog (3.1.14-1) (diff) | |
parent | v3dv: documentation sisu_commands, add sqlite3 discreet (diff) |
Merge tag 'sisu_3.1.15' into debian/sid
Diffstat (limited to 'lib')
33 files changed, 1257 insertions, 811 deletions
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='<div class="toc">' + minitoc + '</div>' + make=SiSU_Env::ProcessingSettings.new(@md) + if make.build.manifest_minitoc? + toc='<div class="toc">' + minitoc + '</div>' + 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 <<WOK <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> @@ -141,9 +152,9 @@ WOK </head> <body> #{@vz.js_top} - #{head_banner.concordance_navigation_band('pdf')} + #{top_band} #{toc} -<div class="content"> +<div class="#{div_class}"> #{@doc_details} <p>Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.<br />[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).]</p> <p>(The word listing/index is Case sensitive: Capitalized words appear before lower case)</p> 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/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 /\{(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}(?<source>(?<linked_doc>\S+?)\.ss[tm]\b)(?<note>.*)/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/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 <SiSU_DbCreate::Create # db_create.rb + class Create <SiSU_DbCreate::Create # db_create.rb end - class Case <SiSU_DbSelect::Case # db_select.rb + class Case <SiSU_DbSelect::Case # db_select.rb end - class Index <SiSU_DbIndex::Index # db_indexes.rb + class Index <SiSU_DbIndex::Index # db_indexes.rb end - class Drop <SiSU_DbDrop::Drop # db_drop.rb + class Drop <SiSU_DbDrop::Drop # db_drop.rb end - class Remove <SiSU_DbRemove::Remove # db_remove.rb + class Remove <SiSU_DbRemove::Remove # db_remove.rb end class LoadDocuments <SiSU_DbTuple::LoadDocuments # db_load_tuple.rb end diff --git a/lib/sisu/v3dv/db_drop.rb b/lib/sisu/v3dv/db_drop.rb index 97bf8665..4b9aba7d 100644 --- a/lib/sisu/v3dv/db_drop.rb +++ b/lib/sisu/v3dv/db_drop.rb @@ -104,7 +104,7 @@ module SiSU_DbDrop sdb.create_table.endnotes_plus sdb.create_table.urls sdb_index.create_indexes - rescue; SiSU_Errors::InfoError.new($!,$@,'-D').error; @sdb.output_dir? + rescue; SiSU_Errors::InfoError.new($!,$@,'-D').error; sdb.output_dir? end exit else diff --git a/lib/sisu/v3dv/db_select.rb b/lib/sisu/v3dv/db_select.rb index bab898f0..52fbe8ba 100644 --- a/lib/sisu/v3dv/db_select.rb +++ b/lib/sisu/v3dv/db_select.rb @@ -108,56 +108,56 @@ module SiSU_DbSelect when /^--createdb$/ @sdb.output_dir? begin - @sdb.create_db + @sdb.create_db rescue; @sdb.output_dir? end when /^--(?:init(?:ialize)?|create(?:all)?)$/ @sdb.output_dir? begin - @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 + @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 rescue; SiSU_Errors::InfoError.new($!,$@,'-D').error; @sdb.output_dir? end when /^--createtables?$/ @sdb.output_dir? begin - @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 + @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 rescue; @sdb.output_dir? end when /^--recreate$/ @sdb.output_dir? begin - @sdb_no.drop.tables - @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 + @sdb_no.drop.tables + @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 rescue; @sdb.output_dir? end when /^--cr(eate)?lex$/ @sdb.output_dir? begin - @sdb.create_table.doc_objects + @sdb.create_table.doc_objects rescue; @sdb.output_dir? end when /^--cr(eate)?metadata$/ @sdb.output_dir? begin - @sdb.create_table.metadata_and_text + @sdb.create_table.metadata_and_text rescue; @sdb.output_dir? end when /^--import$/ diff --git a/lib/sisu/v3dv/dbi.rb b/lib/sisu/v3dv/dbi.rb index e0bd169e..f11d9e81 100644 --- a/lib/sisu/v3dv/dbi.rb +++ b/lib/sisu/v3dv/dbi.rb @@ -71,7 +71,7 @@ module SiSU_DBI SiSU_Env::Load.new('dbi',true).prog @opt=opt @db=SiSU_Env::InfoDb.new - if @opt.cmd =~/d/i \ + if @opt.cmd =~/[Dd]/ \ or @opt.mod.inspect =~/--(pg(?:sql)?|(?:sq)?lite)/ @sql_type=if @opt.cmd=~/D/ \ or @opt.mod.inspect =~/--pg(?:sql)?/ diff --git a/lib/sisu/v3dv/dbi_discreet.rb b/lib/sisu/v3dv/dbi_discreet.rb new file mode 100644 index 00000000..d9ecd8e7 --- /dev/null +++ b/lib/sisu/v3dv/dbi_discreet.rb @@ -0,0 +1,158 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997 - 2012, Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see <http://www.gnu.org/licenses/>. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + <http://www.fsf.org/licensing/licenses/gpl.html> + <http://www.gnu.org/licenses/gpl.html> + + <http://www.jus.uio.no/sisu/gpl.fsf/toc.html> + <http://www.jus.uio.no/sisu/gpl.fsf/doc.html> + <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt> + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + <http://www.jus.uio.no/sisu> + <http://www.sisudoc.org> + + * Download: + <http://www.jus.uio.no/sisu/SiSU/download.html> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** 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/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 --- </p> <p class="small"> - License, SiSU is licensed under + License, SiSU is licensed under <a href="http://www.gnu.org/licenses/gpl.html" target="_top"> GPLv3 or later </a> @@ -2032,7 +2032,7 @@ as a developers tool it is flexible and extensible </p> <br /> <p class="small"> -<a href="http://www.sisudoc.org"><b>SiSU</b></a> at <a href="http://www.sisudoc.org"><www.sisudoc.org></a> or <a href="http://www.jus.uio.no/sisu/"><www.jus.uio.no/sisu/></a></p> +<a href="http://www.sisudoc.org"><b>SiSU</b></a> at <a href="http://www.sisudoc.org"><www.sisudoc.org></a> or <a href="http://www.jus.uio.no/sisu/"><www.jus.uio.no/sisu/></a></p> </div> <div id="column_right"> <p class="tiny"> 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] << %{<div class="content">\n<div class="substance">} @@toc[:scr] << %{<div class="content">\n<div class="substance">} 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") - '<div class="toc">' + minitoc + '</div>' - 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}</a>} 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}</a>} 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}</a>} 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}</a>} 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}</a>} 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+|)$/, - %{<label class="#{ocn_class}"> </label>}) - elsif @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"> </label>}) - else + @make=SiSU_Env::ProcessingSettings.new(@md) + if @make.build.ocn? ocn_class='ocn' + if @ocn.to_i==0 + @ocn.gsub(/^(\d+|)$/, + %{<label class="#{ocn_class}"> </label>}) + else + @ocn.gsub(/^(\d+|)$/, + %{<label class="#{ocn_class}"><a href="#o\\1" class="lnk#{ocn_class}">\\1</a></label>}) + end + else + ocn_class='ocn_off' @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"><a href="#o\\1" class="lnk#{ocn_class}">\\1</a></label>}) + %{<label class="#{ocn_class}"> </label>}) 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 -<p class="center"> -#{@txt} -#{@two} -</a></p>} - end - def navigation_toc_lev1 - %{#{@banner.nav_toc}} - end - def navigation_toc_lev2 #change bold use css - %{<table summary="navigation segment level 2"> -<tr><td width ="20"> -</td> -<td> - <font size="3" #{@vz.font_face}> - <b>#{@txt}</b> - </font> - </p> -#{@vz.table_close}} - end - def navigation_toc_lev3 #change bold use css - %{<table summary="navigation segment level 3"> -<tr><td width ="20"> -</td> -<td> - <font size="3" #{@vz.font_face}> - <b>#{@txt}</b> - </font> - </p> -#{@vz.table_close}} - end - def navigation_toc_lev4 - %{<table summary="navigation segment level 4"> -<tr><td width ="80"> -</td> -<td> -<p> - #{@txt} -</p> -#{@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 - %{ - <h4 class="minitoc"> - <a href="sisu_manifest.html">Manifest (alternative outputs)</a> - </h4> -} - end - def mini_concord_tail - %{ - <h4 class="minitoc"> - <a href="concordance.html">Concordance (wordlist)</a> - </h4> - <h4 class="minitoc"> - <a href="sisu_manifest.html">Manifest (alternative outputs)</a> - </h4> -} - 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<div class="content">\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/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 <<WOK harvest --harvest extracts document index metadata - + WOK end def css(opt) diff --git a/lib/sisu/v3dv/harvest_authors.rb b/lib/sisu/v3dv/harvest_authors.rb index fa6934a5..5bb702be 100644 --- a/lib/sisu/v3dv/harvest_authors.rb +++ b/lib/sisu/v3dv/harvest_authors.rb @@ -70,8 +70,8 @@ module SiSU_Harvest_Authors idx_array={} @opt.f_pths.each do |y| lang_hash_file_array={} - name=y[:f] - filename=y[:pth] + '/' + y[:f] + name=y[:f] + filename=y[:pth] + '/' + y[:f] File.open(filename,'r') do |file| file.each_line("\n\n") do |line| if line =~/^@(?:title|creator|date):(?:\s|$)/m diff --git a/lib/sisu/v3dv/harvest_topics.rb b/lib/sisu/v3dv/harvest_topics.rb index 504e0a4d..dd7ec8c2 100644 --- a/lib/sisu/v3dv/harvest_topics.rb +++ b/lib/sisu/v3dv/harvest_topics.rb @@ -72,8 +72,8 @@ module SiSU_Harvest_Topics idx_array={} @opt.f_pths.each do |y| lang_hash_file_array={} - name=y[:f] - filename=y[:pth] + '/' + y[:f] + name=y[:f] + filename=y[:pth] + '/' + y[:f] File.open(filename,'r') do |file| file.each_line("\n\n") do |line| if line =~/^@(?:title|creator|classify):(?:\s|$)/m 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+|)$/, + %{<label class="#{ocn_class}"><a name="#{@ocn}"> </a></label>}) + else + @ocn.gsub(/^(\d+|)$/, + %{<label class="#{ocn_class}"><a name="#{@ocn}" href="##{@ocn}" class="lnk#{ocn_class}">\\1</a></label>}) + end + else ocn_class='ocn_off' @ocn.gsub(/^(\d+|)$/, %{<label class="#{ocn_class}"> </label>}) - elsif @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"><a name="#{@ocn}"> </a></label>}) - else - ocn_class='ocn' - @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"><a name="#{@ocn}" href="##{@ocn}" class="lnk#{ocn_class}">\\1</a></label>}) 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 %{<td align="center" bgcolor=#{@vz.color_band2}> @@ -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] - <<WOK + if @make.build.html_top_band? + search_and_manifest=<<WOK <td align="center" width="60%"> - #{make_seg_scroll_pdf} + #{make_scroll_search_form_and_manifest_link} </td> WOK - else '' - end - %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> <tr><td width="20%"> #{@vz.banner_band} -</td>#{pdf} +</td>#{search_and_manifest} <td width="20%"> #{@vz.table_close} <p />} + else '' + end end def concordance_navigation_band(type='') - %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + if @make.build.html_top_band? + %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> <tr><td width="20%"> #{@vz.banner_band} </td> @@ -352,6 +354,8 @@ WOK </a> #{@vz.table_close} <p />} + else '' + end end def seg_head_navigation_band(type='') firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> @@ -369,25 +373,6 @@ WOK #{@vz.table_close} <p />} end - def seg_head_navigation_band_bottom(type='') #retired 2.7.9 - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" alt="->"> - #{png_nav.nxt} - </a>} if @md.firstseg =~/\S+/ - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - -</td> -<td width="75%" align="center"> - #{@tocband_segtoc} -</td> -<td width="5%" align="right"> - #{firstseg} -#{@vz.table_close} -<p />} - end def manifest_link(text) # @file=SiSU_Env::FileOp.new(@md) if @md %{<font size=2> @@ -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=%{<td align="center" bgcolor=#{@vz.color_band2}> #{@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' %{ -<div class="content"> +<div class="#{cl}"> <#{tag} class="#{attrib}"> #{@named}#{@txt} </#{tag}> 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] ? '<div id="pane_major">' : '' + (@make.build.html_right_pane? \ + && @flag[:ad]) \ + ? '<div id="pane_major">' + : '' end def minor - @flag[:ad] ? '<div id="pane_minor">' : '' + (@make.build.html_right_pane? \ + && @flag[:ad]) \ + ? '<div id="pane_minor">' + : '' end def close - @flag[:ad] ? '</div>' : '' + (@make.build.html_right_pane? \ + && @flag[:ad]) \ + ? '</div>' + : '' 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<div class="content">\n} << @seg[:endnote_all] << '</div>' # << '</div>' + filename_seg << @seg[:heading_endnotes] << @minitoc << @seg[:headings] << %{\n<div class="#{@cl}">\n} << @seg[:endnote_all] << '</div>' # << '</div>' 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<div class="content">\n} << @seg[:idx] << '</div>' # << '</div>' + filename_seg << @seg[:heading_idx] << @minitoc << @seg[:headings] << %{\n<div class="#{@cl}">\n} << @seg[:idx] << '</div>' # << '</div>' 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<div class="content">\n} << metadata << '</div>' # << '</div>' + filename_seg << @seg[:heading_idx] << @minitoc << @seg[:headings] << %{\n<div class="#{@cl}">\n} << metadata << '</div>' # << '</div>' + else + if @make.build.html_top_band? + filename_seg << @minitoc << @seg[:headings] << @seg[:main] << "\n</div>\n" + else + filename_seg << @minitoc << @seg[:main] << "\n</div>\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</div>\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<div class="content">\n} + @@seg[:main] << %{\n<div class="#{@cl}">\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<div class="content">\n<div class="endnote">\n} + @@seg[:tail] << %{\n<div class="#{@cl}">\n<div class="endnote">\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/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/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? + "<td>#{@env.widget_static.search_form}</td>" + 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/ <<WOK <table summary="band" border="0" cellpadding="3" cellspacing="0"> <tr><td align="left" width="15%" bgcolor="#ffffff">#{vz.banner_band}</td> <td width="70%"><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td> -<td>#{@env.widget_static.search_form}</td></tr> +#{search_form}</tr> </table> WOK else @@ -772,7 +784,7 @@ WOK <table summary="band" border="0" cellpadding="3" cellspacing="0"> <tr><td align="left" bgcolor="#ffffff"><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#{vz.url_path_image_sys}/sisu.png" alt="SiSU -->" /></a></td> <td><p class="tiny">#{@brace_url.xml_open}<a href="#{@base_url}/#{file}">#{@base_url}/#{file}</a>#{@brace_url.xml_close}</p></td> -<td>#{@env.widget_static.search_form}</td></tr> +#{search_form}</tr> </table> WOK end @@ -793,7 +805,7 @@ SiSU manifest: #{@md.title.full} <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en"> #{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/options.rb b/lib/sisu/v3dv/options.rb index b2b7ff15..11d03e1d 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,259 @@ 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[: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 } - : { 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/qrcode.rb b/lib/sisu/v3dv/qrcode.rb index 49ef8ee3..d2b16753 100644 --- a/lib/sisu/v3dv/qrcode.rb +++ b/lib/sisu/v3dv/qrcode.rb @@ -149,7 +149,7 @@ module SiSU_QRcode def summarize(id,file,pth='',rel='',url='',img='● ') size=(File.size("#{pth}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] - @manifest[:txt] <<<<WOK + @manifest[:txt] <<<<WOK #{id} #{kb} #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close} WOK 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/sysenv.rb b/lib/sisu/v3dv/sysenv.rb index fcfc234b..4383a893 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 @@ -1193,13 +1194,6 @@ module SiSU_Env 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?) @rc['manifest']['minitoc'] @@ -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 @@ -2693,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 @@ -2709,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 @@ -2717,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 @@ -2725,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 @@ -2733,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 @@ -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? @@ -3522,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 <InfoDb + def initialize(md) + begin + @md=md + rescue; STDERR.puts SiSU_Screen::Ansi.new(@cmd,$!,$@).rescue + ensure + end + end + def sqlite_discreet + def db + "#{@md.file.output_path.sqlite_discreet.dir}/#{@md.file.base_filename.sqlite_discreet}" + end + def dbi + "DBI:SQLite3:#{sqlite_discreet.db}" + end + def sqlite3 + sqlite_discreet.db + end + def conn_dbi + DBI.connect(sqlite_discreet.dbi) + end + def conn_sqlite3 + SQLite3::Database.new(sqlite_discreet.sqlite3) + end + self + end + end class FileOp <InfoFile #todo unify with CreateFile def initialize(md,fno='') begin @@ -3532,7 +3933,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 +3986,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 +3996,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) @@ -3782,6 +4183,15 @@ WOK end self end + def sqlite_discreet + def dir + output_path.sqlite_discreet.dir + '/' + base_filename.sqlite_discreet + end + def rel + output_path.sqlite_discreet.rel + '/' + base_filename.sqlite_discreet + end + self + end def hash_digest def dir output_path.hash_digest.dir + '/' + base_filename.hash_digest @@ -4072,6 +4482,14 @@ WOK @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft end end + def sqlite_discreet + ft='.sql.db' + if output_dir_structure.by_language_code? + @md.fnb + ft + else + @md.fnb + @md.lang_code_insert + ft + end + end def hash_digest ft='.txt' if output_dir_structure.by_language_code? @@ -4729,6 +5147,27 @@ WOK end self end + def sqlite_discreet + def ft + 'sql' + end + def dir + set_path(ft).dir.ab + end + def url + set_path(ft).url.ab + end + def rel + set_path(ft).rel.ab + end + def rcp + set_path(ft).rcp.ab + end + def rel_sm + set_path(ft).rel_sm.ab + end + self + end def hash_digest def ft 'hashes' @@ -4949,104 +5388,6 @@ WOK self end end - class InfoSet #<InfoEnv - def initialize(md) - @md=md - @env=SiSU_Env::InfoEnv.new(md.fns) - end - def heading_omit_list - @md.make.omit_list - end - def not_heading_make_omit_listed?(test) #fix - listed=if heading_omit_list - x=(heading_omit_list.scan(/\b#{test}\b/)).join - test==x \ - ? false \ - : true - else - true - end - listed - end - def ocn? - @md.opt.opt_act[:ocn][:bool] \ - && (@env.build.ocn?) \ - ? true \ - : false - end - def toc? - @md.opt.opt_act[:toc][:bool] \ - && (not_heading_make_omit_listed?('ocn')) \ - && (@env.build.toc?) \ - ? true \ - : false - end - def manifest? - @md.opt.opt_act[:manifest][:bool] \ - && (not_heading_make_omit_listed?('manifest')) \ - && (@env.build.manifest?) \ - ? true \ - : false - end - def manifest_links? - @md.opt.opt_act[:manifest_links][:bool] \ - && (not_heading_make_omit_listed?('manifest_links')) \ - && (@env.build.manifest_links?) \ - ? true \ - : false - end - def manifest_minitoc? - @md.opt.opt_act[:manifest_minitoc][:bool] \ - && (not_heading_make_omit_listed?('manifest_minitoc')) \ - && (@env.build.manifest_minitoc?) \ - ? true \ - : false - end - def metadata? - @md.opt.opt_act[:metadata][:bool] \ - && (not_heading_make_omit_listed?('metadata')) \ - && (@env.build.metadata?) \ - ? true \ - : false - end - def html_minitoc? - @md.opt.opt_act[:html_minitoc][:bool] \ - && ((not_heading_make_omit_listed?('html_minitoc')) \ - || (not_heading_make_omit_listed?('minitoc'))) \ - && (@env.build.html_minitoc?) \ - ? true \ - : false - end - def html_navigation? - @md.opt.opt_act[:html_navigation][:bool] \ - && (not_heading_make_omit_listed?('html_navigation')) \ - && (@env.build.html_navigation?) \ - ? true \ - : false - end - def html_navigation_bar? - @md.opt.opt_act[:html_navigation_bar][:bool] \ - && (not_heading_make_omit_listed?('html_navigation_bar')) \ - && (@env.build.html_navigation_bar?) \ - ? true \ - : false - end - def html_search_form? - @md.opt.opt_act[:html_search_form][:bool] \ - && (not_heading_make_omit_listed?('html_search_form')) \ - && (@env.build.html_search_form?) \ - ? true \ - : false - end - def html_right_column? - @md.opt.opt_act[:html_right_column][:bool] \ - && ((not_heading_make_omit_listed?('html_right_column')) \ - || (not_heading_make_omit_listed?('html_promo'))) \ - && (@env.build.html_right_column?) \ - ? true \ - : false - end - end class CreateFile <InfoEnv #todo unify with FileOp def initialize(fns) begin @@ -5164,106 +5505,6 @@ WOK @@publisher='SiSU scribe' end end - class InfoDb < InfoEnv - @@rc=nil - def initialize - @@pwd ||=Dir.pwd - @pwd=Dir.pwd - @env=SiSU_Env::InfoEnv.new - #m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - #@pwd_stub=@pwd[m,1] - 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 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 InfoPort < InfoEnv def initialize @env=SiSU_Env::InfoEnv.new 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" + <<WOK +@node Dublin Core +@unnumbered Dublin Core +@cindex chapter, Dublin Core + +#{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} + +WOK end def tail - "@c %% 6\n" + - "@node Index\n" + - "@unnumbered Index\n" + - "@printindex cp\n\n" + - "@bye" + <<WOK +@c %% 6 +@node Index +@unnumbered Index +@printindex cp + +@bye +WOK end def clean(dob) if dob.is==:heading \ and dob.obj !~/##{dob.ocn}/ dob.obj="#{dob.obj} ##{dob.ocn}" end - dob.obj=dob.obj.gsub(/<:#>/,'').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') 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] =<<WOK -#{@tex_ml.newpage('landscape')} -\\pagestyle{fancy} + if (@make.build.toc?) + toc=<<WOK \\renewcommand{\\contentsname}{#{@translate.contents}} \\tableofcontents +WOK + toc_pb={ l: @tex_ml.newpage('landscape'), p: @tex_ml.newpage('portrait') } + else + toc='' + toc_pb={ l: '', p: '' } + end + x[:l] =<<WOK #{@tex_ml.newpage('landscape')} +\\pagestyle{fancy} +#{toc}#{toc_pb[:l]} \\pagenumbering{arabic} #{@tex_ml.paraskip_normal} #{@tex_ml.newpage('landscape')} @@ -754,8 +751,7 @@ WOK x[:p] =<<WOK #{@tex_ml.newpage('portrait')} \\pagestyle{fancy} -\\renewcommand{\\contentsname}{#{@translate.contents}} -\\tableofcontents +#{toc}#{toc_pb[:p]} #{@tex_ml.newpage('portrait')} \\pagenumbering{arabic} #{@tex_ml.paraskip_normal} @@ -814,11 +810,7 @@ WOK if dob.of ==:para paranum=dob.ocn ? dob.ocn : '' paranum = '' if paranum.to_i==0 - paranumber_display=if @md.markup.inspect =~/no_ocn/ \ - or @md.opt.mod.inspect =~/--no-ocn/ \ - or not dob.ocn_ - '' - else + paranumber_display=if @make.build.ocn? tags='' #[keep] code that follows inserts "name tags" as hypertargets, currently using ocn (converting nametags to ocn) for internal linking, related code: |texpdf_format.rb|@|uses nametags directly| #if dob.tags.length > 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/urls.rb b/lib/sisu/v3dv/urls.rb index 39156dff..31614a37 100644 --- a/lib/sisu/v3dv/urls.rb +++ b/lib/sisu/v3dv/urls.rb @@ -215,7 +215,7 @@ module SiSU_Urls SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y).result end def sqlite(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x} DBI sqlite","sqlite3 #{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}/sisu_sqlite.db", "#{y}").result + SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x} DBI sqlite","sqlite3 #{@md.file.output_path.sqlite_discreet.dir}/#{@md.file.base_filename.sqlite_discreet}\n sqlite3 #{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}/sisu_sqlite.db\n", "#{y}").result end self end 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+|)$/, - %{<label class="#{ocn_class}"> </label>}) - elsif @ocn.to_i==0 - @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"><a name="#{@ocn}"> </a></label>}) - else + @make=SiSU_Env::ProcessingSettings.new(@md) + if @make.build.ocn? ocn_class='ocn' + if @ocn.to_i==0 + @ocn.gsub(/^(\d+|)$/, + %{<label class="#{ocn_class}"><a name="#{@ocn}"> </a></label>}) + else + @ocn.gsub(/^(\d+|)$/, + %{<label class="#{ocn_class}"><a name="#{@ocn}">\\1</a></label>}) + end + else + ocn_class='ocn_off' @ocn.gsub(/^(\d+|)$/, - %{<label class="#{ocn_class}"><a name="#{@ocn}">\\1</a></label>}) + %{<label class="#{ocn_class}"> </label>}) end end def name |