From 2f0c9ef183a982d0923cc79ed743574670a7bc87 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:17:16 -0400 Subject: v5 v6: qrcode, sha call, fix --- lib/sisu/v5/qrcode.rb | 2 +- lib/sisu/v6/qrcode.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/qrcode.rb b/lib/sisu/v5/qrcode.rb index 1f3f7ca8..04d91a5e 100644 --- a/lib/sisu/v5/qrcode.rb +++ b/lib/sisu/v5/qrcode.rb @@ -180,7 +180,7 @@ WOK sys=SiSU_Env::SystemCall.new dgst=case @dg when :sha512 - (sys.sha516("#{pth}/#{file}")) #check + (sys.sha512("#{pth}/#{file}")) #check when :md5 (sys.md5("#{pth}/#{file}")) else diff --git a/lib/sisu/v6/qrcode.rb b/lib/sisu/v6/qrcode.rb index b4a84f22..d734ed72 100644 --- a/lib/sisu/v6/qrcode.rb +++ b/lib/sisu/v6/qrcode.rb @@ -180,7 +180,7 @@ WOK sys=SiSU_Env::SystemCall.new dgst=case @dg when :sha512 - (sys.sha516("#{pth}/#{file}")) #check + (sys.sha512("#{pth}/#{file}")) #check when :md5 (sys.md5("#{pth}/#{file}")) else -- cgit v1.2.3 From ff3eb782e658d3096874854504781da9bc6f3aa9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:18:59 -0400 Subject: v5 v6: epub tune, --maintenance, fix --- lib/sisu/v5/se_file_op.rb | 4 ++++ lib/sisu/v5/xhtml_epub2_tune.rb | 5 ++--- lib/sisu/v6/se_file_op.rb | 4 ++++ lib/sisu/v6/xhtml_epub2_tune.rb | 5 ++--- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/se_file_op.rb b/lib/sisu/v5/se_file_op.rb index dfd2aadf..826c01ab 100644 --- a/lib/sisu/v5/se_file_op.rb +++ b/lib/sisu/v5/se_file_op.rb @@ -145,6 +145,10 @@ module SiSU_Info_File @env.processing_path.tune + '/' \ + @fns + '.marshal_tune' end + def xhtml_tune + @env.processing_path.tune + '/' \ + + @fns + '.marshal_tune' + end self end def write_file_processing diff --git a/lib/sisu/v5/xhtml_epub2_tune.rb b/lib/sisu/v5/xhtml_epub2_tune.rb index afeff30e..7376212a 100644 --- a/lib/sisu/v5/xhtml_epub2_tune.rb +++ b/lib/sisu/v5/xhtml_epub2_tune.rb @@ -77,7 +77,7 @@ module SiSU_XHTML_EPUB2_Tune class Output def initialize(data,md) @data,@md=data,md - @file=SiSU_Env::FileOp.new(@md) + @file=SiSU_Env::InfoFile.new(@md.fns) @cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX end def hard_output @@ -89,7 +89,7 @@ module SiSU_XHTML_EPUB2_Tune end end def marshal - File.open(@file.marshal.html_tune,'w') {|f| Marshal.dump(@data.to_a,f)} + File.open(@file.marshal.xhtml_tune,'w') {|f| Marshal.dump(@data.to_a,f)} end end class CleanXHTML @@ -112,7 +112,6 @@ module SiSU_XHTML_EPUB2_Tune def initialize(data,md) @data,@md=data,md @vz=SiSU_Viz::Defaults.new - @env=SiSU_Env::InfoEnv.new(@md.fns) @sys=SiSU_Env::SystemCall.new @env=SiSU_Env::InfoEnv.new(@md.fns) @brace_url=SiSU_Viz::Defaults.new.url_decoration diff --git a/lib/sisu/v6/se_file_op.rb b/lib/sisu/v6/se_file_op.rb index 941b7b7a..ff9aa65a 100644 --- a/lib/sisu/v6/se_file_op.rb +++ b/lib/sisu/v6/se_file_op.rb @@ -145,6 +145,10 @@ module SiSU_Info_File @env.processing_path.tune + '/' \ + @fns + '.marshal_tune' end + def xhtml_tune + @env.processing_path.tune + '/' \ + + @fns + '.marshal_tune' + end self end def write_file_processing diff --git a/lib/sisu/v6/xhtml_epub2_tune.rb b/lib/sisu/v6/xhtml_epub2_tune.rb index 4188ae24..07337309 100644 --- a/lib/sisu/v6/xhtml_epub2_tune.rb +++ b/lib/sisu/v6/xhtml_epub2_tune.rb @@ -77,7 +77,7 @@ module SiSU_XHTML_EPUB2_Tune class Output def initialize(data,md) @data,@md=data,md - @file=SiSU_Env::FileOp.new(@md) + @file=SiSU_Env::InfoFile.new(@md.fns) @cX=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]).cX end def hard_output @@ -89,7 +89,7 @@ module SiSU_XHTML_EPUB2_Tune end end def marshal - File.open(@file.marshal.html_tune,'w') {|f| Marshal.dump(@data.to_a,f)} + File.open(@file.marshal.xhtml_tune,'w') {|f| Marshal.dump(@data.to_a,f)} end end class CleanXHTML @@ -112,7 +112,6 @@ module SiSU_XHTML_EPUB2_Tune def initialize(data,md) @data,@md=data,md @vz=SiSU_Viz::Defaults.new - @env=SiSU_Env::InfoEnv.new(@md.fns) @sys=SiSU_Env::SystemCall.new @env=SiSU_Env::InfoEnv.new(@md.fns) @brace_url=SiSU_Viz::Defaults.new.url_decoration -- cgit v1.2.3 From 69d476386d149117ced7c77f9f383646a33bcd38 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:21:03 -0400 Subject: v5 v6: db, --maintenance sql, separated out postgresql & sqlite * could share "maintenance" db import sql file (as done previously), consider --- lib/sisu/v5/db_import.rb | 12 +++++++++--- lib/sisu/v5/db_select.rb | 8 ++++++-- lib/sisu/v5/dbi_discrete.rb | 16 ++++++++++++---- lib/sisu/v6/db_import.rb | 12 +++++++++--- lib/sisu/v6/db_select.rb | 8 ++++++-- lib/sisu/v6/dbi_discrete.rb | 16 ++++++++++++---- 6 files changed, 54 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb index 0ce24831..59cff28a 100644 --- a/lib/sisu/v5/db_import.rb +++ b/lib/sisu/v5/db_import.rb @@ -102,7 +102,9 @@ module SiSU_DbImport ? @conn.execute( sql ).join.to_i : @conn.exec( sql ).getvalue(0,0).to_i rescue - puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on + if @opt.act[:maintenance][:set]==:on + puts "#{__FILE__}:#{__LINE__}" + end end @col[:lid]=0 if @col[:lid].nil? or @col[:lid].to_s.empty? sql='SELECT MAX(nid) FROM endnotes' @@ -112,7 +114,9 @@ module SiSU_DbImport : @conn.exec( sql ).getvalue(0,0).to_i @id_n ||=0 rescue - puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on + if @opt.act[:maintenance][:set]==:on + puts "#{__FILE__}:#{__LINE__}" + end end @id_n =0 if @col[:lid].nil? or @col[:lid].to_s.empty? @col[:lv0]=@col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=@col[:lv7]=0 @@ -307,7 +311,9 @@ module SiSU_DbImport : @conn.exec( sql ).getvalue(0,0).to_i @@id_t=id_t if id_t rescue - puts "#{__FILE__} #{__LINE__}" if @opt.act[:maintenance][:set]==:on + if @opt.act[:maintenance][:set]==:on + puts "#{__FILE__} #{__LINE__}" + end end @@id_t+=1 #bug related, needs to be performed once at start of file, but consider moving, as, placed here it means program will fail if document header lacks @title: if (@opt.act[:verbose][:set]==:on \ diff --git a/lib/sisu/v5/db_select.rb b/lib/sisu/v5/db_select.rb index ae87ee1b..997b6a1a 100644 --- a/lib/sisu/v5/db_select.rb +++ b/lib/sisu/v5/db_select.rb @@ -182,12 +182,16 @@ module SiSU_DbSelect file=if @opt.act[:maintenance][:set]==:on if @opt.fns and not @opt.fns.empty? @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns - if @sql_type ==:sqlite and @opt.act[:maintenance][:set]==:on + if @sql_type ==:sqlite puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" end @db=SiSU_Env::InfoDb.new @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql" - File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') + if @sql_type ==:sqlite + File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') + else + File.new("#{@env.processing_path.postgresql}/#{@opt.fns}.sql",'w+') + end elsif @opt.fns \ and (@opt.act[:sqlite_create][:set] ==:on \ || @opt.act[:psql_create][:set] ==:on) diff --git a/lib/sisu/v5/dbi_discrete.rb b/lib/sisu/v5/dbi_discrete.rb index 50ef97b4..e50f5646 100644 --- a/lib/sisu/v5/dbi_discrete.rb +++ b/lib/sisu/v5/dbi_discrete.rb @@ -81,7 +81,9 @@ module SiSU_DBI_Discrete #% database building @md=@particulars.md if @opt.act[:sqlite][:set]==:on @sql_type=:sqlite - maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on + if @opt.act[:maintenance][:set]==:on + maintenance_check(@opt,__FILE__,__LINE__) + end end @output_path=@md.file.output_path.sqlite_discrete.dir @filename=@md.file.base_filename.sqlite_discrete @@ -180,13 +182,19 @@ module SiSU_DBI_Discrete #% database building def populate end def sql_maintenance_file - file=if @opt.inspect =~/M/ + file=if @opt.act[:maintenance][:set]==:on if @opt.fns and not @opt.fns.empty? @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns - puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type ==:sqlite and @opt.act[:maintenance][:set]==:on + if @sql_type ==:sqlite + puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" + end @db=SiSU_Env::InfoDb.new @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql" - File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') + if @sql_type ==:sqlite + File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') + else + File.new("#{@env.processing_path.postgresql}/#{@opt.fns}.sql",'w+') + end elsif @opt.fns \ and @opt.fns.inspect =~/create/ nil #sort variations later diff --git a/lib/sisu/v6/db_import.rb b/lib/sisu/v6/db_import.rb index e61290aa..9473863d 100644 --- a/lib/sisu/v6/db_import.rb +++ b/lib/sisu/v6/db_import.rb @@ -102,7 +102,9 @@ module SiSU_DbImport ? @conn.execute( sql ).join.to_i : @conn.exec( sql ).getvalue(0,0).to_i rescue - puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on + if @opt.act[:maintenance][:set]==:on + puts "#{__FILE__}:#{__LINE__}" + end end @col[:lid]=0 if @col[:lid].nil? or @col[:lid].to_s.empty? sql='SELECT MAX(nid) FROM endnotes' @@ -112,7 +114,9 @@ module SiSU_DbImport : @conn.exec( sql ).getvalue(0,0).to_i @id_n ||=0 rescue - puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on + if @opt.act[:maintenance][:set]==:on + puts "#{__FILE__}:#{__LINE__}" + end end @id_n =0 if @col[:lid].nil? or @col[:lid].to_s.empty? @col[:lv0]=@col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=@col[:lv7]=0 @@ -307,7 +311,9 @@ module SiSU_DbImport : @conn.exec( sql ).getvalue(0,0).to_i @@id_t=id_t if id_t rescue - puts "#{__FILE__} #{__LINE__}" if @opt.act[:maintenance][:set]==:on + if @opt.act[:maintenance][:set]==:on + puts "#{__FILE__} #{__LINE__}" + end end @@id_t+=1 #bug related, needs to be performed once at start of file, but consider moving, as, placed here it means program will fail if document header lacks @title: if (@opt.act[:verbose][:set]==:on \ diff --git a/lib/sisu/v6/db_select.rb b/lib/sisu/v6/db_select.rb index f7bf7ee0..c9c4ffc1 100644 --- a/lib/sisu/v6/db_select.rb +++ b/lib/sisu/v6/db_select.rb @@ -182,12 +182,16 @@ module SiSU_DbSelect file=if @opt.act[:maintenance][:set]==:on if @opt.fns and not @opt.fns.empty? @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns - if @sql_type ==:sqlite and @opt.act[:maintenance][:set]==:on + if @sql_type ==:sqlite puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" end @db=SiSU_Env::InfoDb.new @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql" - File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') + if @sql_type ==:sqlite + File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') + else + File.new("#{@env.processing_path.postgresql}/#{@opt.fns}.sql",'w+') + end elsif @opt.fns \ and (@opt.act[:sqlite_create][:set] ==:on \ || @opt.act[:psql_create][:set] ==:on) diff --git a/lib/sisu/v6/dbi_discrete.rb b/lib/sisu/v6/dbi_discrete.rb index d4efe687..4c3efc46 100644 --- a/lib/sisu/v6/dbi_discrete.rb +++ b/lib/sisu/v6/dbi_discrete.rb @@ -81,7 +81,9 @@ module SiSU_DBI_Discrete #% database building @md=@particulars.md if @opt.act[:sqlite][:set]==:on @sql_type=:sqlite - maintenance_check(@opt,__FILE__,__LINE__) if @opt.act[:maintenance][:set]==:on + if @opt.act[:maintenance][:set]==:on + maintenance_check(@opt,__FILE__,__LINE__) + end end @output_path=@md.file.output_path.sqlite_discrete.dir @filename=@md.file.base_filename.sqlite_discrete @@ -180,13 +182,19 @@ module SiSU_DBI_Discrete #% database building def populate end def sql_maintenance_file - file=if @opt.inspect =~/M/ + file=if @opt.act[:maintenance][:set]==:on if @opt.fns and not @opt.fns.empty? @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns - puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type ==:sqlite and @opt.act[:maintenance][:set]==:on + if @sql_type ==:sqlite + puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" + end @db=SiSU_Env::InfoDb.new @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql" - File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') + if @sql_type ==:sqlite + File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') + else + File.new("#{@env.processing_path.postgresql}/#{@opt.fns}.sql",'w+') + end elsif @opt.fns \ and @opt.fns.inspect =~/create/ nil #sort variations later -- cgit v1.2.3 From 1f0232a256c2b64404d4be85af29c1bf9bde3bce Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:26:15 -0400 Subject: v5 v6: bin/sisu, hub, urls --maintenance, fix --- lib/sisu/v5/hub.rb | 15 ++-- lib/sisu/v5/hub_actions.rb | 2 +- lib/sisu/v5/hub_options.rb | 2 +- lib/sisu/v5/urls.rb | 182 +++++++++++++++-------------------------- lib/sisu/v6/hub.rb | 15 ++-- lib/sisu/v6/hub_actions.rb | 2 +- lib/sisu/v6/hub_options.rb | 2 +- lib/sisu/v6/urls.rb | 198 ++++++++++++++++++--------------------------- 8 files changed, 162 insertions(+), 256 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 10ac6f23..70a4e360 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -257,16 +257,17 @@ module SiSU end end class HubClose - def initialize(call_path) + def initialize(call_path,argv) begin - @env=SiSU_Env::InfoEnv.new + env=SiSU_Env::InfoEnv.new rescue ensure - if FileTest.directory?(@env.processing_path.processing) \ - and FileTest.directory?(@env.processing_path.processing_base_tmp) \ - and @env.processing_path.processing_base_tmp =~/#{@env.processing_path.processing}/ \ - and @env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ - FileUtils::cd(@env.processing_path.processing_base_tmp) do + if FileTest.directory?(env.processing_path.processing) \ + and FileTest.directory?(env.processing_path.processing_base_tmp) \ + and env.processing_path.processing_base_tmp =~/#{env.processing_path.processing}/ \ + and env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ \ + and not argv.inspect =~/"--maintenance"|"-M"/ + FileUtils::cd(env.processing_path.processing_base_tmp) do FileUtils::rm_rf('.') end end diff --git a/lib/sisu/v5/hub_actions.rb b/lib/sisu/v5/hub_actions.rb index 3d2e112b..6c97aa4b 100644 --- a/lib/sisu/v5/hub_actions.rb +++ b/lib/sisu/v5/hub_actions.rb @@ -839,7 +839,7 @@ module SiSU_Hub_Actions end end def urls? - if @opt.act[:urls_selected][:set]==:on #% --sitemap, -Y + if @opt.act[:urls_selected][:set]==:on #% --urls if @opt.f_pths.length > 0 require_relative 'urls' SiSU_Hub_Loops::OptionLoopFiles.new(@opt). diff --git a/lib/sisu/v5/hub_options.rb b/lib/sisu/v5/hub_options.rb index 9e35cc36..d267cb74 100644 --- a/lib/sisu/v5/hub_options.rb +++ b/lib/sisu/v5/hub_options.rb @@ -1384,7 +1384,7 @@ module SiSU_Commandline =~/"--harvest/ { bool: false, set: :off } elsif select_arr.inspect \ - =~/"--verbose"/ + =~/"--verbose"|"--maintenance"/ { bool: true, set: :on } else { bool: false, set: :na } diff --git a/lib/sisu/v5/urls.rb b/lib/sisu/v5/urls.rb index 6c8cb1ec..33781603 100644 --- a/lib/sisu/v5/urls.rb +++ b/lib/sisu/v5/urls.rb @@ -124,85 +124,24 @@ module SiSU_Urls + x[:f_pth] ).result end - self - end - def urls_maintenance(opt,x,y) - if x=~/^([abcehHmNoptwxXy])/ \ - and opt.cmd =~/[abcehHmNoptwxXy]/ \ - and x=~/^[#{opt.cmd}]/ \ - and (@opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - tool=@prog.text_editor - if x =~/^m/ \ - and @opt.cmd=~/m/ \ - and x=~/^[#{opt.cmd}]/ - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.ao}/#{@opt.fns}.meta" - ).maintenance - end - if x=~/^([hw])/ \ - and @opt.cmd=~/[hw]/ \ - and x=~/^[#{@opt.cmd}]/ \ - and x !~/segmented/ - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.tune}/#{@md.fns}.tune" - ).maintenance - end - if x=~/^p/ \ - and @opt.cmd=~/p/ \ - and x=~/^[#{@opt.cmd}]/ - tool=@prog.pdf_viewer - fns=@opt.fns.gsub(/~/,'-') - unless @opt.cmd =~/q/ - tell=if x =~/landscape/ - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.landscape.tex" - ) - else - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.tex" - ) - end - tell.maintenance - end - end - if x=~/^o/ \ - and @opt.cmd=~/o/ \ - and x=~/^[#{@opt.cmd}]/ - tool=@prog.odf_viewer - end - if x=~/^e/ \ - and @opt.cmd=~/e/ \ - and x=~/^[#{@opt.cmd}]/ + def maintenance(x) + if @opt.act[:maintenance][:set]==:on SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.epub}/#{Ep[:d_oebps]}/toc.xhtml" - ).maintenance - end - if x=~/^o/ \ - and @opt.cmd=~/o/ \ - and x=~/^[#{@opt.cmd}]/ - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.odf}/#{@opt.fns}/odt/content.xml" + "[#{@opt.f_pth[:lng_is]}]", + x[:cmd], + x[:p_pth] ).maintenance end end + self end def report_info def dal { cmd: '--ao', + p_pth: @env.processing_path.ao + '/' \ + + @opt.fns + '.meta', fn: 'ao', } end @@ -270,6 +209,8 @@ module SiSU_Urls viewer: @prog.web_browser, f_pth: @md.file.output_path.html_seg.dir + '/' \ + @md.file.base_filename.html_segtoc, + p_pth: @env.processing_path.tune + '/' \ + + @md.fns + '.tune', fn: @fn[:toc], } end @@ -279,6 +220,8 @@ module SiSU_Urls viewer: @prog.web_browser, f_pth: @md.file.output_path.html_scroll.dir + '/' \ + @md.file.base_filename.html_scroll, + p_pth: @env.processing_path.tune + '/' \ + + @md.fns + '.tune', fn: @fn[:doc], } end @@ -300,6 +243,8 @@ module SiSU_Urls viewer: @prog.web_browser, f_pth: @md.file.output_path.xhtml.dir + '/' \ + @md.file.base_filename.xhtml, + p_pth: @env.processing_path.tune + '/' \ + + @md.fns + '.tune', fn: @fn[:xhtml], } end @@ -309,6 +254,9 @@ module SiSU_Urls viewer: @prog.epub_viewer, f_pth: @md.file.output_path.epub.dir + '/' \ + @md.file.base_filename.epub, + p_pth: @env.processing_path.epub + '/' \ + + Ep[:d_oebps] + '/' \ + + 'index.xhtml', fn: @fn[:epub], } end @@ -321,6 +269,9 @@ module SiSU_Urls viewer: @prog.odf_viewer, f_pth: @md.file.output_path.odt.dir + '/' \ + @md.file.base_filename.odt, + p_pth: @env.processing_path.odf + '/' \ + + @opt.fns + '/' \ + + 'odt/content.xml', fn: @fn[:odf], } end @@ -388,6 +339,10 @@ module SiSU_Urls f_pth: @md.file.output_path.pdf.dir + '/' \ + @md.file.base_filename.pdf_l \ + @md.papersize_array[0] + '.pdf', + p_pth: @env.processing_path.tex + '/' \ + + @opt.fns.gsub(/~/,'-') + '.' \ + + @md.papersize_array[0] \ + + '.landscape.tex', fn: @fn[:pdf_l], } end @@ -398,6 +353,10 @@ module SiSU_Urls f_pth: @md.file.output_path.pdf.dir + '/' \ + @md.file.base_filename.pdf_p \ + @md.papersize_array[0] + '.pdf', + p_pth: @env.processing_path.tex + '/' \ + + @opt.fns.gsub(/~/,'-') + '.' \ + + @md.papersize_array[0] \ + + '.tex', fn: @fn[:pdf_p], } end @@ -432,6 +391,9 @@ module SiSU_Urls f_pth: @pwd_stub + '::' \ + @opt.fns \ + 'dbi psql', + p_pth: @env.processing_path.postgresql + '/' \ + + @md.fns \ + + '.sql', fn: 'dbi psql', } end @@ -442,15 +404,21 @@ module SiSU_Urls f_pth: @env.path.webserv + '/' \ + @md.opt.f_pth[:pth_stub] + '/' \ + 'sisu_sqlite.db', + p_pth: @env.processing_path.sqlite + '/' \ + + @md.fns \ + + '.sql', fn: 'dbi sqlite3', } end def sqlite_discrete { - cmd: '--sqlite --update/--import', + cmd: '--sqlite', viewer: 'sqlite3 ', f_pth: @md.file.output_path.sqlite_discrete.dir + '/' \ + @md.file.base_filename.sqlite_discrete, + p_pth: @env.processing_path.sqlite + '/' \ + + @md.fns \ + + '.sql', fn: 'dbi sqlite3', } end @@ -485,15 +453,21 @@ module SiSU_Urls viewer: @prog.text_editor, f_pth: @md.file.output_path.src.dir + '/' \ + @opt.fno, + p_pth: @md.file.output_path.src.dir + '/' \ + + @opt.fno, fn: @opt.fno, } end def sisupod { cmd: '--sisupod', - viewer: @prog.web_browser, + viewer: '', f_pth: @md.file.output_path.sisupod.dir + '/' \ - + @opt.fno, + + @opt.fno \ + + '.txz', + p_pth: @md.file.output_path.sisupod.dir + '/' \ + + @opt.fno + '/' \ + + 'sisupod/', fn: @fn[:sisupod], } end @@ -559,7 +533,7 @@ module SiSU_Urls ).flow end end - m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m + m=/.+\/(?:src\/)?(\S+)/im @pwd_stub="#{@env.url.output_tell}"[m,1] unless @opt.act[:quiet][:set]==:on if @opt.fns =~ @m_regular @@ -586,9 +560,11 @@ module SiSU_Urls or @opt.act[:html_seg][:set]==:on) if @opt.act[:html_scroll][:set]==:on show.report(report_info.html.scroll) + show.maintenance(report_info.html.scroll) end if @opt.act[:html_seg][:set]==:on show.report(report_info.html.seg) + show.maintenance(report_info.html.seg) end end if @opt.act[:concordance][:set]==:on @@ -596,12 +572,15 @@ module SiSU_Urls end if @opt.act[:xhtml][:set]==:on show.report(report_info.xhtml.xhtml) + show.maintenance(report_info.xhtml.xhtml) end if @opt.act[:epub][:set]==:on show.report(report_info.xhtml.epub) + show.maintenance(report_info.xhtml.epub) end if @opt.act[:odt][:set]==:on show.report(report_info.xml.odt) + show.maintenance(report_info.xml.odt) end if @opt.act[:xml_dom][:set]==:on show.report(report_info.xml.dom) @@ -626,19 +605,24 @@ module SiSU_Urls or @opt.act[:pdf_l][:set]==:on) if @opt.act[:pdf_p][:set]==:on show.report(report_info.pdf.portrait) + show.maintenance(report_info.pdf.portrait) end if @opt.act[:pdf_l][:set]==:on show.report(report_info.pdf.landscape) + show.maintenance(report_info.pdf.landscape) end end if @opt.act[:psql][:set]==:on show.report(report_info.db.psql) + show.maintenance(report_info.db.psql) end if @opt.act[:sqlite_discrete][:set]==:on show.report(report_info.db.sqlite_discrete) + show.maintenance(report_info.db.sqlite_discrete) end if @opt.act[:sqlite][:set]==:on show.report(report_info.db.sqlite) + show.maintenance(report_info.db.sqlite) end if @opt.act[:texinfo][:set]==:on show.report(report_info.texinfo) @@ -650,30 +634,26 @@ module SiSU_Urls show.report(report_info.hash_digests) end if @opt.act[:po4a][:set]==:on - if @opt.fns =~/\S+?~\S{2}(?:_\S{2})?\.ss[mt]/ - f=y.gsub(/\.pot$/,'.po') - show.po4a.po(x,f) - else - show.po4a.pot(x,f) - end + #if @opt.fns =~/\S+?~\S{2}(?:_\S{2})?\.ss[mt]/ + #else + #end end if @opt.act[:share_source][:set]==:on show.report(report_info.source) + show.maintenance(report_info.source) end if @opt.act[:sisupod][:set]==:on show.report(report_info.sisupod) + show.maintenance(report_info.sisupod) end if @opt.act[:qrcode][:set]==:on show.report(report_info.qrcode) end if @opt.act[:manifest][:set]==:on show.report(report_info.manifest) + show.maintenance(report_info.manifest) end end - if (@opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - urls_maintenance(@opt,x,y) - end end end end @@ -684,42 +664,6 @@ module SiSU_Urls 'URLs', i ).grey_title_hi - @u.each do |x,y| - case x - when /^m/ - show.meta(x,y) - when /^[BcdNsxXy]/ - show.generic(x,y) - when /^[at]/ - show.text(x) - when /^b/ - show.xhtml(x) - when /^e/ - show.epub(x) - when /^h/ - if x =~/scroll/ - show.html.scroll(x) - else - show.html.toc(x) - end - when /^o/ - show.odt(x) - when /^p/ - if x =~/portrait/ - show.pdf.portrait(x) - else - show.pdf.landscape(x) - end - when /^w/ - show.html.concordance(x) - when /^Y/ - show.xml.sitemap(x) - when /^I/ - show.pinfo(x,y) - when /^i/ - show.manpage(x) - end - end end end end diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb index 87c7040e..a5425528 100644 --- a/lib/sisu/v6/hub.rb +++ b/lib/sisu/v6/hub.rb @@ -257,16 +257,17 @@ module SiSU end end class HubClose - def initialize(call_path) + def initialize(call_path,argv) begin - @env=SiSU_Env::InfoEnv.new + env=SiSU_Env::InfoEnv.new rescue ensure - if FileTest.directory?(@env.processing_path.processing) \ - and FileTest.directory?(@env.processing_path.processing_base_tmp) \ - and @env.processing_path.processing_base_tmp =~/#{@env.processing_path.processing}/ \ - and @env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ - FileUtils::cd(@env.processing_path.processing_base_tmp) do + if FileTest.directory?(env.processing_path.processing) \ + and FileTest.directory?(env.processing_path.processing_base_tmp) \ + and env.processing_path.processing_base_tmp =~/#{env.processing_path.processing}/ \ + and env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ \ + and not argv.inspect =~/"--maintenance"|"-M"/ + FileUtils::cd(env.processing_path.processing_base_tmp) do FileUtils::rm_rf('.') end end diff --git a/lib/sisu/v6/hub_actions.rb b/lib/sisu/v6/hub_actions.rb index 3b3201d6..e7e42bd2 100644 --- a/lib/sisu/v6/hub_actions.rb +++ b/lib/sisu/v6/hub_actions.rb @@ -839,7 +839,7 @@ module SiSU_Hub_Actions end end def urls? - if @opt.act[:urls_selected][:set]==:on #% --sitemap, -Y + if @opt.act[:urls_selected][:set]==:on #% --urls if @opt.f_pths.length > 0 require_relative 'urls' SiSU_Hub_Loops::OptionLoopFiles.new(@opt). diff --git a/lib/sisu/v6/hub_options.rb b/lib/sisu/v6/hub_options.rb index f8085c6c..fb58f396 100644 --- a/lib/sisu/v6/hub_options.rb +++ b/lib/sisu/v6/hub_options.rb @@ -1384,7 +1384,7 @@ module SiSU_Commandline =~/"--harvest/ { bool: false, set: :off } elsif select_arr.inspect \ - =~/"--verbose"/ + =~/"--verbose"|"--maintenance"/ { bool: true, set: :on } else { bool: false, set: :na } diff --git a/lib/sisu/v6/urls.rb b/lib/sisu/v6/urls.rb index c89bbafa..b4bf9d23 100644 --- a/lib/sisu/v6/urls.rb +++ b/lib/sisu/v6/urls.rb @@ -124,85 +124,24 @@ module SiSU_Urls + x[:f_pth] ).result end - self - end - def urls_maintenance(opt,x,y) - if x=~/^([abcehHmNoptwxXy])/ \ - and opt.cmd =~/[abcehHmNoptwxXy]/ \ - and x=~/^[#{opt.cmd}]/ \ - and (@opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - tool=@prog.text_editor - if x =~/^m/ \ - and @opt.cmd=~/m/ \ - and x=~/^[#{opt.cmd}]/ - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.ao}/#{@opt.fns}.meta" - ).maintenance - end - if x=~/^([hw])/ \ - and @opt.cmd=~/[hw]/ \ - and x=~/^[#{@opt.cmd}]/ \ - and x !~/segmented/ - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.tune}/#{@md.fns}.tune" - ).maintenance - end - if x=~/^p/ \ - and @opt.cmd=~/p/ \ - and x=~/^[#{@opt.cmd}]/ - tool=@prog.pdf_viewer - fns=@opt.fns.gsub(/~/,'-') - unless @opt.cmd =~/q/ - tell=if x =~/landscape/ - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.landscape.tex" - ) - else - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.tex}/#{fns}.tex" - ) - end - tell.maintenance - end - end - if x=~/^o/ \ - and @opt.cmd=~/o/ \ - and x=~/^[#{@opt.cmd}]/ - tool=@prog.odf_viewer - end - if x=~/^e/ \ - and @opt.cmd=~/e/ \ - and x=~/^[#{@opt.cmd}]/ + def maintenance(x) + if @opt.act[:maintenance][:set]==:on SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.epub}/#{Ep[:d_oebps]}/toc.xhtml" - ).maintenance - end - if x=~/^o/ \ - and @opt.cmd=~/o/ \ - and x=~/^[#{@opt.cmd}]/ - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "-#{x}", - "#{@prog.text_editor} #{@env.processing_path.odf}/#{@opt.fns}/odt/content.xml" + "[#{@opt.f_pth[:lng_is]}]", + x[:cmd], + x[:p_pth] ).maintenance end end + self end def report_info def dal { cmd: '--ao', + p_pth: @env.processing_path.ao + '/' \ + + @opt.fns + '.meta', fn: 'ao', } end @@ -270,6 +209,8 @@ module SiSU_Urls viewer: @prog.web_browser, f_pth: @md.file.output_path.html_seg.dir + '/' \ + @md.file.base_filename.html_segtoc, + p_pth: @env.processing_path.tune + '/' \ + + @md.fns + '.tune', fn: @fn[:toc], } end @@ -279,6 +220,8 @@ module SiSU_Urls viewer: @prog.web_browser, f_pth: @md.file.output_path.html_scroll.dir + '/' \ + @md.file.base_filename.html_scroll, + p_pth: @env.processing_path.tune + '/' \ + + @md.fns + '.tune', fn: @fn[:doc], } end @@ -300,6 +243,8 @@ module SiSU_Urls viewer: @prog.web_browser, f_pth: @md.file.output_path.xhtml.dir + '/' \ + @md.file.base_filename.xhtml, + p_pth: @env.processing_path.tune + '/' \ + + @md.fns + '.tune', fn: @fn[:xhtml], } end @@ -309,6 +254,9 @@ module SiSU_Urls viewer: @prog.epub_viewer, f_pth: @md.file.output_path.epub.dir + '/' \ + @md.file.base_filename.epub, + p_pth: @env.processing_path.epub + '/' \ + + Ep[:d_oebps] + '/' \ + + 'index.xhtml', fn: @fn[:epub], } end @@ -321,6 +269,9 @@ module SiSU_Urls viewer: @prog.odf_viewer, f_pth: @md.file.output_path.odt.dir + '/' \ + @md.file.base_filename.odt, + p_pth: @env.processing_path.odf + '/' \ + + @opt.fns + '/' \ + + 'odt/content.xml', fn: @fn[:odf], } end @@ -388,6 +339,10 @@ module SiSU_Urls f_pth: @md.file.output_path.pdf.dir + '/' \ + @md.file.base_filename.pdf_l \ + @md.papersize_array[0] + '.pdf', + p_pth: @env.processing_path.tex + '/' \ + + @opt.fns.gsub(/~/,'-') + '.' \ + + @md.papersize_array[0] \ + + '.landscape.tex', fn: @fn[:pdf_l], } end @@ -398,6 +353,10 @@ module SiSU_Urls f_pth: @md.file.output_path.pdf.dir + '/' \ + @md.file.base_filename.pdf_p \ + @md.papersize_array[0] + '.pdf', + p_pth: @env.processing_path.tex + '/' \ + + @opt.fns.gsub(/~/,'-') + '.' \ + + @md.papersize_array[0] \ + + '.tex', fn: @fn[:pdf_p], } end @@ -432,6 +391,9 @@ module SiSU_Urls f_pth: @pwd_stub + '::' \ + @opt.fns \ + 'dbi psql', + p_pth: @env.processing_path.postgresql + '/' \ + + @md.fns \ + + '.sql', fn: 'dbi psql', } end @@ -442,15 +404,21 @@ module SiSU_Urls f_pth: @env.path.webserv + '/' \ + @md.opt.f_pth[:pth_stub] + '/' \ + 'sisu_sqlite.db', + p_pth: @env.processing_path.sqlite + '/' \ + + @md.fns \ + + '.sql', fn: 'dbi sqlite3', } end def sqlite_discrete { - cmd: '--sqlite --update/--import', + cmd: '--sqlite', viewer: 'sqlite3 ', f_pth: @md.file.output_path.sqlite_discrete.dir + '/' \ + @md.file.base_filename.sqlite_discrete, + p_pth: @env.processing_path.sqlite + '/' \ + + @md.fns \ + + '.sql', fn: 'dbi sqlite3', } end @@ -485,15 +453,21 @@ module SiSU_Urls viewer: @prog.text_editor, f_pth: @md.file.output_path.src.dir + '/' \ + @opt.fno, + p_pth: @md.file.output_path.src.dir + '/' \ + + @opt.fno, fn: @opt.fno, } end def sisupod { cmd: '--sisupod', - viewer: @prog.web_browser, + viewer: '', f_pth: @md.file.output_path.sisupod.dir + '/' \ - + @opt.fno, + + @opt.fno \ + + '.txz', + p_pth: @md.file.output_path.sisupod.dir + '/' \ + + @opt.fno + '/' \ + + 'sisupod/', fn: @fn[:sisupod], } end @@ -559,7 +533,7 @@ module SiSU_Urls ).flow end end - m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m + m=/.+\/(?:src\/)?(\S+)/im @pwd_stub="#{@env.url.output_tell}"[m,1] unless @opt.act[:quiet][:set]==:on if @opt.fns =~ @m_regular @@ -568,112 +542,134 @@ module SiSU_Urls || @opt.act[:maintenance][:set]==:on) if @opt.act[:txt][:set]==:on show.report(report_info.text.txt) + #show.maintenance(report_info.text.txt) end if @opt.act[:txt_textile][:set]==:on show.report(report_info.text.textile) + #show.maintenance(report_info.text.textile) end if @opt.act[:txt_asciidoc][:set]==:on show.report(report_info.text.asciidoc) + #show.maintenance(report_info.text.asciidoc) end if @opt.act[:txt_markdown][:set]==:on show.report(report_info.text.markdown) + #show.maintenance(report_info.text.markdown) end if @opt.act[:txt_rst][:set]==:on show.report(report_info.text.rst) + #show.maintenance(report_info.text.rst) end if (@opt.act[:html][:set]==:on \ or @opt.act[:html_scroll][:set]==:on \ or @opt.act[:html_seg][:set]==:on) if @opt.act[:html_scroll][:set]==:on show.report(report_info.html.scroll) + show.maintenance(report_info.html.scroll) end if @opt.act[:html_seg][:set]==:on show.report(report_info.html.seg) + show.maintenance(report_info.html.seg) end end if @opt.act[:concordance][:set]==:on show.report(report_info.html.concordance) + #show.maintenance(report_info.html.concordance) end if @opt.act[:xhtml][:set]==:on show.report(report_info.xhtml.xhtml) + show.maintenance(report_info.xhtml.xhtml) end if @opt.act[:epub][:set]==:on show.report(report_info.xhtml.epub) + show.maintenance(report_info.xhtml.epub) end if @opt.act[:odt][:set]==:on show.report(report_info.xml.odt) + show.maintenance(report_info.xml.odt) end if @opt.act[:xml_dom][:set]==:on show.report(report_info.xml.dom) + #show.maintenance(report_info.xml.dom) end if @opt.act[:xml_sax][:set]==:on show.report(report_info.xml.sax) + #show.maintenance(report_info.xml.sax) end if @opt.act[:xml_docbook_book][:set]==:on show.report(report_info.xml.docbook) + #show.maintenance(report_info.xml.docbook) end if @opt.act[:xml_fictionbook][:set]==:on show.report(report_info.xml.fictionbook) + #show.maintenance(report_info.xml.fictionbook) end if @opt.act[:xml_scaffold_structure_sisu][:set]==:on show.report(report_info.xml.scaffold_structure_sisu) + #show.maintenance(report_info.xml.scaffold_structure_sisu) end if @opt.act[:xml_scaffold_structure_collapse][:set]==:on show.report(report_info.xml.scaffold_collapse) + #show.maintenance(report_info.xml.scaffold_collapse) end if (@opt.act[:pdf][:set]==:on \ or @opt.act[:pdf_p][:set]==:on \ or @opt.act[:pdf_l][:set]==:on) if @opt.act[:pdf_p][:set]==:on show.report(report_info.pdf.portrait) + show.maintenance(report_info.pdf.portrait) end if @opt.act[:pdf_l][:set]==:on show.report(report_info.pdf.landscape) + show.maintenance(report_info.pdf.landscape) end end if @opt.act[:psql][:set]==:on show.report(report_info.db.psql) + show.maintenance(report_info.db.psql) end if @opt.act[:sqlite_discrete][:set]==:on show.report(report_info.db.sqlite_discrete) + show.maintenance(report_info.db.sqlite_discrete) end if @opt.act[:sqlite][:set]==:on show.report(report_info.db.sqlite) + show.maintenance(report_info.db.sqlite) end if @opt.act[:texinfo][:set]==:on show.report(report_info.texinfo) + #show.maintenance(report_info.texinfo) end if @opt.act[:manpage][:set]==:on show.report(report_info.manpage) + #show.maintenance(report_info.manpage) end if @opt.act[:hash_digests][:set]==:on show.report(report_info.hash_digests) + #show.maintenance(report_info.hash_digests) end if @opt.act[:po4a][:set]==:on - if @opt.fns =~/\S+?~\S{2}(?:_\S{2})?\.ss[mt]/ - f=y.gsub(/\.pot$/,'.po') - show.po4a.po(x,f) - else - show.po4a.pot(x,f) - end + #if @opt.fns =~/\S+?~\S{2}(?:_\S{2})?\.ss[mt]/ + #else + #end end if @opt.act[:share_source][:set]==:on show.report(report_info.source) + show.maintenance(report_info.source) end if @opt.act[:sisupod][:set]==:on show.report(report_info.sisupod) + show.maintenance(report_info.sisupod) end if @opt.act[:qrcode][:set]==:on show.report(report_info.qrcode) + #show.maintenance(report_info.qrcode) end if @opt.act[:manifest][:set]==:on show.report(report_info.manifest) + show.maintenance(report_info.manifest) end end - if (@opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - urls_maintenance(@opt,x,y) - end end end end @@ -684,42 +680,6 @@ module SiSU_Urls 'URLs', i ).grey_title_hi - @u.each do |x,y| - case x - when /^m/ - show.meta(x,y) - when /^[BcdNsxXy]/ - show.generic(x,y) - when /^[at]/ - show.text(x) - when /^b/ - show.xhtml(x) - when /^e/ - show.epub(x) - when /^h/ - if x =~/scroll/ - show.html.scroll(x) - else - show.html.toc(x) - end - when /^o/ - show.odt(x) - when /^p/ - if x =~/portrait/ - show.pdf.portrait(x) - else - show.pdf.landscape(x) - end - when /^w/ - show.html.concordance(x) - when /^Y/ - show.xml.sitemap(x) - when /^I/ - show.pinfo(x,y) - when /^i/ - show.manpage(x) - end - end end end end -- cgit v1.2.3 From 61b9cb507a5be25b69ca870f3ec379ef1863c124 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:29:43 -0400 Subject: v5 v6: moved files: harvest* to html_harvest* --- lib/sisu/v5/harvest.rb | 114 ---- lib/sisu/v5/harvest_author_format.rb | 114 ---- lib/sisu/v5/harvest_authors.rb | 470 ---------------- lib/sisu/v5/harvest_topics.rb | 900 ------------------------------ lib/sisu/v5/html_harvest.rb | 114 ++++ lib/sisu/v5/html_harvest_author_format.rb | 114 ++++ lib/sisu/v5/html_harvest_authors.rb | 470 ++++++++++++++++ lib/sisu/v5/html_harvest_topics.rb | 900 ++++++++++++++++++++++++++++++ lib/sisu/v5/hub_actions.rb | 2 +- lib/sisu/v6/harvest.rb | 114 ---- lib/sisu/v6/harvest_author_format.rb | 114 ---- lib/sisu/v6/harvest_authors.rb | 470 ---------------- lib/sisu/v6/harvest_topics.rb | 900 ------------------------------ lib/sisu/v6/html_harvest.rb | 114 ++++ lib/sisu/v6/html_harvest_author_format.rb | 114 ++++ lib/sisu/v6/html_harvest_authors.rb | 470 ++++++++++++++++ lib/sisu/v6/html_harvest_topics.rb | 900 ++++++++++++++++++++++++++++++ lib/sisu/v6/hub_actions.rb | 2 +- 18 files changed, 3198 insertions(+), 3198 deletions(-) delete mode 100644 lib/sisu/v5/harvest.rb delete mode 100644 lib/sisu/v5/harvest_author_format.rb delete mode 100644 lib/sisu/v5/harvest_authors.rb delete mode 100644 lib/sisu/v5/harvest_topics.rb create mode 100644 lib/sisu/v5/html_harvest.rb create mode 100644 lib/sisu/v5/html_harvest_author_format.rb create mode 100644 lib/sisu/v5/html_harvest_authors.rb create mode 100644 lib/sisu/v5/html_harvest_topics.rb delete mode 100644 lib/sisu/v6/harvest.rb delete mode 100644 lib/sisu/v6/harvest_author_format.rb delete mode 100644 lib/sisu/v6/harvest_authors.rb delete mode 100644 lib/sisu/v6/harvest_topics.rb create mode 100644 lib/sisu/v6/html_harvest.rb create mode 100644 lib/sisu/v6/html_harvest_author_format.rb create mode 100644 lib/sisu/v6/html_harvest_authors.rb create mode 100644 lib/sisu/v6/html_harvest_topics.rb (limited to 'lib') diff --git a/lib/sisu/v5/harvest.rb b/lib/sisu/v5/harvest.rb deleted file mode 100644 index 87f81bc9..00000000 --- a/lib/sisu/v5/harvest.rb +++ /dev/null @@ -1,114 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - harvest metadata from document corpus (suitable for medium sized sites) - (concept example, [to remove size constraint: implement SQL equivalent]) - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Git - - - - * Ralph Amissah - - - - ** Description: system environment, resource control and configuration details - -=end -module SiSU_Harvest - @@the_idx_topics,@@the_idx_authors={},{} - class Source - require_relative 'hub_options' # hub_options.rb - require_relative 'harvest_topics' # harvest_topics.rb - require_relative 'harvest_authors' # harvest_authors.rb - require_relative 'se' # se.rb - include SiSU_Env - def initialize(opt) - @opt=opt - @env=SiSU_Env::InfoEnv.new - end - def read - begin - harvest_pth=@env.path.webserv + '/' + @opt.base_stub - FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth) - cases(@opt,@env) - rescue - ensure - SiSU_Env::CreateSite.new(@opt).cp_css - end - end - def help - puts <. - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Git - - - - * Ralph Amissah - - - - ** Description: system environment, resource control and configuration details - -=end -module SiSU_FormatAuthor - class Author - def initialize(author_param) - @author_param=author_param - end - def author_details - @authors,@author_array=[],[] - authors=@author_param.scan(/[^;]+/) - authors.each do |a| - a=a.strip - if a =~/"(.+?)"/ - @authors << { the: $1 } - @author_array << $1.upcase - else #if a =~/,/ - x=a.scan(/[^,]+/) - x[0]=x[0].strip - x[1]=x[1].strip if x[1] - if x.length==1 - @authors << { the: x[0] } - @author_array << x[0].upcase - elsif x.length==2 - @authors << { the: x[0], others: x[1] } - @author_array << "#{x[0].upcase}, #{x[1]}" - else #p x.length - end - end - end - l = @authors.length - authors_string='' - @authors.each_with_index do |a,i| - authors_string += if a[:others] - if (l - i) > 1 - "#{a[:others]} #{a[:the]}, " - else - "#{a[:others]} #{a[:the]}" - end - else - if (l - i) > 2 - "#{a[:the]}, " - else - "#{a[:the]}" - end - end - end - { - last_first_a: authors, - last_first_format_a: @author_array, - authors_h: @authors, - authors_s: authors_string, - authors_param: @author_param - } - end - end -end -__END__ diff --git a/lib/sisu/v5/harvest_authors.rb b/lib/sisu/v5/harvest_authors.rb deleted file mode 100644 index 8db14eee..00000000 --- a/lib/sisu/v5/harvest_authors.rb +++ /dev/null @@ -1,470 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - metadata harvest, extract authors and their writings from document set - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Git - - - - * Ralph Amissah - - - - ** Description: simple xml representation (sax style) - -=end -module SiSU_HarvestAuthors - require_relative 'harvest_author_format' # harvest_author_format.rb - class Songsheet - @@the_idx_authors={} - def initialize(opt,env) - @opt,@env=opt,env - @file_list=opt.files - end - def songsheet - idx_array={} - @opt.f_pths.each do |y| - lang_hash_file_array={} - 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 - lang_hash_file_array[y[:lng_is]] ||= [] - lang_hash_file_array[y[:lng_is]] << line - elsif line =~/^@\S+?:(?:\s|$)/m \ - or line =~/^(?:\s*\n|%+ )/ - else break - end - end - end - lang_hash_file_array.each_pair do |lang,a| - idx_array[lang] ||= [] - idx_array=SiSU_HarvestAuthors::Harvest.new( - @opt, - @env, - a, - filename, - name, - idx_array, - lang - ).extract_harvest - end - end - the_idx=SiSU_HarvestAuthors::Index.new( - idx_array, - @@the_idx_authors - ).construct_book_author_index - SiSU_HarvestAuthors::OutputIndex.new( - @opt, - the_idx - ).html_print.html_songsheet - end - end - class Harvest - def initialize(opt,env,data,filename,name,idx_array,lang) - @opt, @env,@data,@filename,@name,@idx_array,@lang= - opt,env, data, filename, name, idx_array, lang - end - def extract_harvest - data, filename, name, idx_array, lang = - @data,@filename,@name,@idx_array,@lang - @title=@subtitle=@fulltitle=@author=@author_format=@date=nil - @authors=[] - rgx={} - rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m - rgx[:title]=/^@title:[ ]+(.+)/ - rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m - rgx[:date]=/^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m - data.each do |para| - if para=~ rgx[:title] - @title=rgx[:title].match(para)[1] - end - if para=~ rgx[:subtitle] - @subtitle=rgx[:subtitle].match(para)[1] - end - if para=~ rgx[:author] - @author_format=rgx[:author].match(para)[1] - end - if para=~ rgx[:date] - @date=rgx[:date].match(para)[1] - end - break if @title && @subtitle && @author && @date - end - @fulltitle=@subtitle \ - ? (@title + ' - ' + @subtitle) - : @title - if @title \ - and @author_format - creator=SiSU_FormatAuthor::Author.new(@author_format.strip).author_details - @authors,@authorship=creator[:authors],creator[:authorship] - file=if name=~/~[a-z]{2,3}\.ss[mt]$/ - name.sub(/~[a-z]{2,3}\.ss[mt]$/,'') - else - name.sub(/\.ss[mt]$/,'') - end - page=if @env.output_dir_structure.by? == :language - "#{lang}/sisu_manifest.html" - else - "sisu_manifest.#{lang}.html" - end - idx_array[lang] <<= { - filename: filename, - file: file, - date: @date, - title: @fulltitle, - author: creator, - page: page, - lang: lang - } - else - #p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}" - end - idx_array[lang]=idx_array[lang].flatten - idx_array - end - end - class Index - def initialize(idx_array,the_idx) - @idx_array,@the_idx=idx_array,the_idx - @@the_idx_authors=@the_idx - end - def capital(txt) - txt[0].chr.capitalize + txt[1,txt.length] - end - def construct_book_author_index - idx_array=@idx_array - idx_array.each_pair do |lang,idx_arr| - @@the_idx_authors[lang] ||= {} - idx_arr.each do |idx| - idx[:author][:last_first_format_a].each do |author| - author=author.strip - if @@the_idx_authors[lang][author].is_a?(NilClass) - @@the_idx_authors[lang][author]={ md: [] } - end - @@the_idx_authors[lang][author][:md] << { - filename: idx[:filename], - file: idx[:file], - author: idx[:author], - title: idx[:title], - date: idx[:date], - page: idx[:page], - lang: idx[:lang] - } - end - end - end - @the_idx=@@the_idx_authors - end - end - class OutputIndex - require_relative 'i18n' # i18n.rb - def initialize(opt,the_idx) - @opt,@the_idx=opt,the_idx - @env=SiSU_Env::InfoEnv.new - @rc=SiSU_Env::GetInit.new.sisu_yaml.rc - @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] - @alph=@alphabet_list.dup - @letter=@alph.shift - @vz=SiSU_Viz::Defaults.new - end - def html_file_open - @the_idx.keys.each do |lng| - @output ||={} - @output[lng] ||={} - harvest_pth,file='','' - if @env.output_dir_structure.by? == :language - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub + '/' \ - + lng + '/' \ - + 'manifest' - file="#{harvest_pth}/authors.html" - elsif @env.output_dir_structure.by? == :filetype - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub + '/' \ - + 'manifest' - file="#{harvest_pth}/authors.#{lng}.html" - elsif @env.output_dir_structure.by? == :filename - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub - file="#{harvest_pth}/authors.#{lng}.html" - end - FileUtils::mkdir_p(harvest_pth) \ - unless FileTest.directory?(harvest_pth) - fileinfo=(@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:urls_selected][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) \ - ? ("file://#{file}") : '' - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "harvest authors (#{@opt.files.length} files)", - fileinfo - ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on - @output[lng][:html]=File.new(file,'w') - end - end - def html_file_close - @the_idx.keys.each do |lng| - @output[lng][:html].close - @output[lng][:html_mnt].close \ - if @output[lng][:html_mnt].is_a?(File) - end - end - def html_print - def html_songsheet - html_file_open - html_head - html_alph - html_body - html_tail - html_file_close - end - def html_head_adjust(lng,type='') - css_path,topics='','' - if @env.output_dir_structure.by? == :language - css_path=(type !~/maintenance/) \ - ? '../../_sisu/css/harvest.css' - : 'harvest.css' - topics='topics.html' - elsif @env.output_dir_structure.by? == :filetype - css_path=(type !~/maintenance/) \ - ? '../_sisu/css/harvest.css' - : 'harvest.css' - topics="topics.#{lng}.html" - elsif @env.output_dir_structure.by? == :filename - css_path=(type !~/maintenance/) \ - ? './_sisu/css/harvest.css' - : 'harvest.css' - topics="topics.#{lng}.html" - end - ln=SiSU_i18n::Languages.new.language.list - harvest_languages='' - @the_idx.keys.each do |lg| - if @env.output_dir_structure.by? == :language - harvest_pth="../../#{lg}/manifest" - file="#{harvest_pth}/authors.html" - elsif @env.output_dir_structure.by? == :filetype - harvest_pth='.' - file="#{harvest_pth}/authors.#{lg}.html" - elsif @env.output_dir_structure.by? == :filename - harvest_pth='.' - file="#{harvest_pth}/authors.#{lg}.html" - end - l=ln[lg][:t] - harvest_languages += - %{#{l}   } - end - sv=SiSU_Env::InfoVersion.instance.get_version - if @env.output_dir_structure.by? == :language - home_pth='../..' - output_structure_by= - '(output organised by language & filetype)' - elsif @env.output_dir_structure.by? == :filetype - home_pth='..' - output_structure_by= - '(output organised by filetype)' - elsif @env.output_dir_structure.by? == :filename - home_pth='.' - output_structure_by= - '(output organised by filename)' - else - home_pth='.' - output_structure_by='(output organised by ?)' - end - < - - - -SiSU Metadata Harvest - Authors - - - - - - - - - - - - -

SiSU Metadata Harvest - Authors #{output_structure_by}

-

[ HOME ] also see SiSU Metadata Harvest - Topics

-

#{@env.widget_static.search_form}

-
-

#{harvest_languages}

-
-WOK - end - def html_head - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] \ - << html_head_adjust(lng,'maintenance') \ - if @opt.act[:maintenance][:set]==:on - @output[lng][:html] \ - << html_head_adjust(lng) - end - end - def html_alph - a=[] - a << '

' - @alph.each do |x| - a << ((x =~/[0-9]/) \ - ? '' - : %{#{x}, }) - end - a=a.join - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << a \ - if @opt.act[:maintenance][:set]==:on - @output[lng][:html] << a - end - end - def html_tail - a =< - - - - - - -#{@vz.credits_sisu} - - -WOK - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << a \ - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html] << a - end - end - def do_html(lng,html) - @output[lng][:html_mnt] << html \ - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html] << html - end - def do_string_name(lng,attrib,string) - f=/^(\S)/.match(string[0])[1] - if @lng != lng - @alph=@alphabet_list.dup - @letter=@alph.shift - @lng = lng - end - if @letter < f - while @letter < f - if @alph.length > 0 - @letter=@alph.shift - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html_mnt] \ - << %{\n

#{@letter}

} - end - @output[lng][:html] \ - << %{\n

#{@letter}

} - else break - end - end - end - end - def html_body - the_idx=@the_idx - the_idx.each_pair do |lng,lng_array| - lng_array.sort.each do |a| - do_string_name(lng,'',a) - name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') - x = %{

#{a[0]}

} - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html_mnt] << x - end - @output[lng][:html] << x - lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt,lng).language_code_insert - works=[] - a[1][:md].each do |i| - manifest_at=if @env.output_dir_structure.by? == :language - i[:file] + Sfx[:html] - elsif @env.output_dir_structure.by? == :filetype - i[:file] + lang_code_insert + Sfx[:html] - elsif @env.output_dir_structure.by? == :filename - './' + i[:file] + '/' + i[:page] - else '' #error - end - work=[ - "#{i[:date]} #{i[:title]}", - %{

#{i[:date]} #{i[:title]}, #{i[:author][:authors_s]}

} - ] - works<<=(@output[lng][:html_mnt].is_a?(File)) \ - ? (work.concat([%{

[src]  #{i[:date]} #{i[:title]}, #{i[:author][:authors_s]} -- [#{i[:file]}.sst]

}])) - : work - end - works.sort_by {|y| y[0]}.each do |z| - @output[lng][:html] << z[1] - @output[lng][:html_mnt] << z[2] \ - if @output[lng][:html_mnt].is_a?(File) - end - end - end - end - self - end - def screen_print - def cycle - the_idx=@the_idx - the_idx.sort.each do |a| - puts a[0] - a[1][:md].each do |x| - puts "\t" + x[:file] - end - end - end - self - end - end -end -__END__ diff --git a/lib/sisu/v5/harvest_topics.rb b/lib/sisu/v5/harvest_topics.rb deleted file mode 100644 index b2e83683..00000000 --- a/lib/sisu/v5/harvest_topics.rb +++ /dev/null @@ -1,900 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - metadata harvest, extract topics and associated writings from document set - (topics use topic_register header) - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Git - - - - * Ralph Amissah - - - - ** Description: simple xml representation (sax style) - -=end -module SiSU_HarvestTopics - require_relative 'harvest_author_format' # harvest_author_format.rb - include SiSU_Viz - class Songsheet - @@the_idx_topics={} - def initialize(opt,env) - @opt,@env=opt,env - @file_list=opt.files - end - def songsheet - idx_array={} - @opt.f_pths.each do |y| - lang_hash_file_array={} - 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 - lang_hash_file_array[y[:lng_is]] ||= [] - lang_hash_file_array[y[:lng_is]] << line - elsif line =~/^@\S+?:(?:\s|$)/m \ - or line =~/^(?:\s*\n|\s*$|%+ )/ - else break - end - end - end - lang_hash_file_array.each_pair do |lang,a| - idx_array[lang] ||=[] - idx_array=SiSU_HarvestTopics::Harvest.new( - @opt, - @env, - a, - filename, - name, - idx_array, - lang - ).extract_harvest - end - end - the_hash=SiSU_HarvestTopics::Index.new( - @opt, - @env, - idx_array, - @@the_idx_topics - ).song - SiSU_HarvestTopics::OutputIndex.new( - @opt, - the_hash - ).html_print.html_songsheet - end - end - class Mix - def spaces - Ax[:spaces] - end - end - class Harvest - def initialize(opt,env,data,filename,name,idx_array,lang) - @opt, @env,@data,@filename,@name,@idx_array,@lang= - opt,env, data, filename, name, idx_array, lang - end - def extract_harvest - data, filename, name, idx_array, lang= - @data,@filename,@name,@idx_array,@lang - @idx_lst=@title=@subtitle=@fulltitle=@author=@author_format=nil - rgx={} - rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m - rgx[:title]=/^@title:[ ]+(.+)/ - rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m - rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)(?:\n\n|\n\s+:\S|\n%)/m - data.each do |para| - if para=~ rgx[:idx] - @idx_list=(rgx[:idx].match(para)[1]).split(/\s*\n\s*/).join - end - if para=~ rgx[:title] - @title=rgx[:title].match(para)[1] - end - if para=~ rgx[:subtitle] - @subtitle=rgx[:subtitle].match(para)[1] - end - if para=~ rgx[:author] - @author_format=rgx[:author].match(para)[1] - end - break if @title && @subtitle && @author && @idx_lst - end - @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title - if @title \ - and @author_format \ - and @idx_list - creator=SiSU_FormatAuthor::Author.new(@author_format.strip).author_details - @authors,@authorship=creator[:authors],creator[:authorship] - file=if name=~/~[a-z]{2,3}\.ss[mt]$/ - name.sub(/~[a-z]{2,3}\.ss[mt]$/,'') - else - name.sub(/\.ss[mt]$/,'') - end - page=if @env.output_dir_structure.by? == :language - "#{lang}/sisu_manifest.html" - else - "sisu_manifest.#{lang}.html" - end - idx_array[lang] <<=if @idx_list =~/;/ - g=@idx_list.scan(/[^;]+/) - idxl=[] - g.each do |i| - i=i.strip - idxl << { - filename: filename, - file: file, - rough_idx: i, - title: @fulltitle, - author: creator, - page: page, - lang: lang - } - end - idxl - else { - filename: filename, - file: file, - rough_idx: @idx_list, - title: @fulltitle, - author: creator, - page: page, - lang: lang, - } - end - else - if (@opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" - end - end - idx_array[lang]=idx_array[lang].flatten - idx_array - end - end - class Index < Mix - def initialize(opt,env,idx_array,the_idx) - @opt, @env,@idx_array,@the_idx= - opt,env, idx_array, the_idx - @@the_idx_topics=@the_idx - end - def song - the_idx=construct_book_topic_keys - construct_book_topic_hash(the_idx) - end - def capital(txt) - txt_a=txt.scan(/\S+/) - tx='' - txt_a.each do |t| - tx += t[0].chr.capitalize + t[1,txt.length] + ' ' - end - tx.strip - end - def capital_(txt) - txt[0].chr.capitalize + txt[1,txt.length] - end - def contents(idx,lang) - names='' - idx[:author][:last_first_format_a].each do |n| - s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') - names=if @env.output_dir_structure.by? == :language - names += %{#{n}, } - else - names += %{#{n}, } - end - end - { - filename: idx[:filename], - file: idx[:file], - author: names, - title: idx[:title], - page: idx[:page] - } - end - def capital_(txt) - txt[0].chr.capitalize + txt[1,txt.length] - end - def key_create(c,alt) - x=nil - x=if c.length==6 - c[0].to_s + '|' + - capital(c[1][0].to_s) + '|' + - capital(c[2][0].to_s) + '|' + - capital(c[3][0].to_s) + '|' + - capital(alt.to_s) - elsif c.length==5 - c[0].to_s + '|' + - capital(c[1][0].to_s) + '|' + - capital(c[2][0].to_s) + '|' + - capital(alt.to_s) - elsif c.length==4 - c[0].to_s + '|' + - capital(c[1][0].to_s) + '|' + - capital(alt.to_s) - elsif c.length==3 - c[0].to_s + '|' + - capital(alt.to_s) - end - end - def construct_book_topic_keys - idx_array=@idx_array - @idx_a=[] - @the_a=[] - idx_array.each_pair do |lang,idx_arr| - @@the_idx_topics[lang] ||= {} - idx_arr.each do |idx| - if idx[:rough_idx] - idx_lst=idx[:rough_idx].scan(/[^:]+/) - else - puts "no topic register in: << #{idx[:filename]} >>" - next - end - idx_a=[] - idx_lst.each do |c| - idx_a << c.scan(/[^|\n]+/m) - end - idx_a << contents(idx,lang) - @idx_a << [lang] + idx_a - end - end - @idx_a.each do |c| - if c.length > 1 \ - and c.is_a?(Array) - if c[2].is_a?(Hash) - c[1].each do |alt| - v=key_create(c,alt) - @the_a << [v, c[2]] if v - end - end - end - if c.length > 2 \ - and c.is_a?(Array) - if c[3].is_a?(Hash) - c[2].each do |alt| - v=key_create(c,alt) - @the_a << [v, c[3]] if v - end - end - end - if c.length > 3 \ - and c.is_a?(Array) - if c[4].is_a?(Hash) - c[3].each do |alt| - v=key_create(c,alt) - @the_a << [v, c[4]] if v - end - end - end - if c.length > 4 \ - and c.is_a?(Array) - if c[5].is_a?(Hash) - c[4].each do |alt| - v=key_create(c,alt) - @the_a << [v, c[5]] if v - end - end - end - if c.length > 5 \ - and c.is_a?(Array) - if c[6].is_a?(Hash) - c[5].each do |alt| - v=key_create(c,alt) - @the_a << [v, c[6]] if v - end - end - end - end - @the_a.sort_by { |x| x[0] } #; y.each {|z| puts z} - end - def construct_book_topic_hash(t) - @the_h={} - t.each do |z| - x=z[0].scan(/[^|]+/) - depth=x.length - extract=(depth-1) - k=case extract - when 4 - { x[0] => { x[1] => { x[2] => { x[3] => { x[4] => z[1] } } } } } - when 3 - { x[0] => { x[1] => { x[2] => { x[3] => z[1] } } } } - when 2 - { x[0] => { x[1] => { x[2] => z[1] } } } - when 1 - { x[0] => { x[1] => z[1] } } - when 0 - { x[0] => z[1] } - end - if extract >= 0 - k.each_pair do |x0,y0| - if extract == 0 - @the_h[x0] ||={ md: [] } - @the_h[x0][:md] << y0 - else - @the_h[x0] ||={} - end - #puts spaces*0 + x0 - if extract >= 1 - y0.each_pair do |x1,y1| - if extract == 1 - @the_h[x0][x1] ||={ md: [] } - @the_h[x0][x1][:md] << y1 - else - @the_h[x0][x1] ||={} - end - #puts spaces*1 + x1 - if extract >= 2 - y1.each_pair do |x2,y2| - if extract == 2 - @the_h[x0][x1][x2] ||={ md: [] } - @the_h[x0][x1][x2][:md] << y2 - else - @the_h[x0][x1][x2] ||={} - end - #puts spaces*2 + x2 - if extract >= 3 - y2.each_pair do |x3,y3| - if extract == 3 - @the_h[x0][x1][x2][x3] ||={ md: [] } - @the_h[x0][x1][x2][x3][:md] << y3 - else - @the_h[x0][x1][x2][x3] ||={} - end - #puts spaces*3 + x3 - if extract == 4 - y3.each_pair do |x4,y4| - if extract == 4 - @the_h[x0][x1][x2][x3][x4] ||={ md: [] } - @the_h[x0][x1][x2][x3][x4][:md] << y4 - else - @the_h[x0][x1][x2][x3][x4] ||={} - end - #puts spaces*4 + x4 - if extract == 5 - y4.each_pair do |x5,y5| - if extract == 5 - @the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] } - @the_h[x0][x1][x2][x3][x4][x5][:md] << y5 - end - #puts spaces*5 + x5 - end - end - end - end - end - end - end - end - end - end - end - end - end - #@the_h.each_pair { |x,y| p x; p y } - @the_h - end - def traverse_base - @the_h.each_pair do |x0,y0| - puts spaces*0 + x0 if x0.is_a?(String) - if y0.is_a?(Hash) - y0.each_pair do |x1,y1| - puts spaces*1 + x1 if x1.is_a?(String) - if y1.is_a?(Hash) - y1.each_pair do |x2,y2| - puts spaces*2 + x2 if x2.is_a?(String) - if y2.is_a?(Hash) - y2.each_pair do |x3,y3| - puts spaces*3 + x3 if x3.is_a?(String) - if y3.is_a?(Hash) - y3.each_pair do |x4,y4| - puts spaces*4 + x4 if x4.is_a?(String) - if y4.is_a?(Hash) - y4.each_pair do |x5,y5| - puts spaces*5 + x5 if x5.is_a?(String) - end - end - end - end - end - end - end - end - end - end - end - end - def traverse - @the_h.each_pair do |x0,y0| - puts spaces*0 + x0 if x0.is_a?(String) - if y0.is_a?(Hash) - if y0.has_key?(:md) - y0[:md].each { |x| puts spaces*5 + x[:title] } - end - y0.each_pair do |x1,y1| - puts spaces*1 + x1 if x1.is_a?(String) - if y1.is_a?(Hash) - if y1.has_key?(:md) - y1[:md].each { |x| puts spaces*5 + x[:title] } - end - y1.each_pair do |x2,y2| - puts spaces*2 + x2 if x2.is_a?(String) - if y2.is_a?(Hash) - if y2.has_key?(:md) - y2[:md].each { |x| puts spaces*5 + x[:title] } - end - y2.each_pair do |x3,y3| - puts spaces*3 + x3 if x3.is_a?(String) - if y3.is_a?(Hash) - if y3.has_key?(:md) - y3[:md].each { |x| puts spaces*5 + x[:title] } - end - y3.each_pair do |x4,y4| - puts spaces*4 + x4 if x4.is_a?(String) - if y4.is_a?(Hash) - if y4.has_key?(:md) - y4[:md].each { |x| puts spaces*5 + x[:title] } - end - y4.each_pair do |x5,y5| - puts spaces*5 + x4 if x4.is_a?(String) - end - end - end - end - end - end - end - end - end - end - end - end - end - class OutputIndex < Mix - require_relative 'i18n' # i18n.rb - def initialize(opt,the_idx) - @opt,@the_idx=opt,the_idx - @env=SiSU_Env::InfoEnv.new - @rc=SiSU_Env::GetInit.new.sisu_yaml.rc - @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] - @alph=@alphabet_list.dup - @letter=@alph.shift - @vz=SiSU_Viz::Defaults.new - end - def html_file_open - @the_idx.keys.each do |lng| - @output ||={} - @output[lng] ||={} - harvest_pth,file='','' - if @env.output_dir_structure.by? == :language - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub + '/' \ - + lng + '/' \ - + 'manifest' - file=harvest_pth + '/' + 'topics.html' - elsif @env.output_dir_structure.by? == :filetype - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub + '/' \ - + 'manifest' - file=harvest_pth + '/' + 'topics.' + lng + '.html' - elsif @env.output_dir_structure.by? == :filename - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub - file=harvest_pth + '/' + 'topics.' + lng + '.html' - end - FileUtils::mkdir_p(harvest_pth) \ - unless FileTest.directory?(harvest_pth) - fileinfo=(@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:urls_selected][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) \ - ? ("file://#{file}") - : '' - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "harvest topics(#{@opt.files.length} files)", - fileinfo - ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on - @output[lng][:html]=File.new(file,'w') - if @opt.act[:maintenance][:set]==:on - @output[lng][:html_mnt]=File.new("#{@env.path.pwd}/topics.html",'w') - end - end - end - def html_file_close - @the_idx.keys.each do |lng| - @output[lng][:html].close - @output[lng][:html_mnt].close if @output[lng][:html_mnt].is_a?(File) - end - end - def html_print - def html_songsheet - #traverse - html_file_open - html_head - html_alph - html_body_traverse - html_tail - html_file_close - end - def html_body_traverse - @the_idx.each_pair do |x0,y0| - lng=x0 - if x0.is_a?(String) - #do_string_name(lng,'lev0',x0) - #puts spaces*0 + x0 - end - if y0.is_a?(Hash) - if y0.has_key?(:md) - y0[:md].each do |x| - #do_hash(lng,attrib,x) #lv==0 ? - #puts spaces*5 + x[:title] - end - end - y0.each_pair do |x1,y1| - if x1.is_a?(String) - do_string_name(lng,'lev0',x1) - #puts spaces*1 + x1 - end - if y1.is_a?(Hash) - if y1.has_key?(:md) - y1[:md].each do |x| - do_hash(lng,0,x) - #puts spaces*5 + x[:title] - end - end - y1.each_pair do |x2,y2| - if x2.is_a?(String) - do_string(lng,'lev1',x2) - #puts spaces*2 + x2 - end - if y2.is_a?(Hash) - if y2.has_key?(:md) - y2[:md].each do |x| - do_hash(lng,1,x) - #puts spaces*5 + x[:title] - end - end - y2.each_pair do |x3,y3| - if x3.is_a?(String) - do_string(lng,'lev2',x3) - #puts spaces*3 + x3 - end - if y3.is_a?(Hash) - if y3.has_key?(:md) - y3[:md].each do |x| - do_hash(lng,2,x) - #puts spaces*5 + x[:title] - end - end - y3.each_pair do |x4,y4| - if x4.is_a?(String) - do_string(lng,'lev3',x4) - #puts spaces*4 + x4 - end - if y4.is_a?(Hash) - if y4.has_key?(:md) - y4[:md].each do |x| - do_hash(lng,3,x) - #puts spaces*5 + x[:title] - end - end - y4.each_pair do |x5,y5| - if x5.is_a?(String) - do_string(lng,'lev4',x5) - #puts spaces*5 + x5 - end - end - end - end - end - end - end - end - end - end - end - end - end - def html_head_adjust(lng,type='') - css_path,authors='','' - if @env.output_dir_structure.by? == :language - css_path=(type !~/maintenance/) \ - ? '../../_sisu/css/harvest.css' - : 'harvest.css' - authors='authors.html' - elsif @env.output_dir_structure.by? == :filetype - css_path=(type !~/maintenance/) \ - ? '../_sisu/css/harvest.css' - : 'harvest.css' - authors="authors.#{lng}.html" - elsif @env.output_dir_structure.by? == :filename - css_path=(type !~/maintenance/) \ - ? './_sisu/css/harvest.css' - : 'harvest.css' - authors="authors.#{lng}.html" - end - ln=SiSU_i18n::Languages.new.language.list - harvest_languages='' - @the_idx.keys.each do |lg| - if @env.output_dir_structure.by? == :language - harvest_pth="../../#{lg}/manifest" - file=harvest_pth + '/' + 'topics.html' - elsif @env.output_dir_structure.by? == :filetype - harvest_pth='.' - file=harvest_pth + '/' + 'topics.' + lg + '.html' - elsif @env.output_dir_structure.by? == :filename - harvest_pth='.' - file=harvest_pth + '/topics.' + lg + '.html' - end - l=ln[lg][:t] - harvest_languages += - %{#{l}   } - end - sv=SiSU_Env::InfoVersion.instance.get_version - if @env.output_dir_structure.by? == :language - home_pth='../..' - output_structure_by='(output organised by language & filetype)' - elsif @env.output_dir_structure.by? == :filetype - home_pth='..' - output_structure_by='(output organised by filetype)' - elsif @env.output_dir_structure.by? == :filename - home_pth='.' - output_structure_by='(output organised by filename)' - else - home_pth='.' - output_structure_by='(output organised by ?)' - end - < - - - -SiSU Metadata Harvest - Topics - - - - - - - - - - - - -

SiSU Metadata Harvest - Topics #{output_structure_by}

-

[ HOME ] also see SiSU Metadata Harvest - Authors

-

#{@env.widget_static.search_form}

-
-

#{harvest_languages}

-
-WOK - end - def html_head - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] \ - << html_head_adjust(lng,'maintenance') \ - if @opt.act[:maintenance][:set]==:on - @output[lng][:html] << html_head_adjust(lng) - end - end - def html_alph - a=[] - a << '

' - @alph.each do |x| - a << ((x =~/[0-9]/) \ - ? '' - : %{#{x}, }) - end - a=a.join - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << a \ - if @opt.act[:maintenance][:set]==:on - @output[lng][:html] << a - end - end - def html_tail - a =< - - - - - - -#{@vz.credits_sisu} - - -WOK - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << a \ - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html] << a - end - end - def do_html(lng,html) - @output[lng][:html] << html - end - def do_html_maintenance(lng,html) - @output[lng][:html_mnt] << html \ - if @output[lng][:html_mnt].is_a?(File) - end - def do_string(lng,attrib,string) - html=%{

#{string}

} - do_html(lng,html) - do_html_maintenance(lng,html) \ - if @output[lng][:html_mnt].is_a?(File) - end - def do_string_default(lng,attrib,string) - html=%{

#{string}

} - do_html(lng,html) - end - def do_string_maintenance(lng,attrib,string) - html=%{

#{string}

} - do_html_maintenance(lng,html) \ - if @output[lng][:html_mnt].is_a?(File) - end - def do_string_name(lng,attrib,string) - f=/^(\S)/.match(string)[1] - if @lng != lng - @alph=@alphabet_list.dup - @letter=@alph.shift - @lng = lng - end - if @letter < f - while @letter < f - if @alph.length > 0 - @letter=@alph.shift - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html_mnt] \ - << %{\n

#{@letter}

} - end - @output[lng][:html] \ - << %{\n

#{@letter}

} - else break - end - end - end - name=string.strip.gsub(/\s+/,'_') - html=%{

#{string}

} - do_html(lng,html) - do_html_maintenance(lng,html) \ - if @output[lng][:html_mnt].is_a?(File) - end - def do_array(lng,lv,array) - lv+=1 - array.each do |b| - do_case(lng,lv,b) - end - end - def do_hash_md(lng,attrib,hash) - lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt,lng).language_code_insert - manifest_at=if @env.output_dir_structure.by? == :language - hash[:file] + Sfx[:html] - elsif @env.output_dir_structure.by? == :filetype - hash[:file] + lang_code_insert + Sfx[:html] - elsif @env.output_dir_structure.by? == :filename - "./#{hash[:file]}/#{hash[:page]}" - else '' #error - end - html=%{#{hash[:title]} - #{hash[:author]}} - do_string_default(lng,attrib,html) - end - def do_hash_md_maintenance(lng,attrib,hash) - if @output[lng][:html_mnt].is_a?(File) #should not be run for presentation output - html=%{[src]  #{hash[:title]} - #{hash[:author]}} - do_string_maintenance(lng,attrib,html) - end - end - def do_hash(lng,lv,hash) - lv+=1 - key=[] - hash.each_key do |m| - if m == :md - do_case(lng,lv,hash[m]) - elsif m != :title \ - and m != :author \ - and m != :filename \ - and m != :file \ - and m != :rough_idx \ - and m != :page - key << m - elsif m == :title - do_hash_md(lng,'work',hash) - do_hash_md_maintenance(lng,'work',hash) - end - end - if key.length > 0 - key.sort.each do |m| - attrib="lev#{lv}" - lv==0 ? do_string_name(lng,attrib,m) : do_string(lng,attrib,m) - do_case(lng,lv,hash[m]) - end - end - end - def do_case(lng,lv,a) - case a - when String - attrib="lev#{lv}" - if a=~/S/ - lv==0 ? do_string_name(lng,attrib,a) : do_string(lng,attrib,a) - end - when Array - do_array(lng,lv,a) - when Hash - do_hash(lng,lv,a) - end - end - #def html_body - # the_idx=@the_idx - # the_idx.each_pair do |lng,lng_array| - # lng_array.sort.each do |a| - # do_case(lng,-1,a) - # end - # end - #end - self - end - end -end -__END__ -terms -|_ t{tl1} -|_ {fa}[fa]{filenames and other details} - | |_ {tl2} -|_ {fa}[fa]{filenames and other details} - | | |_{tl3} -|_ {fa}[fa]{filenames and other details} - | | | |_{tl4} - {fa}[fa]{filenames and other details} - | | | | - | | | |_{tl4a} - {fa}[fa]{filenames and other details} - | | | | - | | | |_{tl4b} - {fa}[fa]{filenames and other details} - | | | | - | | | |_ ... - | | | - | | |_{tl3a} - {fa}[fa]{filenames and other details} - | | - | |_{tl2a} - {fa}[fa]{filenames and other details} - | - |_ t{tl1a} -|_ {fa}[fa]{filenames and other details} - |_ ... diff --git a/lib/sisu/v5/html_harvest.rb b/lib/sisu/v5/html_harvest.rb new file mode 100644 index 00000000..c3a4030b --- /dev/null +++ b/lib/sisu/v5/html_harvest.rb @@ -0,0 +1,114 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + harvest metadata from document corpus (suitable for medium sized sites) + (concept example, [to remove size constraint: implement SQL equivalent]) + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Harvest + @@the_idx_topics,@@the_idx_authors={},{} + class Source + require_relative 'hub_options' # hub_options.rb + require_relative 'html_harvest_topics' # html_harvest_topics.rb + require_relative 'html_harvest_authors' # html_harvest_authors.rb + require_relative 'se' # se.rb + include SiSU_Env + def initialize(opt) + @opt=opt + @env=SiSU_Env::InfoEnv.new + end + def read + begin + harvest_pth=@env.path.webserv + '/' + @opt.base_stub + FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth) + cases(@opt,@env) + rescue + ensure + SiSU_Env::CreateSite.new(@opt).cp_css + end + end + def help + puts <. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_FormatAuthor + class Author + def initialize(author_param) + @author_param=author_param + end + def author_details + @authors,@author_array=[],[] + authors=@author_param.scan(/[^;]+/) + authors.each do |a| + a=a.strip + if a =~/"(.+?)"/ + @authors << { the: $1 } + @author_array << $1.upcase + else #if a =~/,/ + x=a.scan(/[^,]+/) + x[0]=x[0].strip + x[1]=x[1].strip if x[1] + if x.length==1 + @authors << { the: x[0] } + @author_array << x[0].upcase + elsif x.length==2 + @authors << { the: x[0], others: x[1] } + @author_array << "#{x[0].upcase}, #{x[1]}" + else #p x.length + end + end + end + l = @authors.length + authors_string='' + @authors.each_with_index do |a,i| + authors_string += if a[:others] + if (l - i) > 1 + "#{a[:others]} #{a[:the]}, " + else + "#{a[:others]} #{a[:the]}" + end + else + if (l - i) > 2 + "#{a[:the]}, " + else + "#{a[:the]}" + end + end + end + { + last_first_a: authors, + last_first_format_a: @author_array, + authors_h: @authors, + authors_s: authors_string, + authors_param: @author_param + } + end + end +end +__END__ diff --git a/lib/sisu/v5/html_harvest_authors.rb b/lib/sisu/v5/html_harvest_authors.rb new file mode 100644 index 00000000..427ef4d3 --- /dev/null +++ b/lib/sisu/v5/html_harvest_authors.rb @@ -0,0 +1,470 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + metadata harvest, extract authors and their writings from document set + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: simple xml representation (sax style) + +=end +module SiSU_HarvestAuthors + require_relative 'html_harvest_author_format' # html_harvest_author_format.rb + class Songsheet + @@the_idx_authors={} + def initialize(opt,env) + @opt,@env=opt,env + @file_list=opt.files + end + def songsheet + idx_array={} + @opt.f_pths.each do |y| + lang_hash_file_array={} + 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 + lang_hash_file_array[y[:lng_is]] ||= [] + lang_hash_file_array[y[:lng_is]] << line + elsif line =~/^@\S+?:(?:\s|$)/m \ + or line =~/^(?:\s*\n|%+ )/ + else break + end + end + end + lang_hash_file_array.each_pair do |lang,a| + idx_array[lang] ||= [] + idx_array=SiSU_HarvestAuthors::Harvest.new( + @opt, + @env, + a, + filename, + name, + idx_array, + lang + ).extract_harvest + end + end + the_idx=SiSU_HarvestAuthors::Index.new( + idx_array, + @@the_idx_authors + ).construct_book_author_index + SiSU_HarvestAuthors::OutputIndex.new( + @opt, + the_idx + ).html_print.html_songsheet + end + end + class Harvest + def initialize(opt,env,data,filename,name,idx_array,lang) + @opt, @env,@data,@filename,@name,@idx_array,@lang= + opt,env, data, filename, name, idx_array, lang + end + def extract_harvest + data, filename, name, idx_array, lang = + @data,@filename,@name,@idx_array,@lang + @title=@subtitle=@fulltitle=@author=@author_format=@date=nil + @authors=[] + rgx={} + rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m + rgx[:title]=/^@title:[ ]+(.+)/ + rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m + rgx[:date]=/^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m + data.each do |para| + if para=~ rgx[:title] + @title=rgx[:title].match(para)[1] + end + if para=~ rgx[:subtitle] + @subtitle=rgx[:subtitle].match(para)[1] + end + if para=~ rgx[:author] + @author_format=rgx[:author].match(para)[1] + end + if para=~ rgx[:date] + @date=rgx[:date].match(para)[1] + end + break if @title && @subtitle && @author && @date + end + @fulltitle=@subtitle \ + ? (@title + ' - ' + @subtitle) + : @title + if @title \ + and @author_format + creator=SiSU_FormatAuthor::Author.new(@author_format.strip).author_details + @authors,@authorship=creator[:authors],creator[:authorship] + file=if name=~/~[a-z]{2,3}\.ss[mt]$/ + name.sub(/~[a-z]{2,3}\.ss[mt]$/,'') + else + name.sub(/\.ss[mt]$/,'') + end + page=if @env.output_dir_structure.by? == :language + "#{lang}/sisu_manifest.html" + else + "sisu_manifest.#{lang}.html" + end + idx_array[lang] <<= { + filename: filename, + file: file, + date: @date, + title: @fulltitle, + author: creator, + page: page, + lang: lang + } + else + #p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}" + end + idx_array[lang]=idx_array[lang].flatten + idx_array + end + end + class Index + def initialize(idx_array,the_idx) + @idx_array,@the_idx=idx_array,the_idx + @@the_idx_authors=@the_idx + end + def capital(txt) + txt[0].chr.capitalize + txt[1,txt.length] + end + def construct_book_author_index + idx_array=@idx_array + idx_array.each_pair do |lang,idx_arr| + @@the_idx_authors[lang] ||= {} + idx_arr.each do |idx| + idx[:author][:last_first_format_a].each do |author| + author=author.strip + if @@the_idx_authors[lang][author].is_a?(NilClass) + @@the_idx_authors[lang][author]={ md: [] } + end + @@the_idx_authors[lang][author][:md] << { + filename: idx[:filename], + file: idx[:file], + author: idx[:author], + title: idx[:title], + date: idx[:date], + page: idx[:page], + lang: idx[:lang] + } + end + end + end + @the_idx=@@the_idx_authors + end + end + class OutputIndex + require_relative 'i18n' # i18n.rb + def initialize(opt,the_idx) + @opt,@the_idx=opt,the_idx + @env=SiSU_Env::InfoEnv.new + @rc=SiSU_Env::GetInit.new.sisu_yaml.rc + @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + @alph=@alphabet_list.dup + @letter=@alph.shift + @vz=SiSU_Viz::Defaults.new + end + def html_file_open + @the_idx.keys.each do |lng| + @output ||={} + @output[lng] ||={} + harvest_pth,file='','' + if @env.output_dir_structure.by? == :language + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + '/' \ + + lng + '/' \ + + 'manifest' + file="#{harvest_pth}/authors.html" + elsif @env.output_dir_structure.by? == :filetype + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + '/' \ + + 'manifest' + file="#{harvest_pth}/authors.#{lng}.html" + elsif @env.output_dir_structure.by? == :filename + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + file="#{harvest_pth}/authors.#{lng}.html" + end + FileUtils::mkdir_p(harvest_pth) \ + unless FileTest.directory?(harvest_pth) + fileinfo=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:urls_selected][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + ? ("file://#{file}") : '' + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + "harvest authors (#{@opt.files.length} files)", + fileinfo + ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on + @output[lng][:html]=File.new(file,'w') + end + end + def html_file_close + @the_idx.keys.each do |lng| + @output[lng][:html].close + @output[lng][:html_mnt].close \ + if @output[lng][:html_mnt].is_a?(File) + end + end + def html_print + def html_songsheet + html_file_open + html_head + html_alph + html_body + html_tail + html_file_close + end + def html_head_adjust(lng,type='') + css_path,topics='','' + if @env.output_dir_structure.by? == :language + css_path=(type !~/maintenance/) \ + ? '../../_sisu/css/harvest.css' + : 'harvest.css' + topics='topics.html' + elsif @env.output_dir_structure.by? == :filetype + css_path=(type !~/maintenance/) \ + ? '../_sisu/css/harvest.css' + : 'harvest.css' + topics="topics.#{lng}.html" + elsif @env.output_dir_structure.by? == :filename + css_path=(type !~/maintenance/) \ + ? './_sisu/css/harvest.css' + : 'harvest.css' + topics="topics.#{lng}.html" + end + ln=SiSU_i18n::Languages.new.language.list + harvest_languages='' + @the_idx.keys.each do |lg| + if @env.output_dir_structure.by? == :language + harvest_pth="../../#{lg}/manifest" + file="#{harvest_pth}/authors.html" + elsif @env.output_dir_structure.by? == :filetype + harvest_pth='.' + file="#{harvest_pth}/authors.#{lg}.html" + elsif @env.output_dir_structure.by? == :filename + harvest_pth='.' + file="#{harvest_pth}/authors.#{lg}.html" + end + l=ln[lg][:t] + harvest_languages += + %{#{l}   } + end + sv=SiSU_Env::InfoVersion.instance.get_version + if @env.output_dir_structure.by? == :language + home_pth='../..' + output_structure_by= + '(output organised by language & filetype)' + elsif @env.output_dir_structure.by? == :filetype + home_pth='..' + output_structure_by= + '(output organised by filetype)' + elsif @env.output_dir_structure.by? == :filename + home_pth='.' + output_structure_by= + '(output organised by filename)' + else + home_pth='.' + output_structure_by='(output organised by ?)' + end + < + + + +SiSU Metadata Harvest - Authors + + + + + + + + + + + + +

SiSU Metadata Harvest - Authors #{output_structure_by}

+

[ HOME ] also see SiSU Metadata Harvest - Topics

+

#{@env.widget_static.search_form}

+
+

#{harvest_languages}

+
+WOK + end + def html_head + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] \ + << html_head_adjust(lng,'maintenance') \ + if @opt.act[:maintenance][:set]==:on + @output[lng][:html] \ + << html_head_adjust(lng) + end + end + def html_alph + a=[] + a << '

' + @alph.each do |x| + a << ((x =~/[0-9]/) \ + ? '' + : %{#{x}, }) + end + a=a.join + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a \ + if @opt.act[:maintenance][:set]==:on + @output[lng][:html] << a + end + end + def html_tail + a =< + + + + + + +#{@vz.credits_sisu} + + +WOK + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a \ + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html] << a + end + end + def do_html(lng,html) + @output[lng][:html_mnt] << html \ + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html] << html + end + def do_string_name(lng,attrib,string) + f=/^(\S)/.match(string[0])[1] + if @lng != lng + @alph=@alphabet_list.dup + @letter=@alph.shift + @lng = lng + end + if @letter < f + while @letter < f + if @alph.length > 0 + @letter=@alph.shift + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html_mnt] \ + << %{\n

#{@letter}

} + end + @output[lng][:html] \ + << %{\n

#{@letter}

} + else break + end + end + end + end + def html_body + the_idx=@the_idx + the_idx.each_pair do |lng,lng_array| + lng_array.sort.each do |a| + do_string_name(lng,'',a) + name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') + x = %{

#{a[0]}

} + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html_mnt] << x + end + @output[lng][:html] << x + lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt,lng).language_code_insert + works=[] + a[1][:md].each do |i| + manifest_at=if @env.output_dir_structure.by? == :language + i[:file] + Sfx[:html] + elsif @env.output_dir_structure.by? == :filetype + i[:file] + lang_code_insert + Sfx[:html] + elsif @env.output_dir_structure.by? == :filename + './' + i[:file] + '/' + i[:page] + else '' #error + end + work=[ + "#{i[:date]} #{i[:title]}", + %{

#{i[:date]} #{i[:title]}, #{i[:author][:authors_s]}

} + ] + works<<=(@output[lng][:html_mnt].is_a?(File)) \ + ? (work.concat([%{

[src]  #{i[:date]} #{i[:title]}, #{i[:author][:authors_s]} -- [#{i[:file]}.sst]

}])) + : work + end + works.sort_by {|y| y[0]}.each do |z| + @output[lng][:html] << z[1] + @output[lng][:html_mnt] << z[2] \ + if @output[lng][:html_mnt].is_a?(File) + end + end + end + end + self + end + def screen_print + def cycle + the_idx=@the_idx + the_idx.sort.each do |a| + puts a[0] + a[1][:md].each do |x| + puts "\t" + x[:file] + end + end + end + self + end + end +end +__END__ diff --git a/lib/sisu/v5/html_harvest_topics.rb b/lib/sisu/v5/html_harvest_topics.rb new file mode 100644 index 00000000..59812c68 --- /dev/null +++ b/lib/sisu/v5/html_harvest_topics.rb @@ -0,0 +1,900 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + metadata harvest, extract topics and associated writings from document set + (topics use topic_register header) + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: simple xml representation (sax style) + +=end +module SiSU_HarvestTopics + require_relative 'html_harvest_author_format' # html_harvest_author_format.rb + include SiSU_Viz + class Songsheet + @@the_idx_topics={} + def initialize(opt,env) + @opt,@env=opt,env + @file_list=opt.files + end + def songsheet + idx_array={} + @opt.f_pths.each do |y| + lang_hash_file_array={} + 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 + lang_hash_file_array[y[:lng_is]] ||= [] + lang_hash_file_array[y[:lng_is]] << line + elsif line =~/^@\S+?:(?:\s|$)/m \ + or line =~/^(?:\s*\n|\s*$|%+ )/ + else break + end + end + end + lang_hash_file_array.each_pair do |lang,a| + idx_array[lang] ||=[] + idx_array=SiSU_HarvestTopics::Harvest.new( + @opt, + @env, + a, + filename, + name, + idx_array, + lang + ).extract_harvest + end + end + the_hash=SiSU_HarvestTopics::Index.new( + @opt, + @env, + idx_array, + @@the_idx_topics + ).song + SiSU_HarvestTopics::OutputIndex.new( + @opt, + the_hash + ).html_print.html_songsheet + end + end + class Mix + def spaces + Ax[:spaces] + end + end + class Harvest + def initialize(opt,env,data,filename,name,idx_array,lang) + @opt, @env,@data,@filename,@name,@idx_array,@lang= + opt,env, data, filename, name, idx_array, lang + end + def extract_harvest + data, filename, name, idx_array, lang= + @data,@filename,@name,@idx_array,@lang + @idx_lst=@title=@subtitle=@fulltitle=@author=@author_format=nil + rgx={} + rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m + rgx[:title]=/^@title:[ ]+(.+)/ + rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m + rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)(?:\n\n|\n\s+:\S|\n%)/m + data.each do |para| + if para=~ rgx[:idx] + @idx_list=(rgx[:idx].match(para)[1]).split(/\s*\n\s*/).join + end + if para=~ rgx[:title] + @title=rgx[:title].match(para)[1] + end + if para=~ rgx[:subtitle] + @subtitle=rgx[:subtitle].match(para)[1] + end + if para=~ rgx[:author] + @author_format=rgx[:author].match(para)[1] + end + break if @title && @subtitle && @author && @idx_lst + end + @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title + if @title \ + and @author_format \ + and @idx_list + creator=SiSU_FormatAuthor::Author.new(@author_format.strip).author_details + @authors,@authorship=creator[:authors],creator[:authorship] + file=if name=~/~[a-z]{2,3}\.ss[mt]$/ + name.sub(/~[a-z]{2,3}\.ss[mt]$/,'') + else + name.sub(/\.ss[mt]$/,'') + end + page=if @env.output_dir_structure.by? == :language + "#{lang}/sisu_manifest.html" + else + "sisu_manifest.#{lang}.html" + end + idx_array[lang] <<=if @idx_list =~/;/ + g=@idx_list.scan(/[^;]+/) + idxl=[] + g.each do |i| + i=i.strip + idxl << { + filename: filename, + file: file, + rough_idx: i, + title: @fulltitle, + author: creator, + page: page, + lang: lang + } + end + idxl + else { + filename: filename, + file: file, + rough_idx: @idx_list, + title: @fulltitle, + author: creator, + page: page, + lang: lang, + } + end + else + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" + end + end + idx_array[lang]=idx_array[lang].flatten + idx_array + end + end + class Index < Mix + def initialize(opt,env,idx_array,the_idx) + @opt, @env,@idx_array,@the_idx= + opt,env, idx_array, the_idx + @@the_idx_topics=@the_idx + end + def song + the_idx=construct_book_topic_keys + construct_book_topic_hash(the_idx) + end + def capital(txt) + txt_a=txt.scan(/\S+/) + tx='' + txt_a.each do |t| + tx += t[0].chr.capitalize + t[1,txt.length] + ' ' + end + tx.strip + end + def capital_(txt) + txt[0].chr.capitalize + txt[1,txt.length] + end + def contents(idx,lang) + names='' + idx[:author][:last_first_format_a].each do |n| + s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') + names=if @env.output_dir_structure.by? == :language + names += %{#{n}, } + else + names += %{#{n}, } + end + end + { + filename: idx[:filename], + file: idx[:file], + author: names, + title: idx[:title], + page: idx[:page] + } + end + def capital_(txt) + txt[0].chr.capitalize + txt[1,txt.length] + end + def key_create(c,alt) + x=nil + x=if c.length==6 + c[0].to_s + '|' + + capital(c[1][0].to_s) + '|' + + capital(c[2][0].to_s) + '|' + + capital(c[3][0].to_s) + '|' + + capital(alt.to_s) + elsif c.length==5 + c[0].to_s + '|' + + capital(c[1][0].to_s) + '|' + + capital(c[2][0].to_s) + '|' + + capital(alt.to_s) + elsif c.length==4 + c[0].to_s + '|' + + capital(c[1][0].to_s) + '|' + + capital(alt.to_s) + elsif c.length==3 + c[0].to_s + '|' + + capital(alt.to_s) + end + end + def construct_book_topic_keys + idx_array=@idx_array + @idx_a=[] + @the_a=[] + idx_array.each_pair do |lang,idx_arr| + @@the_idx_topics[lang] ||= {} + idx_arr.each do |idx| + if idx[:rough_idx] + idx_lst=idx[:rough_idx].scan(/[^:]+/) + else + puts "no topic register in: << #{idx[:filename]} >>" + next + end + idx_a=[] + idx_lst.each do |c| + idx_a << c.scan(/[^|\n]+/m) + end + idx_a << contents(idx,lang) + @idx_a << [lang] + idx_a + end + end + @idx_a.each do |c| + if c.length > 1 \ + and c.is_a?(Array) + if c[2].is_a?(Hash) + c[1].each do |alt| + v=key_create(c,alt) + @the_a << [v, c[2]] if v + end + end + end + if c.length > 2 \ + and c.is_a?(Array) + if c[3].is_a?(Hash) + c[2].each do |alt| + v=key_create(c,alt) + @the_a << [v, c[3]] if v + end + end + end + if c.length > 3 \ + and c.is_a?(Array) + if c[4].is_a?(Hash) + c[3].each do |alt| + v=key_create(c,alt) + @the_a << [v, c[4]] if v + end + end + end + if c.length > 4 \ + and c.is_a?(Array) + if c[5].is_a?(Hash) + c[4].each do |alt| + v=key_create(c,alt) + @the_a << [v, c[5]] if v + end + end + end + if c.length > 5 \ + and c.is_a?(Array) + if c[6].is_a?(Hash) + c[5].each do |alt| + v=key_create(c,alt) + @the_a << [v, c[6]] if v + end + end + end + end + @the_a.sort_by { |x| x[0] } #; y.each {|z| puts z} + end + def construct_book_topic_hash(t) + @the_h={} + t.each do |z| + x=z[0].scan(/[^|]+/) + depth=x.length + extract=(depth-1) + k=case extract + when 4 + { x[0] => { x[1] => { x[2] => { x[3] => { x[4] => z[1] } } } } } + when 3 + { x[0] => { x[1] => { x[2] => { x[3] => z[1] } } } } + when 2 + { x[0] => { x[1] => { x[2] => z[1] } } } + when 1 + { x[0] => { x[1] => z[1] } } + when 0 + { x[0] => z[1] } + end + if extract >= 0 + k.each_pair do |x0,y0| + if extract == 0 + @the_h[x0] ||={ md: [] } + @the_h[x0][:md] << y0 + else + @the_h[x0] ||={} + end + #puts spaces*0 + x0 + if extract >= 1 + y0.each_pair do |x1,y1| + if extract == 1 + @the_h[x0][x1] ||={ md: [] } + @the_h[x0][x1][:md] << y1 + else + @the_h[x0][x1] ||={} + end + #puts spaces*1 + x1 + if extract >= 2 + y1.each_pair do |x2,y2| + if extract == 2 + @the_h[x0][x1][x2] ||={ md: [] } + @the_h[x0][x1][x2][:md] << y2 + else + @the_h[x0][x1][x2] ||={} + end + #puts spaces*2 + x2 + if extract >= 3 + y2.each_pair do |x3,y3| + if extract == 3 + @the_h[x0][x1][x2][x3] ||={ md: [] } + @the_h[x0][x1][x2][x3][:md] << y3 + else + @the_h[x0][x1][x2][x3] ||={} + end + #puts spaces*3 + x3 + if extract == 4 + y3.each_pair do |x4,y4| + if extract == 4 + @the_h[x0][x1][x2][x3][x4] ||={ md: [] } + @the_h[x0][x1][x2][x3][x4][:md] << y4 + else + @the_h[x0][x1][x2][x3][x4] ||={} + end + #puts spaces*4 + x4 + if extract == 5 + y4.each_pair do |x5,y5| + if extract == 5 + @the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] } + @the_h[x0][x1][x2][x3][x4][x5][:md] << y5 + end + #puts spaces*5 + x5 + end + end + end + end + end + end + end + end + end + end + end + end + end + #@the_h.each_pair { |x,y| p x; p y } + @the_h + end + def traverse_base + @the_h.each_pair do |x0,y0| + puts spaces*0 + x0 if x0.is_a?(String) + if y0.is_a?(Hash) + y0.each_pair do |x1,y1| + puts spaces*1 + x1 if x1.is_a?(String) + if y1.is_a?(Hash) + y1.each_pair do |x2,y2| + puts spaces*2 + x2 if x2.is_a?(String) + if y2.is_a?(Hash) + y2.each_pair do |x3,y3| + puts spaces*3 + x3 if x3.is_a?(String) + if y3.is_a?(Hash) + y3.each_pair do |x4,y4| + puts spaces*4 + x4 if x4.is_a?(String) + if y4.is_a?(Hash) + y4.each_pair do |x5,y5| + puts spaces*5 + x5 if x5.is_a?(String) + end + end + end + end + end + end + end + end + end + end + end + end + def traverse + @the_h.each_pair do |x0,y0| + puts spaces*0 + x0 if x0.is_a?(String) + if y0.is_a?(Hash) + if y0.has_key?(:md) + y0[:md].each { |x| puts spaces*5 + x[:title] } + end + y0.each_pair do |x1,y1| + puts spaces*1 + x1 if x1.is_a?(String) + if y1.is_a?(Hash) + if y1.has_key?(:md) + y1[:md].each { |x| puts spaces*5 + x[:title] } + end + y1.each_pair do |x2,y2| + puts spaces*2 + x2 if x2.is_a?(String) + if y2.is_a?(Hash) + if y2.has_key?(:md) + y2[:md].each { |x| puts spaces*5 + x[:title] } + end + y2.each_pair do |x3,y3| + puts spaces*3 + x3 if x3.is_a?(String) + if y3.is_a?(Hash) + if y3.has_key?(:md) + y3[:md].each { |x| puts spaces*5 + x[:title] } + end + y3.each_pair do |x4,y4| + puts spaces*4 + x4 if x4.is_a?(String) + if y4.is_a?(Hash) + if y4.has_key?(:md) + y4[:md].each { |x| puts spaces*5 + x[:title] } + end + y4.each_pair do |x5,y5| + puts spaces*5 + x4 if x4.is_a?(String) + end + end + end + end + end + end + end + end + end + end + end + end + end + class OutputIndex < Mix + require_relative 'i18n' # i18n.rb + def initialize(opt,the_idx) + @opt,@the_idx=opt,the_idx + @env=SiSU_Env::InfoEnv.new + @rc=SiSU_Env::GetInit.new.sisu_yaml.rc + @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + @alph=@alphabet_list.dup + @letter=@alph.shift + @vz=SiSU_Viz::Defaults.new + end + def html_file_open + @the_idx.keys.each do |lng| + @output ||={} + @output[lng] ||={} + harvest_pth,file='','' + if @env.output_dir_structure.by? == :language + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + '/' \ + + lng + '/' \ + + 'manifest' + file=harvest_pth + '/' + 'topics.html' + elsif @env.output_dir_structure.by? == :filetype + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + '/' \ + + 'manifest' + file=harvest_pth + '/' + 'topics.' + lng + '.html' + elsif @env.output_dir_structure.by? == :filename + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + file=harvest_pth + '/' + 'topics.' + lng + '.html' + end + FileUtils::mkdir_p(harvest_pth) \ + unless FileTest.directory?(harvest_pth) + fileinfo=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:urls_selected][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + ? ("file://#{file}") + : '' + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + "harvest topics(#{@opt.files.length} files)", + fileinfo + ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on + @output[lng][:html]=File.new(file,'w') + if @opt.act[:maintenance][:set]==:on + @output[lng][:html_mnt]=File.new("#{@env.path.pwd}/topics.html",'w') + end + end + end + def html_file_close + @the_idx.keys.each do |lng| + @output[lng][:html].close + @output[lng][:html_mnt].close if @output[lng][:html_mnt].is_a?(File) + end + end + def html_print + def html_songsheet + #traverse + html_file_open + html_head + html_alph + html_body_traverse + html_tail + html_file_close + end + def html_body_traverse + @the_idx.each_pair do |x0,y0| + lng=x0 + if x0.is_a?(String) + #do_string_name(lng,'lev0',x0) + #puts spaces*0 + x0 + end + if y0.is_a?(Hash) + if y0.has_key?(:md) + y0[:md].each do |x| + #do_hash(lng,attrib,x) #lv==0 ? + #puts spaces*5 + x[:title] + end + end + y0.each_pair do |x1,y1| + if x1.is_a?(String) + do_string_name(lng,'lev0',x1) + #puts spaces*1 + x1 + end + if y1.is_a?(Hash) + if y1.has_key?(:md) + y1[:md].each do |x| + do_hash(lng,0,x) + #puts spaces*5 + x[:title] + end + end + y1.each_pair do |x2,y2| + if x2.is_a?(String) + do_string(lng,'lev1',x2) + #puts spaces*2 + x2 + end + if y2.is_a?(Hash) + if y2.has_key?(:md) + y2[:md].each do |x| + do_hash(lng,1,x) + #puts spaces*5 + x[:title] + end + end + y2.each_pair do |x3,y3| + if x3.is_a?(String) + do_string(lng,'lev2',x3) + #puts spaces*3 + x3 + end + if y3.is_a?(Hash) + if y3.has_key?(:md) + y3[:md].each do |x| + do_hash(lng,2,x) + #puts spaces*5 + x[:title] + end + end + y3.each_pair do |x4,y4| + if x4.is_a?(String) + do_string(lng,'lev3',x4) + #puts spaces*4 + x4 + end + if y4.is_a?(Hash) + if y4.has_key?(:md) + y4[:md].each do |x| + do_hash(lng,3,x) + #puts spaces*5 + x[:title] + end + end + y4.each_pair do |x5,y5| + if x5.is_a?(String) + do_string(lng,'lev4',x5) + #puts spaces*5 + x5 + end + end + end + end + end + end + end + end + end + end + end + end + end + def html_head_adjust(lng,type='') + css_path,authors='','' + if @env.output_dir_structure.by? == :language + css_path=(type !~/maintenance/) \ + ? '../../_sisu/css/harvest.css' + : 'harvest.css' + authors='authors.html' + elsif @env.output_dir_structure.by? == :filetype + css_path=(type !~/maintenance/) \ + ? '../_sisu/css/harvest.css' + : 'harvest.css' + authors="authors.#{lng}.html" + elsif @env.output_dir_structure.by? == :filename + css_path=(type !~/maintenance/) \ + ? './_sisu/css/harvest.css' + : 'harvest.css' + authors="authors.#{lng}.html" + end + ln=SiSU_i18n::Languages.new.language.list + harvest_languages='' + @the_idx.keys.each do |lg| + if @env.output_dir_structure.by? == :language + harvest_pth="../../#{lg}/manifest" + file=harvest_pth + '/' + 'topics.html' + elsif @env.output_dir_structure.by? == :filetype + harvest_pth='.' + file=harvest_pth + '/' + 'topics.' + lg + '.html' + elsif @env.output_dir_structure.by? == :filename + harvest_pth='.' + file=harvest_pth + '/topics.' + lg + '.html' + end + l=ln[lg][:t] + harvest_languages += + %{#{l}   } + end + sv=SiSU_Env::InfoVersion.instance.get_version + if @env.output_dir_structure.by? == :language + home_pth='../..' + output_structure_by='(output organised by language & filetype)' + elsif @env.output_dir_structure.by? == :filetype + home_pth='..' + output_structure_by='(output organised by filetype)' + elsif @env.output_dir_structure.by? == :filename + home_pth='.' + output_structure_by='(output organised by filename)' + else + home_pth='.' + output_structure_by='(output organised by ?)' + end + < + + + +SiSU Metadata Harvest - Topics + + + + + + + + + + + + +

SiSU Metadata Harvest - Topics #{output_structure_by}

+

[ HOME ] also see SiSU Metadata Harvest - Authors

+

#{@env.widget_static.search_form}

+
+

#{harvest_languages}

+
+WOK + end + def html_head + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] \ + << html_head_adjust(lng,'maintenance') \ + if @opt.act[:maintenance][:set]==:on + @output[lng][:html] << html_head_adjust(lng) + end + end + def html_alph + a=[] + a << '

' + @alph.each do |x| + a << ((x =~/[0-9]/) \ + ? '' + : %{#{x}, }) + end + a=a.join + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a \ + if @opt.act[:maintenance][:set]==:on + @output[lng][:html] << a + end + end + def html_tail + a =< + + + + + + +#{@vz.credits_sisu} + + +WOK + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a \ + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html] << a + end + end + def do_html(lng,html) + @output[lng][:html] << html + end + def do_html_maintenance(lng,html) + @output[lng][:html_mnt] << html \ + if @output[lng][:html_mnt].is_a?(File) + end + def do_string(lng,attrib,string) + html=%{

#{string}

} + do_html(lng,html) + do_html_maintenance(lng,html) \ + if @output[lng][:html_mnt].is_a?(File) + end + def do_string_default(lng,attrib,string) + html=%{

#{string}

} + do_html(lng,html) + end + def do_string_maintenance(lng,attrib,string) + html=%{

#{string}

} + do_html_maintenance(lng,html) \ + if @output[lng][:html_mnt].is_a?(File) + end + def do_string_name(lng,attrib,string) + f=/^(\S)/.match(string)[1] + if @lng != lng + @alph=@alphabet_list.dup + @letter=@alph.shift + @lng = lng + end + if @letter < f + while @letter < f + if @alph.length > 0 + @letter=@alph.shift + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html_mnt] \ + << %{\n

#{@letter}

} + end + @output[lng][:html] \ + << %{\n

#{@letter}

} + else break + end + end + end + name=string.strip.gsub(/\s+/,'_') + html=%{

#{string}

} + do_html(lng,html) + do_html_maintenance(lng,html) \ + if @output[lng][:html_mnt].is_a?(File) + end + def do_array(lng,lv,array) + lv+=1 + array.each do |b| + do_case(lng,lv,b) + end + end + def do_hash_md(lng,attrib,hash) + lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt,lng).language_code_insert + manifest_at=if @env.output_dir_structure.by? == :language + hash[:file] + Sfx[:html] + elsif @env.output_dir_structure.by? == :filetype + hash[:file] + lang_code_insert + Sfx[:html] + elsif @env.output_dir_structure.by? == :filename + "./#{hash[:file]}/#{hash[:page]}" + else '' #error + end + html=%{#{hash[:title]} - #{hash[:author]}} + do_string_default(lng,attrib,html) + end + def do_hash_md_maintenance(lng,attrib,hash) + if @output[lng][:html_mnt].is_a?(File) #should not be run for presentation output + html=%{[src]  #{hash[:title]} - #{hash[:author]}} + do_string_maintenance(lng,attrib,html) + end + end + def do_hash(lng,lv,hash) + lv+=1 + key=[] + hash.each_key do |m| + if m == :md + do_case(lng,lv,hash[m]) + elsif m != :title \ + and m != :author \ + and m != :filename \ + and m != :file \ + and m != :rough_idx \ + and m != :page + key << m + elsif m == :title + do_hash_md(lng,'work',hash) + do_hash_md_maintenance(lng,'work',hash) + end + end + if key.length > 0 + key.sort.each do |m| + attrib="lev#{lv}" + lv==0 ? do_string_name(lng,attrib,m) : do_string(lng,attrib,m) + do_case(lng,lv,hash[m]) + end + end + end + def do_case(lng,lv,a) + case a + when String + attrib="lev#{lv}" + if a=~/S/ + lv==0 ? do_string_name(lng,attrib,a) : do_string(lng,attrib,a) + end + when Array + do_array(lng,lv,a) + when Hash + do_hash(lng,lv,a) + end + end + #def html_body + # the_idx=@the_idx + # the_idx.each_pair do |lng,lng_array| + # lng_array.sort.each do |a| + # do_case(lng,-1,a) + # end + # end + #end + self + end + end +end +__END__ +terms -|_ t{tl1} -|_ {fa}[fa]{filenames and other details} + | |_ {tl2} -|_ {fa}[fa]{filenames and other details} + | | |_{tl3} -|_ {fa}[fa]{filenames and other details} + | | | |_{tl4} - {fa}[fa]{filenames and other details} + | | | | + | | | |_{tl4a} - {fa}[fa]{filenames and other details} + | | | | + | | | |_{tl4b} - {fa}[fa]{filenames and other details} + | | | | + | | | |_ ... + | | | + | | |_{tl3a} - {fa}[fa]{filenames and other details} + | | + | |_{tl2a} - {fa}[fa]{filenames and other details} + | + |_ t{tl1a} -|_ {fa}[fa]{filenames and other details} + |_ ... diff --git a/lib/sisu/v5/hub_actions.rb b/lib/sisu/v5/hub_actions.rb index 6c97aa4b..7781ef63 100644 --- a/lib/sisu/v5/hub_actions.rb +++ b/lib/sisu/v5/hub_actions.rb @@ -559,7 +559,7 @@ module SiSU_Hub_Actions def harvest? if @opt.act[:harvest][:set]==:on #% --harvest if @opt.f_pths.length > 0 - require_relative 'harvest' # harvest.rb + require_relative 'html_harvest' # html_harvest.rb SiSU_Harvest::Source.new(@opt).read else msg='harvest request requires sisu markup files' diff --git a/lib/sisu/v6/harvest.rb b/lib/sisu/v6/harvest.rb deleted file mode 100644 index 09c1b883..00000000 --- a/lib/sisu/v6/harvest.rb +++ /dev/null @@ -1,114 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - harvest metadata from document corpus (suitable for medium sized sites) - (concept example, [to remove size constraint: implement SQL equivalent]) - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Git - - - - * Ralph Amissah - - - - ** Description: system environment, resource control and configuration details - -=end -module SiSU_Harvest - @@the_idx_topics,@@the_idx_authors={},{} - class Source - require_relative 'hub_options' # hub_options.rb - require_relative 'harvest_topics' # harvest_topics.rb - require_relative 'harvest_authors' # harvest_authors.rb - require_relative 'se' # se.rb - include SiSU_Env - def initialize(opt) - @opt=opt - @env=SiSU_Env::InfoEnv.new - end - def read - begin - harvest_pth=@env.path.webserv + '/' + @opt.base_stub - FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth) - cases(@opt,@env) - rescue - ensure - SiSU_Env::CreateSite.new(@opt).cp_css - end - end - def help - puts <. - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Git - - - - * Ralph Amissah - - - - ** Description: system environment, resource control and configuration details - -=end -module SiSU_FormatAuthor - class Author - def initialize(author_param) - @author_param=author_param - end - def author_details - @authors,@author_array=[],[] - authors=@author_param.scan(/[^;]+/) - authors.each do |a| - a=a.strip - if a =~/"(.+?)"/ - @authors << { the: $1 } - @author_array << $1.upcase - else #if a =~/,/ - x=a.scan(/[^,]+/) - x[0]=x[0].strip - x[1]=x[1].strip if x[1] - if x.length==1 - @authors << { the: x[0] } - @author_array << x[0].upcase - elsif x.length==2 - @authors << { the: x[0], others: x[1] } - @author_array << "#{x[0].upcase}, #{x[1]}" - else #p x.length - end - end - end - l = @authors.length - authors_string='' - @authors.each_with_index do |a,i| - authors_string += if a[:others] - if (l - i) > 1 - "#{a[:others]} #{a[:the]}, " - else - "#{a[:others]} #{a[:the]}" - end - else - if (l - i) > 2 - "#{a[:the]}, " - else - "#{a[:the]}" - end - end - end - { - last_first_a: authors, - last_first_format_a: @author_array, - authors_h: @authors, - authors_s: authors_string, - authors_param: @author_param - } - end - end -end -__END__ diff --git a/lib/sisu/v6/harvest_authors.rb b/lib/sisu/v6/harvest_authors.rb deleted file mode 100644 index e48c4f78..00000000 --- a/lib/sisu/v6/harvest_authors.rb +++ /dev/null @@ -1,470 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - metadata harvest, extract authors and their writings from document set - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Git - - - - * Ralph Amissah - - - - ** Description: simple xml representation (sax style) - -=end -module SiSU_HarvestAuthors - require_relative 'harvest_author_format' # harvest_author_format.rb - class Songsheet - @@the_idx_authors={} - def initialize(opt,env) - @opt,@env=opt,env - @file_list=opt.files - end - def songsheet - idx_array={} - @opt.f_pths.each do |y| - lang_hash_file_array={} - 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 - lang_hash_file_array[y[:lng_is]] ||= [] - lang_hash_file_array[y[:lng_is]] << line - elsif line =~/^@\S+?:(?:\s|$)/m \ - or line =~/^(?:\s*\n|%+ )/ - else break - end - end - end - lang_hash_file_array.each_pair do |lang,a| - idx_array[lang] ||= [] - idx_array=SiSU_HarvestAuthors::Harvest.new( - @opt, - @env, - a, - filename, - name, - idx_array, - lang - ).extract_harvest - end - end - the_idx=SiSU_HarvestAuthors::Index.new( - idx_array, - @@the_idx_authors - ).construct_book_author_index - SiSU_HarvestAuthors::OutputIndex.new( - @opt, - the_idx - ).html_print.html_songsheet - end - end - class Harvest - def initialize(opt,env,data,filename,name,idx_array,lang) - @opt, @env,@data,@filename,@name,@idx_array,@lang= - opt,env, data, filename, name, idx_array, lang - end - def extract_harvest - data, filename, name, idx_array, lang = - @data,@filename,@name,@idx_array,@lang - @title=@subtitle=@fulltitle=@author=@author_format=@date=nil - @authors=[] - rgx={} - rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m - rgx[:title]=/^@title:[ ]+(.+)/ - rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m - rgx[:date]=/^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m - data.each do |para| - if para=~ rgx[:title] - @title=rgx[:title].match(para)[1] - end - if para=~ rgx[:subtitle] - @subtitle=rgx[:subtitle].match(para)[1] - end - if para=~ rgx[:author] - @author_format=rgx[:author].match(para)[1] - end - if para=~ rgx[:date] - @date=rgx[:date].match(para)[1] - end - break if @title && @subtitle && @author && @date - end - @fulltitle=@subtitle \ - ? (@title + ' - ' + @subtitle) - : @title - if @title \ - and @author_format - creator=SiSU_FormatAuthor::Author.new(@author_format.strip).author_details - @authors,@authorship=creator[:authors],creator[:authorship] - file=if name=~/~[a-z]{2,3}\.ss[mt]$/ - name.sub(/~[a-z]{2,3}\.ss[mt]$/,'') - else - name.sub(/\.ss[mt]$/,'') - end - page=if @env.output_dir_structure.by? == :language - "#{lang}/sisu_manifest.html" - else - "sisu_manifest.#{lang}.html" - end - idx_array[lang] <<= { - filename: filename, - file: file, - date: @date, - title: @fulltitle, - author: creator, - page: page, - lang: lang - } - else - #p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}" - end - idx_array[lang]=idx_array[lang].flatten - idx_array - end - end - class Index - def initialize(idx_array,the_idx) - @idx_array,@the_idx=idx_array,the_idx - @@the_idx_authors=@the_idx - end - def capital(txt) - txt[0].chr.capitalize + txt[1,txt.length] - end - def construct_book_author_index - idx_array=@idx_array - idx_array.each_pair do |lang,idx_arr| - @@the_idx_authors[lang] ||= {} - idx_arr.each do |idx| - idx[:author][:last_first_format_a].each do |author| - author=author.strip - if @@the_idx_authors[lang][author].is_a?(NilClass) - @@the_idx_authors[lang][author]={ md: [] } - end - @@the_idx_authors[lang][author][:md] << { - filename: idx[:filename], - file: idx[:file], - author: idx[:author], - title: idx[:title], - date: idx[:date], - page: idx[:page], - lang: idx[:lang] - } - end - end - end - @the_idx=@@the_idx_authors - end - end - class OutputIndex - require_relative 'i18n' # i18n.rb - def initialize(opt,the_idx) - @opt,@the_idx=opt,the_idx - @env=SiSU_Env::InfoEnv.new - @rc=SiSU_Env::GetInit.new.sisu_yaml.rc - @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] - @alph=@alphabet_list.dup - @letter=@alph.shift - @vz=SiSU_Viz::Defaults.new - end - def html_file_open - @the_idx.keys.each do |lng| - @output ||={} - @output[lng] ||={} - harvest_pth,file='','' - if @env.output_dir_structure.by? == :language - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub + '/' \ - + lng + '/' \ - + 'manifest' - file="#{harvest_pth}/authors.html" - elsif @env.output_dir_structure.by? == :filetype - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub + '/' \ - + 'manifest' - file="#{harvest_pth}/authors.#{lng}.html" - elsif @env.output_dir_structure.by? == :filename - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub - file="#{harvest_pth}/authors.#{lng}.html" - end - FileUtils::mkdir_p(harvest_pth) \ - unless FileTest.directory?(harvest_pth) - fileinfo=(@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:urls_selected][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) \ - ? ("file://#{file}") : '' - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "harvest authors (#{@opt.files.length} files)", - fileinfo - ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on - @output[lng][:html]=File.new(file,'w') - end - end - def html_file_close - @the_idx.keys.each do |lng| - @output[lng][:html].close - @output[lng][:html_mnt].close \ - if @output[lng][:html_mnt].is_a?(File) - end - end - def html_print - def html_songsheet - html_file_open - html_head - html_alph - html_body - html_tail - html_file_close - end - def html_head_adjust(lng,type='') - css_path,topics='','' - if @env.output_dir_structure.by? == :language - css_path=(type !~/maintenance/) \ - ? '../../_sisu/css/harvest.css' - : 'harvest.css' - topics='topics.html' - elsif @env.output_dir_structure.by? == :filetype - css_path=(type !~/maintenance/) \ - ? '../_sisu/css/harvest.css' - : 'harvest.css' - topics="topics.#{lng}.html" - elsif @env.output_dir_structure.by? == :filename - css_path=(type !~/maintenance/) \ - ? './_sisu/css/harvest.css' - : 'harvest.css' - topics="topics.#{lng}.html" - end - ln=SiSU_i18n::Languages.new.language.list - harvest_languages='' - @the_idx.keys.each do |lg| - if @env.output_dir_structure.by? == :language - harvest_pth="../../#{lg}/manifest" - file="#{harvest_pth}/authors.html" - elsif @env.output_dir_structure.by? == :filetype - harvest_pth='.' - file="#{harvest_pth}/authors.#{lg}.html" - elsif @env.output_dir_structure.by? == :filename - harvest_pth='.' - file="#{harvest_pth}/authors.#{lg}.html" - end - l=ln[lg][:t] - harvest_languages += - %{#{l}   } - end - sv=SiSU_Env::InfoVersion.instance.get_version - if @env.output_dir_structure.by? == :language - home_pth='../..' - output_structure_by= - '(output organised by language & filetype)' - elsif @env.output_dir_structure.by? == :filetype - home_pth='..' - output_structure_by= - '(output organised by filetype)' - elsif @env.output_dir_structure.by? == :filename - home_pth='.' - output_structure_by= - '(output organised by filename)' - else - home_pth='.' - output_structure_by='(output organised by ?)' - end - < - - - -SiSU Metadata Harvest - Authors - - - - - - - - - - - - -

SiSU Metadata Harvest - Authors #{output_structure_by}

-

[ HOME ] also see SiSU Metadata Harvest - Topics

-

#{@env.widget_static.search_form}

-
-

#{harvest_languages}

-
-WOK - end - def html_head - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] \ - << html_head_adjust(lng,'maintenance') \ - if @opt.act[:maintenance][:set]==:on - @output[lng][:html] \ - << html_head_adjust(lng) - end - end - def html_alph - a=[] - a << '

' - @alph.each do |x| - a << ((x =~/[0-9]/) \ - ? '' - : %{#{x}, }) - end - a=a.join - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << a \ - if @opt.act[:maintenance][:set]==:on - @output[lng][:html] << a - end - end - def html_tail - a =< - - - - - - -#{@vz.credits_sisu} - - -WOK - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << a \ - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html] << a - end - end - def do_html(lng,html) - @output[lng][:html_mnt] << html \ - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html] << html - end - def do_string_name(lng,attrib,string) - f=/^(\S)/.match(string[0])[1] - if @lng != lng - @alph=@alphabet_list.dup - @letter=@alph.shift - @lng = lng - end - if @letter < f - while @letter < f - if @alph.length > 0 - @letter=@alph.shift - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html_mnt] \ - << %{\n

#{@letter}

} - end - @output[lng][:html] \ - << %{\n

#{@letter}

} - else break - end - end - end - end - def html_body - the_idx=@the_idx - the_idx.each_pair do |lng,lng_array| - lng_array.sort.each do |a| - do_string_name(lng,'',a) - name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') - x = %{

#{a[0]}

} - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html_mnt] << x - end - @output[lng][:html] << x - lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt,lng).language_code_insert - works=[] - a[1][:md].each do |i| - manifest_at=if @env.output_dir_structure.by? == :language - i[:file] + Sfx[:html] - elsif @env.output_dir_structure.by? == :filetype - i[:file] + lang_code_insert + Sfx[:html] - elsif @env.output_dir_structure.by? == :filename - './' + i[:file] + '/' + i[:page] - else '' #error - end - work=[ - "#{i[:date]} #{i[:title]}", - %{

#{i[:date]} #{i[:title]}, #{i[:author][:authors_s]}

} - ] - works<<=(@output[lng][:html_mnt].is_a?(File)) \ - ? (work.concat([%{

[src]  #{i[:date]} #{i[:title]}, #{i[:author][:authors_s]} -- [#{i[:file]}.sst]

}])) - : work - end - works.sort_by {|y| y[0]}.each do |z| - @output[lng][:html] << z[1] - @output[lng][:html_mnt] << z[2] \ - if @output[lng][:html_mnt].is_a?(File) - end - end - end - end - self - end - def screen_print - def cycle - the_idx=@the_idx - the_idx.sort.each do |a| - puts a[0] - a[1][:md].each do |x| - puts "\t" + x[:file] - end - end - end - self - end - end -end -__END__ diff --git a/lib/sisu/v6/harvest_topics.rb b/lib/sisu/v6/harvest_topics.rb deleted file mode 100644 index 2b80565e..00000000 --- a/lib/sisu/v6/harvest_topics.rb +++ /dev/null @@ -1,900 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - metadata harvest, extract topics and associated writings from document set - (topics use topic_register header) - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Git - - - - * Ralph Amissah - - - - ** Description: simple xml representation (sax style) - -=end -module SiSU_HarvestTopics - require_relative 'harvest_author_format' # harvest_author_format.rb - include SiSU_Viz - class Songsheet - @@the_idx_topics={} - def initialize(opt,env) - @opt,@env=opt,env - @file_list=opt.files - end - def songsheet - idx_array={} - @opt.f_pths.each do |y| - lang_hash_file_array={} - 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 - lang_hash_file_array[y[:lng_is]] ||= [] - lang_hash_file_array[y[:lng_is]] << line - elsif line =~/^@\S+?:(?:\s|$)/m \ - or line =~/^(?:\s*\n|\s*$|%+ )/ - else break - end - end - end - lang_hash_file_array.each_pair do |lang,a| - idx_array[lang] ||=[] - idx_array=SiSU_HarvestTopics::Harvest.new( - @opt, - @env, - a, - filename, - name, - idx_array, - lang - ).extract_harvest - end - end - the_hash=SiSU_HarvestTopics::Index.new( - @opt, - @env, - idx_array, - @@the_idx_topics - ).song - SiSU_HarvestTopics::OutputIndex.new( - @opt, - the_hash - ).html_print.html_songsheet - end - end - class Mix - def spaces - Ax[:spaces] - end - end - class Harvest - def initialize(opt,env,data,filename,name,idx_array,lang) - @opt, @env,@data,@filename,@name,@idx_array,@lang= - opt,env, data, filename, name, idx_array, lang - end - def extract_harvest - data, filename, name, idx_array, lang= - @data,@filename,@name,@idx_array,@lang - @idx_lst=@title=@subtitle=@fulltitle=@author=@author_format=nil - rgx={} - rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m - rgx[:title]=/^@title:[ ]+(.+)/ - rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m - rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)(?:\n\n|\n\s+:\S|\n%)/m - data.each do |para| - if para=~ rgx[:idx] - @idx_list=(rgx[:idx].match(para)[1]).split(/\s*\n\s*/).join - end - if para=~ rgx[:title] - @title=rgx[:title].match(para)[1] - end - if para=~ rgx[:subtitle] - @subtitle=rgx[:subtitle].match(para)[1] - end - if para=~ rgx[:author] - @author_format=rgx[:author].match(para)[1] - end - break if @title && @subtitle && @author && @idx_lst - end - @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title - if @title \ - and @author_format \ - and @idx_list - creator=SiSU_FormatAuthor::Author.new(@author_format.strip).author_details - @authors,@authorship=creator[:authors],creator[:authorship] - file=if name=~/~[a-z]{2,3}\.ss[mt]$/ - name.sub(/~[a-z]{2,3}\.ss[mt]$/,'') - else - name.sub(/\.ss[mt]$/,'') - end - page=if @env.output_dir_structure.by? == :language - "#{lang}/sisu_manifest.html" - else - "sisu_manifest.#{lang}.html" - end - idx_array[lang] <<=if @idx_list =~/;/ - g=@idx_list.scan(/[^;]+/) - idxl=[] - g.each do |i| - i=i.strip - idxl << { - filename: filename, - file: file, - rough_idx: i, - title: @fulltitle, - author: creator, - page: page, - lang: lang - } - end - idxl - else { - filename: filename, - file: file, - rough_idx: @idx_list, - title: @fulltitle, - author: creator, - page: page, - lang: lang, - } - end - else - if (@opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) - p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" - end - end - idx_array[lang]=idx_array[lang].flatten - idx_array - end - end - class Index < Mix - def initialize(opt,env,idx_array,the_idx) - @opt, @env,@idx_array,@the_idx= - opt,env, idx_array, the_idx - @@the_idx_topics=@the_idx - end - def song - the_idx=construct_book_topic_keys - construct_book_topic_hash(the_idx) - end - def capital(txt) - txt_a=txt.scan(/\S+/) - tx='' - txt_a.each do |t| - tx += t[0].chr.capitalize + t[1,txt.length] + ' ' - end - tx.strip - end - def capital_(txt) - txt[0].chr.capitalize + txt[1,txt.length] - end - def contents(idx,lang) - names='' - idx[:author][:last_first_format_a].each do |n| - s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') - names=if @env.output_dir_structure.by? == :language - names += %{#{n}, } - else - names += %{#{n}, } - end - end - { - filename: idx[:filename], - file: idx[:file], - author: names, - title: idx[:title], - page: idx[:page] - } - end - def capital_(txt) - txt[0].chr.capitalize + txt[1,txt.length] - end - def key_create(c,alt) - x=nil - x=if c.length==6 - c[0].to_s + '|' + - capital(c[1][0].to_s) + '|' + - capital(c[2][0].to_s) + '|' + - capital(c[3][0].to_s) + '|' + - capital(alt.to_s) - elsif c.length==5 - c[0].to_s + '|' + - capital(c[1][0].to_s) + '|' + - capital(c[2][0].to_s) + '|' + - capital(alt.to_s) - elsif c.length==4 - c[0].to_s + '|' + - capital(c[1][0].to_s) + '|' + - capital(alt.to_s) - elsif c.length==3 - c[0].to_s + '|' + - capital(alt.to_s) - end - end - def construct_book_topic_keys - idx_array=@idx_array - @idx_a=[] - @the_a=[] - idx_array.each_pair do |lang,idx_arr| - @@the_idx_topics[lang] ||= {} - idx_arr.each do |idx| - if idx[:rough_idx] - idx_lst=idx[:rough_idx].scan(/[^:]+/) - else - puts "no topic register in: << #{idx[:filename]} >>" - next - end - idx_a=[] - idx_lst.each do |c| - idx_a << c.scan(/[^|\n]+/m) - end - idx_a << contents(idx,lang) - @idx_a << [lang] + idx_a - end - end - @idx_a.each do |c| - if c.length > 1 \ - and c.is_a?(Array) - if c[2].is_a?(Hash) - c[1].each do |alt| - v=key_create(c,alt) - @the_a << [v, c[2]] if v - end - end - end - if c.length > 2 \ - and c.is_a?(Array) - if c[3].is_a?(Hash) - c[2].each do |alt| - v=key_create(c,alt) - @the_a << [v, c[3]] if v - end - end - end - if c.length > 3 \ - and c.is_a?(Array) - if c[4].is_a?(Hash) - c[3].each do |alt| - v=key_create(c,alt) - @the_a << [v, c[4]] if v - end - end - end - if c.length > 4 \ - and c.is_a?(Array) - if c[5].is_a?(Hash) - c[4].each do |alt| - v=key_create(c,alt) - @the_a << [v, c[5]] if v - end - end - end - if c.length > 5 \ - and c.is_a?(Array) - if c[6].is_a?(Hash) - c[5].each do |alt| - v=key_create(c,alt) - @the_a << [v, c[6]] if v - end - end - end - end - @the_a.sort_by { |x| x[0] } #; y.each {|z| puts z} - end - def construct_book_topic_hash(t) - @the_h={} - t.each do |z| - x=z[0].scan(/[^|]+/) - depth=x.length - extract=(depth-1) - k=case extract - when 4 - { x[0] => { x[1] => { x[2] => { x[3] => { x[4] => z[1] } } } } } - when 3 - { x[0] => { x[1] => { x[2] => { x[3] => z[1] } } } } - when 2 - { x[0] => { x[1] => { x[2] => z[1] } } } - when 1 - { x[0] => { x[1] => z[1] } } - when 0 - { x[0] => z[1] } - end - if extract >= 0 - k.each_pair do |x0,y0| - if extract == 0 - @the_h[x0] ||={ md: [] } - @the_h[x0][:md] << y0 - else - @the_h[x0] ||={} - end - #puts spaces*0 + x0 - if extract >= 1 - y0.each_pair do |x1,y1| - if extract == 1 - @the_h[x0][x1] ||={ md: [] } - @the_h[x0][x1][:md] << y1 - else - @the_h[x0][x1] ||={} - end - #puts spaces*1 + x1 - if extract >= 2 - y1.each_pair do |x2,y2| - if extract == 2 - @the_h[x0][x1][x2] ||={ md: [] } - @the_h[x0][x1][x2][:md] << y2 - else - @the_h[x0][x1][x2] ||={} - end - #puts spaces*2 + x2 - if extract >= 3 - y2.each_pair do |x3,y3| - if extract == 3 - @the_h[x0][x1][x2][x3] ||={ md: [] } - @the_h[x0][x1][x2][x3][:md] << y3 - else - @the_h[x0][x1][x2][x3] ||={} - end - #puts spaces*3 + x3 - if extract == 4 - y3.each_pair do |x4,y4| - if extract == 4 - @the_h[x0][x1][x2][x3][x4] ||={ md: [] } - @the_h[x0][x1][x2][x3][x4][:md] << y4 - else - @the_h[x0][x1][x2][x3][x4] ||={} - end - #puts spaces*4 + x4 - if extract == 5 - y4.each_pair do |x5,y5| - if extract == 5 - @the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] } - @the_h[x0][x1][x2][x3][x4][x5][:md] << y5 - end - #puts spaces*5 + x5 - end - end - end - end - end - end - end - end - end - end - end - end - end - #@the_h.each_pair { |x,y| p x; p y } - @the_h - end - def traverse_base - @the_h.each_pair do |x0,y0| - puts spaces*0 + x0 if x0.is_a?(String) - if y0.is_a?(Hash) - y0.each_pair do |x1,y1| - puts spaces*1 + x1 if x1.is_a?(String) - if y1.is_a?(Hash) - y1.each_pair do |x2,y2| - puts spaces*2 + x2 if x2.is_a?(String) - if y2.is_a?(Hash) - y2.each_pair do |x3,y3| - puts spaces*3 + x3 if x3.is_a?(String) - if y3.is_a?(Hash) - y3.each_pair do |x4,y4| - puts spaces*4 + x4 if x4.is_a?(String) - if y4.is_a?(Hash) - y4.each_pair do |x5,y5| - puts spaces*5 + x5 if x5.is_a?(String) - end - end - end - end - end - end - end - end - end - end - end - end - def traverse - @the_h.each_pair do |x0,y0| - puts spaces*0 + x0 if x0.is_a?(String) - if y0.is_a?(Hash) - if y0.has_key?(:md) - y0[:md].each { |x| puts spaces*5 + x[:title] } - end - y0.each_pair do |x1,y1| - puts spaces*1 + x1 if x1.is_a?(String) - if y1.is_a?(Hash) - if y1.has_key?(:md) - y1[:md].each { |x| puts spaces*5 + x[:title] } - end - y1.each_pair do |x2,y2| - puts spaces*2 + x2 if x2.is_a?(String) - if y2.is_a?(Hash) - if y2.has_key?(:md) - y2[:md].each { |x| puts spaces*5 + x[:title] } - end - y2.each_pair do |x3,y3| - puts spaces*3 + x3 if x3.is_a?(String) - if y3.is_a?(Hash) - if y3.has_key?(:md) - y3[:md].each { |x| puts spaces*5 + x[:title] } - end - y3.each_pair do |x4,y4| - puts spaces*4 + x4 if x4.is_a?(String) - if y4.is_a?(Hash) - if y4.has_key?(:md) - y4[:md].each { |x| puts spaces*5 + x[:title] } - end - y4.each_pair do |x5,y5| - puts spaces*5 + x4 if x4.is_a?(String) - end - end - end - end - end - end - end - end - end - end - end - end - end - class OutputIndex < Mix - require_relative 'i18n' # i18n.rb - def initialize(opt,the_idx) - @opt,@the_idx=opt,the_idx - @env=SiSU_Env::InfoEnv.new - @rc=SiSU_Env::GetInit.new.sisu_yaml.rc - @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] - @alph=@alphabet_list.dup - @letter=@alph.shift - @vz=SiSU_Viz::Defaults.new - end - def html_file_open - @the_idx.keys.each do |lng| - @output ||={} - @output[lng] ||={} - harvest_pth,file='','' - if @env.output_dir_structure.by? == :language - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub + '/' \ - + lng + '/' \ - + 'manifest' - file=harvest_pth + '/' + 'topics.html' - elsif @env.output_dir_structure.by? == :filetype - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub + '/' \ - + 'manifest' - file=harvest_pth + '/' + 'topics.' + lng + '.html' - elsif @env.output_dir_structure.by? == :filename - harvest_pth=@env.path.webserv + '/' \ - + @opt.base_stub - file=harvest_pth + '/' + 'topics.' + lng + '.html' - end - FileUtils::mkdir_p(harvest_pth) \ - unless FileTest.directory?(harvest_pth) - fileinfo=(@opt.act[:verbose][:set]==:on \ - || @opt.act[:verbose_plus][:set]==:on \ - || @opt.act[:urls_selected][:set]==:on \ - || @opt.act[:maintenance][:set]==:on) \ - ? ("file://#{file}") - : '' - SiSU_Screen::Ansi.new( - @opt.act[:color_state][:set], - "harvest topics(#{@opt.files.length} files)", - fileinfo - ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on - @output[lng][:html]=File.new(file,'w') - if @opt.act[:maintenance][:set]==:on - @output[lng][:html_mnt]=File.new("#{@env.path.pwd}/topics.html",'w') - end - end - end - def html_file_close - @the_idx.keys.each do |lng| - @output[lng][:html].close - @output[lng][:html_mnt].close if @output[lng][:html_mnt].is_a?(File) - end - end - def html_print - def html_songsheet - #traverse - html_file_open - html_head - html_alph - html_body_traverse - html_tail - html_file_close - end - def html_body_traverse - @the_idx.each_pair do |x0,y0| - lng=x0 - if x0.is_a?(String) - #do_string_name(lng,'lev0',x0) - #puts spaces*0 + x0 - end - if y0.is_a?(Hash) - if y0.has_key?(:md) - y0[:md].each do |x| - #do_hash(lng,attrib,x) #lv==0 ? - #puts spaces*5 + x[:title] - end - end - y0.each_pair do |x1,y1| - if x1.is_a?(String) - do_string_name(lng,'lev0',x1) - #puts spaces*1 + x1 - end - if y1.is_a?(Hash) - if y1.has_key?(:md) - y1[:md].each do |x| - do_hash(lng,0,x) - #puts spaces*5 + x[:title] - end - end - y1.each_pair do |x2,y2| - if x2.is_a?(String) - do_string(lng,'lev1',x2) - #puts spaces*2 + x2 - end - if y2.is_a?(Hash) - if y2.has_key?(:md) - y2[:md].each do |x| - do_hash(lng,1,x) - #puts spaces*5 + x[:title] - end - end - y2.each_pair do |x3,y3| - if x3.is_a?(String) - do_string(lng,'lev2',x3) - #puts spaces*3 + x3 - end - if y3.is_a?(Hash) - if y3.has_key?(:md) - y3[:md].each do |x| - do_hash(lng,2,x) - #puts spaces*5 + x[:title] - end - end - y3.each_pair do |x4,y4| - if x4.is_a?(String) - do_string(lng,'lev3',x4) - #puts spaces*4 + x4 - end - if y4.is_a?(Hash) - if y4.has_key?(:md) - y4[:md].each do |x| - do_hash(lng,3,x) - #puts spaces*5 + x[:title] - end - end - y4.each_pair do |x5,y5| - if x5.is_a?(String) - do_string(lng,'lev4',x5) - #puts spaces*5 + x5 - end - end - end - end - end - end - end - end - end - end - end - end - end - def html_head_adjust(lng,type='') - css_path,authors='','' - if @env.output_dir_structure.by? == :language - css_path=(type !~/maintenance/) \ - ? '../../_sisu/css/harvest.css' - : 'harvest.css' - authors='authors.html' - elsif @env.output_dir_structure.by? == :filetype - css_path=(type !~/maintenance/) \ - ? '../_sisu/css/harvest.css' - : 'harvest.css' - authors="authors.#{lng}.html" - elsif @env.output_dir_structure.by? == :filename - css_path=(type !~/maintenance/) \ - ? './_sisu/css/harvest.css' - : 'harvest.css' - authors="authors.#{lng}.html" - end - ln=SiSU_i18n::Languages.new.language.list - harvest_languages='' - @the_idx.keys.each do |lg| - if @env.output_dir_structure.by? == :language - harvest_pth="../../#{lg}/manifest" - file=harvest_pth + '/' + 'topics.html' - elsif @env.output_dir_structure.by? == :filetype - harvest_pth='.' - file=harvest_pth + '/' + 'topics.' + lg + '.html' - elsif @env.output_dir_structure.by? == :filename - harvest_pth='.' - file=harvest_pth + '/topics.' + lg + '.html' - end - l=ln[lg][:t] - harvest_languages += - %{#{l}   } - end - sv=SiSU_Env::InfoVersion.instance.get_version - if @env.output_dir_structure.by? == :language - home_pth='../..' - output_structure_by='(output organised by language & filetype)' - elsif @env.output_dir_structure.by? == :filetype - home_pth='..' - output_structure_by='(output organised by filetype)' - elsif @env.output_dir_structure.by? == :filename - home_pth='.' - output_structure_by='(output organised by filename)' - else - home_pth='.' - output_structure_by='(output organised by ?)' - end - < - - - -SiSU Metadata Harvest - Topics - - - - - - - - - - - - -

SiSU Metadata Harvest - Topics #{output_structure_by}

-

[ HOME ] also see SiSU Metadata Harvest - Authors

-

#{@env.widget_static.search_form}

-
-

#{harvest_languages}

-
-WOK - end - def html_head - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] \ - << html_head_adjust(lng,'maintenance') \ - if @opt.act[:maintenance][:set]==:on - @output[lng][:html] << html_head_adjust(lng) - end - end - def html_alph - a=[] - a << '

' - @alph.each do |x| - a << ((x =~/[0-9]/) \ - ? '' - : %{#{x}, }) - end - a=a.join - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << a \ - if @opt.act[:maintenance][:set]==:on - @output[lng][:html] << a - end - end - def html_tail - a =< - - - - - - -#{@vz.credits_sisu} - - -WOK - @the_idx.keys.each do |lng| - @output[lng][:html_mnt] << a \ - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html] << a - end - end - def do_html(lng,html) - @output[lng][:html] << html - end - def do_html_maintenance(lng,html) - @output[lng][:html_mnt] << html \ - if @output[lng][:html_mnt].is_a?(File) - end - def do_string(lng,attrib,string) - html=%{

#{string}

} - do_html(lng,html) - do_html_maintenance(lng,html) \ - if @output[lng][:html_mnt].is_a?(File) - end - def do_string_default(lng,attrib,string) - html=%{

#{string}

} - do_html(lng,html) - end - def do_string_maintenance(lng,attrib,string) - html=%{

#{string}

} - do_html_maintenance(lng,html) \ - if @output[lng][:html_mnt].is_a?(File) - end - def do_string_name(lng,attrib,string) - f=/^(\S)/.match(string)[1] - if @lng != lng - @alph=@alphabet_list.dup - @letter=@alph.shift - @lng = lng - end - if @letter < f - while @letter < f - if @alph.length > 0 - @letter=@alph.shift - if @output[lng][:html_mnt].is_a?(File) - @output[lng][:html_mnt] \ - << %{\n

#{@letter}

} - end - @output[lng][:html] \ - << %{\n

#{@letter}

} - else break - end - end - end - name=string.strip.gsub(/\s+/,'_') - html=%{

#{string}

} - do_html(lng,html) - do_html_maintenance(lng,html) \ - if @output[lng][:html_mnt].is_a?(File) - end - def do_array(lng,lv,array) - lv+=1 - array.each do |b| - do_case(lng,lv,b) - end - end - def do_hash_md(lng,attrib,hash) - lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt,lng).language_code_insert - manifest_at=if @env.output_dir_structure.by? == :language - hash[:file] + Sfx[:html] - elsif @env.output_dir_structure.by? == :filetype - hash[:file] + lang_code_insert + Sfx[:html] - elsif @env.output_dir_structure.by? == :filename - "./#{hash[:file]}/#{hash[:page]}" - else '' #error - end - html=%{#{hash[:title]} - #{hash[:author]}} - do_string_default(lng,attrib,html) - end - def do_hash_md_maintenance(lng,attrib,hash) - if @output[lng][:html_mnt].is_a?(File) #should not be run for presentation output - html=%{[src]  #{hash[:title]} - #{hash[:author]}} - do_string_maintenance(lng,attrib,html) - end - end - def do_hash(lng,lv,hash) - lv+=1 - key=[] - hash.each_key do |m| - if m == :md - do_case(lng,lv,hash[m]) - elsif m != :title \ - and m != :author \ - and m != :filename \ - and m != :file \ - and m != :rough_idx \ - and m != :page - key << m - elsif m == :title - do_hash_md(lng,'work',hash) - do_hash_md_maintenance(lng,'work',hash) - end - end - if key.length > 0 - key.sort.each do |m| - attrib="lev#{lv}" - lv==0 ? do_string_name(lng,attrib,m) : do_string(lng,attrib,m) - do_case(lng,lv,hash[m]) - end - end - end - def do_case(lng,lv,a) - case a - when String - attrib="lev#{lv}" - if a=~/S/ - lv==0 ? do_string_name(lng,attrib,a) : do_string(lng,attrib,a) - end - when Array - do_array(lng,lv,a) - when Hash - do_hash(lng,lv,a) - end - end - #def html_body - # the_idx=@the_idx - # the_idx.each_pair do |lng,lng_array| - # lng_array.sort.each do |a| - # do_case(lng,-1,a) - # end - # end - #end - self - end - end -end -__END__ -terms -|_ t{tl1} -|_ {fa}[fa]{filenames and other details} - | |_ {tl2} -|_ {fa}[fa]{filenames and other details} - | | |_{tl3} -|_ {fa}[fa]{filenames and other details} - | | | |_{tl4} - {fa}[fa]{filenames and other details} - | | | | - | | | |_{tl4a} - {fa}[fa]{filenames and other details} - | | | | - | | | |_{tl4b} - {fa}[fa]{filenames and other details} - | | | | - | | | |_ ... - | | | - | | |_{tl3a} - {fa}[fa]{filenames and other details} - | | - | |_{tl2a} - {fa}[fa]{filenames and other details} - | - |_ t{tl1a} -|_ {fa}[fa]{filenames and other details} - |_ ... diff --git a/lib/sisu/v6/html_harvest.rb b/lib/sisu/v6/html_harvest.rb new file mode 100644 index 00000000..b1bd7ca5 --- /dev/null +++ b/lib/sisu/v6/html_harvest.rb @@ -0,0 +1,114 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + harvest metadata from document corpus (suitable for medium sized sites) + (concept example, [to remove size constraint: implement SQL equivalent]) + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_Harvest + @@the_idx_topics,@@the_idx_authors={},{} + class Source + require_relative 'hub_options' # hub_options.rb + require_relative 'html_harvest_topics' # html_harvest_topics.rb + require_relative 'html_harvest_authors' # html_harvest_authors.rb + require_relative 'se' # se.rb + include SiSU_Env + def initialize(opt) + @opt=opt + @env=SiSU_Env::InfoEnv.new + end + def read + begin + harvest_pth=@env.path.webserv + '/' + @opt.base_stub + FileUtils::mkdir_p(harvest_pth) unless FileTest.directory?(harvest_pth) + cases(@opt,@env) + rescue + ensure + SiSU_Env::CreateSite.new(@opt).cp_css + end + end + def help + puts <. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_FormatAuthor + class Author + def initialize(author_param) + @author_param=author_param + end + def author_details + @authors,@author_array=[],[] + authors=@author_param.scan(/[^;]+/) + authors.each do |a| + a=a.strip + if a =~/"(.+?)"/ + @authors << { the: $1 } + @author_array << $1.upcase + else #if a =~/,/ + x=a.scan(/[^,]+/) + x[0]=x[0].strip + x[1]=x[1].strip if x[1] + if x.length==1 + @authors << { the: x[0] } + @author_array << x[0].upcase + elsif x.length==2 + @authors << { the: x[0], others: x[1] } + @author_array << "#{x[0].upcase}, #{x[1]}" + else #p x.length + end + end + end + l = @authors.length + authors_string='' + @authors.each_with_index do |a,i| + authors_string += if a[:others] + if (l - i) > 1 + "#{a[:others]} #{a[:the]}, " + else + "#{a[:others]} #{a[:the]}" + end + else + if (l - i) > 2 + "#{a[:the]}, " + else + "#{a[:the]}" + end + end + end + { + last_first_a: authors, + last_first_format_a: @author_array, + authors_h: @authors, + authors_s: authors_string, + authors_param: @author_param + } + end + end +end +__END__ diff --git a/lib/sisu/v6/html_harvest_authors.rb b/lib/sisu/v6/html_harvest_authors.rb new file mode 100644 index 00000000..f748f400 --- /dev/null +++ b/lib/sisu/v6/html_harvest_authors.rb @@ -0,0 +1,470 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + metadata harvest, extract authors and their writings from document set + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: simple xml representation (sax style) + +=end +module SiSU_HarvestAuthors + require_relative 'html_harvest_author_format' # html_harvest_author_format.rb + class Songsheet + @@the_idx_authors={} + def initialize(opt,env) + @opt,@env=opt,env + @file_list=opt.files + end + def songsheet + idx_array={} + @opt.f_pths.each do |y| + lang_hash_file_array={} + 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 + lang_hash_file_array[y[:lng_is]] ||= [] + lang_hash_file_array[y[:lng_is]] << line + elsif line =~/^@\S+?:(?:\s|$)/m \ + or line =~/^(?:\s*\n|%+ )/ + else break + end + end + end + lang_hash_file_array.each_pair do |lang,a| + idx_array[lang] ||= [] + idx_array=SiSU_HarvestAuthors::Harvest.new( + @opt, + @env, + a, + filename, + name, + idx_array, + lang + ).extract_harvest + end + end + the_idx=SiSU_HarvestAuthors::Index.new( + idx_array, + @@the_idx_authors + ).construct_book_author_index + SiSU_HarvestAuthors::OutputIndex.new( + @opt, + the_idx + ).html_print.html_songsheet + end + end + class Harvest + def initialize(opt,env,data,filename,name,idx_array,lang) + @opt, @env,@data,@filename,@name,@idx_array,@lang= + opt,env, data, filename, name, idx_array, lang + end + def extract_harvest + data, filename, name, idx_array, lang = + @data,@filename,@name,@idx_array,@lang + @title=@subtitle=@fulltitle=@author=@author_format=@date=nil + @authors=[] + rgx={} + rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m + rgx[:title]=/^@title:[ ]+(.+)/ + rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m + rgx[:date]=/^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m + data.each do |para| + if para=~ rgx[:title] + @title=rgx[:title].match(para)[1] + end + if para=~ rgx[:subtitle] + @subtitle=rgx[:subtitle].match(para)[1] + end + if para=~ rgx[:author] + @author_format=rgx[:author].match(para)[1] + end + if para=~ rgx[:date] + @date=rgx[:date].match(para)[1] + end + break if @title && @subtitle && @author && @date + end + @fulltitle=@subtitle \ + ? (@title + ' - ' + @subtitle) + : @title + if @title \ + and @author_format + creator=SiSU_FormatAuthor::Author.new(@author_format.strip).author_details + @authors,@authorship=creator[:authors],creator[:authorship] + file=if name=~/~[a-z]{2,3}\.ss[mt]$/ + name.sub(/~[a-z]{2,3}\.ss[mt]$/,'') + else + name.sub(/\.ss[mt]$/,'') + end + page=if @env.output_dir_structure.by? == :language + "#{lang}/sisu_manifest.html" + else + "sisu_manifest.#{lang}.html" + end + idx_array[lang] <<= { + filename: filename, + file: file, + date: @date, + title: @fulltitle, + author: creator, + page: page, + lang: lang + } + else + #p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}" + end + idx_array[lang]=idx_array[lang].flatten + idx_array + end + end + class Index + def initialize(idx_array,the_idx) + @idx_array,@the_idx=idx_array,the_idx + @@the_idx_authors=@the_idx + end + def capital(txt) + txt[0].chr.capitalize + txt[1,txt.length] + end + def construct_book_author_index + idx_array=@idx_array + idx_array.each_pair do |lang,idx_arr| + @@the_idx_authors[lang] ||= {} + idx_arr.each do |idx| + idx[:author][:last_first_format_a].each do |author| + author=author.strip + if @@the_idx_authors[lang][author].is_a?(NilClass) + @@the_idx_authors[lang][author]={ md: [] } + end + @@the_idx_authors[lang][author][:md] << { + filename: idx[:filename], + file: idx[:file], + author: idx[:author], + title: idx[:title], + date: idx[:date], + page: idx[:page], + lang: idx[:lang] + } + end + end + end + @the_idx=@@the_idx_authors + end + end + class OutputIndex + require_relative 'i18n' # i18n.rb + def initialize(opt,the_idx) + @opt,@the_idx=opt,the_idx + @env=SiSU_Env::InfoEnv.new + @rc=SiSU_Env::GetInit.new.sisu_yaml.rc + @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + @alph=@alphabet_list.dup + @letter=@alph.shift + @vz=SiSU_Viz::Defaults.new + end + def html_file_open + @the_idx.keys.each do |lng| + @output ||={} + @output[lng] ||={} + harvest_pth,file='','' + if @env.output_dir_structure.by? == :language + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + '/' \ + + lng + '/' \ + + 'manifest' + file="#{harvest_pth}/authors.html" + elsif @env.output_dir_structure.by? == :filetype + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + '/' \ + + 'manifest' + file="#{harvest_pth}/authors.#{lng}.html" + elsif @env.output_dir_structure.by? == :filename + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + file="#{harvest_pth}/authors.#{lng}.html" + end + FileUtils::mkdir_p(harvest_pth) \ + unless FileTest.directory?(harvest_pth) + fileinfo=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:urls_selected][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + ? ("file://#{file}") : '' + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + "harvest authors (#{@opt.files.length} files)", + fileinfo + ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on + @output[lng][:html]=File.new(file,'w') + end + end + def html_file_close + @the_idx.keys.each do |lng| + @output[lng][:html].close + @output[lng][:html_mnt].close \ + if @output[lng][:html_mnt].is_a?(File) + end + end + def html_print + def html_songsheet + html_file_open + html_head + html_alph + html_body + html_tail + html_file_close + end + def html_head_adjust(lng,type='') + css_path,topics='','' + if @env.output_dir_structure.by? == :language + css_path=(type !~/maintenance/) \ + ? '../../_sisu/css/harvest.css' + : 'harvest.css' + topics='topics.html' + elsif @env.output_dir_structure.by? == :filetype + css_path=(type !~/maintenance/) \ + ? '../_sisu/css/harvest.css' + : 'harvest.css' + topics="topics.#{lng}.html" + elsif @env.output_dir_structure.by? == :filename + css_path=(type !~/maintenance/) \ + ? './_sisu/css/harvest.css' + : 'harvest.css' + topics="topics.#{lng}.html" + end + ln=SiSU_i18n::Languages.new.language.list + harvest_languages='' + @the_idx.keys.each do |lg| + if @env.output_dir_structure.by? == :language + harvest_pth="../../#{lg}/manifest" + file="#{harvest_pth}/authors.html" + elsif @env.output_dir_structure.by? == :filetype + harvest_pth='.' + file="#{harvest_pth}/authors.#{lg}.html" + elsif @env.output_dir_structure.by? == :filename + harvest_pth='.' + file="#{harvest_pth}/authors.#{lg}.html" + end + l=ln[lg][:t] + harvest_languages += + %{#{l}   } + end + sv=SiSU_Env::InfoVersion.instance.get_version + if @env.output_dir_structure.by? == :language + home_pth='../..' + output_structure_by= + '(output organised by language & filetype)' + elsif @env.output_dir_structure.by? == :filetype + home_pth='..' + output_structure_by= + '(output organised by filetype)' + elsif @env.output_dir_structure.by? == :filename + home_pth='.' + output_structure_by= + '(output organised by filename)' + else + home_pth='.' + output_structure_by='(output organised by ?)' + end + < + + + +SiSU Metadata Harvest - Authors + + + + + + + + + + + + +

SiSU Metadata Harvest - Authors #{output_structure_by}

+

[ HOME ] also see SiSU Metadata Harvest - Topics

+

#{@env.widget_static.search_form}

+
+

#{harvest_languages}

+
+WOK + end + def html_head + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] \ + << html_head_adjust(lng,'maintenance') \ + if @opt.act[:maintenance][:set]==:on + @output[lng][:html] \ + << html_head_adjust(lng) + end + end + def html_alph + a=[] + a << '

' + @alph.each do |x| + a << ((x =~/[0-9]/) \ + ? '' + : %{#{x}, }) + end + a=a.join + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a \ + if @opt.act[:maintenance][:set]==:on + @output[lng][:html] << a + end + end + def html_tail + a =< + + + + + + +#{@vz.credits_sisu} + + +WOK + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a \ + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html] << a + end + end + def do_html(lng,html) + @output[lng][:html_mnt] << html \ + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html] << html + end + def do_string_name(lng,attrib,string) + f=/^(\S)/.match(string[0])[1] + if @lng != lng + @alph=@alphabet_list.dup + @letter=@alph.shift + @lng = lng + end + if @letter < f + while @letter < f + if @alph.length > 0 + @letter=@alph.shift + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html_mnt] \ + << %{\n

#{@letter}

} + end + @output[lng][:html] \ + << %{\n

#{@letter}

} + else break + end + end + end + end + def html_body + the_idx=@the_idx + the_idx.each_pair do |lng,lng_array| + lng_array.sort.each do |a| + do_string_name(lng,'',a) + name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') + x = %{

#{a[0]}

} + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html_mnt] << x + end + @output[lng][:html] << x + lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt,lng).language_code_insert + works=[] + a[1][:md].each do |i| + manifest_at=if @env.output_dir_structure.by? == :language + i[:file] + Sfx[:html] + elsif @env.output_dir_structure.by? == :filetype + i[:file] + lang_code_insert + Sfx[:html] + elsif @env.output_dir_structure.by? == :filename + './' + i[:file] + '/' + i[:page] + else '' #error + end + work=[ + "#{i[:date]} #{i[:title]}", + %{

#{i[:date]} #{i[:title]}, #{i[:author][:authors_s]}

} + ] + works<<=(@output[lng][:html_mnt].is_a?(File)) \ + ? (work.concat([%{

[src]  #{i[:date]} #{i[:title]}, #{i[:author][:authors_s]} -- [#{i[:file]}.sst]

}])) + : work + end + works.sort_by {|y| y[0]}.each do |z| + @output[lng][:html] << z[1] + @output[lng][:html_mnt] << z[2] \ + if @output[lng][:html_mnt].is_a?(File) + end + end + end + end + self + end + def screen_print + def cycle + the_idx=@the_idx + the_idx.sort.each do |a| + puts a[0] + a[1][:md].each do |x| + puts "\t" + x[:file] + end + end + end + self + end + end +end +__END__ diff --git a/lib/sisu/v6/html_harvest_topics.rb b/lib/sisu/v6/html_harvest_topics.rb new file mode 100644 index 00000000..87ed931a --- /dev/null +++ b/lib/sisu/v6/html_harvest_topics.rb @@ -0,0 +1,900 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + metadata harvest, extract topics and associated writings from document set + (topics use topic_register header) + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: simple xml representation (sax style) + +=end +module SiSU_HarvestTopics + require_relative 'html_harvest_author_format' # html_harvest_author_format.rb + include SiSU_Viz + class Songsheet + @@the_idx_topics={} + def initialize(opt,env) + @opt,@env=opt,env + @file_list=opt.files + end + def songsheet + idx_array={} + @opt.f_pths.each do |y| + lang_hash_file_array={} + 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 + lang_hash_file_array[y[:lng_is]] ||= [] + lang_hash_file_array[y[:lng_is]] << line + elsif line =~/^@\S+?:(?:\s|$)/m \ + or line =~/^(?:\s*\n|\s*$|%+ )/ + else break + end + end + end + lang_hash_file_array.each_pair do |lang,a| + idx_array[lang] ||=[] + idx_array=SiSU_HarvestTopics::Harvest.new( + @opt, + @env, + a, + filename, + name, + idx_array, + lang + ).extract_harvest + end + end + the_hash=SiSU_HarvestTopics::Index.new( + @opt, + @env, + idx_array, + @@the_idx_topics + ).song + SiSU_HarvestTopics::OutputIndex.new( + @opt, + the_hash + ).html_print.html_songsheet + end + end + class Mix + def spaces + Ax[:spaces] + end + end + class Harvest + def initialize(opt,env,data,filename,name,idx_array,lang) + @opt, @env,@data,@filename,@name,@idx_array,@lang= + opt,env, data, filename, name, idx_array, lang + end + def extract_harvest + data, filename, name, idx_array, lang= + @data,@filename,@name,@idx_array,@lang + @idx_lst=@title=@subtitle=@fulltitle=@author=@author_format=nil + rgx={} + rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m + rgx[:title]=/^@title:[ ]+(.+)/ + rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m + rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)(?:\n\n|\n\s+:\S|\n%)/m + data.each do |para| + if para=~ rgx[:idx] + @idx_list=(rgx[:idx].match(para)[1]).split(/\s*\n\s*/).join + end + if para=~ rgx[:title] + @title=rgx[:title].match(para)[1] + end + if para=~ rgx[:subtitle] + @subtitle=rgx[:subtitle].match(para)[1] + end + if para=~ rgx[:author] + @author_format=rgx[:author].match(para)[1] + end + break if @title && @subtitle && @author && @idx_lst + end + @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title + if @title \ + and @author_format \ + and @idx_list + creator=SiSU_FormatAuthor::Author.new(@author_format.strip).author_details + @authors,@authorship=creator[:authors],creator[:authorship] + file=if name=~/~[a-z]{2,3}\.ss[mt]$/ + name.sub(/~[a-z]{2,3}\.ss[mt]$/,'') + else + name.sub(/\.ss[mt]$/,'') + end + page=if @env.output_dir_structure.by? == :language + "#{lang}/sisu_manifest.html" + else + "sisu_manifest.#{lang}.html" + end + idx_array[lang] <<=if @idx_list =~/;/ + g=@idx_list.scan(/[^;]+/) + idxl=[] + g.each do |i| + i=i.strip + idxl << { + filename: filename, + file: file, + rough_idx: i, + title: @fulltitle, + author: creator, + page: page, + lang: lang + } + end + idxl + else { + filename: filename, + file: file, + rough_idx: @idx_list, + title: @fulltitle, + author: creator, + page: page, + lang: lang, + } + end + else + if (@opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" + end + end + idx_array[lang]=idx_array[lang].flatten + idx_array + end + end + class Index < Mix + def initialize(opt,env,idx_array,the_idx) + @opt, @env,@idx_array,@the_idx= + opt,env, idx_array, the_idx + @@the_idx_topics=@the_idx + end + def song + the_idx=construct_book_topic_keys + construct_book_topic_hash(the_idx) + end + def capital(txt) + txt_a=txt.scan(/\S+/) + tx='' + txt_a.each do |t| + tx += t[0].chr.capitalize + t[1,txt.length] + ' ' + end + tx.strip + end + def capital_(txt) + txt[0].chr.capitalize + txt[1,txt.length] + end + def contents(idx,lang) + names='' + idx[:author][:last_first_format_a].each do |n| + s=n.sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') + names=if @env.output_dir_structure.by? == :language + names += %{#{n}, } + else + names += %{#{n}, } + end + end + { + filename: idx[:filename], + file: idx[:file], + author: names, + title: idx[:title], + page: idx[:page] + } + end + def capital_(txt) + txt[0].chr.capitalize + txt[1,txt.length] + end + def key_create(c,alt) + x=nil + x=if c.length==6 + c[0].to_s + '|' + + capital(c[1][0].to_s) + '|' + + capital(c[2][0].to_s) + '|' + + capital(c[3][0].to_s) + '|' + + capital(alt.to_s) + elsif c.length==5 + c[0].to_s + '|' + + capital(c[1][0].to_s) + '|' + + capital(c[2][0].to_s) + '|' + + capital(alt.to_s) + elsif c.length==4 + c[0].to_s + '|' + + capital(c[1][0].to_s) + '|' + + capital(alt.to_s) + elsif c.length==3 + c[0].to_s + '|' + + capital(alt.to_s) + end + end + def construct_book_topic_keys + idx_array=@idx_array + @idx_a=[] + @the_a=[] + idx_array.each_pair do |lang,idx_arr| + @@the_idx_topics[lang] ||= {} + idx_arr.each do |idx| + if idx[:rough_idx] + idx_lst=idx[:rough_idx].scan(/[^:]+/) + else + puts "no topic register in: << #{idx[:filename]} >>" + next + end + idx_a=[] + idx_lst.each do |c| + idx_a << c.scan(/[^|\n]+/m) + end + idx_a << contents(idx,lang) + @idx_a << [lang] + idx_a + end + end + @idx_a.each do |c| + if c.length > 1 \ + and c.is_a?(Array) + if c[2].is_a?(Hash) + c[1].each do |alt| + v=key_create(c,alt) + @the_a << [v, c[2]] if v + end + end + end + if c.length > 2 \ + and c.is_a?(Array) + if c[3].is_a?(Hash) + c[2].each do |alt| + v=key_create(c,alt) + @the_a << [v, c[3]] if v + end + end + end + if c.length > 3 \ + and c.is_a?(Array) + if c[4].is_a?(Hash) + c[3].each do |alt| + v=key_create(c,alt) + @the_a << [v, c[4]] if v + end + end + end + if c.length > 4 \ + and c.is_a?(Array) + if c[5].is_a?(Hash) + c[4].each do |alt| + v=key_create(c,alt) + @the_a << [v, c[5]] if v + end + end + end + if c.length > 5 \ + and c.is_a?(Array) + if c[6].is_a?(Hash) + c[5].each do |alt| + v=key_create(c,alt) + @the_a << [v, c[6]] if v + end + end + end + end + @the_a.sort_by { |x| x[0] } #; y.each {|z| puts z} + end + def construct_book_topic_hash(t) + @the_h={} + t.each do |z| + x=z[0].scan(/[^|]+/) + depth=x.length + extract=(depth-1) + k=case extract + when 4 + { x[0] => { x[1] => { x[2] => { x[3] => { x[4] => z[1] } } } } } + when 3 + { x[0] => { x[1] => { x[2] => { x[3] => z[1] } } } } + when 2 + { x[0] => { x[1] => { x[2] => z[1] } } } + when 1 + { x[0] => { x[1] => z[1] } } + when 0 + { x[0] => z[1] } + end + if extract >= 0 + k.each_pair do |x0,y0| + if extract == 0 + @the_h[x0] ||={ md: [] } + @the_h[x0][:md] << y0 + else + @the_h[x0] ||={} + end + #puts spaces*0 + x0 + if extract >= 1 + y0.each_pair do |x1,y1| + if extract == 1 + @the_h[x0][x1] ||={ md: [] } + @the_h[x0][x1][:md] << y1 + else + @the_h[x0][x1] ||={} + end + #puts spaces*1 + x1 + if extract >= 2 + y1.each_pair do |x2,y2| + if extract == 2 + @the_h[x0][x1][x2] ||={ md: [] } + @the_h[x0][x1][x2][:md] << y2 + else + @the_h[x0][x1][x2] ||={} + end + #puts spaces*2 + x2 + if extract >= 3 + y2.each_pair do |x3,y3| + if extract == 3 + @the_h[x0][x1][x2][x3] ||={ md: [] } + @the_h[x0][x1][x2][x3][:md] << y3 + else + @the_h[x0][x1][x2][x3] ||={} + end + #puts spaces*3 + x3 + if extract == 4 + y3.each_pair do |x4,y4| + if extract == 4 + @the_h[x0][x1][x2][x3][x4] ||={ md: [] } + @the_h[x0][x1][x2][x3][x4][:md] << y4 + else + @the_h[x0][x1][x2][x3][x4] ||={} + end + #puts spaces*4 + x4 + if extract == 5 + y4.each_pair do |x5,y5| + if extract == 5 + @the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] } + @the_h[x0][x1][x2][x3][x4][x5][:md] << y5 + end + #puts spaces*5 + x5 + end + end + end + end + end + end + end + end + end + end + end + end + end + #@the_h.each_pair { |x,y| p x; p y } + @the_h + end + def traverse_base + @the_h.each_pair do |x0,y0| + puts spaces*0 + x0 if x0.is_a?(String) + if y0.is_a?(Hash) + y0.each_pair do |x1,y1| + puts spaces*1 + x1 if x1.is_a?(String) + if y1.is_a?(Hash) + y1.each_pair do |x2,y2| + puts spaces*2 + x2 if x2.is_a?(String) + if y2.is_a?(Hash) + y2.each_pair do |x3,y3| + puts spaces*3 + x3 if x3.is_a?(String) + if y3.is_a?(Hash) + y3.each_pair do |x4,y4| + puts spaces*4 + x4 if x4.is_a?(String) + if y4.is_a?(Hash) + y4.each_pair do |x5,y5| + puts spaces*5 + x5 if x5.is_a?(String) + end + end + end + end + end + end + end + end + end + end + end + end + def traverse + @the_h.each_pair do |x0,y0| + puts spaces*0 + x0 if x0.is_a?(String) + if y0.is_a?(Hash) + if y0.has_key?(:md) + y0[:md].each { |x| puts spaces*5 + x[:title] } + end + y0.each_pair do |x1,y1| + puts spaces*1 + x1 if x1.is_a?(String) + if y1.is_a?(Hash) + if y1.has_key?(:md) + y1[:md].each { |x| puts spaces*5 + x[:title] } + end + y1.each_pair do |x2,y2| + puts spaces*2 + x2 if x2.is_a?(String) + if y2.is_a?(Hash) + if y2.has_key?(:md) + y2[:md].each { |x| puts spaces*5 + x[:title] } + end + y2.each_pair do |x3,y3| + puts spaces*3 + x3 if x3.is_a?(String) + if y3.is_a?(Hash) + if y3.has_key?(:md) + y3[:md].each { |x| puts spaces*5 + x[:title] } + end + y3.each_pair do |x4,y4| + puts spaces*4 + x4 if x4.is_a?(String) + if y4.is_a?(Hash) + if y4.has_key?(:md) + y4[:md].each { |x| puts spaces*5 + x[:title] } + end + y4.each_pair do |x5,y5| + puts spaces*5 + x4 if x4.is_a?(String) + end + end + end + end + end + end + end + end + end + end + end + end + end + class OutputIndex < Mix + require_relative 'i18n' # i18n.rb + def initialize(opt,the_idx) + @opt,@the_idx=opt,the_idx + @env=SiSU_Env::InfoEnv.new + @rc=SiSU_Env::GetInit.new.sisu_yaml.rc + @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + @alph=@alphabet_list.dup + @letter=@alph.shift + @vz=SiSU_Viz::Defaults.new + end + def html_file_open + @the_idx.keys.each do |lng| + @output ||={} + @output[lng] ||={} + harvest_pth,file='','' + if @env.output_dir_structure.by? == :language + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + '/' \ + + lng + '/' \ + + 'manifest' + file=harvest_pth + '/' + 'topics.html' + elsif @env.output_dir_structure.by? == :filetype + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + '/' \ + + 'manifest' + file=harvest_pth + '/' + 'topics.' + lng + '.html' + elsif @env.output_dir_structure.by? == :filename + harvest_pth=@env.path.webserv + '/' \ + + @opt.base_stub + file=harvest_pth + '/' + 'topics.' + lng + '.html' + end + FileUtils::mkdir_p(harvest_pth) \ + unless FileTest.directory?(harvest_pth) + fileinfo=(@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:urls_selected][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) \ + ? ("file://#{file}") + : '' + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + "harvest topics(#{@opt.files.length} files)", + fileinfo + ).dark_grey_title_hi unless @opt.act[:quiet][:set]==:on + @output[lng][:html]=File.new(file,'w') + if @opt.act[:maintenance][:set]==:on + @output[lng][:html_mnt]=File.new("#{@env.path.pwd}/topics.html",'w') + end + end + end + def html_file_close + @the_idx.keys.each do |lng| + @output[lng][:html].close + @output[lng][:html_mnt].close if @output[lng][:html_mnt].is_a?(File) + end + end + def html_print + def html_songsheet + #traverse + html_file_open + html_head + html_alph + html_body_traverse + html_tail + html_file_close + end + def html_body_traverse + @the_idx.each_pair do |x0,y0| + lng=x0 + if x0.is_a?(String) + #do_string_name(lng,'lev0',x0) + #puts spaces*0 + x0 + end + if y0.is_a?(Hash) + if y0.has_key?(:md) + y0[:md].each do |x| + #do_hash(lng,attrib,x) #lv==0 ? + #puts spaces*5 + x[:title] + end + end + y0.each_pair do |x1,y1| + if x1.is_a?(String) + do_string_name(lng,'lev0',x1) + #puts spaces*1 + x1 + end + if y1.is_a?(Hash) + if y1.has_key?(:md) + y1[:md].each do |x| + do_hash(lng,0,x) + #puts spaces*5 + x[:title] + end + end + y1.each_pair do |x2,y2| + if x2.is_a?(String) + do_string(lng,'lev1',x2) + #puts spaces*2 + x2 + end + if y2.is_a?(Hash) + if y2.has_key?(:md) + y2[:md].each do |x| + do_hash(lng,1,x) + #puts spaces*5 + x[:title] + end + end + y2.each_pair do |x3,y3| + if x3.is_a?(String) + do_string(lng,'lev2',x3) + #puts spaces*3 + x3 + end + if y3.is_a?(Hash) + if y3.has_key?(:md) + y3[:md].each do |x| + do_hash(lng,2,x) + #puts spaces*5 + x[:title] + end + end + y3.each_pair do |x4,y4| + if x4.is_a?(String) + do_string(lng,'lev3',x4) + #puts spaces*4 + x4 + end + if y4.is_a?(Hash) + if y4.has_key?(:md) + y4[:md].each do |x| + do_hash(lng,3,x) + #puts spaces*5 + x[:title] + end + end + y4.each_pair do |x5,y5| + if x5.is_a?(String) + do_string(lng,'lev4',x5) + #puts spaces*5 + x5 + end + end + end + end + end + end + end + end + end + end + end + end + end + def html_head_adjust(lng,type='') + css_path,authors='','' + if @env.output_dir_structure.by? == :language + css_path=(type !~/maintenance/) \ + ? '../../_sisu/css/harvest.css' + : 'harvest.css' + authors='authors.html' + elsif @env.output_dir_structure.by? == :filetype + css_path=(type !~/maintenance/) \ + ? '../_sisu/css/harvest.css' + : 'harvest.css' + authors="authors.#{lng}.html" + elsif @env.output_dir_structure.by? == :filename + css_path=(type !~/maintenance/) \ + ? './_sisu/css/harvest.css' + : 'harvest.css' + authors="authors.#{lng}.html" + end + ln=SiSU_i18n::Languages.new.language.list + harvest_languages='' + @the_idx.keys.each do |lg| + if @env.output_dir_structure.by? == :language + harvest_pth="../../#{lg}/manifest" + file=harvest_pth + '/' + 'topics.html' + elsif @env.output_dir_structure.by? == :filetype + harvest_pth='.' + file=harvest_pth + '/' + 'topics.' + lg + '.html' + elsif @env.output_dir_structure.by? == :filename + harvest_pth='.' + file=harvest_pth + '/topics.' + lg + '.html' + end + l=ln[lg][:t] + harvest_languages += + %{#{l}   } + end + sv=SiSU_Env::InfoVersion.instance.get_version + if @env.output_dir_structure.by? == :language + home_pth='../..' + output_structure_by='(output organised by language & filetype)' + elsif @env.output_dir_structure.by? == :filetype + home_pth='..' + output_structure_by='(output organised by filetype)' + elsif @env.output_dir_structure.by? == :filename + home_pth='.' + output_structure_by='(output organised by filename)' + else + home_pth='.' + output_structure_by='(output organised by ?)' + end + < + + + +SiSU Metadata Harvest - Topics + + + + + + + + + + + + +

SiSU Metadata Harvest - Topics #{output_structure_by}

+

[ HOME ] also see SiSU Metadata Harvest - Authors

+

#{@env.widget_static.search_form}

+
+

#{harvest_languages}

+
+WOK + end + def html_head + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] \ + << html_head_adjust(lng,'maintenance') \ + if @opt.act[:maintenance][:set]==:on + @output[lng][:html] << html_head_adjust(lng) + end + end + def html_alph + a=[] + a << '

' + @alph.each do |x| + a << ((x =~/[0-9]/) \ + ? '' + : %{#{x}, }) + end + a=a.join + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a \ + if @opt.act[:maintenance][:set]==:on + @output[lng][:html] << a + end + end + def html_tail + a =< + + + + + + +#{@vz.credits_sisu} + + +WOK + @the_idx.keys.each do |lng| + @output[lng][:html_mnt] << a \ + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html] << a + end + end + def do_html(lng,html) + @output[lng][:html] << html + end + def do_html_maintenance(lng,html) + @output[lng][:html_mnt] << html \ + if @output[lng][:html_mnt].is_a?(File) + end + def do_string(lng,attrib,string) + html=%{

#{string}

} + do_html(lng,html) + do_html_maintenance(lng,html) \ + if @output[lng][:html_mnt].is_a?(File) + end + def do_string_default(lng,attrib,string) + html=%{

#{string}

} + do_html(lng,html) + end + def do_string_maintenance(lng,attrib,string) + html=%{

#{string}

} + do_html_maintenance(lng,html) \ + if @output[lng][:html_mnt].is_a?(File) + end + def do_string_name(lng,attrib,string) + f=/^(\S)/.match(string)[1] + if @lng != lng + @alph=@alphabet_list.dup + @letter=@alph.shift + @lng = lng + end + if @letter < f + while @letter < f + if @alph.length > 0 + @letter=@alph.shift + if @output[lng][:html_mnt].is_a?(File) + @output[lng][:html_mnt] \ + << %{\n

#{@letter}

} + end + @output[lng][:html] \ + << %{\n

#{@letter}

} + else break + end + end + end + name=string.strip.gsub(/\s+/,'_') + html=%{

#{string}

} + do_html(lng,html) + do_html_maintenance(lng,html) \ + if @output[lng][:html_mnt].is_a?(File) + end + def do_array(lng,lv,array) + lv+=1 + array.each do |b| + do_case(lng,lv,b) + end + end + def do_hash_md(lng,attrib,hash) + lang_code_insert=SiSU_Env::FilenameLanguageCodeInsert.new(@opt,lng).language_code_insert + manifest_at=if @env.output_dir_structure.by? == :language + hash[:file] + Sfx[:html] + elsif @env.output_dir_structure.by? == :filetype + hash[:file] + lang_code_insert + Sfx[:html] + elsif @env.output_dir_structure.by? == :filename + "./#{hash[:file]}/#{hash[:page]}" + else '' #error + end + html=%{#{hash[:title]} - #{hash[:author]}} + do_string_default(lng,attrib,html) + end + def do_hash_md_maintenance(lng,attrib,hash) + if @output[lng][:html_mnt].is_a?(File) #should not be run for presentation output + html=%{[src]  #{hash[:title]} - #{hash[:author]}} + do_string_maintenance(lng,attrib,html) + end + end + def do_hash(lng,lv,hash) + lv+=1 + key=[] + hash.each_key do |m| + if m == :md + do_case(lng,lv,hash[m]) + elsif m != :title \ + and m != :author \ + and m != :filename \ + and m != :file \ + and m != :rough_idx \ + and m != :page + key << m + elsif m == :title + do_hash_md(lng,'work',hash) + do_hash_md_maintenance(lng,'work',hash) + end + end + if key.length > 0 + key.sort.each do |m| + attrib="lev#{lv}" + lv==0 ? do_string_name(lng,attrib,m) : do_string(lng,attrib,m) + do_case(lng,lv,hash[m]) + end + end + end + def do_case(lng,lv,a) + case a + when String + attrib="lev#{lv}" + if a=~/S/ + lv==0 ? do_string_name(lng,attrib,a) : do_string(lng,attrib,a) + end + when Array + do_array(lng,lv,a) + when Hash + do_hash(lng,lv,a) + end + end + #def html_body + # the_idx=@the_idx + # the_idx.each_pair do |lng,lng_array| + # lng_array.sort.each do |a| + # do_case(lng,-1,a) + # end + # end + #end + self + end + end +end +__END__ +terms -|_ t{tl1} -|_ {fa}[fa]{filenames and other details} + | |_ {tl2} -|_ {fa}[fa]{filenames and other details} + | | |_{tl3} -|_ {fa}[fa]{filenames and other details} + | | | |_{tl4} - {fa}[fa]{filenames and other details} + | | | | + | | | |_{tl4a} - {fa}[fa]{filenames and other details} + | | | | + | | | |_{tl4b} - {fa}[fa]{filenames and other details} + | | | | + | | | |_ ... + | | | + | | |_{tl3a} - {fa}[fa]{filenames and other details} + | | + | |_{tl2a} - {fa}[fa]{filenames and other details} + | + |_ t{tl1a} -|_ {fa}[fa]{filenames and other details} + |_ ... diff --git a/lib/sisu/v6/hub_actions.rb b/lib/sisu/v6/hub_actions.rb index e7e42bd2..076461db 100644 --- a/lib/sisu/v6/hub_actions.rb +++ b/lib/sisu/v6/hub_actions.rb @@ -559,7 +559,7 @@ module SiSU_Hub_Actions def harvest? if @opt.act[:harvest][:set]==:on #% --harvest if @opt.f_pths.length > 0 - require_relative 'harvest' # harvest.rb + require_relative 'html_harvest' # html_harvest.rb SiSU_Harvest::Source.new(@opt).read else msg='harvest request requires sisu markup files' -- cgit v1.2.3 From 92b4747c4f5b4f6753587d2db969fe3d2c4ca077 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:32:54 -0400 Subject: v5: html, reduce difference with v6 (removal of some trailing slashes


) --- lib/sisu/v5/html.rb | 14 +++++++------- lib/sisu/v5/html_concordance.rb | 4 ++-- lib/sisu/v5/html_format.rb | 20 +++++++++----------- lib/sisu/v5/html_lite_shared.rb | 2 +- lib/sisu/v5/html_manifest.rb | 6 +++--- lib/sisu/v5/html_promo.rb | 16 ++++++++-------- lib/sisu/v5/html_scroll.rb | 2 +- lib/sisu/v5/html_segments.rb | 4 ++-- lib/sisu/v5/html_tune.rb | 6 +++--- 9 files changed, 36 insertions(+), 38 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index 047ce9f9..76dbe2a2 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -335,10 +335,10 @@ module SiSU_HTML

-(relatively static) RSS feeds for DOCUMENTS:
-RSS feed http://www.jus.uio.no/lm/rssfeed/documents.xml
-RSS feed http://www.jus.uio.no/lm/rssfeed/tradelaw.xml
-RSS feed http://www.jus.uio.no/lm/rssfeed/environmental.xml
+(relatively static) RSS feeds for DOCUMENTS:
+RSS feed http://www.jus.uio.no/lm/rssfeed/documents.xml
+RSS feed http://www.jus.uio.no/lm/rssfeed/tradelaw.xml
+RSS feed http://www.jus.uio.no/lm/rssfeed/environmental.xml

info@address.com

@@ -383,7 +383,7 @@ WOK toc[:seg_mini]=format_toc.mini_lev0 title=if dob.ocn ==0 then linkname else - @@toc[:scr] << '
' + @@toc[:scr] << '
' %{#{linkname}} end txt_obj={ txt: title } @@ -425,7 +425,7 @@ WOK else linkname end else - @@toc[:scr] << '
' + @@toc[:scr] << '
' %{#{linkname}} end txt_obj={ txt: title } @@ -666,7 +666,7 @@ WOK @segtoc << "#{@vz.table_close*1}\n" tmp_head=nil if @md.prefix_a - tmp_head ||= %{

#{@md.prefix_a}\n} + tmp_head ||= %{

#{@md.prefix_a}\n} toc_shared << tmp_head.dup @segtoc << tmp_head.dup end diff --git a/lib/sisu/v5/html_concordance.rb b/lib/sisu/v5/html_concordance.rb index 51acabef..32a2ea35 100644 --- a/lib/sisu/v5/html_concordance.rb +++ b/lib/sisu/v5/html_concordance.rb @@ -176,10 +176,10 @@ WOK #{toc}

#{@doc_details} -

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

+

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

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

- word (number of occurences)
linked references to word within document
+ word (number of occurences)
linked references to word within document
[if number of occurences exceed number of references - word occurs more than once in at least one reference. Footnote/endnotes are either assigned to the paragraph from which they are referenced or ignored, so it is relevant to check the footnotes referenced from within a paragraph as well.]

diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index c34759cf..e99f1b5f 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -301,7 +301,7 @@ WOK   #{@vz.table_close} -

} +

} else '' end end @@ -324,7 +324,7 @@ WOK #{doc_types} #{up_button} #{@vz.table_close} -

} +

} else '' end end @@ -354,7 +354,7 @@ WOK  #{firstseg}  #{@vz.table_close} -

} +

} else '' end end @@ -422,9 +422,7 @@ WOK #{@stylesheet.css_head} #{@vz.color_body} - - -} +} end def concordance if @md.concord_make @@ -513,7 +511,7 @@ WOK rights=SiSU_HTML_Tune::CleanHTML.new(@md.rights.all).clean_for_html rights=rights.gsub(/^\s*Copyright\s+\(C\)/,'Copyright © ') %{

Rights: #{rights}

-

} +

} end self end @@ -1021,7 +1019,7 @@ WOK end def heading_normal(tag,attrib) section_break=(tag=~/h[1-5]/) \ - ? '



' + ? '


' : '' %{#{section_break}
@@ -1179,13 +1177,13 @@ WOK
#{@txt} #{@two} -

} +

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

+ %{

@@ -1197,7 +1195,7 @@ WOK #{@vz.table_close}} end def navigation_toc_lev3 #change bold use css - %{

+ %{

diff --git a/lib/sisu/v5/html_lite_shared.rb b/lib/sisu/v5/html_lite_shared.rb index 7c3cdf0f..d766b54c 100644 --- a/lib/sisu/v5/html_lite_shared.rb +++ b/lib/sisu/v5/html_lite_shared.rb @@ -104,7 +104,7 @@ module SiSU_FormatShared w=%{width="#{w}"} if w h=%{height="#{h}"} if h c=m[/"(.+?)"/m,1] - caption=%{

#{c}

} if c + caption=%{

#{c}

} if c png=m.scan(/\S+/)[0] ins=if u \ and u.strip !~/^image$/ diff --git a/lib/sisu/v5/html_manifest.rb b/lib/sisu/v5/html_manifest.rb index 45ee2aae..d3e5871c 100644 --- a/lib/sisu/v5/html_manifest.rb +++ b/lib/sisu/v5/html_manifest.rb @@ -158,7 +158,7 @@ module SiSU_Manifest if @o_str.dump_or_redirect? '' elsif src==:src #check - %{
#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}} + %{
#{@brace_url.xml_open}#{url}/#{file}#{@brace_url.xml_close}} else %{

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

} end @@ -265,7 +265,7 @@ module SiSU_Manifest end end def metadata(id,info) - info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'
') + info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'
') @manifest[:html] << %{\n} end def links(url,lnk,target) @@ -1009,7 +1009,7 @@ WOK

#{id}:

#{info}

-
+
#{vz.credits_sisu_manifest}
diff --git a/lib/sisu/v5/html_promo.rb b/lib/sisu/v5/html_promo.rb index 57b45639..1f2b0388 100644 --- a/lib/sisu/v5/html_promo.rb +++ b/lib/sisu/v5/html_promo.rb @@ -145,7 +145,7 @@ module SiSU_HTML_Promo @prod['form'] ? %{

#{@prod['form']}

} : '' end def nick - @prod['nick'] ? %{(#{@prod['nick']})
} : '' + @prod['nick'] ? %{(#{@prod['nick']})
} : '' end def update @prod['update'] ? %{

Updated: #{@prod['update']}

} : '' @@ -186,7 +186,7 @@ module SiSU_HTML_Promo else nil end form=if action - '
' + @env.widget.search_form('hyperestraier',action,'',table) + '
' + @env.widget.search_form('hyperestraier',action,'',table) else '' end form @@ -208,7 +208,7 @@ module SiSU_HTML_Promo end end def image - @prod['image'] ? %{
} : '' + @prod['image'] ? %{
} : '' end def url_link @url_=if @prod['url'] =~/https?:/ @@ -296,7 +296,7 @@ module SiSU_HTML_Promo def output_form_sponsor(type,id) cell=cell(@ad[:promo][type][id],prod_id) <<-WOK -
+
#{cell.site_link} #{cell.blurb} #{cell.links} @@ -306,7 +306,7 @@ module SiSU_HTML_Promo prod_id=id.gsub(/id_/,'') cell=cell(@ad[:promo][type][id],prod_id) < +
#{cell.site_link} #{cell.author} #{cell.year} @@ -330,7 +330,7 @@ WOK prod_type=((id=~/id_(?:[0-9x]){10,13}/i) ? 'isbn' : 'id') id_detail=%{

#{prod_type}: #{prod_id}

} < +
#{cell.site_link} #{cell.author} #{cell.year} @@ -346,7 +346,7 @@ WOK prod_id=id.gsub(/id_/,'') cell=cell(@ad[:promo][type][id],prod_id) < +
#{cell.site_link} #{cell.editor} #{cell.issn} @@ -363,7 +363,7 @@ WOK cell=cell(@ad[:promo][type][id],prod_id) #translate date (dd month yyyy) from 2007-03-04 and ruby conversion < +
#{cell.site_link} #{cell.date} #{cell.location} diff --git a/lib/sisu/v5/html_scroll.rb b/lib/sisu/v5/html_scroll.rb index dc636378..1b632f56 100644 --- a/lib/sisu/v5/html_scroll.rb +++ b/lib/sisu/v5/html_scroll.rb @@ -134,7 +134,7 @@ module SiSU_HTML_Scroll end elsif dob.is==:break \ and dob.from==:markup - '


' + '


' elsif dob.is==:heading_insert x=if dob.ln==0 unless dob.obj.empty? diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb index 555b75bb..4054e6fc 100644 --- a/lib/sisu/v5/html_segments.rb +++ b/lib/sisu/v5/html_segments.rb @@ -443,7 +443,7 @@ module SiSU_HTML_Seg @@seg[:tocband_banner] \ << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) @@seg[:tocband_bannerless] \ - << '
' \ + << '
' \ << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) if @title_banner_ @@seg[:headings] \ @@ -570,7 +570,7 @@ module SiSU_HTML_Seg sto.table elsif dob.is==:break \ and dob.from==:markup - '


' + '


' end if @md.flag_separate_endnotes dob.obj=dob.obj.gsub(/"\s+href="#(#{Mx[:note]}\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#\\1">}) #endnote- twice #removed file type diff --git a/lib/sisu/v5/html_tune.rb b/lib/sisu/v5/html_tune.rb index 026a1177..bd934ecc 100644 --- a/lib/sisu/v5/html_tune.rb +++ b/lib/sisu/v5/html_tune.rb @@ -119,7 +119,7 @@ module SiSU_HTML_Tune end str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). - gsub(/[\\]{2}/m,'
') + gsub(/[\\]{2}/m,'
') end end class Tune @@ -187,7 +187,7 @@ module SiSU_HTML_Tune w=%{width="#{w}"} if w h=%{height="#{h}"} if h c=m[/"(.+?)"/m,1] - caption=%{

#{c}

} if c + caption=%{

#{c}

} if c png=m.scan(/\S+/)[0] image_path=@md.file.output_path.html_seg.rel_image #image_path=(@md.fns =~/\.-ss[tm]$/) \ @@ -277,7 +277,7 @@ module SiSU_HTML_Tune def markup(dob) dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') - dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
') unless dob.is==:table + dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
') unless dob.is==:table dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1'). gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1'). gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1'). -- cgit v1.2.3 From 46485232482fdcb385f8dda5f01cad57f7add189 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:34:20 -0400 Subject: v5: html, reduce difference with v6 (mostly removal of bgcolor) * note: html_format.rb has differences, else same --- lib/sisu/v5/cgi_sql_common.rb | 8 ++++---- lib/sisu/v5/defaults.rb | 34 +++++++++++++++++----------------- lib/sisu/v5/html_concordance.rb | 2 +- lib/sisu/v5/html_lite_shared.rb | 2 +- lib/sisu/v5/html_manifest.rb | 12 ++++++------ lib/sisu/v5/html_tune.rb | 2 +- lib/sisu/v5/xhtml_epub2.rb | 2 +- 7 files changed, 31 insertions(+), 31 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/cgi_sql_common.rb b/lib/sisu/v5/cgi_sql_common.rb index a16ca0db..d6f99342 100644 --- a/lib/sisu/v5/cgi_sql_common.rb +++ b/lib/sisu/v5/cgi_sql_common.rb @@ -156,11 +156,11 @@ module SiSU_CGI_SQL - +
-
+

SiSU @@ -543,11 +543,11 @@ module SiSU_CGI_SQL def tail <<-'WOK'


- +
-
+

SiSU diff --git a/lib/sisu/v5/defaults.rb b/lib/sisu/v5/defaults.rb index 0ea154b2..da8b13a2 100644 --- a/lib/sisu/v5/defaults.rb +++ b/lib/sisu/v5/defaults.rb @@ -268,7 +268,7 @@ module SiSU_Viz end #% path def path_stylesheet_home - %{ } + %{ } end #% text #changed from txt to avoid naming conflicts #FOLLOW def txt_generator @@ -372,7 +372,7 @@ module SiSU_Viz end #% color def color_body - %{} + %{} end def color_white '"#ffffff"' @@ -450,7 +450,7 @@ module SiSU_Viz %{"#{color_white}"} end def color_body - %{} + %{} end def color_font_face #was font WATCH "#{color_black}" @@ -663,38 +663,38 @@ module SiSU_Viz
' end def margin_txt_w1 - %{ + %{
  } end def margin_txt_w2 - %{ + %{
  } end def margin_txt_0 - %{ + %{
} end def margin_txt_1 - %{ + %{
} end def margin_txt_2 - %{ + %{
} end def margin_txt_3 - %{ + %{
} end def margin_css - ' + '
' end #% png @@ -790,8 +790,8 @@ module SiSU_Viz } end def banner_band #yellow_dark now white - %{ -
+ %{ + -
#{png_home} @@ -800,11 +800,11 @@ module SiSU_Viz #{table_close}} end def banner_instrument_cover_band_scr - ' + '
-
' end def banner_instrument_cover_band_seg - ' + '
' end #% widget @@ -813,7 +813,7 @@ module SiSU_Viz end def widgets_open < + WOK end def widget_sisu_text @@ -941,7 +941,7 @@ WOK end def credits_sisu %{
-
+
#{widget_sisu}
} @@ -993,7 +993,7 @@ WOK - + diff --git a/lib/sisu/v5/html_concordance.rb b/lib/sisu/v5/html_concordance.rb index 32a2ea35..6053bd61 100644 --- a/lib/sisu/v5/html_concordance.rb +++ b/lib/sisu/v5/html_concordance.rb @@ -136,7 +136,7 @@ module SiSU_Concordance @fnb=@md.fnb @lex_button=%{SiSU home -->} @doc_details =<
 

#{@md.title.full}

#{@md.author}

+
 

#{@md.title.full}

#{@md.author}

WOK @make=SiSU_Env::ProcessingSettings.new(@md) end diff --git a/lib/sisu/v5/html_lite_shared.rb b/lib/sisu/v5/html_lite_shared.rb index d766b54c..35eb130e 100644 --- a/lib/sisu/v5/html_lite_shared.rb +++ b/lib/sisu/v5/html_lite_shared.rb @@ -265,7 +265,7 @@ GSUB parablock=parablock.gsub(//,'') @@tablehead=1 if parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u parablock=parablock.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+)#{Mx[:gr_c]}/, - %{}) + %{
}) if parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << %{

#{x}

\n}} diff --git a/lib/sisu/v5/html_manifest.rb b/lib/sisu/v5/html_manifest.rb index d3e5871c..d2c1360f 100644 --- a/lib/sisu/v5/html_manifest.rb +++ b/lib/sisu/v5/html_manifest.rb @@ -963,26 +963,26 @@ WOK       metadata suggested links (if any)

-
+
WOK published_versions @manifest[:html] << '
' @manifest[:html] <<<#{@translate.manifest_description_output} - +
WOK output_tests @manifest[:html] << '

#{@translate.filetype_description}

#{@translate.filename}

#{@translate.file_size}

(kB)

' @manifest[:html] <<< + WOK source_tests @manifest[:html] << '
' @manifest[:html] <<<#{@translate.manifest_description_metadata} - +
WOK metadata_tests @@ -991,7 +991,7 @@ WOK WOK @manifest[:html] <<<#{@translate.suggested_links}:

-

#{@translate.metadata}

#{@translate.description}

+
WOK links_tests @manifest[:html] <<<#{@translate.language_version_list} -
+
WOK diff --git a/lib/sisu/v5/html_tune.rb b/lib/sisu/v5/html_tune.rb index bd934ecc..292087e5 100644 --- a/lib/sisu/v5/html_tune.rb +++ b/lib/sisu/v5/html_tune.rb @@ -65,7 +65,7 @@ module SiSU_HTML_Tune @@line_mode='' @@endnote_array=[] @@endnote_call_counter=1 - @@table_align='

#{@translate.filename}

#{@translate.description}

 

+ @@table_align='
 \; ' diff --git a/lib/sisu/v5/xhtml_epub2.rb b/lib/sisu/v5/xhtml_epub2.rb index 2d89bc68..794c9024 100644 --- a/lib/sisu/v5/xhtml_epub2.rb +++ b/lib/sisu/v5/xhtml_epub2.rb @@ -850,7 +850,7 @@ module SiSU_XHTML_EPUB2 - +
-- cgit v1.2.3 From e283681065039fa2b7ac56ab257d5cb4eb4658ac Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:35:54 -0400 Subject: v5 v6: constants, remove ocn html leader * resulting hashtag #1 instead of #o1 --- lib/sisu/v5/constants.rb | 2 +- lib/sisu/v6/constants.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index 5bac6769..1e5a4dfe 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -104,7 +104,7 @@ Mx={ segname_prefix_auto_num_extract: 'c', segname_prefix_auto_num_provide: 's', segname_prefix_auto_num_other: 'x', - ocn_id_char: 'o', + ocn_id_char: '', #'o', now as before; remove for html5 note: 'note_', note_ref: 'noteref_', note_astx: 'note_astx_', diff --git a/lib/sisu/v6/constants.rb b/lib/sisu/v6/constants.rb index 80fa7c7a..bf16d7da 100644 --- a/lib/sisu/v6/constants.rb +++ b/lib/sisu/v6/constants.rb @@ -104,7 +104,7 @@ Mx={ segname_prefix_auto_num_extract: 'c', segname_prefix_auto_num_provide: 's', segname_prefix_auto_num_other: 'x', - ocn_id_char: 'o', + ocn_id_char: '', #'o', now as before; remove for html5 note: 'note_', note_ref: 'noteref_', note_astx: 'note_astx_', -- cgit v1.2.3 From b99857de428aa6e9182c5e724444bd791afd9dbd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:37:42 -0400 Subject: v5 v6: html_format, label, re: object number object names --- lib/sisu/v5/html_format.rb | 20 +++++++------------- lib/sisu/v6/html_format.rb | 11 ++++++++--- 2 files changed, 15 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index e99f1b5f..3cfa9268 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -71,10 +71,10 @@ module SiSU_HTML_Format if @ocn.to_i==0 \ or @ocn.empty? '' + elsif @make.build.html_strict? + %{} else - name=(@make.build.html_strict?) ? '' : %{ name="#{@ocn}"} - @ocn.gsub(/^(\d+|)$/, - %{}) + %{} end else '' @@ -819,7 +819,7 @@ WOK #{@seg_name_html[@seg_name_html_tracker]} - #{@md.html_title} - + #{rdf.metatag_html} #{@stylesheet.css_head_seg} @@ -918,15 +918,9 @@ WOK and dob.tags.length > 0 # insert tags "hypertargets" dob.tags.each do |t| t=t.gsub(/[^a-z0-9._-]/,'') #use for all html tags? consider limiting to strict? or implementing earlier - if @make.build.html_strict? - tags=(t =~/^[#{Mx[:ocn_id_char]}]?[0-9.]+$/) \ - ? tags #check what can be sorted in ao - : (tags << %{}) - else - tags=(t =~/^[#{Mx[:ocn_id_char]}][0-9.]+$/) \ - ? tags #check what can be sorted in ao - : (tags << %{}) - end + tags=(t =~/^[0-9.]+$/) \ + ? tags #check what can be sorted in ao + : (tags << %{}) end end tags diff --git a/lib/sisu/v6/html_format.rb b/lib/sisu/v6/html_format.rb index abefdf2f..61fedba1 100644 --- a/lib/sisu/v6/html_format.rb +++ b/lib/sisu/v6/html_format.rb @@ -71,10 +71,11 @@ module SiSU_HTML_Format if @ocn.to_i==0 \ or @ocn.empty? '' + elsif @make.build.html_strict? + %{} else - name=(@make.build.html_strict?) ? '' : %{ name="#{@ocn}"} - @ocn.gsub(/^(\d+|)$/, - %{}) + %{} + #%{} end else '' @@ -410,6 +411,7 @@ WOK
} end def head + rdf=SiSU_XML_Tags::RDF.new(@md) %{#{doc_type} @@ -417,6 +419,7 @@ WOK #{@md.html_title} +#{rdf.metatag_html} #{@stylesheet.css_head} #{@vz.color_body} @@ -809,6 +812,7 @@ WOK } #revisit end def head_seg + rdf=SiSU_XML_Tags::RDF.new(@md) %{#{doc_type} @@ -817,6 +821,7 @@ WOK #{@md.html_title} +#{rdf.metatag_html} #{@stylesheet.css_head_seg} #{@vz.color_body} -- cgit v1.2.3 From 710370599b0f3f8c8ce4bc7a1ebcbbc880c9b0f3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:40:09 -0400 Subject: v5 v6: html, epub, set document body language --- lib/sisu/v5/html_format.rb | 4 ++-- lib/sisu/v5/html_manifest.rb | 2 +- lib/sisu/v5/xhtml_epub2_format.rb | 6 +++--- lib/sisu/v6/html_format.rb | 4 ++-- lib/sisu/v6/html_manifest.rb | 2 +- lib/sisu/v6/xhtml_epub2_format.rb | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index 3cfa9268..75bacdc2 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -421,7 +421,7 @@ WOK #{rdf.metatag_html} #{@stylesheet.css_head} -#{@vz.color_body} + } end def concordance @@ -823,7 +823,7 @@ WOK #{rdf.metatag_html} #{@stylesheet.css_head_seg} -#{@vz.color_body} + } end def title_banner(title,subtitle,creator) diff --git a/lib/sisu/v5/html_manifest.rb b/lib/sisu/v5/html_manifest.rb index d2c1360f..de629d61 100644 --- a/lib/sisu/v5/html_manifest.rb +++ b/lib/sisu/v5/html_manifest.rb @@ -901,7 +901,7 @@ SiSU manifest: #{@md.title.full} #{@stylesheet.css_head} - + #{format_head_toc.seg_head_navigation_band(:manifest)} WOK if make.build.manifest_minitoc? diff --git a/lib/sisu/v5/xhtml_epub2_format.rb b/lib/sisu/v5/xhtml_epub2_format.rb index 751aa32b..4004a446 100644 --- a/lib/sisu/v5/xhtml_epub2_format.rb +++ b/lib/sisu/v5/xhtml_epub2_format.rb @@ -1330,7 +1330,7 @@ application/epub+zip #{@css.xhtml_epub} - #{@vz.color_body} +
@@ -1753,7 +1753,7 @@ output_epub_cont_seg.close #{@css.xhtml_epub} - #{@vz.color_body}} + } end def concordance if @md.concord_make @@ -1837,7 +1837,7 @@ output_epub_cont_seg.close #{@css.xhtml_epub} - #{@vz.color_body}} + } end def endnote_mark %{ diff --git a/lib/sisu/v6/html_format.rb b/lib/sisu/v6/html_format.rb index 61fedba1..a8e3fa28 100644 --- a/lib/sisu/v6/html_format.rb +++ b/lib/sisu/v6/html_format.rb @@ -422,7 +422,7 @@ WOK #{rdf.metatag_html} #{@stylesheet.css_head} -#{@vz.color_body} + } end def concordance @@ -824,7 +824,7 @@ WOK #{rdf.metatag_html} #{@stylesheet.css_head_seg} -#{@vz.color_body} + } end def title_banner(title,subtitle,creator) diff --git a/lib/sisu/v6/html_manifest.rb b/lib/sisu/v6/html_manifest.rb index 1ac7f4d4..3cc41b10 100644 --- a/lib/sisu/v6/html_manifest.rb +++ b/lib/sisu/v6/html_manifest.rb @@ -901,7 +901,7 @@ SiSU manifest: #{@md.title.full} #{@stylesheet.css_head} - + #{format_head_toc.seg_head_navigation_band(:manifest)} WOK if make.build.manifest_minitoc? diff --git a/lib/sisu/v6/xhtml_epub2_format.rb b/lib/sisu/v6/xhtml_epub2_format.rb index d654937e..73c5a1ab 100644 --- a/lib/sisu/v6/xhtml_epub2_format.rb +++ b/lib/sisu/v6/xhtml_epub2_format.rb @@ -1330,7 +1330,7 @@ application/epub+zip #{@css.xhtml_epub} - #{@vz.color_body} +
@@ -1753,7 +1753,7 @@ output_epub_cont_seg.close #{@css.xhtml_epub} - #{@vz.color_body}} + } end def concordance if @md.concord_make @@ -1837,7 +1837,7 @@ output_epub_cont_seg.close #{@css.xhtml_epub} - #{@vz.color_body}} + } end def endnote_mark %{ -- cgit v1.2.3 From 53b74bac29e476d4000b76d10acc0c31e2376669 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:46:48 -0400 Subject: v6: '*_parts', remove defaults.rb & some relics related to sisu skins, long gone * old code removed & substituted as required by *_parts * attending code changes, fairly wide ranging, test --- lib/sisu/v6/ao.rb | 2 - lib/sisu/v6/ao_syntax.rb | 29 +- lib/sisu/v6/css.rb | 78 +- lib/sisu/v6/defaults.rb | 1214 -------------------------------- lib/sisu/v6/generic_parts.rb | 134 ++++ lib/sisu/v6/html.rb | 13 +- lib/sisu/v6/html_concordance.rb | 5 - lib/sisu/v6/html_format.rb | 238 +++---- lib/sisu/v6/html_harvest_authors.rb | 4 +- lib/sisu/v6/html_harvest_topics.rb | 7 +- lib/sisu/v6/html_lite_shared.rb | 15 +- lib/sisu/v6/html_manifest.rb | 15 +- lib/sisu/v6/html_parts.rb | 440 ++++++++++++ lib/sisu/v6/html_promo.rb | 3 - lib/sisu/v6/html_scroll.rb | 1 - lib/sisu/v6/html_segments.rb | 25 +- lib/sisu/v6/html_shared.rb | 1 - lib/sisu/v6/html_table.rb | 7 +- lib/sisu/v6/html_tune.rb | 18 +- lib/sisu/v6/hub.rb | 2 - lib/sisu/v6/hub_loop_markup_files.rb | 2 - lib/sisu/v6/manpage.rb | 13 +- lib/sisu/v6/manpage_format.rb | 2 - lib/sisu/v6/po4a.rb | 6 - lib/sisu/v6/qrcode.rb | 18 +- lib/sisu/v6/rexml.rb | 1 - lib/sisu/v6/se_createsite.rb | 13 +- lib/sisu/v6/se_get_init.rb | 3 +- lib/sisu/v6/se_info_env.rb | 32 +- lib/sisu/v6/shared_metadata.rb | 9 +- lib/sisu/v6/sst_do_inline_footnotes.rb | 54 -- lib/sisu/v6/sst_to_s_xml_sax.rb | 3 - lib/sisu/v6/texinfo.rb | 4 - lib/sisu/v6/texinfo_format.rb | 2 - lib/sisu/v6/texpdf.rb | 9 +- lib/sisu/v6/texpdf_format.rb | 98 +-- lib/sisu/v6/texpdf_parts.rb | 238 +++++++ lib/sisu/v6/txt_asciidoc.rb | 13 +- lib/sisu/v6/txt_markdown.rb | 13 +- lib/sisu/v6/txt_plain.rb | 13 +- lib/sisu/v6/txt_rst.rb | 13 +- lib/sisu/v6/txt_shared.rb | 1 + lib/sisu/v6/txt_textile.rb | 14 +- lib/sisu/v6/wikispeak.rb | 11 +- lib/sisu/v6/xhtml.rb | 5 - lib/sisu/v6/xhtml_epub2.rb | 5 - lib/sisu/v6/xhtml_epub2_concordance.rb | 10 +- lib/sisu/v6/xhtml_epub2_format.rb | 67 +- lib/sisu/v6/xhtml_epub2_segments.rb | 1 - lib/sisu/v6/xhtml_epub2_tune.rb | 14 +- lib/sisu/v6/xhtml_parts.rb | 186 +++++ lib/sisu/v6/xhtml_shared.rb | 1 - lib/sisu/v6/xhtml_table.rb | 7 +- lib/sisu/v6/xml_dom.rb | 5 - lib/sisu/v6/xml_format.rb | 629 +---------------- lib/sisu/v6/xml_odf_odt.rb | 20 +- lib/sisu/v6/xml_odf_odt_format.rb | 3 - lib/sisu/v6/xml_parts.rb | 194 +++++ lib/sisu/v6/xml_sax.rb | 3 - lib/sisu/v6/xml_shared.rb | 15 +- lib/sisu/v6/xml_tables.rb | 24 +- 61 files changed, 1557 insertions(+), 2468 deletions(-) delete mode 100644 lib/sisu/v6/defaults.rb create mode 100644 lib/sisu/v6/generic_parts.rb create mode 100644 lib/sisu/v6/html_parts.rb create mode 100644 lib/sisu/v6/texpdf_parts.rb create mode 100644 lib/sisu/v6/xhtml_parts.rb create mode 100644 lib/sisu/v6/xml_parts.rb (limited to 'lib') diff --git a/lib/sisu/v6/ao.rb b/lib/sisu/v6/ao.rb index 4b439d94..34e952cb 100644 --- a/lib/sisu/v6/ao.rb +++ b/lib/sisu/v6/ao.rb @@ -59,8 +59,6 @@ =end module SiSU_AO - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'se' # se.rb include SiSU_Env require_relative 'dp' # dp.rb diff --git a/lib/sisu/v6/ao_syntax.rb b/lib/sisu/v6/ao_syntax.rb index 7a7ad8a0..2e771185 100644 --- a/lib/sisu/v6/ao_syntax.rb +++ b/lib/sisu/v6/ao_syntax.rb @@ -66,7 +66,6 @@ module SiSU_AO_Syntax class Markup def initialize(md='',data='') @md,@data=md,data - @vz=SiSU_Viz::Defaults.new @data_new=[] url_and_stub=SiSU_Env::InfoEnv.new.url @output_url="#{url_and_stub.remote}" @@ -98,23 +97,13 @@ module SiSU_AO_Syntax #ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)} #not implemented @line_scan_ital=if defined? @md.italics_match_list[:str] /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.italics_match_list[:str]}#{tail_m_ital}|\S+|\n/i - elsif defined? @vz.markup_make_italic[:str] - /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/i end @manmkp_bold=emph_italics \ ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]' : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]' - @line_scan_bold=if (defined? @md.bold_match_list[:str] \ - and @md.bold_match_list[:str]) \ - and (defined? @vz.markup_make_bold[:str] \ - and @vz.markup_make_bold[:str]) - /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i - elsif defined? @md.bold_match_list[:str] \ + @line_scan_bold=if defined? @md.bold_match_list[:str] \ and @md.bold_match_list[:str] /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]})#{tail_m_bold}|\S+|\n/i - elsif defined? @vz.markup_make_bold[:str] \ - and @vz.markup_make_bold[:str] - /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i end end def songsheet @@ -154,9 +143,7 @@ module SiSU_AO_Syntax def wordlist_italics(dob) dob=dob.dup if (defined? @md.italics_match_list[:str] \ - and @md.italics_match_list[:str]) \ - or (defined? @vz.markup_make_italic[:str] \ - and @vz.markup_make_italic[:str]) + and @md.italics_match_list[:str]) dob.obj=if dob.is !=:meta \ && dob.is !=:heading \ && dob.is !=:heading_insert \ @@ -172,10 +159,6 @@ module SiSU_AO_Syntax and @md.italics_match_list[:regx] w=w.gsub(@md.italics_match_list[:regx], "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") - elsif defined? @vz.markup_make_italic \ - and @vz.markup_make_italic - w=w.gsub(@vz.markup_make_italic, - "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") else w end end @@ -267,9 +250,7 @@ module SiSU_AO_Syntax def wordlist_bold(dob) dob=dob.dup if (defined? @md.bold_match_list[:str] \ - and @md.bold_match_list[:str]) \ - or (defined? @vz.markup_make_bold[:str] \ - and @vz.markup_make_bold[:str]) + and @md.bold_match_list[:str]) dob.obj=if dob.is !=:meta \ && dob.is !=:heading \ && dob.is !=:heading_insert \ @@ -285,10 +266,6 @@ module SiSU_AO_Syntax and @md.bold_match_list[:regx] #document header: @bold: [bold word list] w=w.gsub(@md.bold_match_list[:regx], "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") - elsif defined? @vz.markup_make_bold \ - and @vz.markup_make_bold #defaults adjusted bold word list - w=w.gsub(@vz.markup_make_bold, - "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end else w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/ diff --git a/lib/sisu/v6/css.rb b/lib/sisu/v6/css.rb index d68503f5..05f0631a 100644 --- a/lib/sisu/v6/css.rb +++ b/lib/sisu/v6/css.rb @@ -59,7 +59,7 @@ =end module SiSU_Style require_relative 'se' # se.rb - require_relative 'defaults' # defaults.rb + require_relative 'html_parts' # html_parts.rb class CSS_HeadInfo def initialize(md,ft='html') @md,@ft=md,ft @@ -159,40 +159,38 @@ module SiSU_Style end end class CSS - def initialize - @vz=SiSU_Viz::Defaults.new - end + include SiSU_Parts_HTML def fonts - @vz.font_fonts + the_font.set_fonts end def html_tables #stylesheet for css table_pages <. - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Git - - - - * Ralph Amissah - - - - ** Description: Default values - -=end -$latex_run=nil -module SiSU_Viz - begin - require 'uri' - rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). - error('uri NOT FOUND (LoadError)') - end - require_relative 'se' # se.rb - include SiSU_Env - require_relative 'css' # css.rb - include SiSU_Style - class Defaults - def initialize - @fonts='verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' # 'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman' - @dir=SiSU_Env::InfoEnv.new - @date=SiSU_Env::InfoDate.new #{@date.year} - @v=SiSU_Env::InfoVersion.instance.get_version - end - #% glyph - def glyph_bullet # • - '• ' # [• flagged] - end - #% html - def html_hardspace - ' ' - end - def semantic_tags - def default - { - pub: 'publication', - conv: 'convention', - vol: 'volume', - pg: 'page', - cty: 'city', - org: 'organization', - uni: 'university', - dept: 'department', - fac: 'faculty', - inst: 'institute', - co: 'company', - com: 'company', - conv: 'convention', - dt: 'date', - y: 'year', - m: 'month', - d: 'day', - ti: 'title', - au: 'author', - ed: 'editor', #editor? - v: 'version', #edition - n: 'name', - fn: 'firstname', - mn: 'middlename', - ln: 'lastname', - in: 'initials', - qt: 'quote', - ct: 'cite', - ref: 'reference', - ab: 'abreviation', - def: 'define', - desc: 'description', - trans: 'translate', - } - end - self - end - #% decorate - def decorate_italics - 'title|article|book|journal' - end - def decorate_bold - end - def decorate_uppercase - 'surname' - end - #% semantic - def sem_title #dc 1 - 'title' - end - def sem_article - 'article' - end - def sem_book - 'book' - end - def sem_journal - 'journal' - end - def sem_fullname # (contains: firstname, surname) #issues arise as contains surname etc. - 'fullname' - end - def sem_first - 'first' - end - def sem_surname - 'surname' - end - def sem_middle - 'middle' - end - def sem_creator #dc 2 #==fullname (contains: firstname, surname) - 'creator' - end - def sem_author #==fullname (contains: firstname, surname) - 'author' - end - def sem_editor #==fullname (contains: firstname, surname) - 'editor' - end - def sem_illustrator #==fullname (contains: firstname, surname) - 'illustrator' - end - def sem_translator #==fullname (contains: firstname, surname) - 'translator' - end - def sem_isbn # 10 or 13 - 'isbn' - end - def sem_isbn_10 - 'isbn10' - end - def sem_isbn_13 - 'isbn13' - end - def sem_loc # library of congress - 'loc' - end - def sem_dewey - 'dewey' - end - def sem_pg # project gutenberg number - 'pg' - end - def sem_subject #dc 3 - 'subject' - end - def sem_date #dc 7 - 'date' - end - def sem_date_created - 'date_created' - end - def sem_date_issued - 'date_issued' - end - def sem_date_available - 'date_available' - end - def sem_date_valid - 'date_valid' - end - def sem_date_modified - 'date_modified' - end - def sem_type #dc 8 - 'type' - end - def sem_description #dc 4 - 'description' - end - def sem_publisher #dc 5 - 'publisher' - end - def sem_contributor #dc 6 - 'contributor' - end - def sem_format #dc 9 - 'format' - end - def sem_identifier #dc 10 - 'identifier' - end - def sem_source #dc 11 - 'source' - end - def sem_language #dc 12 - 'language' - end - def sem_relation #dc 13 - 'source' - end - def sem_coverage #dc 14 - 'coverage' - end - def sem_rights #dc 15 - 'rights' - end - def sem_copyright - 'copyright' - end - def sem_license - 'license' - end - def sem_prepared_by - 'prepared_by' - end - def sem_digitized_by - 'digitized_by' - end - def sem_keywords - 'keywords' - end - def sem_comments - 'comments' - end - def sem_abstract - 'abstract' - end - #% path - def path_stylesheet_home - %{ } - end - #% text #changed from txt to avoid naming conflicts #FOLLOW - def txt_generator - %{ - } - end - def txt_generator_comment - %{ } - end - def txt_hp - ' SiSU' - end - def txt_hp_alias - 'SiSU' - end - def txt_home - 'SiSU' - end - def txt_signature # used in latex/pdf footer - 'SiSU' - end - #% url - def url_urify(uri) - URI.parse(uri) - end - def url_sisu - 'http://www.sisudoc.org/' - end - def url_sisudoc - 'http://www.sisudoc.org' - end - def url_footer_signature - 'http://www.sisudoc.org/' - end - def url_root - '/sisu' #watch - end - def url_root_http - 'http://www.sisudoc.org/' #watch - end - def url_home - 'http://www.sisudoc.org/' # used in pdf header - end - def url_site #used as stub... where there are subdirectories and is different from home - url_home - #'http://www.sisudoc.org/' # used in pdf header - end - def url_txt - 'www.sisudoc.org/' - end - def url_path_image_base #used for html image display - "#{Xx[:html_relative2]}_sisu/image" - end - def url_path_image #used for html image display - "#{Xx[:html_relative2]}_sisu/image" - end - def url_path_image_sys #used for html image display - "#{Xx[:html_relative2]}_sisu/image_sys" - end - def url_decoration - def tex_open #'{\UseTextSymbol{OML}{<}}' - Dx[:url_o] - end - def tex_close #'{\UseTextSymbol{OML}{>}}' - Dx[:url_c] - end - def xml_open #'<' - Dx[:url_o] - end - def xml_close #'>' - Dx[:url_c] - end - def txt_open - '<' - end - def txt_close - '>' - end - self - end - def rel_decoration - def tex_open #'{\UseTextSymbol{OML}{<}}' - Dx[:rel_o] - end - def tex_close #'{\UseTextSymbol{OML}{>}}' - Dx[:rel_c] - end - def xml_open #'<' - Dx[:rel_o] - end - def xml_close #'>' - Dx[:rel_c] - end - def txt_open - '<' - end - def txt_close - '>' - end - self - end - #% color - def color_body - %{} - end - def color_white - '"#ffffff"' - end - def color_black - '#000000' - end - def color_blue_ink - '#003399' - end - def color_blue_tinge - '#e3ecef' - end - def color_blue_grey - '#8faebf' - end - def color_blue_murky - '#437389' - end - def color_beige - '#f1e8de' - end - def color_subtleglow - '#dddccc' - end - def color_glow - '#fff0c3' - end - def color_rose - '#ffdec9' - end - def color_turquoise - '#1c869b' - end - def color_grey_pale - '#eeeeee' - end - def color_grey_medium - '#cccccc' - end - def color_grey - '#999999' - end - def color_yellow_light - '#fff3b6' - end - def color_yellow - '#ffde14' - end - def color_yellow_dark - '#ffcc00' - end - def color_green_light - '#b7d398' # #e2efd5 #b7d398 #b1c999 # '#aed19e' - end - def color_green - '#0a8400' - end - def color_green_dark - '#086800' - end - def color_ruby - '#a00000' - end - def color_maroon - '#800000' - end - def color_paper - %{"#{color_white}"} - end - def color_band1 - %{"#{color_white}"} - end - def color_band2 - %{"#{color_white}"} - end - def color_body - %{} - end - def color_font_face #was font WATCH - "#{color_black}" - end - def color_surround - %{"#{color_white}"} - end - def color_band - %{"#{color_white}"} - end - def color_table1 - 'ffffcc' - end - def color_table2 - 'c0d0f0' - end - def color_band1 - '"#ffffff"' - end - def color_band2 - '"#ffffff"' - end - #% icon - def icon_ico - 'rb7.ico' - end - def icon_sisu - 'sisu.png' - end - def icon_manifest - 'b_info.png' - end - def icon_doc - 'b_doc.png' - end - def icon_toc - 'b_toc.png' - end - def icon_wmp - 'b_wmp.png' - end - def icon_odf - 'b_odf.png' - end - def icon_epub - 'b_epub.png' - end - def icon_pdf - 'b_pdf.png' - end - def icon_pdf_portrait - 'b_pdf.png' - end - def icon_pdf_landscape - 'b_pdf.png' - end - def icon_choice - 'b_choice.png' - end - def icon_new - 'b_new.png' - end - def icon_dot_clear - 'dot_clear.png' - end - def icon_dot_white - 'dot_white.png' - end - def icon_dot - icon_dot_white - end - def icon_home_button - 'sisu.png' - end - def icon_next - 'arrow_next_red.png' - end - def icon_previous - 'arrow_prev_red.png' - end - def icon_up - 'arrow_up_red.png' - end - #% font - def font_fonts - @fonts - end - def font_face - %{face="#{font_fonts}"} - end - def font_color - 'color="#000000"' - end - def font_size_endnote - 'size="3"' - end - def font_small - 'size="3"' - end - def font_tiny - 'size="2"' - end - #% markup - def markup_italics_list #regular expression of words to be italised - end - def markup_bold_list #regular expression of words to be made bold - 'SiSU' - end - def markup_make_italic - if defined? italics_list \ - and italics_list - make={} - if italics_list - r=italics_list.dup - x=case r - when /\/i$/ then 'i' - else '' - end - r=r.gsub(/^\/(.+?)\/i?/,'\1'). - gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided - m='\b(' + r + ')\b' - make[:str] - make[:regx]=(x =~/i/) \ - ? (/#{m}/i) - : (/#{m}/) - else nil - end - end - end - def markup_make_bold - if defined? bold_list \ - and not bold_list.empty? - make={} - if bold_list - r=bold_list.dup - x=case r - when /\/i$/ then 'i' - else '' - end - r.gsub(/^\/(.+?)\/i?/,'\1'). - gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided - m='\b(' + r + ')\b' - make[:str] - make[:regx]=(x =~/i/) \ - ? (/#{m}/i) - : (/#{m}/) - else nil - end - make - end - end - #% paragraph - def paragraph_txt - %{

} - end - def paragraph_endnote - %{

} - end - def paragraph_font_tiny - %{} - end - def paragraph_font_small - %{} - end - #% table - def table_close - '

' - end - def table_width_1 - '"100%"' - end - def table_width_2 - '"99%"' - end - def table_width_txt - '"94%"' - end - def table_width_txt_r - '"96%"' - end - def table_cellpad_box - '"20"' - end - #% indent - def indent_level_0 - '"1%"' - end - def indent_level_1 - '"4%"' - end - def indent_level_2 - '"6%"' - end - def indent_level_3 - '"8%"' - end - def indent_level_4 - '"10%"' - end - #% margin - def margin_num - '

' - end - def margin_numless - '' - end - def margin_num_css - ' ' - end - def margin_txt_w1 - %{ - -
 } - end - def margin_txt_w2 - %{ - -
 } - end - def margin_txt_0 - %{ -
-} - end - def margin_txt_1 - %{ -
} - end - def margin_txt_2 - %{ - -
-} - end - def margin_txt_3 - %{ - -
-} - end - def margin_css - ' -
' - end - #% png - def png_ico - %{ } - end - def png_sisu #check url path - %{ - SiSU - } - end - def png_site - %{@} - end - def png_nav - %{Contents} - end - def png_manifest - %{Document Manifest} - end - def png_doc - %{Full Text} - end - def png_toc - %{TOC linked} - end - def png_odf - %{ODF/ODT} - end - def png_epub - %{EPUB} - end - def png_pdf - %{PDF} - end - def png_pdf_portrait - %{PDF portrait} - end - def png_pdf_landscape - %{PDF landscape} - end - def png_home - #dir=SiSU_Env::InfoEnv.new #(@fns) - %{#{txt_home} -->} - #%{#{txt_home} -->} - end - def png_home_button - rel=@dir.path_rel_links.html_scroll_2 - %{#{txt_home} -->} - end - #% png_nav #not currently used - #% nav_txt - def nav_txt_homepage - %{ -  home  - } - end - def nav_txt_toc_link - %{ -   toc  - } - end - def nav_txt_doc_link - %{ -  scroll  - } - end - def nav_txt_manifest - #{png_manifest} document manifest - %{ - [ document manifest ] - } - end - def nav_txt_concordance - %{ -   A-Z  - } - end - def nav_txt_pdf_portrait - %{ -  pdf  - } - end - def nav_txt_pdf_landscape - %{ -  pdf  - } - end - #% banner - def banner_home_button_only - %{ - #{png_home_button} - } - end - def banner_band #yellow_dark now white - %{ - -
- - #{png_home} - - -#{table_close}} - end - def banner_instrument_cover_band_scr - ' -
' - end - def banner_instrument_cover_band_seg - ' - -WOK - end - def widget_sisu_verbose -< - -WOK - end - def widget_way_better - < - -WOK - end - #% credits - def credits_sisu_manifest - widget_sisu_text - end - def credits_sisu - %{
-
' - end - #% widget - def widget_promo # Array used to build promo from list.yml and promo.yml - # ['sisu_icon','sisu','sisu_search_libre','open_society','fsf','ruby'] - end - def widgets_open -< -WOK - end - def widget_sisu_text -< - Output generated by - - #{@v[:project]} - - #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) -

-WOK - end - def widget_sisu -< -
- -#{widget_sisu_text} -
-

- - SiSU - -

-
- -

- Output generated by - - #{@v[:project]} - - #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) -
- - #{@v[:project]} - - Copyright © Ralph Amissah - 1997, current #{@date.year_static}. - All Rights Reserved. -
- - #{@v[:project]} - - is software for document structuring, publishing and search, -
- - www.sisudoc.org/ - - and - - www.sisudoc.org - -
- w3 since October 3 1993 - - ralph@amissah.com - -

-
-

- #{@v[:project]} using: -
Standard SiSU markup syntax, -
Standard SiSU meta-markup syntax, and the -
Standard SiSU object citation numbering and system, (object/text positioning system) -
- Copyright © Ralph Amissah 1997, current #{@date.year_static}. - All Rights Reserved. -

-
-

- - GPLv3 - -

-
-

- - #{@v[:project]} - - is released under - GPLv3 - or later, - #{url_decoration.xml_open}http://www.gnu.org/licenses/gpl.html#{url_decoration.xml_close} -

-
-

- #{@v[:project]}, developed using - - Ruby - - on - - Debian/Gnu/Linux - - software infrastructure, - with the usual GPL (or OSS) suspects. -
- Better - "performance, reliability, scalability, security & total cost of ownership" - [not to mention flexibility & choice] use of and adherence to open standards (where practical and fair) and it is software libré. -
- Get With the Future - - Way Better! - -

-
-
- #{widget_sisu} -
} - '' - end - def credits_splash - end - def credits_sisu_epub - %{
-

EPUB generated by #{@v[:project]} v#{@v[:version]}, GPL3

-
} - '' - end - end - class Home < Defaults - def initialize - @v=SiSU_Env::InfoVersion.instance.get_version - @dir=SiSU_Env::InfoEnv.new - @date=SiSU_Env::InfoDate.new #{@date.year} - end - def redirect - < -SiSU - - - -SiSU informtion provided at www.sisudoc.org/sisu/SiSU

-If your browser supports redirection, you will be escorted there shortly. - - -WOK - end - def homepage - < - - -SiSU information Structuring Universe - Structured information, Serialized Units - software for electronic texts, documents, books, digital libraries in plaintext, HTML, EPUB, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQL (PostgreSQL and SQLite), and for search - - - - - - - - - - - - - - - - - -

SiSU

-

-[Manual] -

-

-[Source] -[List Info (sisu@lists.sisudoc.org)] -

- -

SiSU Markup Samples

-

-[Source] -[Output] -

- -
- -

- Structured information, Serialized Units -    - - <www.sisudoc.org> - -   or   - - <www.jus.uio.no/sisu/> - -software for electronic texts, document collections, books, digital libraries & search, with "atomic search" & text locating system (shared object citation numbering: "ocn"). -Outputs include: plaintext, HTML, EPUB, ODT (OpenDocumentText), (XHTML, XML,) LaTeX, PDF, SQL (PostgreSQL and SQLite). -

-

- -<sisu@lists.sisudoc.org> - - -<http://lists.sisudoc.org/listinfo/sisu> - -

-

- -<ralph@amissah.com> - - -<ralph.amissah@gmail.com> - -

-

-#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!), #{@date.year_static}. -

-

-w3 since October 3 1993. -

- - -WOK - end - def home_toc - ' ' - end - end - class Inserts - end - class TeX < Defaults - def initialize(papersize='') - @papersize=papersize - end - def a4 - def portrait - def w - 160 - end - def h - 228 - end - def img_px - 450 - end - self - end - def landscape - def w - 238 - end - def h - 160 - end - def img_px - 300 - end - self - end - self - end - def letter - def portrait - def w - 166 - end - def h - 212 - end - def img_px - 468 - end - self - end - def landscape - def w - 226 - end - def h - 166 - end - def img_px - 290 - end - self - end - self - end - def legal - def portrait - def w - 168 - end - def h - 286 - end - def img_px - 474 - end - self - end - def landscape - def w - 296 - end - def h - 166 - end - def img_px - 420 - end - self - end - self - end - def b5 - def portrait - def w - 140 - end - def h - 204 - end - def img_px - 356 - end - self - end - def landscape - def w - 200 - end - def h - 130 - end - def img_px - 260 - end - self - end - self - end - def a5 - def portrait - def w - 112 - end - def h - 162 - end - def img_px - 280 - end - self - end - def landscape - def w - 152 - end - def h - 100 - end - def img_px - 190 - end - self - end - self - end - def dimensions - case @papersize - when /a4/ then a4 - when /letter/ then letter - when /legal/ then legal - when /b5/ then b5 - when /a5/ then a5 - else a4 - end - end - end -end -__END__ diff --git a/lib/sisu/v6/generic_parts.rb b/lib/sisu/v6/generic_parts.rb new file mode 100644 index 00000000..bb3b3371 --- /dev/null +++ b/lib/sisu/v6/generic_parts.rb @@ -0,0 +1,134 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: shared html parts + +=end +module SiSU_Parts_Generic + def the_url + def urify(uri) + URI.parse(uri) + end + def sisu + 'http://www.sisudoc.org/' + end + def sisudoc + 'http://www.sisudoc.org' + end + def footer_signature + 'http://www.sisudoc.org/' + end + def rl_root + '/sisu' #watch + end + def root_http + 'http://www.sisudoc.org/' #watch + end + def home + 'http://www.sisudoc.org/' # used in pdf header + end + def site #used as stub... where there are subdirectories and is different from home + home + end + def home_txt + 'www.sisudoc.org' + end + def sisu_txt + 'www.sisudoc.org' + end + self + end + def the_text + def home + 'SiSU' + end + def txt_hp + ' SiSU' + end + def txt_hp_alias + 'SiSU' + end + def txt_home + 'SiSU' + end + def txt_signature # used in latex/pdf footer + 'SiSU' + end + def url_open + '<' + end + def url_close + '>' + end + self + end + def the_icon + def i_ico + 'rb7.ico' + end + def i_home_button + 'sisu.png' + end + def i_choice + 'b_choice.png' + end + def i_new + 'b_new.png' + end + self + end +end +__END__ diff --git a/lib/sisu/v6/html.rb b/lib/sisu/v6/html.rb index 014a81c5..3da2baf4 100644 --- a/lib/sisu/v6/html.rb +++ b/lib/sisu/v6/html.rb @@ -66,9 +66,8 @@ module SiSU_HTML end require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'html_table' # html_table.rb + require_relative 'html_parts' # html_parts.rb require_relative 'html_format' # html_format.rb include SiSU_HTML_Format require_relative 'html_segments' # html_segments.rb @@ -181,7 +180,6 @@ module SiSU_HTML def initialize(particulars) @particulars=particulars @md,@env=particulars.md,particulars.env - @vz=SiSU_Viz::Defaults.new @env,@css=particulars.env,SiSU_Style::CSS.new end def tuned_file_instructions @@ -267,7 +265,6 @@ module SiSU_HTML @@firstseg=nil def initialize(md=nil,data='') @data,@md=data,md - @vz=SiSU_Viz::Defaults.new @ocn_html_identifier= SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md @@ -334,7 +331,7 @@ module SiSU_HTML @@toc[:seg] <<<
-

+

(relatively static) RSS feeds for DOCUMENTS:
RSS feed http://www.jus.uio.no/lm/rssfeed/documents.xml
RSS feed http://www.jus.uio.no/lm/rssfeed/tradelaw.xml
@@ -607,9 +604,9 @@ WOK end end class ScrollHeadAndSegToc < Toc + include SiSU_Parts_HTML def initialize(md='',toc='',links_guide_toc='') @md,@toc,@links_guide_toc=md,toc,links_guide_toc - @vz=SiSU_Viz::Defaults.new @make=SiSU_Env::ProcessingSettings.new(@md) end def in_common @@ -662,8 +659,8 @@ WOK toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold end - toc_shared << "#{@vz.table_close*1}\n" - @segtoc << "#{@vz.table_close*1}\n" + toc_shared << "#{the_table_close*1}\n" + @segtoc << "#{the_table_close*1}\n" tmp_head=nil if @md.prefix_a tmp_head ||= %{

#{@md.prefix_a}\n} diff --git a/lib/sisu/v6/html_concordance.rb b/lib/sisu/v6/html_concordance.rb index 54560aa2..4d3b74e4 100644 --- a/lib/sisu/v6/html_concordance.rb +++ b/lib/sisu/v6/html_concordance.rb @@ -63,8 +63,6 @@ module SiSU_Concordance include SiSU_Particulars require_relative 'se' # se.rb include SiSU_Env - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'html_format' # html_format.rb include SiSU_HTML_Format require_relative 'html_minitoc' # html_minitoc.rb @@ -125,7 +123,6 @@ module SiSU_Concordance end private class DocTitle - include SiSU_Viz #revisit, both requires (html & xml_shared) needed for stand alone operation (sisu -w [filename]) require_relative 'xml_shared' # xml_shared.rb require_relative 'html' # html.rb @@ -206,8 +203,6 @@ WOK class Words require_relative 'i18n' # i18n.rb include SiSU_i18n - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'html_format' # html_format.rb include SiSU_HTML_Format require_relative 'se' # se.rb diff --git a/lib/sisu/v6/html_format.rb b/lib/sisu/v6/html_format.rb index a8e3fa28..f02a51e1 100644 --- a/lib/sisu/v6/html_format.rb +++ b/lib/sisu/v6/html_format.rb @@ -58,7 +58,7 @@ =end module SiSU_HTML_Format - include SiSU_Viz + require_relative 'html_parts' # html_parts.rb class ParagraphNumber def initialize(md,ocn) @md,@ocn=md,ocn.to_s @@ -98,13 +98,13 @@ module SiSU_HTML_Format end class HeadInformation require_relative 'css' # css.rb + include SiSU_Parts_HTML require_relative 'xml_shared' # xml_shared.rb - include SiSU_Viz - attr_reader :md,:rdf,:vz + attr_reader :md,:rdf def initialize(md) @md=md # DublinCore 1 - title - @vz=SiSU_Viz::Defaults.new + @bits=SiSU_Proj_HTML::Bits.new @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || []) @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) @tocband_scroll,@tocband_segtoc=nil,nil @@ -165,7 +165,7 @@ module SiSU_HTML_Format %{ -
+ #{wgt.manifest(page)} #{wgt.search}
} @@ -173,14 +173,6 @@ module SiSU_HTML_Format def rdf SiSU_XML_Tags::RDF.new(md) end - def doc_type - %{ -\n} - end - def table_close - %{
-#{@vz.table_close}} - end def button_home(page=:seg) button=%{ \n } end def scroll(text) if @md.fns =~ /\.(?:-|ssm\.)?sst$/ - %{} else - %{} end @@ -292,7 +284,7 @@ module SiSU_HTML_Format #{make_scroll_search_form_and_manifest_link} WOK - %{
\n} if @md.make.home_button_image.is_a?(Hash) @@ -207,6 +199,7 @@ module SiSU_HTML_Format end end class Widget < HeadInformation + include SiSU_Parts_HTML def initialize(md) super(md) @md=md @@ -217,15 +210,15 @@ module SiSU_HTML_Format @make=SiSU_Env::ProcessingSettings.new(md) end def home - %{ + %{ - #{@vz.nav_txt_homepage} + #{the_nav.txt_homepage} + %{ #{text} @@ -258,16 +251,15 @@ module SiSU_HTML_Format end if page==:manifest manifest_lnk="#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}" - brace_url=SiSU_Viz::Defaults.new.url_decoration - %{ - - #{brace_url.xml_open}#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}#{brace_url.xml_close} + %{ + + #{the_url_decoration.xml_open}#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}#{the_url_decoration.xml_close} + %{ - #{@vz.nav_txt_manifest} + #{the_nav.txt_manifest}
+ %{
@@ -301,7 +293,7 @@ WOK
#{button_home(:scroll)}   -#{@vz.table_close} +#{the_table_close}

} else '' end @@ -317,14 +309,14 @@ WOK else '' end if @make.build.html_top_band? - %{ + %{
#{button_home} #{doc_types} #{up_button} -#{@vz.table_close} +#{the_table_close}

} else '' end @@ -345,7 +337,7 @@ WOK else '' end if @make.build.html_top_band? - %{ + %{
@@ -354,7 +346,7 @@ WOK } %{
#{button_home(page)}  #{firstseg}  -#{@vz.table_close} +#{the_table_close}

} else '' end @@ -377,8 +369,8 @@ WOK end def make_scroll_search_form_and_manifest_link wgt=SiSU_HTML_Format::Widget.new(@md) - %{

- #{@vz.nav_txt_doc_link} + %{ + #{the_nav.txt_doc_link}
@@ -390,13 +382,13 @@ WOK def make_scroll_seg_pdf seg='' wgt=SiSU_HTML_Format::Widget.new(@md) - seg=%{ } %{
- #{@vz.nav_txt_toc_link} + seg=%{ + #{the_nav.txt_toc_link}
-
+ #{wgt.manifest} #{wgt.search}
} @@ -405,14 +397,15 @@ WOK wgt=SiSU_HTML_Format::Widget.new(@md) %{ -
+ #{wgt.manifest} #{wgt.search}
} end def head rdf=SiSU_XML_Tags::RDF.new(@md) - %{#{doc_type} + %{ + @@ -427,27 +420,26 @@ WOK end def concordance if @md.concord_make - %{#{@vz.margin_css} + %{#{the_margin.css} <h4 class="toc"> <a href="./#{@md.file.base_filename.html_concordance}"> <i>Concordance</i> </a> </h4> -#{@vz.table_close}} +#{table_close}} else - %{#{@vz.margin_css} -#{@vz.table_close}} + %{#{the_margin.css} +#{table_close}} end end def links_guide_vertical_open # @file=SiSU_Env::FileOp.new(@md) if @md - url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) %{ <div id="vertical_links"> <ul id="vertical"> <li class="refbold"> - <a href="#{url}"> - #{@vz.txt_hp} + <a href="#{the_url.home}"> + #{the_text.txt_hp} </a> </li> <li class="ref"> @@ -462,13 +454,12 @@ WOK end def links_guide_horizontal_open # @file=SiSU_Env::FileOp.new(@md) if @md - url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) %{ <div id="horizontal_links"> <ul id="horizontal"> <li class="refbold"> - <a href="#{url}"> - #{@vz.txt_hp} + <a href="#{the_url.home}"> + #{the_text.txt_hp} </a> </li> <li class="ref"> @@ -522,69 +513,69 @@ WOK def scroll_head_title_banner_open icon=@md.icon ? %{<center>\n#{@md.icon}\n</center>} : '' %{#{icon} -#{@vz.banner_instrument_cover_band_scr}} +#{the_banner.instrument_cover_band_scr}} end def seg_head_title_banner_open icon=@md.icon ? %{<center>\n#{@md.icon}\n</center>} : '' %{#{icon} -#{@vz.banner_instrument_cover_band_seg}} +#{the_banner.instrument_cover_band_seg}} end def make_scroll - concord=concordance_link(@vz.nav_txt_concordance) + concord=concordance_link(the_nav.txt_concordance) %{<table summary="toc scroll" border="0" cellpadding="3" cellspacing="0"> <tr><td align="center" bgcolor="white" border="0"> - #{@vz.nav_txt_doc_link} + #{the_nav.txt_doc_link} </td> <td align="center" bgcolor="white"> #{concord} -#{@vz.table_close}} +#{the_table_close}} end def make_seg - concord=concordance_link(@vz.nav_txt_concordance) + concord=concordance_link(the_nav.txt_concordance) %{<table summary="toc segment" border="0" cellpadding="3" cellspacing="0"> <tr><td align="center" bgcolor="white"> - #{@vz.nav_txt_toc_link} + #{the_nav.txt_toc_link} </td> <td align="center" bgcolor="white"> <font size=2> #{concord} -#{@vz.table_close}} +#{the_table_close}} end def manifest #check structure if not @o_str.dump_or_redirect? - manifest=manifest_link(@vz.nav_txt_manifest) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} + manifest=manifest_link(the_nav.txt_manifest) + %{#{the_margin.txt_3} + #{the_font.paragraph_font_small} #{manifest} </font> -#{@vz.table_close}} +#{the_table_close}} else '' end end def concordance #check structure - concord=concordance_link(@vz.nav_txt_concordance) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} + concord=concordance_link(the_nav.txt_concordance) + %{#{the_margin.txt_3} + #{the_font.paragraph_font_small} #{concord} </font> -#{@vz.table_close}} +#{the_table_close}} end def metadata - %{#{@vz.margin_css} + %{#{the_margin.css} <h4 class="toc"> <a href="#{@metalink}"> <i>MetaData</i> </a> </h4> -#{@vz.table_close}} +#{the_table_close}} end def seg_tail %{ <div class="main_column"> <p> <p> -<table summary="toc segment tail" bgcolor=#{@vz.color_band1}> +<table summary="toc segment tail" bgcolor=#{the_color.band1}> <tr><td width="20%"> - #{@vz.banner_band} + #{the_banner.banner_band} </td> <td width="60%"> <center> @@ -593,8 +584,7 @@ WOK </td></tr> </table> <p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div> @@ -607,8 +597,7 @@ WOK %{ <div class="main_column"> #{nav} -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div> @@ -618,8 +607,7 @@ WOK %{ <div class="main_column"> <p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div> @@ -643,7 +631,7 @@ WOK nxt=nxt.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}") end end - %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> + %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{the_color.grey_pale} align="center"> <tr><td align="left"> <a href="#{pre}" target="_top"> #{png_nav.dot_pre} @@ -658,13 +646,13 @@ WOK <a href="#{nxt}" target="_top"> #{png_nav.dot_nxt} </a> -#{@vz.table_close}} +#{the_table_close}} end def dot_control_pre pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}" up=@toc nxt="#{@md.file.base_filename.html_segtoc}" - %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> + %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{the_color.grey_pale} align="center"> <tr><td align="left"> <a href="#{pre}" target="_top"> #{png_nav.dot_pre} @@ -679,21 +667,21 @@ WOK <a href="#{nxt}" target="_top"> #{png_nav.dot_nxt} </a> -#{@vz.table_close}} +#{the_table_close}} end def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' - toc=%{<td align="center" bgcolor=#{@vz.color_band1}> + toc=%{<td align="center" bgcolor=#{the_color.band1}> <a href="#{@toc}" target="_top"> #{png_nav.toc} </a> </td>} - pre=%{<td align="center" bgcolor=#{@vz.color_band1}> + pre=%{<td align="center" bgcolor=#{the_color.band1}> <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top"> #{png_nav.pre} </a> </td>} if f_pre==true - nxt=%{<td align="center" bgcolor=#{@vz.color_band1}> + nxt=%{<td align="center" bgcolor=#{the_color.band1}> <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top"> #{png_nav.nxt} </a> @@ -711,7 +699,7 @@ WOK #{toc} #{nxt} <td> -#{@vz.table_close}} +#{the_table_close}} end def toc_next2 toc_nav(false,true).dup @@ -740,34 +728,33 @@ WOK end end def navigation_table - %{<table summary="navigation segment table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0"> + %{<table summary="navigation segment table" width=#{the_width.table1} border="0" bgcolor="white" cellpadding="0"> <tr><th width="#{@@indent['leve_1']}" align="right"> </td> <td valign="top"> <font size=2>} end def navigation_table1 - %{<table summary="navigation segment table1" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table1} align="left"> + %{<table summary="navigation segment table1" width=#{the_width.table1} border="0" cellpadding=#{the_table_cellpad_box} bgcolor=#{the_color.table1} align="left"> <tr><td valign="top"> <font size="2">} end def navigation_table2 - %{<table summary="navigation segment table2" width=#{@vz.table_width_2} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table2} align="left"> + %{<table summary="navigation segment table2" width=#{the_width.table2} border="0" cellpadding=#{the_table_cellpad_box} bgcolor=#{the_color.table2} align="left"> <tr><td valign="top"> <font size="2">} end def credit %{ <div class="main_column"> -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div></div> } end def navigation_band(segtocband,seg_table_top_control) #change name to navigation_band_banner - %{<table summary="segment navigation band with banner" bgcolor=#{@vz.color_band1} width="100%"><tr> + %{<table summary="segment navigation band with banner" bgcolor=#{the_color.band1} width="100%"><tr> <td width="20%" align="left"> #{button_home} </td> @@ -783,7 +770,7 @@ WOK def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigation_band_bannerless %{ <div class="main_column"> - <table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr> + <table summary="segment navigation band" bgcolor=#{the_color.band1} width="100%"><tr> <td width="70%" align="center"> #{doc_types} </td> @@ -813,7 +800,8 @@ WOK end def head_seg rdf=SiSU_XML_Tags::RDF.new(@md) - %{#{doc_type} + %{<!DOCTYPE html> +<html> <head> <meta charset="utf-8"> <title> @@ -841,8 +829,8 @@ WOK </p> <p class="tiny"> copy @ - <a href="#{@vz.url_home}"> - #{@vz.txt_home} + <a href="#{the_url.home}"> + #{the_text.txt_home} </a> </p> </div> @@ -854,8 +842,8 @@ WOK super(md) end def toc_owner_details - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} + %{#{the_margin.txt_3} +#{the_font.paragraph_font_small} <a href="#owner.details"> Owner Details <font size="1" color="#777777"> @@ -863,11 +851,11 @@ WOK </font> </a> </font> -#{@vz.table_close}} +#{the_table_close}} end end class FormatTextObject - @vz=SiSU_Viz::Defaults.new + include SiSU_Parts_HTML attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o @@ -900,7 +888,6 @@ WOK @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') end @p_num=ParagraphNumber.new(@md,@ocn) - @vz=SiSU_Viz::Defaults.new end def nametags_scroll(dob) tags='' @@ -1128,21 +1115,21 @@ WOK end end def bold_para - %{#{@vz.margin_txt_0} + %{#{the_margin.txt_0} <p class="bold"> #{@txt} </p> -#{@vz.margin_num_css} +#{the_margin.num_css}     -#{@vz.table_close}} +#{the_table_close}} end def bold_heading %{<p class="bold"> #{@txt} </p> -#{@vz.margin_num_css} +#{the_margin.num_css}     -#{@vz.table_close}} +#{the_table_close}} end def toc_head_copy_at %{<p class="center">#{@txt}</p>\n} @@ -1160,63 +1147,12 @@ WOK class FormatScroll < FormatTextObject def initialize(md,txt) super(md,txt) - @vz=SiSU_Viz::Defaults.new end end class FormatSeg < FormatTextObject def initialize(md,txt) super(md,txt) end - def navigation_toc_lev1_advert - %{#{@banner.home_button}\n -<center> -#{@txt} -#{@two} -</a></center><p>} - end - def navigation_toc_lev1 - %{#{@banner.nav_toc}} - end - def navigation_toc_lev2 #change bold use css - %{<p> -<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 - %{<p> -<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 navigation_toc_lev7 - 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 %{ @@ -1291,7 +1227,7 @@ WOK <p class="bold"> #{@txt} </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_heading5 %{<p class="bold"> diff --git a/lib/sisu/v6/html_harvest_authors.rb b/lib/sisu/v6/html_harvest_authors.rb index f748f400..14b18ca0 100644 --- a/lib/sisu/v6/html_harvest_authors.rb +++ b/lib/sisu/v6/html_harvest_authors.rb @@ -60,6 +60,7 @@ =end module SiSU_HarvestAuthors require_relative 'html_harvest_author_format' # html_harvest_author_format.rb + require_relative 'html_parts' # html_parts.rb class Songsheet @@the_idx_authors={} def initialize(opt,env) @@ -211,7 +212,6 @@ module SiSU_HarvestAuthors @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] @alph=@alphabet_list.dup @letter=@alph.shift - @vz=SiSU_Viz::Defaults.new end def html_file_open @the_idx.keys.each do |lng| @@ -376,7 +376,7 @@ WOK <a name="finish" id="finish"></a> <a name="stop" id="stop"></a> <a name="credits"></a> -#{@vz.credits_sisu} +#{SiSU_Proj_HTML::Bits.new.credits_sisu} </body> </html> WOK diff --git a/lib/sisu/v6/html_harvest_topics.rb b/lib/sisu/v6/html_harvest_topics.rb index 87ed931a..3daafe3d 100644 --- a/lib/sisu/v6/html_harvest_topics.rb +++ b/lib/sisu/v6/html_harvest_topics.rb @@ -60,8 +60,8 @@ =end module SiSU_HarvestTopics - require_relative 'html_harvest_author_format' # html_harvest_author_format.rb - include SiSU_Viz + require_relative 'html_harvest_author_format' # html_harvest_author_format.rb + require_relative 'html_parts' # html_parts.rb class Songsheet @@the_idx_topics={} def initialize(opt,env) @@ -501,7 +501,6 @@ module SiSU_HarvestTopics @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] @alph=@alphabet_list.dup @letter=@alph.shift - @vz=SiSU_Viz::Defaults.new end def html_file_open @the_idx.keys.each do |lng| @@ -745,7 +744,7 @@ WOK <a name="finish" id="finish"></a> <a name="stop" id="stop"></a> <a name="credits"></a> -#{@vz.credits_sisu} +#{SiSU_Proj_HTML::Bits.new.credits_sisu} </body> </html> WOK diff --git a/lib/sisu/v6/html_lite_shared.rb b/lib/sisu/v6/html_lite_shared.rb index dc54fdb9..e54ee952 100644 --- a/lib/sisu/v6/html_lite_shared.rb +++ b/lib/sisu/v6/html_lite_shared.rb @@ -59,11 +59,10 @@ =end module SiSU_FormatShared - require_relative 'defaults' # defaults.rb - include SiSU_Viz + require_relative 'html_parts' # html_parts.rb class CSS_Format - require_relative 'defaults' # defaults.rb require_relative 'se_hub_particulars' # se_hub_particulars.rb + include SiSU_Parts_HTML @@fns=nil def initialize(md,t_o) @md,@t_o=md,t_o @@ -79,10 +78,8 @@ module SiSU_FormatShared else @@hname end @tab="\t" - @brace_url=SiSU_Viz::Defaults.new.url_decoration @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @@tablehead,@@tablefoot=[],[] - @vz=SiSU_Viz::Defaults.new @env=SiSU_Env::InfoEnv.new(@md.fns) @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" end @@ -172,7 +169,7 @@ module SiSU_FormatShared gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). gsub(/#{Mx[:url_o]}[_\\](\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>'). #special case \{ e.g. \}http://url - gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{\\1#{@brace_url.xml_open}<a href="\\2" target="_top">\\2</a>#{@brace_url.xml_close}\\3}) #http ftp matches with decoration + gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{\\1#{the_url_decoration.xml_open}<a href="\\2" target="_top">\\2</a>#{the_url_decoration.xml_close}\\3}) #http ftp matches with decoration else s.gsub(/</m,'<'). gsub(/>/m,'>') @@ -190,7 +187,7 @@ module SiSU_FormatShared gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>\2'). #http ftp matches escaped, no decoration gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>'). #special case \{ e.g. \}http://url - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}<a href="\\1" target="_top">\\1</a>#{the_url_decoration.xml_close}}) #http ftp matches with decoration end def paragraph %{<p class="h#{@lv}" type="substantive" header="#{@hname}">#{@txt}</p>\n} # << "\n" @@ -252,7 +249,7 @@ GSUB tag_para(h) end def para_table - %{<p class="norm" align="left"><font #{@vz.font_small} #{@vz.font_color} #{@vz.font_face}>} + %{<p class="norm" align="left"><font #{the_font.set_small} #{the_font.set_color} #{the_font.set_face}>} end def ocn %{<label class="ocn">#{@ocn}</label>} << "\n" @@ -271,7 +268,7 @@ GSUB @@tablefoot.each {|x| tablefoot << %{<p align="center"><font size=2><i>#{x}</i></font></p>\n}} @@tablefoot=[] parablock=parablock.gsub(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/, - %{#{@vz.table_close}\n}) # + + %{#{the_table_close}\n}) # + end if @@tablehead==1 if parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u diff --git a/lib/sisu/v6/html_manifest.rb b/lib/sisu/v6/html_manifest.rb index 3cc41b10..8fcf198c 100644 --- a/lib/sisu/v6/html_manifest.rb +++ b/lib/sisu/v6/html_manifest.rb @@ -63,13 +63,13 @@ module SiSU_Manifest require_relative 'prog_text_translation' # prog_text_translation.rb require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars + require_relative 'html_parts' # html_parts.rb require_relative 'html_minitoc' # html_minitoc.rb require_relative 'html' # html.rb include SiSU_HTML_Format require_relative 'dp' # dp.rb include SiSU_Param require_relative 'i18n' # i18n.rb - include SiSU_Viz class Source def initialize(opt) @opt=opt @@ -123,6 +123,7 @@ module SiSU_Manifest end private class Output <Source + include SiSU_Parts_HTML def initialize(md) @manifest={ txt: [], html: [] } @md,@fns=md,md.fns @@ -140,7 +141,6 @@ module SiSU_Manifest l=SiSU_Env::StandardiseLanguage.new(md.opt.lng).language @language=l[:n] @translate=SiSU_Translate::Source.new(md,@language) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet @fn_lng=(@f.output_dir_structure.by_language_code?) \ ? '' @@ -158,9 +158,9 @@ module SiSU_Manifest if @o_str.dump_or_redirect? '' elsif src==:src #check - %{<br>#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}} + %{<br>#{the_url_decoration.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{the_url_decoration.xml_close}} else - %{<p class="tiny">#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p>} + %{<p class="tiny">#{the_url_decoration.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{the_url_decoration.xml_close}</p>} end end def summarize(id,file,pth='',rel='',url='',img='● ') @@ -261,7 +261,7 @@ module SiSU_Manifest def published_languages(id) published_manifests?.each do |l| @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n" - @manifest[:html] << %{<tr><th class="left"><p class="bold"><a href="#{l[:mu]}">#{l[:l]}</a></p></th><td><p class="norm">#{l[:l]}</p><p class="tiny">#{@brace_url.xml_open}<a href="#{l[:mu]}">#{l[:mu]}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right"> </p></td></tr>\n} + @manifest[:html] << %{<tr><th class="left"><p class="bold"><a href="#{l[:mu]}">#{l[:l]}</a></p></th><td><p class="norm">#{l[:l]}</p><p class="tiny">#{the_url_decoration.xml_open}<a href="#{l[:mu]}">#{l[:mu]}</a>#{the_url_decoration.xml_close}</p></td><td class="right"><p class="right"> </p></td></tr>\n} end end def metadata(id,info) @@ -273,7 +273,7 @@ module SiSU_Manifest elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root) else url end - @manifest[:html] << %{<tr><th class="right" width=5%><p class="norm">●</p></th><td class="left"><p class="norm"><a href="#{url}">#{lnk}</a></p><p class="tiny">  #{@brace_url.xml_open}<a href="#{static}">#{static}</a>#{@brace_url.xml_close}</p></td></tr>\n} + @manifest[:html] << %{<tr><th class="right" width=5%><p class="norm">●</p></th><td class="left"><p class="norm"><a href="#{url}">#{lnk}</a></p><p class="tiny">  #{the_url_decoration.xml_open}<a href="#{static}">#{static}</a>#{the_url_decoration.xml_close}</p></td></tr>\n} end def output_tests if FileTest.file?(@f.place_file.html_segtoc.dir)==true @@ -885,7 +885,6 @@ WOK begin make=SiSU_Env::ProcessingSettings.new(@md) minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n") - vz=SiSU_Viz::Defaults.new format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) @manifest[:html] <<<<WOK <!DOCTYPE html> @@ -1010,7 +1009,7 @@ WOK </div> <div> <br> -#{vz.credits_sisu_manifest} +#{SiSU_Proj_HTML::Bits.new.credits_sisu_manifest} </div> </body> </html> diff --git a/lib/sisu/v6/html_parts.rb b/lib/sisu/v6/html_parts.rb new file mode 100644 index 00000000..2c09db7e --- /dev/null +++ b/lib/sisu/v6/html_parts.rb @@ -0,0 +1,440 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * 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> + + * Git + <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> + <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/v6/html_parts.rb;hb=HEAD> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** Description: shared html parts + +=end +module SiSU_Parts_HTML + require_relative 'generic_parts' # generic_parts.rb + include SiSU_Parts_Generic + def the_line_break + '<br>' + end + def the_table_close + '</td></tr> +</table>' + end + def the_table_cellpad_box + '"20"' + end + def the_color + def white + '#ffffff' + end + def black + '#000000' + end + def grey_pale + '#eeeeee' + end + def grey_medium + '#cccccc' + end + def grey + '#999999' + end + def blue_ink + '#003399' + end + def blue_tinge + '#e3ecef' + end + def yellow_light + '#fff3b6' + end + def table1 + 'ffffcc' + end + def table2 + 'c0d0f0' + end + def band1 + %{"#{white}"} + end + def band2 + %{"#{white}"} + end + self + end + def the_url_decoration + #def tex_open #'{\UseTextSymbol{OML}{<}}' + # Dx[:url_o] + #end + #def tex_close #'{\UseTextSymbol{OML}{>}}' + # Dx[:url_c] + #end + def xml_open #'<' + Dx[:url_o] + end + def xml_close #'>' + Dx[:url_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + def the_width + def table1 + '"100%"' + end + def table2 + '"99%"' + end + def table_txt + '"94%"' + end + def table_txt_r + '"96%"' + end + self + end + def the_png + def _url_path_image_base #used for html image display + "#{Xx[:html_relative2]}_sisu/image" + end + def ico + %{ <link rel="shortcut icon" href="../_sisu/image/#{the_icon.i_ico}" />} + end + def png_home + %{<img border="0" src="#{_url_path_image_base}/#{the_icon.home_button}" alt="#{the_text.home} -->" />} + end + def png_home_button + rel=@dir.path_rel_links.html_scroll_2 + %{<img border="0" src="#{rel}/#{the_icon.home_button}" alt="#{the_text.home} -->" />} + end + self + end + def the_font + def set_fonts + 'verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' + #'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman' + end + def set_face + %{face="#{set_fonts}"} + end + def set_color + 'color="#000000"' + end + def set_size_endnote + 'size="3"' + end + def set_small + 'size="3"' + end + def set_tiny + 'size="2"' + end + def paragraph_font_tiny + %{<font #{set_tiny} #{set_face}>} + end + def paragraph_font_small + %{<font #{set_small} #{set_face}>} + end + self + end + def the_nav + def txt_homepage + %{ <font face="#{the_font.set_fonts}" size="2"> +  home  + </font> } + end + def txt_toc_link + %{ <font face="#{the_font.set_fonts}" size="2"> +   toc  + </font> } + end + def txt_doc_link + %{ <font face="#{the_font.set_fonts}" size="2"> +  scroll  + </font> } + end + def txt_manifest + #{png_manifest} document manifest + %{ <font face="#{the_font.set_fonts}" size="2"> + [ document manifest ] + </font> } + end + def txt_concordance + %{ <font face="#{the_font.set_fonts}" size="2"> +   A-Z  + </font> } + end + self + end + def the_banner + def home_button_only + %{<a href="#{url.site}/"> + #{the_png.png_home_button} + </a>} + end + def banner_band + %{<table summary="home button" width="100%" border="0" cellpadding="3" align="center"> +<tr><td align="left" valign="middle"> + <a href="#{url.site}/" target="_top"> + #{the_png.png_home} + </a> +</td> +<td width="90%"> +#{the_table_close}} + end + def instrument_cover_band_scr + '<table summary="scroll instrument cover band" width="100%" border="0" cellpadding="8" align="center"> +<tr><td align="center">' + end + def instrument_cover_band_seg + '<table summary="segment instrument cover band, title, author, location" width="100%" border="0" cellpadding="8" align="center"> +<tr><td align="center">' + end + self + end + def the_margin + def txt_0 + %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center"> +<tr><td width=#{indent_level_0} align="right"> +</td><td valign="top" align="justify">} + end + def txt_1 + %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center"> +<tr><td width=#{indent_level_1} align="right"></td><td valign="top" align="justify">} + end + def txt_2 + %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center"> +<tr><td width=#{indent_level_2} align="right"> +</td> +<td valign="top" align="justify">} + end + def txt_3 + %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center"> +<tr><td width=#{indent_level_3} align="right"> +</td> +<td valign="top" align="justify">} + end + def css + '<table summary="normal text css" width="100%" border="0" cellpadding="2" align="center"> +<tr><td valign="top" align="justify"> ' + end + def num + '</p> </td><td width="4%" align="right" valign="top">' + end + def numless + '</td><td width="4%" align="right" valign="top">' + end + def num_css + '</td> +<td width="2%" align="right" valign="top"> ' + end + self + end +end +module SiSU_Proj_HTML + require_relative 'se' # se.rb + include SiSU_Env + #require_relative 'css' # css.rb + # include SiSU_Style + class Bits + include SiSU_Parts_HTML + def initialize + @v=SiSU_Env::InfoVersion.instance.get_version + #@dir=SiSU_Env::InfoEnv.new + #@date=SiSU_Env::InfoDate.new #{@date.year} + end + def txt_generator + %{ <meta name="generator" content="#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!)" /> + <link rel="generator" href="http://www.sisudoc.org/" />} + end + def widget_sisu_text +<<WOK + <p class="tiny"><font color="#666666" size="2"> + Output generated by + <a href="#{the_url.sisu}"> + #{@v[:project]} + </a> + #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) + </font></p> +WOK + end + def credits_sisu_manifest + widget_sisu_text + end + def widget_sisu +<<WOK +<!-- widget sisu --> +<tr><td valign="top" width="100%"> +<!-- SiSU Rights --> +#{widget_sisu_text} +</td></tr> +WOK + end + def credits_sisu + %{<div class="substance"> +<table summary="SiSU summary" cellpadding="4" border="0"> +<tr><td> + #{widget_sisu} +</table></div>} + '' + end + def widget_promo # Array used to build promo from list.yml and promo.yml + # ['sisu_icon','sisu','sisu_search_libre','open_society','fsf','ruby'] + end + end + class Home + def initialize + @v=SiSU_Env::InfoVersion.instance.get_version + @dir=SiSU_Env::InfoEnv.new + @date=SiSU_Env::InfoDate.new #{@date.year} + end + def redirect + <<WOK +<html><head> +<title>SiSU + + + +SiSU informtion provided at www.sisudoc.org/sisu/SiSU

+If your browser supports redirection, you will be escorted there shortly. + + +WOK + end + def homepage + < + + +SiSU information Structuring Universe - Structured information, Serialized Units - software for electronic texts, documents, books, digital libraries in plaintext, HTML, EPUB, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQL (PostgreSQL and SQLite), and for search + + + + + + + + + + + + + + + + + +

SiSU

+

+[Manual] +

+

+[Source] +[List Info (sisu@lists.sisudoc.org)] +

+ +

SiSU Markup Samples

+

+[Source] +[Output] +

+ +
+ +

+ Structured information, Serialized Units +    + + <www.sisudoc.org> + +   or   + + <www.jus.uio.no/sisu/> + +software for electronic texts, document collections, books, digital libraries & search, with "atomic search" & text locating system (shared object citation numbering: "ocn"). +Outputs include: plaintext, HTML, EPUB, ODT (OpenDocumentText), (XHTML, XML,) LaTeX, PDF, SQL (PostgreSQL and SQLite). +

+

+ +<sisu@lists.sisudoc.org> + + +<http://lists.sisudoc.org/listinfo/sisu> + +

+

+ +<ralph@amissah.com> + + +<ralph.amissah@gmail.com> + +

+

+#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!), #{@date.year_static}. +

+

+w3 since October 3 1993. +

+ + +WOK + end + def home_toc + ' ' + end + end +end +__END__ diff --git a/lib/sisu/v6/html_promo.rb b/lib/sisu/v6/html_promo.rb index 750add5c..1880e246 100644 --- a/lib/sisu/v6/html_promo.rb +++ b/lib/sisu/v6/html_promo.rb @@ -66,7 +66,6 @@ module SiSU_HTML_Promo @env=SiSU_Env::InfoEnv.new(@md.fns,@md) @rc=SiSU_Env::GetInit.new.sisu_yaml.rc @ad=SiSU_Env::GetInit.new.ads - @vz=SiSU_Viz::Defaults.new @flag=@env.widget.promo? @make=SiSU_Env::ProcessingSettings.new(@md) end @@ -97,8 +96,6 @@ module SiSU_HTML_Promo && @flag[:ad] ads=if @md.promo && @md.promo.length > 0 #promo set in document promo_array=@md.promo - elsif @flag[:sk] #promo set - promo_array=@vz.widget_promo elsif @flag[:rc] #promo set in rc file promo_array=if @rc['html']['promo'].is_a?(String) @rc['html']['promo'].split(/[,;]\s*/) diff --git a/lib/sisu/v6/html_scroll.rb b/lib/sisu/v6/html_scroll.rb index f6a1115c..9e158af3 100644 --- a/lib/sisu/v6/html_scroll.rb +++ b/lib/sisu/v6/html_scroll.rb @@ -65,7 +65,6 @@ module SiSU_HTML_Scroll class Scroll def initialize(md='',data='',endnotes='') @md,@data,@endnotes=md,data,endnotes - @vz=SiSU_Viz::Defaults.new end def songsheet begin diff --git a/lib/sisu/v6/html_segments.rb b/lib/sisu/v6/html_segments.rb index 54b0b124..907e79a5 100644 --- a/lib/sisu/v6/html_segments.rb +++ b/lib/sisu/v6/html_segments.rb @@ -200,7 +200,6 @@ module SiSU_HTML_Seg attr_reader :seg_name_html,:seg_name_html_tracker def initialize(md=nil,data='') @md,@data=md,data - @vz=SiSU_Viz::Defaults.new @seg_name_html=@@seg_name_html || nil @seg_name_html_tracker=@@tracker || nil @env=SiSU_Env::InfoEnv.new(@md.fns) if @md @@ -575,19 +574,17 @@ module SiSU_HTML_Seg if @md.flag_separate_endnotes dob.obj=dob.obj.gsub(/"\s+href="#(#{Mx[:note]}\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#\\1">}) #endnote- twice #removed file type end - if dob.obj !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/ - if (dob.is==:heading \ - || dob.is==:heading_insert \ - || dob.is==:para) \ - && (not dob.ocn \ - || (dob.ocn.to_s.empty?)) - format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob) - end - dob.obj=dob.obj.gsub(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with #?? workpoint - if dob.obj =~/ / #endnote- note- - format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob) - dob=format_seg.no_paranum - end + if (dob.is==:heading \ + || dob.is==:heading_insert \ + || dob.is==:para) \ + && (not dob.ocn \ + || (dob.ocn.to_s.empty?)) + format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob) + end + dob.obj=dob.obj.gsub(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with #?? workpoint + if dob.obj =~/ / #endnote- note- + format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob) + dob=format_seg.no_paranum end if (dob.is==:heading \ || dob.is==:heading_insert) \ diff --git a/lib/sisu/v6/html_shared.rb b/lib/sisu/v6/html_shared.rb index 3067b153..fe1d83d0 100644 --- a/lib/sisu/v6/html_shared.rb +++ b/lib/sisu/v6/html_shared.rb @@ -58,7 +58,6 @@ =end module SiSU_HTML_Shared - require_relative 'defaults' # defaults.rb require_relative 'html_table' # html_table.rb class TableHTML < SiSU_HTML_Table::TableHTML end diff --git a/lib/sisu/v6/html_table.rb b/lib/sisu/v6/html_table.rb index 82ab4913..c789dc71 100644 --- a/lib/sisu/v6/html_table.rb +++ b/lib/sisu/v6/html_table.rb @@ -58,9 +58,10 @@ =end module SiSU_HTML_Table - require_relative 'defaults' # defaults.rb - require_relative 'xhtml_table.rb' # xhtml_table.rb - class TableHTML /, %{\n
\\3
\n}) end - dob.obj=dob.obj.gsub(/!pick/,%{stellar}). - gsub(/!new/,%{ new}). + dob.obj=dob.obj.gsub(/!pick/,%{stellar}). + gsub(/!new/,%{ new}). gsub(/<:h(.{1,7}?)>/,'\1'). gsub(/<:to(\d{1,7}?)>/,'to { \1 } '). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). #http ftp matches escaped, no decoration - gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration if dob.obj =~/#{Xx[:html_relative2]}\/\S+/ \ and dob.obj !~/(\"#{Xx[:html_relative2]}\/\S+?\"|>\s*#{Xx[:html_relative2]}\/\S+<)/ dob.obj=dob.obj.gsub(/(#{Xx[:html_relative2]}\/\S+)/,'\1') @@ -245,9 +245,9 @@ module SiSU_HTML_Tune and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ dob.obj=dob.obj.gsub(/\.\.(\/\S+)/,%{\1}) end - dob.obj=dob.obj.gsub(//m,'>') end diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb index a5425528..13f95654 100644 --- a/lib/sisu/v6/hub.rb +++ b/lib/sisu/v6/hub.rb @@ -68,8 +68,6 @@ module SiSU require_relative 'hub_options' # hub_options.rb require_relative 'dp' # dp.rb include SiSU_Param - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'utils' # utils.rb begin require 'uri' diff --git a/lib/sisu/v6/hub_loop_markup_files.rb b/lib/sisu/v6/hub_loop_markup_files.rb index abae9912..cf56f23b 100644 --- a/lib/sisu/v6/hub_loop_markup_files.rb +++ b/lib/sisu/v6/hub_loop_markup_files.rb @@ -67,8 +67,6 @@ module SiSU_Hub_Loops require_relative 'hub_options' # hub_options.rb require_relative 'dp' # dp.rb include SiSU_Param - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'utils' # utils.rb begin require 'uri' diff --git a/lib/sisu/v6/manpage.rb b/lib/sisu/v6/manpage.rb index 2eb32e36..9ff83fd5 100644 --- a/lib/sisu/v6/manpage.rb +++ b/lib/sisu/v6/manpage.rb @@ -63,10 +63,10 @@ module SiSU_Manpage require_relative 'se' # se.rb include SiSU_Env include SiSU_Param - include SiSU_Viz require_relative 'manpage_format' # manpage_format.rb include SiSU_ManpageFormat require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' @@ -122,14 +122,11 @@ module SiSU_Manpage end private class Scroll #{@dob.obj} " diff --git a/lib/sisu/v6/po4a.rb b/lib/sisu/v6/po4a.rb index b616e764..da294e12 100644 --- a/lib/sisu/v6/po4a.rb +++ b/lib/sisu/v6/po4a.rb @@ -66,7 +66,6 @@ module SiSU_Po4a require_relative 'shared_metadata' # shared_metadata.rb require_relative 'po4a_set' # po4a_set.rb include SiSU_Param - include SiSU_Viz class Source @@opt_src,@@opt_trn,@@opt_src_,@@opt_trn_,@@md_src,@@md_trn=nil,nil,nil,nil,nil,nil def initialize(opt,fn=nil) @@ -172,8 +171,6 @@ module SiSU_Po4a end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1') - #dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") notes=extract_endnotes(dob) #% ### footnotes current state - extracted dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'~^'). # endnote marker marked up diff --git a/lib/sisu/v6/qrcode.rb b/lib/sisu/v6/qrcode.rb index d734ed72..902411b6 100644 --- a/lib/sisu/v6/qrcode.rb +++ b/lib/sisu/v6/qrcode.rb @@ -66,8 +66,8 @@ module SiSU_QRcode require_relative 'html' # html.rb require_relative 'dp' # dp.rb include SiSU_Param + require_relative 'generic_parts' # generic_parts.rb require_relative 'i18n' # i18n.rb - include SiSU_Viz class Source def initialize(opt) @opt=opt @@ -116,6 +116,7 @@ module SiSU_QRcode end private class OutputInfo 0 + elsif defined? @html_bits.widget_promo \ + and not @html_bits.widget_promo.nil? \ + and @html_bits.widget_promo.is_a?(Array) \ + and @html_bits.widget_promo.length > 0 @flag[:sk]=true true elsif defined? @rc['html']['promo'] \ @@ -610,8 +612,8 @@ module SiSU_Info_Env and @rc['search'][type]['action'] =~/https?:\/\// flag=if promo?[:ad] false - elsif defined? @vz.widget_search \ - and @vz.widget_search==true + elsif defined? @html_bits.widget_search \ + and @html_bits.widget_search==true true elsif defined? @rc['search'][type]['flag'] \ and @rc['search'][type]['flag']==true @@ -636,8 +638,8 @@ module SiSU_Info_Env and @rc['search'][type]['db'] =~/\S+/ flag=if promo?[:ad] false - elsif defined? @vz.widget_search \ - and @vz.widget_search==true + elsif defined? @html_bits.widget_search \ + and @html_bits.widget_search==true true elsif defined? @rc['search'][type]['flag'] \ and @rc['search'][type]['flag']==true @@ -756,7 +758,7 @@ WOK end def widget_static @rc=SiSU_Env::GetInit.new.sisu_yaml.rc - @vz=SiSU_Viz::Defaults.new + @html_bits=SiSU_Proj_HTML::Bits.new @flag={ ad: false, md: false, sk: false, rc: false } def search? flag=if defined? @rc['search'] \ @@ -765,8 +767,8 @@ WOK and @rc['search']['sisu']['action'] =~/https?:\/\// \ and defined? @rc['search']['sisu']['db'] \ and @rc['search']['sisu']['db'] =~/\S+/ - flag=if defined? @vz.widget_search \ - and @vz.widget_search==true + flag=if defined? @html_bits.widget_search \ + and @html_bits.widget_search==true true elsif defined? @rc['search']['sisu']['flag'] \ and @rc['search']['sisu']['flag']==true @@ -787,8 +789,8 @@ WOK and @rc['search']['sisu']['db'] =~/\S+/ \ and defined? @rc['search']['sisu']['db'] \ and @rc['search']['sisu']['db'] =~/\S+/ - flag=if defined? @vz.widget_search \ - and @vz.widget_search==true + flag=if defined? @html_bits.widget_search \ + and @html_bits.widget_search==true true elsif defined? @rc['search']['sisu']['flag'] \ and @rc['search']['sisu']['flag']==true diff --git a/lib/sisu/v6/shared_metadata.rb b/lib/sisu/v6/shared_metadata.rb index 998c48df..646d7f72 100644 --- a/lib/sisu/v6/shared_metadata.rb +++ b/lib/sisu/v6/shared_metadata.rb @@ -58,8 +58,10 @@ =end module SiSU_Metadata + require_relative 'xml_parts' # xml_parts.rb require_relative 'xml_shared' # xml_shared.rb class Summary + include SiSU_Parts_XML attr_accessor :tag,:inf,:class,:attrib def initialize(md,display_heading=false) @md,@display_heading=md,display_heading @@ -916,7 +918,6 @@ WOK end def odf def meta_para - url_brace=SiSU_Viz::Defaults.new.url_decoration if @inf.is_a?(String) @inf=@inf.gsub(//,'>'). gsub(/<br(?: \/)?>/,'
') @@ -938,13 +939,13 @@ WOK '\1\2') #special case \{ e.g. \}http://url @inf=if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/ @inf.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration else @inf.gsub(/(https?:\/\/[^<>()'"\s]+)/, - %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration end @inf=@inf.gsub(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol end <#{@tag.capitalize}: #{@inf} diff --git a/lib/sisu/v6/sst_do_inline_footnotes.rb b/lib/sisu/v6/sst_do_inline_footnotes.rb index e013506d..42fd559e 100644 --- a/lib/sisu/v6/sst_do_inline_footnotes.rb +++ b/lib/sisu/v6/sst_do_inline_footnotes.rb @@ -59,8 +59,6 @@ =end module SiSU_ConvertFootnotes - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'se' # se.rb include SiSU_Env require_relative 'dp' # dp.rb @@ -211,7 +209,6 @@ module SiSU_ConvertFootnotes : x end data=data_new.flatten - data=SiSU_ConvertFootnotes::Make.new(@md,data).substitutions_and_insertions? data=SiSU_ConvertFootnotes::Make.new(@md,data).character_check data=SiSU_ConvertFootnotes::Make.new(@md,data).endnotes SiSU_ConvertFootnotes::Output.new(@md,data).hard_output @@ -270,57 +267,6 @@ module SiSU_ConvertFootnotes end @tuned_file end - def substitutions_and_insertions? - data=@data - tuned_file=[] - data.each do |para| - if @md.markup =~/0\.16|0\.37/ #parameters not extracted/available - para.gsub!(/^0~\S+\s+/,'@\1: ') - para.gsub!(/^1~/,':A~') - para.gsub!(/^2~/,':B~') - para.gsub!(/^3~/,':C~') - para.gsub!(/^4~/,'1~') - para.gsub!(/^5~/,'2~') - para.gsub!(/^6~/,'3~') - para.gsub!(/^7~/,'4~') - para.gsub!(/^8~/,'5~') - para.gsub!(/^9~/,'6~') - end - if para =~/<:insert\d+!?>/ \ - and para !~/^%\s+/ - ins=SiSU_Viz::Inserts.new - case para - when /^\s*<:insert1>\s*$/ - para=[] - ins.insert1.split(/\n\n/).each {|x| para << x } - when /^\s*<:insert2>\s*$/ - para=[] - ins.insert2.split(/\n\n/).each {|x| para << x } - when /^\s*<:insert3>\s*$/ - para=[] - ins.insert3.split(/\n\n/).each {|x| para << x << "\n"} - para=ins.insert3 - when /^\s*<:insert4>\s*$/ - para=[] - ins.insert4.split(/\n\n/).each {|x| para << x << "\n"} - para=ins.insert4 - when /^\s*<:insert5>\s*$/ - para=[] - ins.insert5.split(/\n\n/).each {|x| para << x << "\n"} - when /^\s*<:insert6>\s*$/ - para=[] - ins.insert6.split(/\n\n/).each {|x| para << x << "\n"} - when /^\s*<:insert7>\s*$/ - para=[] - ins.insert7.split(/\n\n/).each {|x| para << x << "\n"} - end - para.each {|x| tuned_file << x } - else tuned_file << para - end - tuned_file.compact! - end - tuned_file - end def name_endnote_seg data=@data @tuned_file=[] diff --git a/lib/sisu/v6/sst_to_s_xml_sax.rb b/lib/sisu/v6/sst_to_s_xml_sax.rb index 9d63bbf1..5a77903a 100644 --- a/lib/sisu/v6/sst_to_s_xml_sax.rb +++ b/lib/sisu/v6/sst_to_s_xml_sax.rb @@ -60,8 +60,6 @@ module SiSU_SimpleXML_ModelSax require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'dp' # dp.rb include SiSU_Param require_relative 'se' # se.rb @@ -151,7 +149,6 @@ module SiSU_SimpleXML_ModelSax @@xml={ body: [], open: [], close: [], head: [] } def initialize(data='',particulars='') @data,@env,@md=data,particulars.env,particulars.md - @vz=SiSU_Viz::Defaults.new @regx=/^(?:#{Mx[:mk_o]}:p[bn]#{Mx[:mk_c]}\s*)?(?:#{Mx[:lv_o]}[1-9]:(\S*)#{Mx[:lv_c]})?(.+)/ @tab="\t" if @md diff --git a/lib/sisu/v6/texinfo.rb b/lib/sisu/v6/texinfo.rb index f0360502..a82c1542 100644 --- a/lib/sisu/v6/texinfo.rb +++ b/lib/sisu/v6/texinfo.rb @@ -61,7 +61,6 @@ module SiSU_TexInfo require_relative 'html' # html.rb require_relative 'dp' # dp.rb include SiSU_Param - include SiSU_Viz #include Stamp ... needed removed arbitrarily 2005w05/1 (warnings about undefined flags) require_relative 'texinfo_format' # texinfo_format.rb include SiSU_TexInfoFormat @@ -74,13 +73,11 @@ module SiSU_TexInfo @@tex_pattern_margin_number="\\\\marginpar.+?\s+" class Source include SiSU_Param - include SiSU_Viz include SiSU_TexInfo def initialize(opt) @opt=opt @md=SiSU_Param::Parameters.new(@opt).get @env=SiSU_Env::InfoEnv.new(@opt.fns) - @vz=SiSU_Viz::Defaults.new end def directories begin @@ -151,7 +148,6 @@ module SiSU_TexInfo def initialize(md,data) @md,@data=md,data @env=SiSU_Env::InfoEnv.new(@md.fns) - @vz=SiSU_Viz::Defaults.new @f=SiSU_Env::FileOp.new(@md) end def songsheet diff --git a/lib/sisu/v6/texinfo_format.rb b/lib/sisu/v6/texinfo_format.rb index 9c841ff0..03ec2609 100644 --- a/lib/sisu/v6/texinfo_format.rb +++ b/lib/sisu/v6/texinfo_format.rb @@ -61,7 +61,6 @@ module SiSU_TexInfoFormat @@table_pg_break_counter=1 require_relative 'dp' # dp.rb include SiSU_Param - include SiSU_Viz class Texinfo @@tex_1='\\\\~' #?? debug @@tabular="{tabular}" @@ -75,7 +74,6 @@ module SiSU_TexInfoFormat p dob.class p caller end - @vz=SiSU_Viz::Defaults.new end def head t=Time.now diff --git a/lib/sisu/v6/texpdf.rb b/lib/sisu/v6/texpdf.rb index 00bf7961..79a36c0d 100644 --- a/lib/sisu/v6/texpdf.rb +++ b/lib/sisu/v6/texpdf.rb @@ -64,8 +64,7 @@ module SiSU_TeX SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). error('pstore NOT FOUND (LoadError)') end - require_relative 'defaults' # defaults.rb - include SiSU_Viz + require_relative 'texpdf_parts' # texpdf_parts.rb require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars require_relative 'texpdf_format' # texpdf_format.rb @@ -88,7 +87,6 @@ module SiSU_TeX end require_relative 'se' # se.rb include SiSU_Env - include SiSU_Viz require_relative 'ao' # ao.rb include SiSU_AO include SiSU_TeX @@ -395,6 +393,7 @@ module SiSU_TeX end end class LaTeXcreate + include SiSU_Parts_TeXpdf @@tex_head={ 'a4'=> { p: nil, l: nil }, 'a5'=> { p: nil, l: nil }, @@ -411,9 +410,7 @@ module SiSU_TeX @data=@particulars.ao_array # ao file drawn here @st={ tex: {} } @tex_ml=SiSU_TeX_Pdf::UseTeX.new(@md) - @vz=SiSU_Viz::Defaults.new @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern - @brace_url=SiSU_Viz::Defaults.new.url_decoration l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language @language=l[:n] @translate=SiSU_Translate::Source.new(@md,@language) @@ -810,7 +807,7 @@ module SiSU_TeX end def markup(data) @tex_file=[] - home=@vz.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex + home=the_text.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex title=@md.title.full.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex @md.papersize_array.each do |ps| if @md.opt.act[:pdf_p][:set]==:on diff --git a/lib/sisu/v6/texpdf_format.rb b/lib/sisu/v6/texpdf_format.rb index b3ee1230..134a2b2f 100644 --- a/lib/sisu/v6/texpdf_format.rb +++ b/lib/sisu/v6/texpdf_format.rb @@ -58,19 +58,19 @@ =end module SiSU_TeX_Pdf + require_relative 'texpdf_parts' # texpdf_parts.rb @@table_pg_break_counter=1 - include SiSU_Viz class BareUrls + include SiSU_Parts_TeXpdf def initialize(md,dob=nil) @md,@dob=md,dob - @brace_url=SiSU_Viz::Defaults.new.url_decoration end def bare_urls @dob.obj=@dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@[a-zA-Z0-9_-]+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - "#{@brace_url.tex_open}\\begin{scriptsize}\\email{\\1}#{@brace_url.tex_close}") + "#{url_decoration.tex_open}\\begin{scriptsize}\\email{\\1}#{url_decoration.tex_close}") @dob.tmp=@dob.tmp.gsub(/(^|[^\\])_/m,'\1\_'). #watch may not work gsub(/(^|[^#{Mx[:lnk_c]}])#{Mx[:url_o]}_?(?:\\?_)?(\S+?)#{Mx[:url_c]}/m, - "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}") + "\\1#{url_decoration.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{url_decoration.tex_close}") @dob end def bare_urls_in_code @@ -81,7 +81,7 @@ module SiSU_TeX_Pdf end end class FormatTextObject - require_relative 'defaults' # defaults.rb + include SiSU_Parts_TeXpdf attr_accessor :string,:string1,:orientation,:url,:dir,:tex @@sys=SiSU_Env::SystemCall.new @@tex_pattern_margin_number=/\\begin\{tiny\}\\hspace\{0mm\}\\end\{tiny\}\{\\marginpar.+?\}\}\}/ @@ -102,7 +102,6 @@ module SiSU_TeX_Pdf end @start_table='' @tx=SiSU_Env::GetInit.new.tex - @brace_rel=SiSU_Viz::Defaults.new.rel_decoration @env ||=SiSU_Env::InfoEnv.new(@md.fns) @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine @make ||=SiSU_Env::ProcessingSettings.new(@md) @@ -517,7 +516,7 @@ module SiSU_TeX_Pdf link.gsub!(/&/,"#{Xx[:protect]}&") url="#{@env.url.root}/" + url str.sub!(/#{Mx[:lnk_o]}[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/m, - "#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}") + "#{url_decoration.tex_open}\\href{#{url}}{#{link}}#{url_decoration.tex_close}") end while str =~/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+)#{Mx[:lnk_c]}#{Mx[:rel_o]}#?(\S+?)#{Mx[:rel_c]}/m link,url=$1,$2 @@ -533,7 +532,7 @@ module SiSU_TeX_Pdf if ocn_lnk and not ocn_lnk.empty? idx \ ? (str.sub!(rgx_url_internal,"\\hyperlink{#{ocn_lnk}}{#{link}}")) - : (str.sub!(rgx_url_internal,"#{@brace_rel.tex_open}\\hyperlink{#{ocn_lnk}}{#{link}}#{@brace_rel.tex_close}")) + : (str.sub!(rgx_url_internal,"#{url_decoration.tex_open}\\hyperlink{#{ocn_lnk}}{#{link}}#{url_decoration.tex_close}")) else puts %{name tag: "#{url}" not found} str.sub!(rgx_url_internal,"#{link}") @@ -541,7 +540,7 @@ module SiSU_TeX_Pdf #[keep] code that follows uses nametags directly, currently nametags converted to their ocn, related code: |texpdf.rb|@|hypertargets| #idx \ #? (str.sub!(rgx_url_internal,"\\hyperlink{#{url}}{#{link}}")) \ - #: (str.sub!(rgx_url_internal,"#{@brace_rel.tex_open}\\hyperlink{#{url}}{#{link}}#{@brace_rel.tex_close}")) + #: (str.sub!(rgx_url_internal,"#{url_decoration.tex_open}\\hyperlink{#{url}}{#{link}}#{url_decoration.tex_close}")) end str=str.gsub(/#{Xx[:protect]}/,'') end @@ -554,7 +553,7 @@ module SiSU_TeX_Pdf url=url.strip link=z.strip link.gsub!(/&/,"#{Xx[:protect]}&") - str.sub!(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}") + str.sub!(rgx_url_generic,"#{url_decoration.tex_open}\\href{#{url}}{#{link}}#{url_decoration.tex_close}") str=str.gsub(/#{Xx[:protect]}/,'') str else str @@ -578,9 +577,9 @@ module SiSU_TeX_Pdf url=url.strip link=z.strip link.gsub!(/&/,"#{Xx[:protect]}&") - dob.tmp.sub!(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}#{punctuate}") + dob.tmp.sub!(rgx_url_generic,"#{url_decoration.tex_open}\\href{#{url}}{#{link}}#{url_decoration.tex_close}#{punctuate}") dob.tmp.gsub!(/#{Xx[:protect]}/,'') - #dob.tmp=dob.tmp.sub(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}#{punctuate}"). + #dob.tmp=dob.tmp.sub(rgx_url_generic,"#{url_decoration.tex_open}\\href{#{url}}{#{link}}#{url_decoration.tex_close}#{punctuate}"). # gsub(/#{Xx[:protect]}/,'') dob else dob @@ -760,7 +759,6 @@ module SiSU_TeX_Pdf p caller end @tx=SiSU_Env::GetInit.new.tex - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine @ps=@txt if @txt=~/(?:a4|letter|legal|book|a5|b5)/i @lang ||=SiSU_i18n::Languages.new #.list[@md.opt.lng][:xlp] @@ -1236,9 +1234,9 @@ module SiSU_TeX_Pdf end end class SpecialCharacters + include SiSU_Parts_TeXpdf def initialize(md,str,is=:default) @md,@txt,@is=md,str,is - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine end def xetex_code_listings(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list @@ -1380,7 +1378,7 @@ module SiSU_TeX_Pdf if is !=:code \ and is !=:no_urls str=str.gsub(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/, - "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start + "\\1#{url_decoration.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{url_decoration.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start end str=str.gsub(/<:ee>/,''). gsub(//,' '). #proposed change, insert, but may be redundant @@ -1487,13 +1485,12 @@ module SiSU_TeX_Pdf end end class UseTeX + include SiSU_Parts_TeXpdf attr_accessor :url,:txt,:date def initialize(md) @md=md - @vz=SiSU_Viz::Defaults.new @date=SiSU_Env::InfoDate.new # #{@date.year} @copymark='{\\begin{footnotesize}\\raisebox{1ex}{\\copyright}\\end{footnotesize}}' - @brace_url=SiSU_Viz::Defaults.new.url_decoration end def skip "\n\\vspace*{\\smallskipamount} \n" @@ -1532,15 +1529,12 @@ module SiSU_TeX_Pdf "\\rfoot[\\tiny \\href{}{}]{\\textrm{\\thepage}}\n" end def site - if not @vz.url_home.empty? \ - and not @vz.url_txt.empty? + if not the_url.home.empty? \ + and not the_url.home_txt.empty? "\n\\date{\\begin{tiny} \\end{tiny}}" else '' end end - def sitename # owners site, eg freeculture, free.for.all, gutenberg etc. - "\\href{#{@vz.url_home}}{#{@vz.txt_home}}" - end def owner_chapter "Contact Details for Original Promulgating Authority" end @@ -1572,7 +1566,7 @@ module SiSU_TeX_Pdf \\\\ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\begin{tiny}[ #{v[:project]} #{v[:version]} of #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} \\\\ Copyright #{@copymark} 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved. \\\\ SiSU is software for document structuring, publishing and search (with object citation numbering), \\href{http://www.sisudoc.org}{www.sisudoc.org} -\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later, #{@brace_url.tex_open}\\href{http://www.fsf.org/licenses/gpl.html}{http://www.fsf.org/licenses/gpl.html}#{@brace_url.tex_close}. +\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later, #{url_brace.tex_open}\\href{http://www.fsf.org/licenses/gpl.html}{http://www.fsf.org/licenses/gpl.html}#{url_brace.tex_close}. {\\end{footnotesize} \\\\ WOK @@ -1618,64 +1612,6 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ \\listofendnotes WOK end - def doc_tail - dir=SiSU_Env::InfoEnv.new(@md.fns) - v=SiSU_Env::InfoVersion.instance.get_version - sisu_ico=if FileTest.file?("#{dir.path.image_source_include}/sisu.png") - "\\includegraphics*[width=60pt]{#{dir.path.image_source_include}/sisu.png}" - else - SiSU_Screen::Ansi.new( - @md.opt.act[:color_state][:set], - 'WARNING - image directory or image(s) missing:', - %{"#{dir.path.image_source_include}"} - ).warn unless @md.opt.act[:quiet][:set]==:on - " SiSU " - end - url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') - <<-WOK -\\begin{english}[variant=british] -\\subsection*{Information on this document copy and an unofficial List of Some web related information and sources} -\\addcontentsline{toc}{section}{Information on this document copy and an unofficial List of Some web related information and sources} -\\\\ -\"Support Open Standards and Software Libré for the Information Technology Infrastructure\" RA\\subsubsection*{Information on this document copy #{site}} -\\addcontentsline{toc}{subsection}{Information on this document copy} -{\\begin{footnotesize} -\\\\ Generated by \\href{http://www.jus.uio.no/sisu/}{SiSU} found at \\href{http://www.jus.uio.no/sisu/}{www.jus.uio.no/sisu} \\begin{tiny}[ #{v[:project]} #{v[:version]} #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.sisudoc.org}{www.sisudoc.org}. SiSU is software for document structuring, publishing and search (using SiSU: object citation numbering, markup, meta-markup, and system) Copyright #{@copymark} 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved. -\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later (\\href{http://www.fsf.org/licenses/gpl.html}{www.fsf.org/licenses/gpl.html}). {\\end{footnotesize} -{\\begin{small} -\\\\ W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{#{sisu_ico}}SiSU 1997, current #{@date.year_static}. \\\\ #{sitename} presentations at \\begin{scriptsize}#{site}\\end{scriptsize} \\\\ \\\\ #{@md.title.full} \\textbf{pdf} versions can be found at: \\\\ -{\\end{small} -\\\\ #{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\ -#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\ -\\\\\n#{@md.title.full} \\textbf{html} versions may be found at: \\\\ -#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}\\end{scriptsize}#{@brace_url.tex_close} or \\\\ -#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}\\end{scriptsize}#{@brace_url.tex_close} -\\\\ -\\\\ -\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}{SiSU Manifest} of document output and metadata may be found at: \\\\ -#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}\\end{scriptsize}#{@brace_url.tex_close} -\\\\ -\\\\ - #{sitename} found at: \\begin{scriptsize}#{site}\\end{scriptsize}\\subsubsection*{Links that may be of interest at #{@vz.txt_home} and elsewhere:} -\\addcontentsline{toc}{subsection}{Links that may be of interest} -\\end{english} - WOK - end - def mail_tail #not retested, the old mail_tail is commented out and appended to this program - dir=SiSU_Env::InfoEnv.new(@md.fns) - <<-WOK -\\subsection*{Mail sender details} -\\addcontentsline{toc}{subsection}{Mail sender details} -\\\\ -Mail from: ralph@amissah.com\\\\ -44 20 8789 3452\\\\ -44 77 9669 4448 -\\\\ - \"Support Open Standards and Open Sources for the Information Technology Infrastructure\" RA -\\subsubsection*{Information on this document copy #{site}\\copyright} -Presentations' look and feel generated by \\href{http://www.jus.uio.no/sisu/}{SiSU Scribe} \\href{http://www.jus.uio.no/sisu/}{http://www.jus.uio.no/sisu/} programmed in Ruby on Debian/Gnu/Linux by Copyright \\copyright Ralph Amissah, W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{\\includegraphics*[width=35pt]{#{dir.path.image_source_include}/sisu.png}}for #{sitename}. SiSU Scribe (sisu information structuring unit) produces Electronic Documents, i.e. it generates structured output for use in a number of file formats, including the pdf file produced here. - WOK - end end end __END__ diff --git a/lib/sisu/v6/texpdf_parts.rb b/lib/sisu/v6/texpdf_parts.rb new file mode 100644 index 00000000..dbd669ff --- /dev/null +++ b/lib/sisu/v6/texpdf_parts.rb @@ -0,0 +1,238 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: shared html parts + +=end +module SiSU_Parts_TeXpdf + require_relative 'generic_parts' # generic_parts.rb + include SiSU_Parts_Generic + def the_line_break + ' \\ ' + end + def url_decoration + def tex_open #'{\UseTextSymbol{OML}{<}}' + Dx[:url_o] + end + def tex_close #'{\UseTextSymbol{OML}{>}}' + Dx[:url_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + def the_font + def set_fonts + 'verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' + end + self + end + class TeX + def initialize(papersize='') + @papersize=papersize + end + def a4 + def portrait + def w + 160 + end + def h + 228 + end + def img_px + 450 + end + self + end + def landscape + def w + 238 + end + def h + 160 + end + def img_px + 300 + end + self + end + self + end + def letter + def portrait + def w + 166 + end + def h + 212 + end + def img_px + 468 + end + self + end + def landscape + def w + 226 + end + def h + 166 + end + def img_px + 290 + end + self + end + self + end + def legal + def portrait + def w + 168 + end + def h + 286 + end + def img_px + 474 + end + self + end + def landscape + def w + 296 + end + def h + 166 + end + def img_px + 420 + end + self + end + self + end + def b5 + def portrait + def w + 140 + end + def h + 204 + end + def img_px + 356 + end + self + end + def landscape + def w + 200 + end + def h + 130 + end + def img_px + 260 + end + self + end + self + end + def a5 + def portrait + def w + 112 + end + def h + 162 + end + def img_px + 280 + end + self + end + def landscape + def w + 152 + end + def h + 100 + end + def img_px + 190 + end + self + end + self + end + def dimensions + case @papersize + when /a4/ then a4 + when /letter/ then letter + when /legal/ then legal + when /b5/ then b5 + when /a5/ then a5 + else a4 + end + end + end +end +__END__ diff --git a/lib/sisu/v6/txt_asciidoc.rb b/lib/sisu/v6/txt_asciidoc.rb index ed1f2826..5f27a86a 100644 --- a/lib/sisu/v6/txt_asciidoc.rb +++ b/lib/sisu/v6/txt_asciidoc.rb @@ -62,9 +62,9 @@ module SiSU_Txt_AsciiDoc require_relative 'se' # se.rb include SiSU_Env require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb include SiSU_Param - include SiSU_Viz @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source @@ -126,14 +126,12 @@ module SiSU_Txt_AsciiDoc end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{the_text.url_open}\\1#{the_text.url_close}") dob.obj=dob.obj.gsub(/\s*#{Mx[:en_a_o]}([\d*+]+)\s+(.+?)#{Mx[:en_a_c]}/,' footnote:[note\1,\2]'). gsub(/\s*#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/,' footnote:[\1]') dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v6/txt_markdown.rb b/lib/sisu/v6/txt_markdown.rb index 80277cf6..eb220a46 100644 --- a/lib/sisu/v6/txt_markdown.rb +++ b/lib/sisu/v6/txt_markdown.rb @@ -62,9 +62,9 @@ module SiSU_Txt_Markdown require_relative 'se' # se.rb include SiSU_Env require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb include SiSU_Param - include SiSU_Viz @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source @@ -125,14 +125,12 @@ module SiSU_Txt_Markdown end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{the_text.url_open}\\1#{the_text.url_close}") extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v6/txt_plain.rb b/lib/sisu/v6/txt_plain.rb index 22e5a520..c988c50f 100644 --- a/lib/sisu/v6/txt_plain.rb +++ b/lib/sisu/v6/txt_plain.rb @@ -63,9 +63,9 @@ module SiSU_Txt_Plain require_relative 'se' # se.rb include SiSU_Env require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb include SiSU_Param - include SiSU_Viz @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source @@ -127,14 +127,12 @@ module SiSU_Txt_Plain end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{the_text.url_open}\\1#{the_text.url_close}") extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v6/txt_rst.rb b/lib/sisu/v6/txt_rst.rb index 71912858..8e08ba81 100644 --- a/lib/sisu/v6/txt_rst.rb +++ b/lib/sisu/v6/txt_rst.rb @@ -62,9 +62,9 @@ module SiSU_Txt_rST require_relative 'se' # se.rb include SiSU_Env require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb include SiSU_Param - include SiSU_Viz @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source @@ -126,14 +126,12 @@ module SiSU_Txt_rST end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{the_text.url_open}\\1#{the_text.url_close}") extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v6/txt_shared.rb b/lib/sisu/v6/txt_shared.rb index f0745d7b..f2b4a0bf 100644 --- a/lib/sisu/v6/txt_shared.rb +++ b/lib/sisu/v6/txt_shared.rb @@ -58,6 +58,7 @@ =end module SiSU_TextUtils + require_relative 'generic_parts' # generic_parts.rb class Wrap def initialize(para='',n_char_max=76,n_indent=0,n_hang=nil,post='') @para,@n_char_max,@n_indent,@post,=para,n_char_max,n_indent,post diff --git a/lib/sisu/v6/txt_textile.rb b/lib/sisu/v6/txt_textile.rb index 93a23f86..39e95bcb 100644 --- a/lib/sisu/v6/txt_textile.rb +++ b/lib/sisu/v6/txt_textile.rb @@ -62,12 +62,13 @@ module SiSU_Txt_Textile require_relative 'se' # se.rb include SiSU_Env require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb include SiSU_Param - include SiSU_Viz @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source + include SiSU_Parts_Generic def initialize(opt) @opt=opt unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/ @@ -126,14 +127,12 @@ module SiSU_Txt_Textile end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{the_text.url_open}\\1#{the_text.url_close}") extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v6/wikispeak.rb b/lib/sisu/v6/wikispeak.rb index a66d529a..b2fe65fc 100644 --- a/lib/sisu/v6/wikispeak.rb +++ b/lib/sisu/v6/wikispeak.rb @@ -62,9 +62,9 @@ module SiSU_Wikispeak require_relative 'se' # se.rb include SiSU_Env include SiSU_Param - include SiSU_Viz require_relative 'plaintext_format' # plaintext_format.rb include Format + require_relative 'html_parts' # html_parts.rb require_relative 'txt_shared' @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' @@ -109,7 +109,6 @@ module SiSU_Wikispeak class SplitTextObject / diff --git a/lib/sisu/v6/xhtml.rb b/lib/sisu/v6/xhtml.rb index 6ff864f6..40073ff3 100644 --- a/lib/sisu/v6/xhtml.rb +++ b/lib/sisu/v6/xhtml.rb @@ -58,8 +58,6 @@ ** Notes: tidy -xml scroll.xhtml >> index.tidy =end module SiSU_XHTML - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars require_relative 'se' # se.rb @@ -152,7 +150,6 @@ module SiSU_XHTML @@xml={ body: [], sisu: [], open: [], close: [], head: [] } def initialize(particulars) @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array - @vz=SiSU_Viz::Defaults.new @tab="\t" @trans=SiSU_XML_Munge::Trans.new(@md) @sys=SiSU_Env::SystemCall.new @@ -369,8 +366,6 @@ WOK format_text.scr_inden_ocn_e_no_paranum end end - if dob.obj !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ - end else # end dob.obj=dob.obj.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj diff --git a/lib/sisu/v6/xhtml_epub2.rb b/lib/sisu/v6/xhtml_epub2.rb index af796cbe..4850ad73 100644 --- a/lib/sisu/v6/xhtml_epub2.rb +++ b/lib/sisu/v6/xhtml_epub2.rb @@ -66,8 +66,6 @@ module SiSU_XHTML_EPUB2 end require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'xml_shared' # xml_shared.rb include SiSU_XML_Munge require_relative 'xhtml_table' # xhtml_table.rb @@ -161,7 +159,6 @@ module SiSU_XHTML_EPUB2 def initialize(particulars) @particulars=particulars @md,@env=particulars.md,particulars.env - @vz=SiSU_Viz::Defaults.new @env,@css=particulars.env,SiSU_Style::CSS.new end def directories @@ -213,7 +210,6 @@ module SiSU_XHTML_EPUB2 @@firstseg=nil def initialize(md=nil,data='') @md,@data=md,data - @vz=SiSU_Viz::Defaults.new @epub=SiSU_XHTML_EPUB2_Format::HeadInformation.new(@md) @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md @make=SiSU_Env::ProcessingSettings.new(@md) @@ -645,7 +641,6 @@ module SiSU_XHTML_EPUB2 class ScrollHeadAndSegToc < Toc def initialize(md='',toc='',links_guide_toc='') @md,@toc,@links_guide_toc=md,toc,links_guide_toc - @vz=SiSU_Viz::Defaults.new end def in_common toc_shared=[] diff --git a/lib/sisu/v6/xhtml_epub2_concordance.rb b/lib/sisu/v6/xhtml_epub2_concordance.rb index 67fc623b..0c70d858 100644 --- a/lib/sisu/v6/xhtml_epub2_concordance.rb +++ b/lib/sisu/v6/xhtml_epub2_concordance.rb @@ -63,8 +63,7 @@ module SiSU_XHTML_EPUB2_Concordance include SiSU_Particulars require_relative 'se' # se.rb include SiSU_Env - require_relative 'defaults' # defaults.rb - include SiSU_Viz + require_relative 'xhtml_parts' # xhtml_parts.rb require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb include SiSU_XHTML_EPUB2_Format class Source @@ -101,13 +100,11 @@ module SiSU_XHTML_EPUB2_Concordance end private class DocTitle - include SiSU_Viz #revisit, both requires (html & xml_shared) needed for stand alone operation (sisu -w [filename]) require_relative 'xhtml_epub2' # xhtml_epub2.rb def initialize(particulars) @particulars,@md=particulars,particulars.md @data=SiSU_XHTML_EPUB2::Source::XHTML_Environment.new(particulars).tuned_file_instructions - @vz=SiSU_Viz::Defaults.new @fnb=@md.fnb @lex_button=%{
SiSU home} @doc_details =<>#{credits}\n} # footer end end diff --git a/lib/sisu/v6/xhtml_epub2_format.rb b/lib/sisu/v6/xhtml_epub2_format.rb index 73c5a1ab..f6aa6be5 100644 --- a/lib/sisu/v6/xhtml_epub2_format.rb +++ b/lib/sisu/v6/xhtml_epub2_format.rb @@ -58,7 +58,6 @@ =end module SiSU_XHTML_EPUB2_Format - include SiSU_Viz class ParagraphNumber def initialize(md,ocn) @md,@ocn=md,ocn.to_s @@ -1235,6 +1234,7 @@ module SiSU_XHTML_EPUB2_Format end end module SanitizeXML + require_relative 'xhtml_parts' # xhtml_parts.rb def self.xml(x) if x.is_a?(String) x=x.gsub(/ /,' ') if Ep[:alt]==:on @@ -1249,12 +1249,10 @@ module SiSU_XHTML_EPUB2_Format end end class HeadInformation - include SiSU_Viz - attr_reader :md,:rdf,:vz + attr_reader :md,:rdf def initialize(md) @md=md # DublinCore 1 - title - @vz=SiSU_Viz::Defaults.new @css=SiSU_Env::CSS_Stylesheet.new(md) @seg_name_xhtml=(SiSU_XHTML_EPUB2::Source::Seg.new.seg_name_xhtml || []) @seg_name_xhtml_tracker=(SiSU_XHTML_EPUB2::Source::Seg.new.seg_name_xhtml_tracker || []) @@ -1722,15 +1720,16 @@ output_epub_cont_seg.close end def table_close %{ -#{@vz.table_close}} +#{the_table_close}} end def xhtml_close - %{#{@vz.credits_sisu_epub} + %{#{SiSU_Proj_XHTML::Bits.new.credits_sisu_epub} } end end class HeadToc < HeadInformation + include SiSU_Parts_XHTML def initialize(md) super(md) @md=md @@ -1757,16 +1756,16 @@ output_epub_cont_seg.close end def concordance if @md.concord_make - %{#{@vz.margin_css} + %{#{the_margin.css}

Concordance

-#{@vz.table_close}} +#{the_table_close}} else - %{#{@vz.margin_css} -#{@vz.table_close}} + %{#{the_margin.css} +#{the_table_close}} end end def links_guide_open(type='horizontal') @@ -1787,40 +1786,40 @@ output_epub_cont_seg.close %{

Prefix: #{@md.prefix_b}} end def make_seg - concord=concordance_link(@vz.nav_txt_concordance) + concord=concordance_link(the_nav.txt_concordance) %{ +
- #{@vz.nav_txt_toc_link} + #{the_nav.txt_toc_link} #{concord} -#{@vz.table_close}} +#{the_table_close}} end def manifest #check structure - manifest=manifest_link(@vz.nav_txt_manifest) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} + manifest=manifest_link(the_nav.txt_manifest) + %{#{the_margin.txt_3} + #{the_font.paragraph_font_small} #{manifest} -#{@vz.table_close}} +#{the_table_close}} end def concordance #check structure - concord=concordance_link(@vz.nav_txt_concordance) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} + concord=concordance_link(the_nav.txt_concordance) + %{#{the_margin.txt_3} + #{the_font.paragraph_font_small} #{concord} -#{@vz.table_close}} +#{the_table_close}} end def metadata - %{#{@vz.margin_css} + %{#{the_margin.css}

MetaData

-#{@vz.table_close}} +#{the_table_close}} end end class HeadSeg < HeadInformation @@ -1850,8 +1849,8 @@ output_epub_cont_seg.close super(md) end def toc_owner_details - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} + %{#{the_margin.txt_3} +#{the_font.paragraph_font_small} Owner Details @@ -1859,11 +1858,11 @@ output_epub_cont_seg.close -#{@vz.table_close}} +#{the_table_close}} end end class FormatTextObject - @vz=SiSU_Viz::Defaults.new + include SiSU_Parts_XHTML attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o @@ -1907,7 +1906,6 @@ output_epub_cont_seg.close @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') end @p_num=ParagraphNumber.new(@md,@ocn) - @vz=SiSU_Viz::Defaults.new end def nametags_seg(dob) #FIX tags='' @@ -2084,13 +2082,13 @@ output_epub_cont_seg.close end end def bold_para - %{#{@vz.margin_txt_0} + %{#{the_margin.txt_0}

#{@txt}

-#{@vz.margin_num_css} +#{the_margin.num_css} #{$ep[:hsp]*3} -#{@vz.table_close}} +#{the_table_close}} end def bold_heading #unused @txt=@txt.gsub(/[1-9]~\S+/,''). @@ -2098,9 +2096,9 @@ output_epub_cont_seg.close %{

#{@txt}

-#{@vz.margin_num_css} +#{the_margin.num_css} #{$ep[:hsp]*3} -#{@vz.table_close}} +#{the_table_close}} end def toc_head_copy_at @txt=SanitizeXML.xml(@txt) @@ -2122,7 +2120,6 @@ output_epub_cont_seg.close class FormatScroll < FormatTextObject def initialize(md,txt) super(md,txt) - @vz=SiSU_Viz::Defaults.new end end class FormatSeg < FormatTextObject @@ -2206,7 +2203,7 @@ output_epub_cont_seg.close

#{@txt}

-#{@vz.table_close}} +#{the_table_close}} end def navigation_heading5 %{

diff --git a/lib/sisu/v6/xhtml_epub2_segments.rb b/lib/sisu/v6/xhtml_epub2_segments.rb index 961ef299..fca2e729 100644 --- a/lib/sisu/v6/xhtml_epub2_segments.rb +++ b/lib/sisu/v6/xhtml_epub2_segments.rb @@ -131,7 +131,6 @@ WOK attr_reader :seg_name_xhtml,:seg_name_xhtml_tracker def initialize(md='',data='') @md,@data=md,data - @vz=SiSU_Viz::Defaults.new @seg_name_xhtml=@@seg_name_xhtml || nil @seg_name_xhtml_tracker=@@tracker || nil @make=SiSU_Env::ProcessingSettings.new(@md) if @md diff --git a/lib/sisu/v6/xhtml_epub2_tune.rb b/lib/sisu/v6/xhtml_epub2_tune.rb index 07337309..836ccce3 100644 --- a/lib/sisu/v6/xhtml_epub2_tune.rb +++ b/lib/sisu/v6/xhtml_epub2_tune.rb @@ -61,6 +61,7 @@ require_relative 'dp' # dp.rb module SiSU_XHTML_EPUB2_Tune require_relative 'se' # se.rb include SiSU_Env; include SiSU_Screen + require_relative 'xhtml_parts' # xhtml_parts.rb require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb #watch @@line_mode='' @@endnote_array=[] @@ -109,12 +110,11 @@ module SiSU_XHTML_EPUB2_Tune end end class Tune + include SiSU_Parts_XHTML def initialize(data,md) @data,@md=data,md - @vz=SiSU_Viz::Defaults.new @sys=SiSU_Env::SystemCall.new @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration end def songsheet begin @@ -261,18 +261,18 @@ module SiSU_XHTML_EPUB2_Tune dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/, %{\n

\\3
\n}) end - dob.obj=dob.obj.gsub(/!pick/,%{stellar}). - gsub(/!new/,%{#{$ep[:hsp]}new}). + dob.obj=dob.obj.gsub(/!pick/,%{stellar}). + gsub(/!new/,%{#{$ep[:hsp]}new}). gsub(/<:h(.{1,7}?)>/,'\1'). gsub(/<:to(\d{1,7}?)>/,%{to#{$ep[:hsp]}\{#{$ep[:hsp]}\\1#{$ep[:hsp]}\} }). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). #http ftp matches escaped, no decoration - gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration if dob.obj =~/..\/\S+/ \ and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ dob.obj=dob.obj.gsub(/(\.\.\/\S+)/,'\1') end - dob.obj=dob.obj.gsub(//m,'>') end diff --git a/lib/sisu/v6/xhtml_parts.rb b/lib/sisu/v6/xhtml_parts.rb new file mode 100644 index 00000000..7be47079 --- /dev/null +++ b/lib/sisu/v6/xhtml_parts.rb @@ -0,0 +1,186 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: shared html parts + +=end +module SiSU_Parts_XHTML + require_relative 'generic_parts' # generic_parts.rb + include SiSU_Parts_Generic + def the_line_break + '
' + end + def the_table_close + '
' + end + def the_url + def home + 'http://www.sisudoc.org/' # used in pdf header + end + def site #used as stub... where there are subdirectories and is different from home + home + end + self + end + def the_url_decoration + def xml_open #'<' + Dx[:url_o] + end + def xml_close #'>' + Dx[:url_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + def the_margin + def txt_0 + %{ +
+} + end + def txt_1 + %{ +
} + end + def txt_2 + %{ + +
+} + end + def txt_3 + %{ + +
+} + end + def css + ' + +} else %{} end diff --git a/lib/sisu/v6/xml_dom.rb b/lib/sisu/v6/xml_dom.rb index 16c1895e..fd96b564 100644 --- a/lib/sisu/v6/xml_dom.rb +++ b/lib/sisu/v6/xml_dom.rb @@ -58,8 +58,6 @@ ** Notes: tidy -xml dom.xml >> index.tidy =end module SiSU_XML_DOM - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars require_relative 'se' # se.rb @@ -167,7 +165,6 @@ module SiSU_XML_DOM def initialize(particulars) @env, @md, @ao_arr= particulars.env,particulars.md,particulars.ao_array - @vz=SiSU_Viz::Defaults.new @trans=SiSU_XML_Munge::Trans.new(@md) @sys=SiSU_Env::SystemCall.new end @@ -519,8 +516,6 @@ WOK format_text.scr_inden_ocn_e_no_paranum end end - if dob.obj !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ - end else # end dob.obj=dob.obj.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj diff --git a/lib/sisu/v6/xml_format.rb b/lib/sisu/v6/xml_format.rb index 73a41efa..088b5d2b 100644 --- a/lib/sisu/v6/xml_format.rb +++ b/lib/sisu/v6/xml_format.rb @@ -60,8 +60,8 @@ =end module SiSU_XML_Format require_relative 'dp' # dp.rb - include SiSU_Param - include SiSU_Viz + require_relative 'xml_parts' # xml_parts.rb + include SiSU_Param class ParagraphNumber def initialize(md,paranum) @md=md @@ -86,6 +86,7 @@ module SiSU_XML_Format end end class HeadInformation + include SiSU_Parts_XML def initialize #dc rdf @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords='' @md=@@md @@ -197,7 +198,6 @@ module SiSU_XML_Format if @md.rights.copyright.all # possibly redundant see dc.rights @owner=%{\n} if @md.owner @keywords=%{\n} if @md.keywords - @vz=SiSU_Viz::Defaults.new #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php @index='index' end def meta_content_clean(content='') @@ -279,6 +279,7 @@ WOK end end class FormatTextObject + include SiSU_Parts_XML attr_accessor :md,:txt,:format,:paranum,:p_num,:para_id,:headname,:font def initialize(md,dob) @md,@dob=md,dob @@ -292,7 +293,6 @@ WOK @lnk_url=@lnk_url.gsub(rgx,'') if @lnk_url =~rgx rgx=/~\{\d+\s+(.+?)\}~/ @lnk_url=@lnk_url.gsub(rgx,'\1') if @lnk_url =~rgx - @vz=SiSU_Viz::Defaults.new end def scr_endnote_body "#{@txt} " @@ -368,13 +368,12 @@ WOK end end class HeadInformation - include SiSU_Viz + include SiSU_Parts_XML attr_reader :md,:sfx,:pdf,:rdf,:vz def initialize(md) @md=md @rdf=SiSU_XML_Tags::RDF.new(md) # DublinCore 1 - title - @vz=SiSU_Viz::Defaults.new @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || []) @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) @@ -389,7 +388,7 @@ WOK end def table_close %{ -#{@vz.table_close}} +#{the_table_close}} end def html_close #moved %{ @@ -398,597 +397,8 @@ WOK end class XML end - class HeadToc < HeadInformation - def initialize(md) - super(md) - @md=md - @tocband_scroll,@tocband_segtoc=make_scroll,make_seg - end - def scroll_head_navigation_band - pdf=if @md.programs[:pdf] - < - #{make_seg_scroll_pdf} - -WOK - else '' - end - %{
' + end + def num_css + ' ' + end + self + end + def the_font + def set_fonts + 'verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' + #'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman' + end + def set_small + 'size="3"' + end + def set_tiny + 'size="2"' + end + def paragraph_font_tiny + %{} + end + def paragraph_font_small + %{} + end + self + end + def the_nav + def txt_concordance + %{ +   A-Z  + } + end + def txt_toc_link + %{ +   toc  + } + end + def txt_manifest + #{png_manifest} document manifest + %{ + [ document manifest ] + } + end + def txt_concordance + %{ +   A-Z  + } + end + self + end +end +module SiSU_Proj_XHTML + require_relative 'se' # se.rb + include SiSU_Env + class Bits + include SiSU_Parts_HTML + def initialize + @v=SiSU_Env::InfoVersion.instance.get_version + end + def credits_sisu_epub + %{
+

EPUB generated by #{@v[:project]} v#{@v[:version]}, GPL3

+
} + '' + end + end +end +__END__ diff --git a/lib/sisu/v6/xhtml_shared.rb b/lib/sisu/v6/xhtml_shared.rb index c1a1a207..c324474f 100644 --- a/lib/sisu/v6/xhtml_shared.rb +++ b/lib/sisu/v6/xhtml_shared.rb @@ -58,7 +58,6 @@ =end module SiSU_XHTML_Shared - require_relative 'defaults' # defaults.rb require_relative 'xhtml_table' # xhtml_table.rb class TableXHTML < SiSU_XHTML_Table::TableXHTML end diff --git a/lib/sisu/v6/xhtml_table.rb b/lib/sisu/v6/xhtml_table.rb index bfaed250..8df539aa 100644 --- a/lib/sisu/v6/xhtml_table.rb +++ b/lib/sisu/v6/xhtml_table.rb @@ -58,12 +58,13 @@ =end module SiSU_XHTML_Table - require_relative 'defaults' # defaults.rb + require_relative 'xhtml_parts' # xhtml_parts.rb class TableXHTML + include SiSU_Parts_XHTML @@tablehead=0 @@tablefoot=[] #watch def initialize(table) - @table_obj,@vz=table,SiSU_Viz::Defaults.new + @table_obj=table end def table table_obj=@table_obj @@ -80,7 +81,7 @@ module SiSU_XHTML_Table trc,nc=[],0 table_row_with_columns.each do |c| c=c.gsub(/^~$/,''). # tilde / empty cell - gsub(/<:br>/,'
') + gsub(/<:br>/,the_line_break) trc <<= if table_obj.head_ and nr==0; %{
#{c}#{c}
-#{pdf} -
- #{@vz.banner_band} - -   -#{@vz.table_close} -

} - end - def concordance_navigation_band(type='') - if type=~/pdf/ - @tocband_concordance=make_concordance - end - %{ - - -
- #{@vz.banner_band} - - #{@tocband_concordance} - -   - #{@vz.png_nav_toc} -   -#{@vz.table_close} -

} - end - def seg_head_navigation_band(type='') - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{ - #{@vz.png_nav_nxt} - } if @md.firstseg =~/\S+/ - %{ - - - -} - %{
- #{@vz.banner_band} - - #{@tocband_segtoc} - -  #{firstseg}  -#{@vz.table_close} -

} - end - def seg_head_navigation_band_bottom(type='') - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{ - #{@vz.png_nav_nxt} - } if @md.firstseg =~/\S+/ - %{ - - - -} - %{
-   - - #{@tocband_segtoc} - -  #{firstseg}  -#{@vz.table_close} -

} - end - def make_seg_scroll_pdf - wgt=Widget.new(@md) - scroll=%{

- #{@vz.nav_txt_doc_link} -
- - #{scroll} - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.pdf}#{wgt.odf} - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -
} - end - def make_scroll_seg_pdf - seg='' - wgt=Widget.new(@md) - seg=%{

- #{@vz.nav_txt_toc_link} -
- - #{seg} - #{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -
- #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -
} - end - def make_concordance - wgt=Widget.new(@md) - %{ - - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -
- #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -
} - end - def head - %{#{doc_type} - - - #{@md.html_title} - - -#{@rdf.rdftoc} -#{@rdf.metatag_html} -#{@stylesheet.css_head} - -#{@vz.color_body} - - -} - end - def links_guide_open(type='horizontal') - if type=='vertical'; links_guide_vertical_open - else links_guide_horizontal_open - end - end - def links_guide_close #(type='horizontal') - insert='' - insert=if @md.sfx_src =~/s?/ - link='http://sisudoc.org' #get from defaults - url='sisudoc.org' - insert= %{ -

  • - - #{url} - -
  • - - -} - end - %{ #{insert} -} - end - def prefix_a - end - def rights - copyright=meta_content_clean(@md.rights.copyright.all) - rights=copyright(/^\s*Copyright\s+\(C\)/,'Copyright © ') - %{

    Rights: #{rights}

    -

    } - end - def prefix_b - %{

    Prefix: #{@md.prefix_b}

    } - end - def scroll_head_title_banner_open - %{

    -#{@md.icon} -
    -#{@vz.banner_instrument_cover_band_scr}} - end - def seg_head_title_banner_open - %{
    - #{@md.icon} -
    -#{@vz.banner_instrument_cover_band_seg}} - end - def make_scroll - concord=concordance_link(@vz.nav_txt_concordance) - %{ - -
    - #{@vz.nav_txt_doc_link} - - #{concord} -#{@vz.table_close}} - end - def make_seg - concord=concordance_link(@vz.nav_txt_concordance) - %{ - -
    - #{@vz.nav_txt_toc_link} - - - #{concord} -#{@vz.table_close}} - end - def manifest #check structure - manifest=manifest_link(@vz.nav_txt_manifest) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} - #{manifest} - -#{@vz.table_close}} - end - def concordance #check structure - concord=concordance_link(@vz.nav_txt_concordance) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} - #{concord} - -#{@vz.table_close}} - end - def metadata - %{#{@vz.margin_css} -

    - - MetaData - -

    -#{@vz.table_close}} - end - def seg_tail - %{ -
    -

     

    - - - -
    - #{@vz.banner_band} - -
    - #{@tocband_segtoc} -
    -
    -

     

    -#{@vz.credits_splash} -#{@vz.credits_sisu} - - - - - - -
    - - -} - end - def scroll_tail #debug - nav=scroll_head_navigation_band - %{ -
    -#{nav} -#{@vz.credits_splash} -#{@vz.credits_sisu} - - - - - - -
    - - -} - end - def seg_navigation_tail #this is a bug area, look up and "tidy" - #nav=scroll_head_navigation_band - %{ -
    -

     

    -#{@vz.credits_splash} -#{@vz.credits_sisu} - - - - - - -
    - - -} - end - end - class HeadSeg < HeadInformation - def initialize(md) #(md='') - super(md) - end - def head - %{#{doc_type} - - - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - - -#{@rdf.rdfseg} -#{@rdf.metatag_html} -#{@vz.font_css_table_file} - -#{@vz.color_body} - - -} - end - def title_banner(title,subtitle,creator) - end - def dot_control_pre_next - %{ - - -} - pre=%{} if f_pre==true - nxt=%{} if f_nxt==true - %{
    - - #{@vz.png_nav_dot_pre} - - - - #{@vz.png_nav_dot_toc} - - - - #{@vz.png_nav_dot_nxt} - -#{@vz.table_close}} - end - def toc_nav(f_pre=false,f_nxt=false,use=1) - pre=nxt='' - toc=%{ - - #{@vz.png_nav_toc} - - - - #{@vz.png_nav_pre} - - - - #{@vz.png_nav_nxt} - -
    - -#{pre} -#{toc} -#{nxt} -
    -#{@vz.table_close}} - end - def toc_next2 - toc_nav(false,true).dup - end - def toc_pre_next2 - toc_nav(true,true).dup - end - def toc_pre2 - toc_nav(true,false,2).dup - end - def doc_types #used in seg_nav_band ### - wgt=Widget.new(@md) - #dir=SiSU_Env::InfoEnv.new(@md.fns) - if @md.concord_make - %{ - - - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -
    - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -
    } - else - %{ - - - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -
    - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -
    } - end - end - def navigation_table - %{ -
    - - - } - end - def navigation_table1 - %{ -
    - } - end - def navigation_table2 - %{ -
    - } - end - def header_advert_local_1 - dir=SiSU_Env::InfoEnv.new(@fns) - %{
    - -
    - - #{@md.ad_alt} - -

    -#{@vz.table_close} -} - end - def header_advert_local_2 - dir=SiSU_Env::InfoEnv.new(@fns) - %{

    - -
    - - #{@md.ad_alt} - -

    -#{@vz.table_close} -} - end - def header_advert_external - dir=SiSU_Env::InfoEnv.new(@fns) - %{

    - -
    - - #{@md.ad_alt} - -

    -#{@vz.table_close} -} - end - def credit - %{ -

    -#{@vz.credits_splash} -#{@vz.credits_sisu} - - - - - - -
    -} - end - def navigation_band(segtocband,seg_table_top_control) #change name to navigaion_band_banner - %{ - - - -
    -#{@vz.banner_band} - - #{doc_types} - - #{segtocband} -
    -#{seg_table_top_control}} - end - def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless - %{ -
    - - - -
    - #{doc_types} - - #{segtocband} -
    - #{seg_table_top_control} -
    -} - end - def endnote_mark -%{ -

    -


    -

    } - end - def endnote_section_open -%{ -
    -} - end - def endnote_section_close -%{ -
    -} #revisit - end - def head - %{#{doc_type} - - - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - - -#{@rdf.rdfseg} -#{@rdf.metatag_html} -#{@stylesheet.css_head} - -#{@vz.color_body} - - -} - end - def title_banner(title,subtitle,creator) - %{ -
    -

    - #{title} -

    -

    - #{subtitle} -

    -

    - #{creator} -

    -

    - copy @ - - #{@vz.txt_home} - -

    -
    -} - end - end - class HeadScroll < HeadToc - def initialize(md) #(md='') - super(md) - end - def toc_owner_details - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} - - Owner Details - -     - - - -#{@vz.table_close}} - end - def table - %{ - - -
    - -#{@vz.paragraph_txt}} - end - def table1 - %{ - -
    -#{@vz.paragraph_txt}} - end - def table2 - %{ -
    -#{@vz.paragraph_txt}} - end - end class FormatTextObject - @vz=SiSU_Viz::Defaults.new + include SiSU_Parts_XML attr_accessor :md,:dob,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o @@ -1034,7 +444,6 @@ WOK end end @dob=t_o if defined? t_o.is - @vz=SiSU_Viz::Defaults.new end def endnote_body %{ @@ -1183,13 +592,13 @@ WOK end end def bold_para - %{#{@vz.margin_txt_0} + %{#{the_margin.txt_0}

    #{@txt}

    -#{@vz.margin_num_css} +#{the_margin.num_css}     -#{@vz.table_close}} +#{the_table_close}} end def bold_header @txt=@txt.gsub(/[1-9]~(\S+)/,''). @@ -1197,9 +606,9 @@ WOK %{

    #{@txt}

    -#{@vz.margin_num_css} +#{the_margin.num_css}     -#{@vz.table_close}} +#{the_table_close}} end def toc_head_copy_at %{

    #{@txt}

    \n} @@ -1215,9 +624,9 @@ WOK end end class FormatScroll < FormatTextObject + include SiSU_Parts_XML def initialize(md,txt) super(md,txt) - @vz=SiSU_Viz::Defaults.new end end class FormatSeg < FormatTextObject @@ -1240,11 +649,11 @@ WOK
    - + #{@txt}

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

    @@ -1252,11 +661,11 @@ WOK

    - + #{@txt}

    -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev4 %{ @@ -1266,7 +675,7 @@ WOK

    #{@txt}

    -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev5 end @@ -1344,7 +753,7 @@ WOK

    #{@txt}

    -#{@vz.table_close}} +#{the_table_close}} end def navigation_header5 %{

    diff --git a/lib/sisu/v6/xml_odf_odt.rb b/lib/sisu/v6/xml_odf_odt.rb index 0e887d05..0351babc 100644 --- a/lib/sisu/v6/xml_odf_odt.rb +++ b/lib/sisu/v6/xml_odf_odt.rb @@ -63,7 +63,7 @@ module SiSU_XML_ODF_ODT require_relative 'ao' # ao.rb require_relative 'se' # se.rb include SiSU_Env - include SiSU_Viz + require_relative 'xml_parts' # xml_parts.rb require_relative 'xml_odf_odt_format' # xml_odf_odt_format.rb include SiSU_XML_ODF_ODT_Format require_relative 'shared_metadata' # shared_metadata.rb @@ -128,8 +128,8 @@ module SiSU_XML_ODF_ODT end private class Scroll \1'). #http ftp matches escaped, no decoration gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration dob.obj= if dob.is==:para \ and dob.indent.to_s =~/[0-9]/ \ and dob.indent == dob.hang @@ -441,7 +439,7 @@ module SiSU_XML_ODF_ODT end def footnote_urls(str) str=str.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) str=text_link(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/ str=text_link_relative(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/ str @@ -516,9 +514,9 @@ module SiSU_XML_ODF_ODT dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1'). #http ftp matches escaped, no decoration gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i| set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : '' parablock=group_clean(parablock) @@ -541,9 +539,9 @@ module SiSU_XML_ODF_ODT dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1'). #http ftp matches escaped, no decoration gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i| set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : '' parablock=group_clean(parablock) diff --git a/lib/sisu/v6/xml_odf_odt_format.rb b/lib/sisu/v6/xml_odf_odt_format.rb index 980fd29d..7f8d2106 100644 --- a/lib/sisu/v6/xml_odf_odt_format.rb +++ b/lib/sisu/v6/xml_odf_odt_format.rb @@ -60,7 +60,6 @@ module SiSU_XML_ODF_ODT_Format require_relative 'dp' # dp.rb include SiSU_Param - include SiSU_Viz class ParagraphNumber def initialize(make,paranum) @make=make @@ -146,7 +145,6 @@ module SiSU_XML_ODF_ODT_Format end rgx=/#{Mx[:en_a_o]}\d+\s+(.+?)#{Mx[:en_a_c]}/ @txt=@txt.gsub(rgx,'\1') if @txt =~rgx - @vz=SiSU_Viz::Defaults.new end def scr_endnote_body "#{@txt} " @@ -173,7 +171,6 @@ module SiSU_XML_ODF_ODT_Format def initialize(md,dob,p_num) @md,@dob,@p_num=md,dob,p_num @txt=dob.obj - @vz=SiSU_Viz::Defaults.new if @md.fns != @@fns @@table_counter=0 @@fns=@md.fns diff --git a/lib/sisu/v6/xml_parts.rb b/lib/sisu/v6/xml_parts.rb new file mode 100644 index 00000000..e4d30de6 --- /dev/null +++ b/lib/sisu/v6/xml_parts.rb @@ -0,0 +1,194 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: shared html parts + +=end +module SiSU_Parts_XML + require_relative 'generic_parts' # generic_parts.rb + include SiSU_Parts_Generic + def the_line_break + '
    ' + end + def the_table_close + ' +

    ' + end + def the_url_decoration + def xml_open #'<' + Dx[:url_o] + end + def xml_close #'>' + Dx[:url_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + def the_color + def white + '#ffffff' + end + def black + '#000000' + end + def grey_pale + '#eeeeee' + end + def grey_medium + '#cccccc' + end + def grey + '#999999' + end + def blue_ink + '#003399' + end + def blue_tinge + '#e3ecef' + end + def yellow_light + '#fff3b6' + end + def table1 + 'ffffcc' + end + def table2 + 'c0d0f0' + end + def band1 + %{"#{white}"} + end + def band2 + %{"#{white}"} + end + self + end + def the_png + def _url_path_image_base #used for html image display + "#{Xx[:html_relative2]}_sisu/image" + end + def ico + %{ } + end + def png_home + %{#{the_text.home} -->} + end + def png_home_button + rel=@dir.path_rel_links.html_scroll_2 + %{#{the_text.home} -->} + end + self + end + def the_font + def set_fonts + 'verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' + #'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman' + end + def set_face + %{face="#{set_fonts}"} + end + #def set_color + # 'color="#000000"' + #end + #def set_size_endnote + # 'size="3"' + #end + #def set_small + # 'size="3"' + #end + #def set_tiny + # 'size="2"' + #end + #def paragraph_font_tiny + # %{} + #end + #def paragraph_font_small + # %{} + #end + self + end + def the_banner + def home_button_only + %{ + #{the_png.png_home_button} + } + end + def banner_band + %{ + + +
    + + #{the_png.png_home} + + +#{the_table_close}} + end + self + end +end +module SiSU_Proj_XML + require_relative 'html_parts' # html_parts.rb + require_relative 'se' # se.rb + include SiSU_Env + class Bits < SiSU_Proj_HTML::Bits + end +end +__END__ diff --git a/lib/sisu/v6/xml_sax.rb b/lib/sisu/v6/xml_sax.rb index 9e236d1c..5603dcaf 100644 --- a/lib/sisu/v6/xml_sax.rb +++ b/lib/sisu/v6/xml_sax.rb @@ -58,8 +58,6 @@ =end module SiSU_XML_SAX - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars require_relative 'se' # se.rb @@ -168,7 +166,6 @@ module SiSU_XML_SAX def initialize(particulars) @env, @md, @ao_arr= particulars.env,particulars.md,particulars.ao_array - @vz=SiSU_Viz::Defaults.new @trans=SiSU_XML_Munge::Trans.new(@md) @sys=SiSU_Env::SystemCall.new end diff --git a/lib/sisu/v6/xml_shared.rb b/lib/sisu/v6/xml_shared.rb index 73eee6ec..601b6d69 100644 --- a/lib/sisu/v6/xml_shared.rb +++ b/lib/sisu/v6/xml_shared.rb @@ -57,13 +57,13 @@ ** Description: common file for xml generation =end module SiSU_XML_Munge + require_relative 'xml_parts' # xml_parts.rb class Trans - require_relative 'defaults' # defaults.rb + include SiSU_Parts_XML def initialize(md) @md=md @sys=SiSU_Env::SystemCall.new @dir=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration if @md.sem_tag @ab ||=semantic_tags.default end @@ -297,7 +297,7 @@ module SiSU_XML_Munge gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, '\1'). #watch, compare html_tune gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1') #escaped urls not linked, deal with later else @@ -307,7 +307,7 @@ module SiSU_XML_Munge dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ') end dob.obj=dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). gsub(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}"). gsub(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}"). gsub(/ |#{Mx[:nbsp]}/m,' '). @@ -470,8 +470,8 @@ end module SiSU_XML_Tags #Format require_relative 'dp' # dp.rb include SiSU_Param - include SiSU_Viz class RDF + include SiSU_Parts_XML def initialize(md='',seg_name=[],tracker=0) @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords='' @md=md @@ -595,7 +595,6 @@ module SiSU_XML_Tags #Format end content=meta_content_clean(@md.keywords) @keywords=%{ \n} if @md.keywords - @vz=SiSU_Viz::Defaults.new end def meta_content_clean(content='') content=if not content.nil? @@ -654,8 +653,8 @@ WOK def metatag_html #values strung together, because some empty, and resulting output (line breaks) is much better </,1] @@ -124,7 +122,6 @@ module SiSU_Tables @@tablefoot=[] #watch def initialize(table,id='') @table_obj,@id=table,id - @vz=SiSU_Viz::Defaults.new end def spaces Ax[:spaces] @@ -181,7 +178,14 @@ module SiSU_Tables @@tablehead=0 @@tablefoot=[] def initialize(one) - @one,@parablock,@vz=one,one,SiSU_Viz::Defaults.new + @one,@parablock=one,one + end + def table_close + '
    ' + end + def margin_numless + '
    ' end def table_head(inf) %{ @@ -193,7 +197,7 @@ module SiSU_Tables
    } end def table_end(tablefoot='') - %{
    #{@vz.margin_numless}#{@vz.margin_numless} #{@vz.table_close} + %{
    #{the_margin_numless}#{the_margin_numless} #{the_table_close} #{tablefoot}} end def table_row(inf,h=false) @@ -216,13 +220,15 @@ module SiSU_Tables @@tablefoot << m if m @parablock=@parablock.gsub(//,'') @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u - if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head($1) + if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u + @parablock=table_head($1) end if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock=table_end + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @parablock=table_end end end if @@tablehead==1 -- cgit v1.2.3 From 32fd8f3908bc8632e2d8ab4d872f6e4362fe031b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 12 Oct 2014 10:52:35 -0400 Subject: v5: merge v6: remove defaults.rb & some relics related to sisu skins --- lib/sisu/v5/ao.rb | 2 - lib/sisu/v5/ao_syntax.rb | 29 +- lib/sisu/v5/css.rb | 78 +- lib/sisu/v5/defaults.rb | 1214 -------------------------------- lib/sisu/v5/generic_parts.rb | 134 ++++ lib/sisu/v5/html.rb | 13 +- lib/sisu/v5/html_concordance.rb | 5 - lib/sisu/v5/html_format.rb | 238 +++---- lib/sisu/v5/html_harvest_authors.rb | 4 +- lib/sisu/v5/html_harvest_topics.rb | 7 +- lib/sisu/v5/html_lite_shared.rb | 15 +- lib/sisu/v5/html_manifest.rb | 15 +- lib/sisu/v5/html_parts.rb | 440 ++++++++++++ lib/sisu/v5/html_promo.rb | 3 - lib/sisu/v5/html_scroll.rb | 1 - lib/sisu/v5/html_segments.rb | 25 +- lib/sisu/v5/html_shared.rb | 1 - lib/sisu/v5/html_table.rb | 7 +- lib/sisu/v5/html_tune.rb | 18 +- lib/sisu/v5/hub.rb | 2 - lib/sisu/v5/hub_loop_markup_files.rb | 2 - lib/sisu/v5/manpage.rb | 13 +- lib/sisu/v5/manpage_format.rb | 2 - lib/sisu/v5/po4a.rb | 6 - lib/sisu/v5/qrcode.rb | 18 +- lib/sisu/v5/rexml.rb | 1 - lib/sisu/v5/se_createsite.rb | 13 +- lib/sisu/v5/se_get_init.rb | 3 +- lib/sisu/v5/se_info_env.rb | 32 +- lib/sisu/v5/shared_metadata.rb | 9 +- lib/sisu/v5/sst_do_inline_footnotes.rb | 54 -- lib/sisu/v5/sst_to_s_xml_sax.rb | 3 - lib/sisu/v5/texinfo.rb | 4 - lib/sisu/v5/texinfo_format.rb | 2 - lib/sisu/v5/texpdf.rb | 9 +- lib/sisu/v5/texpdf_format.rb | 98 +-- lib/sisu/v5/texpdf_parts.rb | 238 +++++++ lib/sisu/v5/txt_asciidoc.rb | 13 +- lib/sisu/v5/txt_markdown.rb | 13 +- lib/sisu/v5/txt_plain.rb | 13 +- lib/sisu/v5/txt_rst.rb | 13 +- lib/sisu/v5/txt_shared.rb | 1 + lib/sisu/v5/txt_textile.rb | 14 +- lib/sisu/v5/wikispeak.rb | 11 +- lib/sisu/v5/xhtml.rb | 5 - lib/sisu/v5/xhtml_epub2.rb | 5 - lib/sisu/v5/xhtml_epub2_concordance.rb | 10 +- lib/sisu/v5/xhtml_epub2_format.rb | 67 +- lib/sisu/v5/xhtml_epub2_segments.rb | 1 - lib/sisu/v5/xhtml_epub2_tune.rb | 14 +- lib/sisu/v5/xhtml_parts.rb | 186 +++++ lib/sisu/v5/xhtml_shared.rb | 1 - lib/sisu/v5/xhtml_table.rb | 7 +- lib/sisu/v5/xml_dom.rb | 5 - lib/sisu/v5/xml_format.rb | 629 +---------------- lib/sisu/v5/xml_odf_odt.rb | 20 +- lib/sisu/v5/xml_odf_odt_format.rb | 3 - lib/sisu/v5/xml_parts.rb | 194 +++++ lib/sisu/v5/xml_sax.rb | 3 - lib/sisu/v5/xml_shared.rb | 15 +- lib/sisu/v5/xml_tables.rb | 24 +- 61 files changed, 1557 insertions(+), 2468 deletions(-) delete mode 100644 lib/sisu/v5/defaults.rb create mode 100644 lib/sisu/v5/generic_parts.rb create mode 100644 lib/sisu/v5/html_parts.rb create mode 100644 lib/sisu/v5/texpdf_parts.rb create mode 100644 lib/sisu/v5/xhtml_parts.rb create mode 100644 lib/sisu/v5/xml_parts.rb (limited to 'lib') diff --git a/lib/sisu/v5/ao.rb b/lib/sisu/v5/ao.rb index 3f1ce71e..ebb17a8f 100644 --- a/lib/sisu/v5/ao.rb +++ b/lib/sisu/v5/ao.rb @@ -59,8 +59,6 @@ =end module SiSU_AO - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'se' # se.rb include SiSU_Env require_relative 'dp' # dp.rb diff --git a/lib/sisu/v5/ao_syntax.rb b/lib/sisu/v5/ao_syntax.rb index e9f4d3bd..be184a5e 100644 --- a/lib/sisu/v5/ao_syntax.rb +++ b/lib/sisu/v5/ao_syntax.rb @@ -66,7 +66,6 @@ module SiSU_AO_Syntax class Markup def initialize(md='',data='') @md,@data=md,data - @vz=SiSU_Viz::Defaults.new @data_new=[] url_and_stub=SiSU_Env::InfoEnv.new.url @output_url="#{url_and_stub.remote}" @@ -98,23 +97,13 @@ module SiSU_AO_Syntax #ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)} #not implemented @line_scan_ital=if defined? @md.italics_match_list[:str] /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.italics_match_list[:str]}#{tail_m_ital}|\S+|\n/i - elsif defined? @vz.markup_make_italic[:str] - /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/i end @manmkp_bold=emph_italics \ ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]' : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]' - @line_scan_bold=if (defined? @md.bold_match_list[:str] \ - and @md.bold_match_list[:str]) \ - and (defined? @vz.markup_make_bold[:str] \ - and @vz.markup_make_bold[:str]) - /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i - elsif defined? @md.bold_match_list[:str] \ + @line_scan_bold=if defined? @md.bold_match_list[:str] \ and @md.bold_match_list[:str] /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]})#{tail_m_bold}|\S+|\n/i - elsif defined? @vz.markup_make_bold[:str] \ - and @vz.markup_make_bold[:str] - /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i end end def songsheet @@ -154,9 +143,7 @@ module SiSU_AO_Syntax def wordlist_italics(dob) dob=dob.dup if (defined? @md.italics_match_list[:str] \ - and @md.italics_match_list[:str]) \ - or (defined? @vz.markup_make_italic[:str] \ - and @vz.markup_make_italic[:str]) + and @md.italics_match_list[:str]) dob.obj=if dob.is !=:meta \ && dob.is !=:heading \ && dob.is !=:heading_insert \ @@ -172,10 +159,6 @@ module SiSU_AO_Syntax and @md.italics_match_list[:regx] w=w.gsub(@md.italics_match_list[:regx], "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") - elsif defined? @vz.markup_make_italic \ - and @vz.markup_make_italic - w=w.gsub(@vz.markup_make_italic, - "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") else w end end @@ -267,9 +250,7 @@ module SiSU_AO_Syntax def wordlist_bold(dob) dob=dob.dup if (defined? @md.bold_match_list[:str] \ - and @md.bold_match_list[:str]) \ - or (defined? @vz.markup_make_bold[:str] \ - and @vz.markup_make_bold[:str]) + and @md.bold_match_list[:str]) dob.obj=if dob.is !=:meta \ && dob.is !=:heading \ && dob.is !=:heading_insert \ @@ -285,10 +266,6 @@ module SiSU_AO_Syntax and @md.bold_match_list[:regx] #document header: @bold: [bold word list] w=w.gsub(@md.bold_match_list[:regx], "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") - elsif defined? @vz.markup_make_bold \ - and @vz.markup_make_bold #defaults adjusted bold word list - w=w.gsub(@vz.markup_make_bold, - "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end else w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/ diff --git a/lib/sisu/v5/css.rb b/lib/sisu/v5/css.rb index 09f5a435..b70d3edd 100644 --- a/lib/sisu/v5/css.rb +++ b/lib/sisu/v5/css.rb @@ -59,7 +59,7 @@ =end module SiSU_Style require_relative 'se' # se.rb - require_relative 'defaults' # defaults.rb + require_relative 'html_parts' # html_parts.rb class CSS_HeadInfo def initialize(md,ft='html') @md,@ft=md,ft @@ -159,40 +159,38 @@ module SiSU_Style end end class CSS - def initialize - @vz=SiSU_Viz::Defaults.new - end + include SiSU_Parts_HTML def fonts - @vz.font_fonts + the_font.set_fonts end def html_tables #stylesheet for css table_pages <. - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Git - - - - * Ralph Amissah - - - - ** Description: Default values - -=end -$latex_run=nil -module SiSU_Viz - begin - require 'uri' - rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). - error('uri NOT FOUND (LoadError)') - end - require_relative 'se' # se.rb - include SiSU_Env - require_relative 'css' # css.rb - include SiSU_Style - class Defaults - def initialize - @fonts='verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' # 'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman' - @dir=SiSU_Env::InfoEnv.new - @date=SiSU_Env::InfoDate.new #{@date.year} - @v=SiSU_Env::InfoVersion.instance.get_version - end - #% glyph - def glyph_bullet # • - '• ' # [• flagged] - end - #% html - def html_hardspace - ' ' - end - def semantic_tags - def default - { - pub: 'publication', - conv: 'convention', - vol: 'volume', - pg: 'page', - cty: 'city', - org: 'organization', - uni: 'university', - dept: 'department', - fac: 'faculty', - inst: 'institute', - co: 'company', - com: 'company', - conv: 'convention', - dt: 'date', - y: 'year', - m: 'month', - d: 'day', - ti: 'title', - au: 'author', - ed: 'editor', #editor? - v: 'version', #edition - n: 'name', - fn: 'firstname', - mn: 'middlename', - ln: 'lastname', - in: 'initials', - qt: 'quote', - ct: 'cite', - ref: 'reference', - ab: 'abreviation', - def: 'define', - desc: 'description', - trans: 'translate', - } - end - self - end - #% decorate - def decorate_italics - 'title|article|book|journal' - end - def decorate_bold - end - def decorate_uppercase - 'surname' - end - #% semantic - def sem_title #dc 1 - 'title' - end - def sem_article - 'article' - end - def sem_book - 'book' - end - def sem_journal - 'journal' - end - def sem_fullname # (contains: firstname, surname) #issues arise as contains surname etc. - 'fullname' - end - def sem_first - 'first' - end - def sem_surname - 'surname' - end - def sem_middle - 'middle' - end - def sem_creator #dc 2 #==fullname (contains: firstname, surname) - 'creator' - end - def sem_author #==fullname (contains: firstname, surname) - 'author' - end - def sem_editor #==fullname (contains: firstname, surname) - 'editor' - end - def sem_illustrator #==fullname (contains: firstname, surname) - 'illustrator' - end - def sem_translator #==fullname (contains: firstname, surname) - 'translator' - end - def sem_isbn # 10 or 13 - 'isbn' - end - def sem_isbn_10 - 'isbn10' - end - def sem_isbn_13 - 'isbn13' - end - def sem_loc # library of congress - 'loc' - end - def sem_dewey - 'dewey' - end - def sem_pg # project gutenberg number - 'pg' - end - def sem_subject #dc 3 - 'subject' - end - def sem_date #dc 7 - 'date' - end - def sem_date_created - 'date_created' - end - def sem_date_issued - 'date_issued' - end - def sem_date_available - 'date_available' - end - def sem_date_valid - 'date_valid' - end - def sem_date_modified - 'date_modified' - end - def sem_type #dc 8 - 'type' - end - def sem_description #dc 4 - 'description' - end - def sem_publisher #dc 5 - 'publisher' - end - def sem_contributor #dc 6 - 'contributor' - end - def sem_format #dc 9 - 'format' - end - def sem_identifier #dc 10 - 'identifier' - end - def sem_source #dc 11 - 'source' - end - def sem_language #dc 12 - 'language' - end - def sem_relation #dc 13 - 'source' - end - def sem_coverage #dc 14 - 'coverage' - end - def sem_rights #dc 15 - 'rights' - end - def sem_copyright - 'copyright' - end - def sem_license - 'license' - end - def sem_prepared_by - 'prepared_by' - end - def sem_digitized_by - 'digitized_by' - end - def sem_keywords - 'keywords' - end - def sem_comments - 'comments' - end - def sem_abstract - 'abstract' - end - #% path - def path_stylesheet_home - %{ } - end - #% text #changed from txt to avoid naming conflicts #FOLLOW - def txt_generator - %{ - } - end - def txt_generator_comment - %{ } - end - def txt_hp - ' SiSU' - end - def txt_hp_alias - 'SiSU' - end - def txt_home - 'SiSU' - end - def txt_signature # used in latex/pdf footer - 'SiSU' - end - #% url - def url_urify(uri) - URI.parse(uri) - end - def url_sisu - 'http://www.sisudoc.org/' - end - def url_sisudoc - 'http://www.sisudoc.org' - end - def url_footer_signature - 'http://www.sisudoc.org/' - end - def url_root - '/sisu' #watch - end - def url_root_http - 'http://www.sisudoc.org/' #watch - end - def url_home - 'http://www.sisudoc.org/' # used in pdf header - end - def url_site #used as stub... where there are subdirectories and is different from home - url_home - #'http://www.sisudoc.org/' # used in pdf header - end - def url_txt - 'www.sisudoc.org/' - end - def url_path_image_base #used for html image display - "#{Xx[:html_relative2]}_sisu/image" - end - def url_path_image #used for html image display - "#{Xx[:html_relative2]}_sisu/image" - end - def url_path_image_sys #used for html image display - "#{Xx[:html_relative2]}_sisu/image_sys" - end - def url_decoration - def tex_open #'{\UseTextSymbol{OML}{<}}' - Dx[:url_o] - end - def tex_close #'{\UseTextSymbol{OML}{>}}' - Dx[:url_c] - end - def xml_open #'<' - Dx[:url_o] - end - def xml_close #'>' - Dx[:url_c] - end - def txt_open - '<' - end - def txt_close - '>' - end - self - end - def rel_decoration - def tex_open #'{\UseTextSymbol{OML}{<}}' - Dx[:rel_o] - end - def tex_close #'{\UseTextSymbol{OML}{>}}' - Dx[:rel_c] - end - def xml_open #'<' - Dx[:rel_o] - end - def xml_close #'>' - Dx[:rel_c] - end - def txt_open - '<' - end - def txt_close - '>' - end - self - end - #% color - def color_body - %{} - end - def color_white - '"#ffffff"' - end - def color_black - '#000000' - end - def color_blue_ink - '#003399' - end - def color_blue_tinge - '#e3ecef' - end - def color_blue_grey - '#8faebf' - end - def color_blue_murky - '#437389' - end - def color_beige - '#f1e8de' - end - def color_subtleglow - '#dddccc' - end - def color_glow - '#fff0c3' - end - def color_rose - '#ffdec9' - end - def color_turquoise - '#1c869b' - end - def color_grey_pale - '#eeeeee' - end - def color_grey_medium - '#cccccc' - end - def color_grey - '#999999' - end - def color_yellow_light - '#fff3b6' - end - def color_yellow - '#ffde14' - end - def color_yellow_dark - '#ffcc00' - end - def color_green_light - '#b7d398' # #e2efd5 #b7d398 #b1c999 # '#aed19e' - end - def color_green - '#0a8400' - end - def color_green_dark - '#086800' - end - def color_ruby - '#a00000' - end - def color_maroon - '#800000' - end - def color_paper - %{"#{color_white}"} - end - def color_band1 - %{"#{color_white}"} - end - def color_band2 - %{"#{color_white}"} - end - def color_body - %{} - end - def color_font_face #was font WATCH - "#{color_black}" - end - def color_surround - %{"#{color_white}"} - end - def color_band - %{"#{color_white}"} - end - def color_table1 - 'ffffcc' - end - def color_table2 - 'c0d0f0' - end - def color_band1 - '"#ffffff"' - end - def color_band2 - '"#ffffff"' - end - #% icon - def icon_ico - 'rb7.ico' - end - def icon_sisu - 'sisu.png' - end - def icon_manifest - 'b_info.png' - end - def icon_doc - 'b_doc.png' - end - def icon_toc - 'b_toc.png' - end - def icon_wmp - 'b_wmp.png' - end - def icon_odf - 'b_odf.png' - end - def icon_epub - 'b_epub.png' - end - def icon_pdf - 'b_pdf.png' - end - def icon_pdf_portrait - 'b_pdf.png' - end - def icon_pdf_landscape - 'b_pdf.png' - end - def icon_choice - 'b_choice.png' - end - def icon_new - 'b_new.png' - end - def icon_dot_clear - 'dot_clear.png' - end - def icon_dot_white - 'dot_white.png' - end - def icon_dot - icon_dot_white - end - def icon_home_button - 'sisu.png' - end - def icon_next - 'arrow_next_red.png' - end - def icon_previous - 'arrow_prev_red.png' - end - def icon_up - 'arrow_up_red.png' - end - #% font - def font_fonts - @fonts - end - def font_face - %{face="#{font_fonts}"} - end - def font_color - 'color="#000000"' - end - def font_size_endnote - 'size="3"' - end - def font_small - 'size="3"' - end - def font_tiny - 'size="2"' - end - #% markup - def markup_italics_list #regular expression of words to be italised - end - def markup_bold_list #regular expression of words to be made bold - 'SiSU' - end - def markup_make_italic - if defined? italics_list \ - and italics_list - make={} - if italics_list - r=italics_list.dup - x=case r - when /\/i$/ then 'i' - else '' - end - r=r.gsub(/^\/(.+?)\/i?/,'\1'). - gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided - m='\b(' + r + ')\b' - make[:str] - make[:regx]=(x =~/i/) \ - ? (/#{m}/i) - : (/#{m}/) - else nil - end - end - end - def markup_make_bold - if defined? bold_list \ - and not bold_list.empty? - make={} - if bold_list - r=bold_list.dup - x=case r - when /\/i$/ then 'i' - else '' - end - r.gsub(/^\/(.+?)\/i?/,'\1'). - gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided - m='\b(' + r + ')\b' - make[:str] - make[:regx]=(x =~/i/) \ - ? (/#{m}/i) - : (/#{m}/) - else nil - end - make - end - end - #% paragraph - def paragraph_txt - %{

    } - end - def paragraph_endnote - %{

    } - end - def paragraph_font_tiny - %{} - end - def paragraph_font_small - %{} - end - #% table - def table_close - '

    ' - end - def table_width_1 - '"100%"' - end - def table_width_2 - '"99%"' - end - def table_width_txt - '"94%"' - end - def table_width_txt_r - '"96%"' - end - def table_cellpad_box - '"20"' - end - #% indent - def indent_level_0 - '"1%"' - end - def indent_level_1 - '"4%"' - end - def indent_level_2 - '"6%"' - end - def indent_level_3 - '"8%"' - end - def indent_level_4 - '"10%"' - end - #% margin - def margin_num - '

    ' - end - def margin_numless - '' - end - def margin_num_css - ' ' - end - def margin_txt_w1 - %{ - -
     } - end - def margin_txt_w2 - %{ - -
     } - end - def margin_txt_0 - %{ -
    -} - end - def margin_txt_1 - %{ -
    } - end - def margin_txt_2 - %{ - -
    -} - end - def margin_txt_3 - %{ - -
    -} - end - def margin_css - ' -
    ' - end - #% png - def png_ico - %{ } - end - def png_sisu #check url path - %{ - SiSU - } - end - def png_site - %{@} - end - def png_nav - %{Contents} - end - def png_manifest - %{Document Manifest} - end - def png_doc - %{Full Text} - end - def png_toc - %{TOC linked} - end - def png_odf - %{ODF/ODT} - end - def png_epub - %{EPUB} - end - def png_pdf - %{PDF} - end - def png_pdf_portrait - %{PDF portrait} - end - def png_pdf_landscape - %{PDF landscape} - end - def png_home - #dir=SiSU_Env::InfoEnv.new #(@fns) - %{#{txt_home} -->} - #%{#{txt_home} -->} - end - def png_home_button - rel=@dir.path_rel_links.html_scroll_2 - %{#{txt_home} -->} - end - #% png_nav #not currently used - #% nav_txt - def nav_txt_homepage - %{ -  home  - } - end - def nav_txt_toc_link - %{ -   toc  - } - end - def nav_txt_doc_link - %{ -  scroll  - } - end - def nav_txt_manifest - #{png_manifest} document manifest - %{ - [ document manifest ] - } - end - def nav_txt_concordance - %{ -   A-Z  - } - end - def nav_txt_pdf_portrait - %{ -  pdf  - } - end - def nav_txt_pdf_landscape - %{ -  pdf  - } - end - #% banner - def banner_home_button_only - %{ - #{png_home_button} - } - end - def banner_band #yellow_dark now white - %{ - -
    - - #{png_home} - - -#{table_close}} - end - def banner_instrument_cover_band_scr - ' -
    ' - end - def banner_instrument_cover_band_seg - ' - -WOK - end - def widget_sisu_verbose -< - -WOK - end - def widget_way_better - < - -WOK - end - #% credits - def credits_sisu_manifest - widget_sisu_text - end - def credits_sisu - %{
    -
    ' - end - #% widget - def widget_promo # Array used to build promo from list.yml and promo.yml - # ['sisu_icon','sisu','sisu_search_libre','open_society','fsf','ruby'] - end - def widgets_open -< -WOK - end - def widget_sisu_text -< - Output generated by - - #{@v[:project]} - - #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) -

    -WOK - end - def widget_sisu -< -
    - -#{widget_sisu_text} -
    -

    - - SiSU - -

    -
    - -

    - Output generated by - - #{@v[:project]} - - #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) -
    - - #{@v[:project]} - - Copyright © Ralph Amissah - 1997, current #{@date.year_static}. - All Rights Reserved. -
    - - #{@v[:project]} - - is software for document structuring, publishing and search, -
    - - www.sisudoc.org/ - - and - - www.sisudoc.org - -
    - w3 since October 3 1993 - - ralph@amissah.com - -

    -
    -

    - #{@v[:project]} using: -
    Standard SiSU markup syntax, -
    Standard SiSU meta-markup syntax, and the -
    Standard SiSU object citation numbering and system, (object/text positioning system) -
    - Copyright © Ralph Amissah 1997, current #{@date.year_static}. - All Rights Reserved. -

    -
    -

    - - GPLv3 - -

    -
    -

    - - #{@v[:project]} - - is released under - GPLv3 - or later, - #{url_decoration.xml_open}http://www.gnu.org/licenses/gpl.html#{url_decoration.xml_close} -

    -
    -

    - #{@v[:project]}, developed using - - Ruby - - on - - Debian/Gnu/Linux - - software infrastructure, - with the usual GPL (or OSS) suspects. -
    - Better - "performance, reliability, scalability, security & total cost of ownership" - [not to mention flexibility & choice] use of and adherence to open standards (where practical and fair) and it is software libré. -
    - Get With the Future - - Way Better! - -

    -
    -
    - #{widget_sisu} -
    } - '' - end - def credits_splash - end - def credits_sisu_epub - %{
    -

    EPUB generated by #{@v[:project]} v#{@v[:version]}, GPL3

    -
    } - '' - end - end - class Home < Defaults - def initialize - @v=SiSU_Env::InfoVersion.instance.get_version - @dir=SiSU_Env::InfoEnv.new - @date=SiSU_Env::InfoDate.new #{@date.year} - end - def redirect - < -SiSU - - - -SiSU informtion provided at www.sisudoc.org/sisu/SiSU

    -If your browser supports redirection, you will be escorted there shortly. - - -WOK - end - def homepage - < - - -SiSU information Structuring Universe - Structured information, Serialized Units - software for electronic texts, documents, books, digital libraries in plaintext, HTML, EPUB, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQL (PostgreSQL and SQLite), and for search - - - - - - - - - - - - - - - - - -

    SiSU

    -

    -[Manual] -

    -

    -[Source] -[List Info (sisu@lists.sisudoc.org)] -

    - -

    SiSU Markup Samples

    -

    -[Source] -[Output] -

    - -
    - -

    - Structured information, Serialized Units -    - - <www.sisudoc.org> - -   or   - - <www.jus.uio.no/sisu/> - -software for electronic texts, document collections, books, digital libraries & search, with "atomic search" & text locating system (shared object citation numbering: "ocn"). -Outputs include: plaintext, HTML, EPUB, ODT (OpenDocumentText), (XHTML, XML,) LaTeX, PDF, SQL (PostgreSQL and SQLite). -

    -

    - -<sisu@lists.sisudoc.org> - - -<http://lists.sisudoc.org/listinfo/sisu> - -

    -

    - -<ralph@amissah.com> - - -<ralph.amissah@gmail.com> - -

    -

    -#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!), #{@date.year_static}. -

    -

    -w3 since October 3 1993. -

    - - -WOK - end - def home_toc - ' ' - end - end - class Inserts - end - class TeX < Defaults - def initialize(papersize='') - @papersize=papersize - end - def a4 - def portrait - def w - 160 - end - def h - 228 - end - def img_px - 450 - end - self - end - def landscape - def w - 238 - end - def h - 160 - end - def img_px - 300 - end - self - end - self - end - def letter - def portrait - def w - 166 - end - def h - 212 - end - def img_px - 468 - end - self - end - def landscape - def w - 226 - end - def h - 166 - end - def img_px - 290 - end - self - end - self - end - def legal - def portrait - def w - 168 - end - def h - 286 - end - def img_px - 474 - end - self - end - def landscape - def w - 296 - end - def h - 166 - end - def img_px - 420 - end - self - end - self - end - def b5 - def portrait - def w - 140 - end - def h - 204 - end - def img_px - 356 - end - self - end - def landscape - def w - 200 - end - def h - 130 - end - def img_px - 260 - end - self - end - self - end - def a5 - def portrait - def w - 112 - end - def h - 162 - end - def img_px - 280 - end - self - end - def landscape - def w - 152 - end - def h - 100 - end - def img_px - 190 - end - self - end - self - end - def dimensions - case @papersize - when /a4/ then a4 - when /letter/ then letter - when /legal/ then legal - when /b5/ then b5 - when /a5/ then a5 - else a4 - end - end - end -end -__END__ diff --git a/lib/sisu/v5/generic_parts.rb b/lib/sisu/v5/generic_parts.rb new file mode 100644 index 00000000..c7a702e9 --- /dev/null +++ b/lib/sisu/v5/generic_parts.rb @@ -0,0 +1,134 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: shared html parts + +=end +module SiSU_Parts_Generic + def the_url + def urify(uri) + URI.parse(uri) + end + def sisu + 'http://www.sisudoc.org/' + end + def sisudoc + 'http://www.sisudoc.org' + end + def footer_signature + 'http://www.sisudoc.org/' + end + def rl_root + '/sisu' #watch + end + def root_http + 'http://www.sisudoc.org/' #watch + end + def home + 'http://www.sisudoc.org/' # used in pdf header + end + def site #used as stub... where there are subdirectories and is different from home + home + end + def home_txt + 'www.sisudoc.org' + end + def sisu_txt + 'www.sisudoc.org' + end + self + end + def the_text + def home + 'SiSU' + end + def txt_hp + ' SiSU' + end + def txt_hp_alias + 'SiSU' + end + def txt_home + 'SiSU' + end + def txt_signature # used in latex/pdf footer + 'SiSU' + end + def url_open + '<' + end + def url_close + '>' + end + self + end + def the_icon + def i_ico + 'rb7.ico' + end + def i_home_button + 'sisu.png' + end + def i_choice + 'b_choice.png' + end + def i_new + 'b_new.png' + end + self + end +end +__END__ diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index 76dbe2a2..1a8d6608 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -66,9 +66,8 @@ module SiSU_HTML end require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'html_table' # html_table.rb + require_relative 'html_parts' # html_parts.rb require_relative 'html_format' # html_format.rb include SiSU_HTML_Format require_relative 'html_segments' # html_segments.rb @@ -181,7 +180,6 @@ module SiSU_HTML def initialize(particulars) @particulars=particulars @md,@env=particulars.md,particulars.env - @vz=SiSU_Viz::Defaults.new @env,@css=particulars.env,SiSU_Style::CSS.new end def tuned_file_instructions @@ -267,7 +265,6 @@ module SiSU_HTML @@firstseg=nil def initialize(md=nil,data='') @data,@md=data,md - @vz=SiSU_Viz::Defaults.new @ocn_html_identifier= SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md @@ -334,7 +331,7 @@ module SiSU_HTML @@toc[:seg] <<<
    -

    +

    (relatively static) RSS feeds for DOCUMENTS:
    RSS feed http://www.jus.uio.no/lm/rssfeed/documents.xml
    RSS feed http://www.jus.uio.no/lm/rssfeed/tradelaw.xml
    @@ -607,9 +604,9 @@ WOK end end class ScrollHeadAndSegToc < Toc + include SiSU_Parts_HTML def initialize(md='',toc='',links_guide_toc='') @md,@toc,@links_guide_toc=md,toc,links_guide_toc - @vz=SiSU_Viz::Defaults.new @make=SiSU_Env::ProcessingSettings.new(@md) end def in_common @@ -662,8 +659,8 @@ WOK toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold end - toc_shared << "#{@vz.table_close*1}\n" - @segtoc << "#{@vz.table_close*1}\n" + toc_shared << "#{the_table_close*1}\n" + @segtoc << "#{the_table_close*1}\n" tmp_head=nil if @md.prefix_a tmp_head ||= %{

    #{@md.prefix_a}\n} diff --git a/lib/sisu/v5/html_concordance.rb b/lib/sisu/v5/html_concordance.rb index 6053bd61..231eb4c1 100644 --- a/lib/sisu/v5/html_concordance.rb +++ b/lib/sisu/v5/html_concordance.rb @@ -63,8 +63,6 @@ module SiSU_Concordance include SiSU_Particulars require_relative 'se' # se.rb include SiSU_Env - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'html_format' # html_format.rb include SiSU_HTML_Format require_relative 'html_minitoc' # html_minitoc.rb @@ -125,7 +123,6 @@ module SiSU_Concordance end private class DocTitle - include SiSU_Viz #revisit, both requires (html & xml_shared) needed for stand alone operation (sisu -w [filename]) require_relative 'xml_shared' # xml_shared.rb require_relative 'html' # html.rb @@ -206,8 +203,6 @@ WOK class Words require_relative 'i18n' # i18n.rb include SiSU_i18n - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'html_format' # html_format.rb include SiSU_HTML_Format require_relative 'se' # se.rb diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index 75bacdc2..b0611508 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -58,7 +58,7 @@ =end module SiSU_HTML_Format - include SiSU_Viz + require_relative 'html_parts' # html_parts.rb class ParagraphNumber def initialize(md,ocn) @md,@ocn=md,ocn.to_s @@ -97,13 +97,13 @@ module SiSU_HTML_Format end class HeadInformation require_relative 'css' # css.rb + include SiSU_Parts_HTML require_relative 'xml_shared' # xml_shared.rb - include SiSU_Viz - attr_reader :md,:rdf,:vz + attr_reader :md,:rdf def initialize(md) @md=md # DublinCore 1 - title - @vz=SiSU_Viz::Defaults.new + @bits=SiSU_Proj_HTML::Bits.new @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || []) @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) @tocband_scroll,@tocband_segtoc=nil,nil @@ -164,7 +164,7 @@ module SiSU_HTML_Format %{ -
    + #{wgt.manifest(page)} #{wgt.search}
    } @@ -172,14 +172,6 @@ module SiSU_HTML_Format def rdf SiSU_XML_Tags::RDF.new(md) end - def doc_type - %{ -\n} - end - def table_close - %{
    -#{@vz.table_close}} - end def button_home(page=:seg) button=%{ \n } end def scroll(text) if @md.fns =~ /\.(?:-|ssm\.)?sst$/ - %{} else - %{} end @@ -291,7 +283,7 @@ module SiSU_HTML_Format #{make_scroll_search_form_and_manifest_link} WOK - %{
    \n} if @md.make.home_button_image.is_a?(Hash) @@ -206,6 +198,7 @@ module SiSU_HTML_Format end end class Widget < HeadInformation + include SiSU_Parts_HTML def initialize(md) super(md) @md=md @@ -216,15 +209,15 @@ module SiSU_HTML_Format @make=SiSU_Env::ProcessingSettings.new(md) end def home - %{ + %{ - #{@vz.nav_txt_homepage} + #{the_nav.txt_homepage} + %{ #{text} @@ -257,16 +250,15 @@ module SiSU_HTML_Format end if page==:manifest manifest_lnk="#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}" - brace_url=SiSU_Viz::Defaults.new.url_decoration - %{ - - #{brace_url.xml_open}#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}#{brace_url.xml_close} + %{ + + #{the_url_decoration.xml_open}#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}#{the_url_decoration.xml_close} + %{ - #{@vz.nav_txt_manifest} + #{the_nav.txt_manifest}
    + %{
    @@ -300,7 +292,7 @@ WOK
    #{button_home(:scroll)}   -#{@vz.table_close} +#{the_table_close}

    } else '' end @@ -316,14 +308,14 @@ WOK else '' end if @make.build.html_top_band? - %{ + %{
    #{button_home} #{doc_types} #{up_button} -#{@vz.table_close} +#{the_table_close}

    } else '' end @@ -344,7 +336,7 @@ WOK else '' end if @make.build.html_top_band? - %{ + %{
    @@ -353,7 +345,7 @@ WOK } %{
    #{button_home(page)}  #{firstseg}  -#{@vz.table_close} +#{the_table_close}

    } else '' end @@ -376,8 +368,8 @@ WOK end def make_scroll_search_form_and_manifest_link wgt=SiSU_HTML_Format::Widget.new(@md) - %{

    - #{@vz.nav_txt_doc_link} + %{ + #{the_nav.txt_doc_link}
    @@ -389,13 +381,13 @@ WOK def make_scroll_seg_pdf seg='' wgt=SiSU_HTML_Format::Widget.new(@md) - seg=%{ } %{
    - #{@vz.nav_txt_toc_link} + seg=%{ + #{the_nav.txt_toc_link}
    -
    + #{wgt.manifest} #{wgt.search}
    } @@ -404,14 +396,15 @@ WOK wgt=SiSU_HTML_Format::Widget.new(@md) %{ -
    + #{wgt.manifest} #{wgt.search}
    } end def head rdf=SiSU_XML_Tags::RDF.new(@md) - %{#{doc_type} + %{ + @@ -426,27 +419,26 @@ WOK end def concordance if @md.concord_make - %{#{@vz.margin_css} + %{#{the_margin.css} <h4 class="toc"> <a href="./#{@md.file.base_filename.html_concordance}"> <i>Concordance</i> </a> </h4> -#{@vz.table_close}} +#{table_close}} else - %{#{@vz.margin_css} -#{@vz.table_close}} + %{#{the_margin.css} +#{table_close}} end end def links_guide_vertical_open # @file=SiSU_Env::FileOp.new(@md) if @md - url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) %{ <div id="vertical_links"> <ul id="vertical"> <li class="refbold"> - <a href="#{url}"> - #{@vz.txt_hp} + <a href="#{the_url.home}"> + #{the_text.txt_hp} </a> </li> <li class="ref"> @@ -461,13 +453,12 @@ WOK end def links_guide_horizontal_open # @file=SiSU_Env::FileOp.new(@md) if @md - url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) %{ <div id="horizontal_links"> <ul id="horizontal"> <li class="refbold"> - <a href="#{url}"> - #{@vz.txt_hp} + <a href="#{the_url.home}"> + #{the_text.txt_hp} </a> </li> <li class="ref"> @@ -521,69 +512,69 @@ WOK def scroll_head_title_banner_open icon=@md.icon ? %{<center>\n#{@md.icon}\n</center>} : '' %{#{icon} -#{@vz.banner_instrument_cover_band_scr}} +#{the_banner.instrument_cover_band_scr}} end def seg_head_title_banner_open icon=@md.icon ? %{<center>\n#{@md.icon}\n</center>} : '' %{#{icon} -#{@vz.banner_instrument_cover_band_seg}} +#{the_banner.instrument_cover_band_seg}} end def make_scroll - concord=concordance_link(@vz.nav_txt_concordance) + concord=concordance_link(the_nav.txt_concordance) %{<table summary="toc scroll" border="0" cellpadding="3" cellspacing="0"> <tr><td align="center" bgcolor="white" border="0"> - #{@vz.nav_txt_doc_link} + #{the_nav.txt_doc_link} </td> <td align="center" bgcolor="white"> #{concord} -#{@vz.table_close}} +#{the_table_close}} end def make_seg - concord=concordance_link(@vz.nav_txt_concordance) + concord=concordance_link(the_nav.txt_concordance) %{<table summary="toc segment" border="0" cellpadding="3" cellspacing="0"> <tr><td align="center" bgcolor="white"> - #{@vz.nav_txt_toc_link} + #{the_nav.txt_toc_link} </td> <td align="center" bgcolor="white"> <font size=2> #{concord} -#{@vz.table_close}} +#{the_table_close}} end def manifest #check structure if not @o_str.dump_or_redirect? - manifest=manifest_link(@vz.nav_txt_manifest) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} + manifest=manifest_link(the_nav.txt_manifest) + %{#{the_margin.txt_3} + #{the_font.paragraph_font_small} #{manifest} </font> -#{@vz.table_close}} +#{the_table_close}} else '' end end def concordance #check structure - concord=concordance_link(@vz.nav_txt_concordance) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} + concord=concordance_link(the_nav.txt_concordance) + %{#{the_margin.txt_3} + #{the_font.paragraph_font_small} #{concord} </font> -#{@vz.table_close}} +#{the_table_close}} end def metadata - %{#{@vz.margin_css} + %{#{the_margin.css} <h4 class="toc"> <a href="#{@metalink}"> <i>MetaData</i> </a> </h4> -#{@vz.table_close}} +#{the_table_close}} end def seg_tail %{ <div class="main_column"> <p> <p> -<table summary="toc segment tail" bgcolor=#{@vz.color_band1}> +<table summary="toc segment tail" bgcolor=#{the_color.band1}> <tr><td width="20%"> - #{@vz.banner_band} + #{the_banner.banner_band} </td> <td width="60%"> <center> @@ -592,8 +583,7 @@ WOK </td></tr> </table> <p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div> @@ -606,8 +596,7 @@ WOK %{ <div class="main_column"> #{nav} -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div> @@ -617,8 +606,7 @@ WOK %{ <div class="main_column"> <p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div> @@ -642,7 +630,7 @@ WOK nxt=nxt.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}") end end - %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> + %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{the_color.grey_pale} align="center"> <tr><td align="left"> <a href="#{pre}" target="_top"> #{png_nav.dot_pre} @@ -657,13 +645,13 @@ WOK <a href="#{nxt}" target="_top"> #{png_nav.dot_nxt} </a> -#{@vz.table_close}} +#{the_table_close}} end def dot_control_pre pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}" up=@toc nxt="#{@md.file.base_filename.html_segtoc}" - %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> + %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{the_color.grey_pale} align="center"> <tr><td align="left"> <a href="#{pre}" target="_top"> #{png_nav.dot_pre} @@ -678,21 +666,21 @@ WOK <a href="#{nxt}" target="_top"> #{png_nav.dot_nxt} </a> -#{@vz.table_close}} +#{the_table_close}} end def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' - toc=%{<td align="center" bgcolor=#{@vz.color_band1}> + toc=%{<td align="center" bgcolor=#{the_color.band1}> <a href="#{@toc}" target="_top"> #{png_nav.toc} </a> </td>} - pre=%{<td align="center" bgcolor=#{@vz.color_band1}> + pre=%{<td align="center" bgcolor=#{the_color.band1}> <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top"> #{png_nav.pre} </a> </td>} if f_pre==true - nxt=%{<td align="center" bgcolor=#{@vz.color_band1}> + nxt=%{<td align="center" bgcolor=#{the_color.band1}> <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top"> #{png_nav.nxt} </a> @@ -710,7 +698,7 @@ WOK #{toc} #{nxt} <td> -#{@vz.table_close}} +#{the_table_close}} end def toc_next2 toc_nav(false,true).dup @@ -739,34 +727,33 @@ WOK end end def navigation_table - %{<table summary="navigation segment table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0"> + %{<table summary="navigation segment table" width=#{the_width.table1} border="0" bgcolor="white" cellpadding="0"> <tr><th width="#{@@indent['leve_1']}" align="right"> </td> <td valign="top"> <font size=2>} end def navigation_table1 - %{<table summary="navigation segment table1" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table1} align="left"> + %{<table summary="navigation segment table1" width=#{the_width.table1} border="0" cellpadding=#{the_table_cellpad_box} bgcolor=#{the_color.table1} align="left"> <tr><td valign="top"> <font size="2">} end def navigation_table2 - %{<table summary="navigation segment table2" width=#{@vz.table_width_2} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table2} align="left"> + %{<table summary="navigation segment table2" width=#{the_width.table2} border="0" cellpadding=#{the_table_cellpad_box} bgcolor=#{the_color.table2} align="left"> <tr><td valign="top"> <font size="2">} end def credit %{ <div class="main_column"> -#{@vz.credits_splash} -#{@vz.credits_sisu} +#{@bits.credits_sisu} <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </div></div> } end def navigation_band(segtocband,seg_table_top_control) #change name to navigation_band_banner - %{<table summary="segment navigation band with banner" bgcolor=#{@vz.color_band1} width="100%"><tr> + %{<table summary="segment navigation band with banner" bgcolor=#{the_color.band1} width="100%"><tr> <td width="20%" align="left"> #{button_home} </td> @@ -782,7 +769,7 @@ WOK def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigation_band_bannerless %{ <div class="main_column"> - <table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr> + <table summary="segment navigation band" bgcolor=#{the_color.band1} width="100%"><tr> <td width="70%" align="center"> #{doc_types} </td> @@ -812,7 +799,8 @@ WOK end def head_seg rdf=SiSU_XML_Tags::RDF.new(@md) - %{#{doc_type} + %{<!DOCTYPE html> +<html> <head> <meta charset="utf-8"> <title> @@ -840,8 +828,8 @@ WOK </p> <p class="tiny"> copy @ - <a href="#{@vz.url_home}"> - #{@vz.txt_home} + <a href="#{the_url.home}"> + #{the_text.txt_home} </a> </p> </div> @@ -853,8 +841,8 @@ WOK super(md) end def toc_owner_details - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} + %{#{the_margin.txt_3} +#{the_font.paragraph_font_small} <a href="#owner.details"> Owner Details <font size="1" color="#777777"> @@ -862,11 +850,11 @@ WOK </font> </a> </font> -#{@vz.table_close}} +#{the_table_close}} end end class FormatTextObject - @vz=SiSU_Viz::Defaults.new + include SiSU_Parts_HTML attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o @@ -899,7 +887,6 @@ WOK @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') end @p_num=ParagraphNumber.new(@md,@ocn) - @vz=SiSU_Viz::Defaults.new end def nametags_scroll(dob) tags='' @@ -1127,21 +1114,21 @@ WOK end end def bold_para - %{#{@vz.margin_txt_0} + %{#{the_margin.txt_0} <p class="bold"> #{@txt} </p> -#{@vz.margin_num_css} +#{the_margin.num_css}     -#{@vz.table_close}} +#{the_table_close}} end def bold_heading %{<p class="bold"> #{@txt} </p> -#{@vz.margin_num_css} +#{the_margin.num_css}     -#{@vz.table_close}} +#{the_table_close}} end def toc_head_copy_at %{<p class="center">#{@txt}</p>\n} @@ -1159,63 +1146,12 @@ WOK class FormatScroll < FormatTextObject def initialize(md,txt) super(md,txt) - @vz=SiSU_Viz::Defaults.new end end class FormatSeg < FormatTextObject def initialize(md,txt) super(md,txt) end - def navigation_toc_lev1_advert - %{#{@banner.home_button}\n -<center> -#{@txt} -#{@two} -</a></center><p>} - end - def navigation_toc_lev1 - %{#{@banner.nav_toc}} - end - def navigation_toc_lev2 #change bold use css - %{<p> -<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 - %{<p> -<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 navigation_toc_lev7 - 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 %{ @@ -1290,7 +1226,7 @@ WOK <p class="bold"> #{@txt} </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_heading5 %{<p class="bold"> diff --git a/lib/sisu/v5/html_harvest_authors.rb b/lib/sisu/v5/html_harvest_authors.rb index 427ef4d3..0fa079d6 100644 --- a/lib/sisu/v5/html_harvest_authors.rb +++ b/lib/sisu/v5/html_harvest_authors.rb @@ -60,6 +60,7 @@ =end module SiSU_HarvestAuthors require_relative 'html_harvest_author_format' # html_harvest_author_format.rb + require_relative 'html_parts' # html_parts.rb class Songsheet @@the_idx_authors={} def initialize(opt,env) @@ -211,7 +212,6 @@ module SiSU_HarvestAuthors @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] @alph=@alphabet_list.dup @letter=@alph.shift - @vz=SiSU_Viz::Defaults.new end def html_file_open @the_idx.keys.each do |lng| @@ -376,7 +376,7 @@ WOK <a name="finish" id="finish"></a> <a name="stop" id="stop"></a> <a name="credits"></a> -#{@vz.credits_sisu} +#{SiSU_Proj_HTML::Bits.new.credits_sisu} </body> </html> WOK diff --git a/lib/sisu/v5/html_harvest_topics.rb b/lib/sisu/v5/html_harvest_topics.rb index 59812c68..ab74968c 100644 --- a/lib/sisu/v5/html_harvest_topics.rb +++ b/lib/sisu/v5/html_harvest_topics.rb @@ -60,8 +60,8 @@ =end module SiSU_HarvestTopics - require_relative 'html_harvest_author_format' # html_harvest_author_format.rb - include SiSU_Viz + require_relative 'html_harvest_author_format' # html_harvest_author_format.rb + require_relative 'html_parts' # html_parts.rb class Songsheet @@the_idx_topics={} def initialize(opt,env) @@ -501,7 +501,6 @@ module SiSU_HarvestTopics @alphabet_list=%W[9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] @alph=@alphabet_list.dup @letter=@alph.shift - @vz=SiSU_Viz::Defaults.new end def html_file_open @the_idx.keys.each do |lng| @@ -745,7 +744,7 @@ WOK <a name="finish" id="finish"></a> <a name="stop" id="stop"></a> <a name="credits"></a> -#{@vz.credits_sisu} +#{SiSU_Proj_HTML::Bits.new.credits_sisu} </body> </html> WOK diff --git a/lib/sisu/v5/html_lite_shared.rb b/lib/sisu/v5/html_lite_shared.rb index 35eb130e..fa1cc481 100644 --- a/lib/sisu/v5/html_lite_shared.rb +++ b/lib/sisu/v5/html_lite_shared.rb @@ -59,11 +59,10 @@ =end module SiSU_FormatShared - require_relative 'defaults' # defaults.rb - include SiSU_Viz + require_relative 'html_parts' # html_parts.rb class CSS_Format - require_relative 'defaults' # defaults.rb require_relative 'se_hub_particulars' # se_hub_particulars.rb + include SiSU_Parts_HTML @@fns=nil def initialize(md,t_o) @md,@t_o=md,t_o @@ -79,10 +78,8 @@ module SiSU_FormatShared else @@hname end @tab="\t" - @brace_url=SiSU_Viz::Defaults.new.url_decoration @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @@tablehead,@@tablefoot=[],[] - @vz=SiSU_Viz::Defaults.new @env=SiSU_Env::InfoEnv.new(@md.fns) @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" end @@ -172,7 +169,7 @@ module SiSU_FormatShared gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). gsub(/#{Mx[:url_o]}[_\\](\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>'). #special case \{ e.g. \}http://url - gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{\\1#{@brace_url.xml_open}<a href="\\2" target="_top">\\2</a>#{@brace_url.xml_close}\\3}) #http ftp matches with decoration + gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{\\1#{the_url_decoration.xml_open}<a href="\\2" target="_top">\\2</a>#{the_url_decoration.xml_close}\\3}) #http ftp matches with decoration else s.gsub(/</m,'<'). gsub(/>/m,'>') @@ -190,7 +187,7 @@ module SiSU_FormatShared gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>\2'). #http ftp matches escaped, no decoration gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>'). #special case \{ e.g. \}http://url - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}<a href="\\1" target="_top">\\1</a>#{the_url_decoration.xml_close}}) #http ftp matches with decoration end def paragraph %{<p class="h#{@lv}" type="substantive" header="#{@hname}">#{@txt}</p>\n} # << "\n" @@ -252,7 +249,7 @@ GSUB tag_para(h) end def para_table - %{<p class="norm" align="left"><font #{@vz.font_small} #{@vz.font_color} #{@vz.font_face}>} + %{<p class="norm" align="left"><font #{the_font.set_small} #{the_font.set_color} #{the_font.set_face}>} end def ocn %{<label class="ocn">#{@ocn}</label>} << "\n" @@ -271,7 +268,7 @@ GSUB @@tablefoot.each {|x| tablefoot << %{<p align="center"><font size=2><i>#{x}</i></font></p>\n}} @@tablefoot=[] parablock=parablock.gsub(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/, - %{#{@vz.table_close}\n}) # + + %{#{the_table_close}\n}) # + end if @@tablehead==1 if parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u diff --git a/lib/sisu/v5/html_manifest.rb b/lib/sisu/v5/html_manifest.rb index de629d61..02368111 100644 --- a/lib/sisu/v5/html_manifest.rb +++ b/lib/sisu/v5/html_manifest.rb @@ -63,13 +63,13 @@ module SiSU_Manifest require_relative 'prog_text_translation' # prog_text_translation.rb require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars + require_relative 'html_parts' # html_parts.rb require_relative 'html_minitoc' # html_minitoc.rb require_relative 'html' # html.rb include SiSU_HTML_Format require_relative 'dp' # dp.rb include SiSU_Param require_relative 'i18n' # i18n.rb - include SiSU_Viz class Source def initialize(opt) @opt=opt @@ -123,6 +123,7 @@ module SiSU_Manifest end private class Output <Source + include SiSU_Parts_HTML def initialize(md) @manifest={ txt: [], html: [] } @md,@fns=md,md.fns @@ -140,7 +141,6 @@ module SiSU_Manifest l=SiSU_Env::StandardiseLanguage.new(md.opt.lng).language @language=l[:n] @translate=SiSU_Translate::Source.new(md,@language) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet @fn_lng=(@f.output_dir_structure.by_language_code?) \ ? '' @@ -158,9 +158,9 @@ module SiSU_Manifest if @o_str.dump_or_redirect? '' elsif src==:src #check - %{<br>#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}} + %{<br>#{the_url_decoration.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{the_url_decoration.xml_close}} else - %{<p class="tiny">#{@brace_url.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{@brace_url.xml_close}</p>} + %{<p class="tiny">#{the_url_decoration.xml_open}<a href="#{url}/#{file}">#{url}/#{file}</a>#{the_url_decoration.xml_close}</p>} end end def summarize(id,file,pth='',rel='',url='',img='● ') @@ -261,7 +261,7 @@ module SiSU_Manifest def published_languages(id) published_manifests?.each do |l| @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n" - @manifest[:html] << %{<tr><th class="left"><p class="bold"><a href="#{l[:mu]}">#{l[:l]}</a></p></th><td><p class="norm">#{l[:l]}</p><p class="tiny">#{@brace_url.xml_open}<a href="#{l[:mu]}">#{l[:mu]}</a>#{@brace_url.xml_close}</p></td><td class="right"><p class="right"> </p></td></tr>\n} + @manifest[:html] << %{<tr><th class="left"><p class="bold"><a href="#{l[:mu]}">#{l[:l]}</a></p></th><td><p class="norm">#{l[:l]}</p><p class="tiny">#{the_url_decoration.xml_open}<a href="#{l[:mu]}">#{l[:mu]}</a>#{the_url_decoration.xml_close}</p></td><td class="right"><p class="right"> </p></td></tr>\n} end end def metadata(id,info) @@ -273,7 +273,7 @@ module SiSU_Manifest elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root) else url end - @manifest[:html] << %{<tr><th class="right" width=5%><p class="norm">●</p></th><td class="left"><p class="norm"><a href="#{url}">#{lnk}</a></p><p class="tiny">  #{@brace_url.xml_open}<a href="#{static}">#{static}</a>#{@brace_url.xml_close}</p></td></tr>\n} + @manifest[:html] << %{<tr><th class="right" width=5%><p class="norm">●</p></th><td class="left"><p class="norm"><a href="#{url}">#{lnk}</a></p><p class="tiny">  #{the_url_decoration.xml_open}<a href="#{static}">#{static}</a>#{the_url_decoration.xml_close}</p></td></tr>\n} end def output_tests if FileTest.file?(@f.place_file.html_segtoc.dir)==true @@ -885,7 +885,6 @@ WOK begin make=SiSU_Env::ProcessingSettings.new(@md) minitoc=SiSU_HTML_MiniToc::TocMini.new(@md,data).songsheet.join("\n") - vz=SiSU_Viz::Defaults.new format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) @manifest[:html] <<<<WOK <!DOCTYPE html> @@ -1010,7 +1009,7 @@ WOK </div> <div> <br> -#{vz.credits_sisu_manifest} +#{SiSU_Proj_HTML::Bits.new.credits_sisu_manifest} </div> </body> </html> diff --git a/lib/sisu/v5/html_parts.rb b/lib/sisu/v5/html_parts.rb new file mode 100644 index 00000000..6f3468d0 --- /dev/null +++ b/lib/sisu/v5/html_parts.rb @@ -0,0 +1,440 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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.sisudoc.org/sisu/en/manifest/gpl.fsf.html> + + * 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> + + * Git + <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> + <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/v5/html_parts.rb;hb=HEAD> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** Description: shared html parts + +=end +module SiSU_Parts_HTML + require_relative 'generic_parts' # generic_parts.rb + include SiSU_Parts_Generic + def the_line_break + '<br>' + end + def the_table_close + '</td></tr> +</table>' + end + def the_table_cellpad_box + '"20"' + end + def the_color + def white + '#ffffff' + end + def black + '#000000' + end + def grey_pale + '#eeeeee' + end + def grey_medium + '#cccccc' + end + def grey + '#999999' + end + def blue_ink + '#003399' + end + def blue_tinge + '#e3ecef' + end + def yellow_light + '#fff3b6' + end + def table1 + 'ffffcc' + end + def table2 + 'c0d0f0' + end + def band1 + %{"#{white}"} + end + def band2 + %{"#{white}"} + end + self + end + def the_url_decoration + #def tex_open #'{\UseTextSymbol{OML}{<}}' + # Dx[:url_o] + #end + #def tex_close #'{\UseTextSymbol{OML}{>}}' + # Dx[:url_c] + #end + def xml_open #'<' + Dx[:url_o] + end + def xml_close #'>' + Dx[:url_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + def the_width + def table1 + '"100%"' + end + def table2 + '"99%"' + end + def table_txt + '"94%"' + end + def table_txt_r + '"96%"' + end + self + end + def the_png + def _url_path_image_base #used for html image display + "#{Xx[:html_relative2]}_sisu/image" + end + def ico + %{ <link rel="shortcut icon" href="../_sisu/image/#{the_icon.i_ico}" />} + end + def png_home + %{<img border="0" src="#{_url_path_image_base}/#{the_icon.home_button}" alt="#{the_text.home} -->" />} + end + def png_home_button + rel=@dir.path_rel_links.html_scroll_2 + %{<img border="0" src="#{rel}/#{the_icon.home_button}" alt="#{the_text.home} -->" />} + end + self + end + def the_font + def set_fonts + 'verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' + #'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman' + end + def set_face + %{face="#{set_fonts}"} + end + def set_color + 'color="#000000"' + end + def set_size_endnote + 'size="3"' + end + def set_small + 'size="3"' + end + def set_tiny + 'size="2"' + end + def paragraph_font_tiny + %{<font #{set_tiny} #{set_face}>} + end + def paragraph_font_small + %{<font #{set_small} #{set_face}>} + end + self + end + def the_nav + def txt_homepage + %{ <font face="#{the_font.set_fonts}" size="2"> +  home  + </font> } + end + def txt_toc_link + %{ <font face="#{the_font.set_fonts}" size="2"> +   toc  + </font> } + end + def txt_doc_link + %{ <font face="#{the_font.set_fonts}" size="2"> +  scroll  + </font> } + end + def txt_manifest + #{png_manifest} document manifest + %{ <font face="#{the_font.set_fonts}" size="2"> + [ document manifest ] + </font> } + end + def txt_concordance + %{ <font face="#{the_font.set_fonts}" size="2"> +   A-Z  + </font> } + end + self + end + def the_banner + def home_button_only + %{<a href="#{url.site}/"> + #{the_png.png_home_button} + </a>} + end + def banner_band + %{<table summary="home button" width="100%" border="0" cellpadding="3" align="center"> +<tr><td align="left" valign="middle"> + <a href="#{url.site}/" target="_top"> + #{the_png.png_home} + </a> +</td> +<td width="90%"> +#{the_table_close}} + end + def instrument_cover_band_scr + '<table summary="scroll instrument cover band" width="100%" border="0" cellpadding="8" align="center"> +<tr><td align="center">' + end + def instrument_cover_band_seg + '<table summary="segment instrument cover band, title, author, location" width="100%" border="0" cellpadding="8" align="center"> +<tr><td align="center">' + end + self + end + def the_margin + def txt_0 + %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center"> +<tr><td width=#{indent_level_0} align="right"> +</td><td valign="top" align="justify">} + end + def txt_1 + %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center"> +<tr><td width=#{indent_level_1} align="right"></td><td valign="top" align="justify">} + end + def txt_2 + %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center"> +<tr><td width=#{indent_level_2} align="right"> +</td> +<td valign="top" align="justify">} + end + def txt_3 + %{<table summary="" width=#{the_width.table_txt} border="0" cellpadding="2" align="center"> +<tr><td width=#{indent_level_3} align="right"> +</td> +<td valign="top" align="justify">} + end + def css + '<table summary="normal text css" width="100%" border="0" cellpadding="2" align="center"> +<tr><td valign="top" align="justify"> ' + end + def num + '</p> </td><td width="4%" align="right" valign="top">' + end + def numless + '</td><td width="4%" align="right" valign="top">' + end + def num_css + '</td> +<td width="2%" align="right" valign="top"> ' + end + self + end +end +module SiSU_Proj_HTML + require_relative 'se' # se.rb + include SiSU_Env + #require_relative 'css' # css.rb + # include SiSU_Style + class Bits + include SiSU_Parts_HTML + def initialize + @v=SiSU_Env::InfoVersion.instance.get_version + #@dir=SiSU_Env::InfoEnv.new + #@date=SiSU_Env::InfoDate.new #{@date.year} + end + def txt_generator + %{ <meta name="generator" content="#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!)" /> + <link rel="generator" href="http://www.sisudoc.org/" />} + end + def widget_sisu_text +<<WOK + <p class="tiny"><font color="#666666" size="2"> + Output generated by + <a href="#{the_url.sisu}"> + #{@v[:project]} + </a> + #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) + </font></p> +WOK + end + def credits_sisu_manifest + widget_sisu_text + end + def widget_sisu +<<WOK +<!-- widget sisu --> +<tr><td valign="top" width="100%"> +<!-- SiSU Rights --> +#{widget_sisu_text} +</td></tr> +WOK + end + def credits_sisu + %{<div class="substance"> +<table summary="SiSU summary" cellpadding="4" border="0"> +<tr><td> + #{widget_sisu} +</table></div>} + '' + end + def widget_promo # Array used to build promo from list.yml and promo.yml + # ['sisu_icon','sisu','sisu_search_libre','open_society','fsf','ruby'] + end + end + class Home + def initialize + @v=SiSU_Env::InfoVersion.instance.get_version + @dir=SiSU_Env::InfoEnv.new + @date=SiSU_Env::InfoDate.new #{@date.year} + end + def redirect + <<WOK +<html><head> +<title>SiSU + + + +SiSU informtion provided at www.sisudoc.org/sisu/SiSU

    +If your browser supports redirection, you will be escorted there shortly. + + +WOK + end + def homepage + < + + +SiSU information Structuring Universe - Structured information, Serialized Units - software for electronic texts, documents, books, digital libraries in plaintext, HTML, EPUB, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQL (PostgreSQL and SQLite), and for search + + + + + + + + + + + + + + + + + +

    SiSU

    +

    +[Manual] +

    +

    +[Source] +[List Info (sisu@lists.sisudoc.org)] +

    + +

    SiSU Markup Samples

    +

    +[Source] +[Output] +

    + +
    + +

    + Structured information, Serialized Units +    + + <www.sisudoc.org> + +   or   + + <www.jus.uio.no/sisu/> + +software for electronic texts, document collections, books, digital libraries & search, with "atomic search" & text locating system (shared object citation numbering: "ocn"). +Outputs include: plaintext, HTML, EPUB, ODT (OpenDocumentText), (XHTML, XML,) LaTeX, PDF, SQL (PostgreSQL and SQLite). +

    +

    + +<sisu@lists.sisudoc.org> + + +<http://lists.sisudoc.org/listinfo/sisu> + +

    +

    + +<ralph@amissah.com> + + +<ralph.amissah@gmail.com> + +

    +

    +#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!), #{@date.year_static}. +

    +

    +w3 since October 3 1993. +

    + + +WOK + end + def home_toc + ' ' + end + end +end +__END__ diff --git a/lib/sisu/v5/html_promo.rb b/lib/sisu/v5/html_promo.rb index 1f2b0388..a2d3ecf3 100644 --- a/lib/sisu/v5/html_promo.rb +++ b/lib/sisu/v5/html_promo.rb @@ -66,7 +66,6 @@ module SiSU_HTML_Promo @env=SiSU_Env::InfoEnv.new(@md.fns,@md) @rc=SiSU_Env::GetInit.new.sisu_yaml.rc @ad=SiSU_Env::GetInit.new.ads - @vz=SiSU_Viz::Defaults.new @flag=@env.widget.promo? @make=SiSU_Env::ProcessingSettings.new(@md) end @@ -97,8 +96,6 @@ module SiSU_HTML_Promo && @flag[:ad] ads=if @md.promo && @md.promo.length > 0 #promo set in document promo_array=@md.promo - elsif @flag[:sk] #promo set - promo_array=@vz.widget_promo elsif @flag[:rc] #promo set in rc file promo_array=if @rc['html']['promo'].is_a?(String) @rc['html']['promo'].split(/[,;]\s*/) diff --git a/lib/sisu/v5/html_scroll.rb b/lib/sisu/v5/html_scroll.rb index 1b632f56..94dac502 100644 --- a/lib/sisu/v5/html_scroll.rb +++ b/lib/sisu/v5/html_scroll.rb @@ -65,7 +65,6 @@ module SiSU_HTML_Scroll class Scroll def initialize(md='',data='',endnotes='') @md,@data,@endnotes=md,data,endnotes - @vz=SiSU_Viz::Defaults.new end def songsheet begin diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb index 4054e6fc..60cd51f1 100644 --- a/lib/sisu/v5/html_segments.rb +++ b/lib/sisu/v5/html_segments.rb @@ -200,7 +200,6 @@ module SiSU_HTML_Seg attr_reader :seg_name_html,:seg_name_html_tracker def initialize(md=nil,data='') @md,@data=md,data - @vz=SiSU_Viz::Defaults.new @seg_name_html=@@seg_name_html || nil @seg_name_html_tracker=@@tracker || nil @env=SiSU_Env::InfoEnv.new(@md.fns) if @md @@ -575,19 +574,17 @@ module SiSU_HTML_Seg if @md.flag_separate_endnotes dob.obj=dob.obj.gsub(/"\s+href="#(#{Mx[:note]}\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#\\1">}) #endnote- twice #removed file type end - if dob.obj !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/ - if (dob.is==:heading \ - || dob.is==:heading_insert \ - || dob.is==:para) \ - && (not dob.ocn \ - || (dob.ocn.to_s.empty?)) - format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob) - end - dob.obj=dob.obj.gsub(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with #?? workpoint - if dob.obj =~/ / #endnote- note- - format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob) - dob=format_seg.no_paranum - end + if (dob.is==:heading \ + || dob.is==:heading_insert \ + || dob.is==:para) \ + && (not dob.ocn \ + || (dob.ocn.to_s.empty?)) + format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob) + end + dob.obj=dob.obj.gsub(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with #?? workpoint + if dob.obj =~/ / #endnote- note- + format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob) + dob=format_seg.no_paranum end if (dob.is==:heading \ || dob.is==:heading_insert) \ diff --git a/lib/sisu/v5/html_shared.rb b/lib/sisu/v5/html_shared.rb index 3b6b9dfd..04617e74 100644 --- a/lib/sisu/v5/html_shared.rb +++ b/lib/sisu/v5/html_shared.rb @@ -58,7 +58,6 @@ =end module SiSU_HTML_Shared - require_relative 'defaults' # defaults.rb require_relative 'html_table' # html_table.rb class TableHTML < SiSU_HTML_Table::TableHTML end diff --git a/lib/sisu/v5/html_table.rb b/lib/sisu/v5/html_table.rb index 497f7c4e..f29256a7 100644 --- a/lib/sisu/v5/html_table.rb +++ b/lib/sisu/v5/html_table.rb @@ -58,9 +58,10 @@ =end module SiSU_HTML_Table - require_relative 'defaults' # defaults.rb - require_relative 'xhtml_table.rb' # xhtml_table.rb - class TableHTML /, %{\n
    \\3
    \n}) end - dob.obj=dob.obj.gsub(/!pick/,%{stellar}). - gsub(/!new/,%{ new}). + dob.obj=dob.obj.gsub(/!pick/,%{stellar}). + gsub(/!new/,%{ new}). gsub(/<:h(.{1,7}?)>/,'\1'). gsub(/<:to(\d{1,7}?)>/,'to { \1 } '). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). #http ftp matches escaped, no decoration - gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration if dob.obj =~/#{Xx[:html_relative2]}\/\S+/ \ and dob.obj !~/(\"#{Xx[:html_relative2]}\/\S+?\"|>\s*#{Xx[:html_relative2]}\/\S+<)/ dob.obj=dob.obj.gsub(/(#{Xx[:html_relative2]}\/\S+)/,'\1') @@ -245,9 +245,9 @@ module SiSU_HTML_Tune and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ dob.obj=dob.obj.gsub(/\.\.(\/\S+)/,%{\1}) end - dob.obj=dob.obj.gsub(//m,'>') end diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 70a4e360..a4751e40 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -68,8 +68,6 @@ module SiSU require_relative 'hub_options' # hub_options.rb require_relative 'dp' # dp.rb include SiSU_Param - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'utils' # utils.rb begin require 'uri' diff --git a/lib/sisu/v5/hub_loop_markup_files.rb b/lib/sisu/v5/hub_loop_markup_files.rb index 70127915..165fdc93 100644 --- a/lib/sisu/v5/hub_loop_markup_files.rb +++ b/lib/sisu/v5/hub_loop_markup_files.rb @@ -67,8 +67,6 @@ module SiSU_Hub_Loops require_relative 'hub_options' # hub_options.rb require_relative 'dp' # dp.rb include SiSU_Param - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'utils' # utils.rb begin require 'uri' diff --git a/lib/sisu/v5/manpage.rb b/lib/sisu/v5/manpage.rb index a42c7dfe..1dff0bde 100644 --- a/lib/sisu/v5/manpage.rb +++ b/lib/sisu/v5/manpage.rb @@ -63,10 +63,10 @@ module SiSU_Manpage require_relative 'se' # se.rb include SiSU_Env include SiSU_Param - include SiSU_Viz require_relative 'manpage_format' # manpage_format.rb include SiSU_ManpageFormat require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' @@ -122,14 +122,11 @@ module SiSU_Manpage end private class Scroll #{@dob.obj} " diff --git a/lib/sisu/v5/po4a.rb b/lib/sisu/v5/po4a.rb index 7b7e2665..03cf14f7 100644 --- a/lib/sisu/v5/po4a.rb +++ b/lib/sisu/v5/po4a.rb @@ -66,7 +66,6 @@ module SiSU_Po4a require_relative 'shared_metadata' # shared_metadata.rb require_relative 'po4a_set' # po4a_set.rb include SiSU_Param - include SiSU_Viz class Source @@opt_src,@@opt_trn,@@opt_src_,@@opt_trn_,@@md_src,@@md_trn=nil,nil,nil,nil,nil,nil def initialize(opt,fn=nil) @@ -172,8 +171,6 @@ module SiSU_Po4a end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1') - #dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") notes=extract_endnotes(dob) #% ### footnotes current state - extracted dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'~^'). # endnote marker marked up diff --git a/lib/sisu/v5/qrcode.rb b/lib/sisu/v5/qrcode.rb index 04d91a5e..483f4deb 100644 --- a/lib/sisu/v5/qrcode.rb +++ b/lib/sisu/v5/qrcode.rb @@ -66,8 +66,8 @@ module SiSU_QRcode require_relative 'html' # html.rb require_relative 'dp' # dp.rb include SiSU_Param + require_relative 'generic_parts' # generic_parts.rb require_relative 'i18n' # i18n.rb - include SiSU_Viz class Source def initialize(opt) @opt=opt @@ -116,6 +116,7 @@ module SiSU_QRcode end private class OutputInfo 0 + elsif defined? @html_bits.widget_promo \ + and not @html_bits.widget_promo.nil? \ + and @html_bits.widget_promo.is_a?(Array) \ + and @html_bits.widget_promo.length > 0 @flag[:sk]=true true elsif defined? @rc['html']['promo'] \ @@ -610,8 +612,8 @@ module SiSU_Info_Env and @rc['search'][type]['action'] =~/https?:\/\// flag=if promo?[:ad] false - elsif defined? @vz.widget_search \ - and @vz.widget_search==true + elsif defined? @html_bits.widget_search \ + and @html_bits.widget_search==true true elsif defined? @rc['search'][type]['flag'] \ and @rc['search'][type]['flag']==true @@ -636,8 +638,8 @@ module SiSU_Info_Env and @rc['search'][type]['db'] =~/\S+/ flag=if promo?[:ad] false - elsif defined? @vz.widget_search \ - and @vz.widget_search==true + elsif defined? @html_bits.widget_search \ + and @html_bits.widget_search==true true elsif defined? @rc['search'][type]['flag'] \ and @rc['search'][type]['flag']==true @@ -756,7 +758,7 @@ WOK end def widget_static @rc=SiSU_Env::GetInit.new.sisu_yaml.rc - @vz=SiSU_Viz::Defaults.new + @html_bits=SiSU_Proj_HTML::Bits.new @flag={ ad: false, md: false, sk: false, rc: false } def search? flag=if defined? @rc['search'] \ @@ -765,8 +767,8 @@ WOK and @rc['search']['sisu']['action'] =~/https?:\/\// \ and defined? @rc['search']['sisu']['db'] \ and @rc['search']['sisu']['db'] =~/\S+/ - flag=if defined? @vz.widget_search \ - and @vz.widget_search==true + flag=if defined? @html_bits.widget_search \ + and @html_bits.widget_search==true true elsif defined? @rc['search']['sisu']['flag'] \ and @rc['search']['sisu']['flag']==true @@ -787,8 +789,8 @@ WOK and @rc['search']['sisu']['db'] =~/\S+/ \ and defined? @rc['search']['sisu']['db'] \ and @rc['search']['sisu']['db'] =~/\S+/ - flag=if defined? @vz.widget_search \ - and @vz.widget_search==true + flag=if defined? @html_bits.widget_search \ + and @html_bits.widget_search==true true elsif defined? @rc['search']['sisu']['flag'] \ and @rc['search']['sisu']['flag']==true diff --git a/lib/sisu/v5/shared_metadata.rb b/lib/sisu/v5/shared_metadata.rb index 9f4f4362..17e0a4c4 100644 --- a/lib/sisu/v5/shared_metadata.rb +++ b/lib/sisu/v5/shared_metadata.rb @@ -58,8 +58,10 @@ =end module SiSU_Metadata + require_relative 'xml_parts' # xml_parts.rb require_relative 'xml_shared' # xml_shared.rb class Summary + include SiSU_Parts_XML attr_accessor :tag,:inf,:class,:attrib def initialize(md,display_heading=false) @md,@display_heading=md,display_heading @@ -916,7 +918,6 @@ WOK end def odf def meta_para - url_brace=SiSU_Viz::Defaults.new.url_decoration if @inf.is_a?(String) @inf=@inf.gsub(//,'>'). gsub(/<br(?: \/)?>/,'
    ') @@ -938,13 +939,13 @@ WOK '\1\2') #special case \{ e.g. \}http://url @inf=if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/ @inf.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration else @inf.gsub(/(https?:\/\/[^<>()'"\s]+)/, - %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration end @inf=@inf.gsub(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol end <#{@tag.capitalize}: #{@inf} diff --git a/lib/sisu/v5/sst_do_inline_footnotes.rb b/lib/sisu/v5/sst_do_inline_footnotes.rb index 41bc30f2..fab94edf 100644 --- a/lib/sisu/v5/sst_do_inline_footnotes.rb +++ b/lib/sisu/v5/sst_do_inline_footnotes.rb @@ -59,8 +59,6 @@ =end module SiSU_ConvertFootnotes - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'se' # se.rb include SiSU_Env require_relative 'dp' # dp.rb @@ -211,7 +209,6 @@ module SiSU_ConvertFootnotes : x end data=data_new.flatten - data=SiSU_ConvertFootnotes::Make.new(@md,data).substitutions_and_insertions? data=SiSU_ConvertFootnotes::Make.new(@md,data).character_check data=SiSU_ConvertFootnotes::Make.new(@md,data).endnotes SiSU_ConvertFootnotes::Output.new(@md,data).hard_output @@ -270,57 +267,6 @@ module SiSU_ConvertFootnotes end @tuned_file end - def substitutions_and_insertions? - data=@data - tuned_file=[] - data.each do |para| - if @md.markup =~/0\.16|0\.37/ #parameters not extracted/available - para.gsub!(/^0~\S+\s+/,'@\1: ') - para.gsub!(/^1~/,':A~') - para.gsub!(/^2~/,':B~') - para.gsub!(/^3~/,':C~') - para.gsub!(/^4~/,'1~') - para.gsub!(/^5~/,'2~') - para.gsub!(/^6~/,'3~') - para.gsub!(/^7~/,'4~') - para.gsub!(/^8~/,'5~') - para.gsub!(/^9~/,'6~') - end - if para =~/<:insert\d+!?>/ \ - and para !~/^%\s+/ - ins=SiSU_Viz::Inserts.new - case para - when /^\s*<:insert1>\s*$/ - para=[] - ins.insert1.split(/\n\n/).each {|x| para << x } - when /^\s*<:insert2>\s*$/ - para=[] - ins.insert2.split(/\n\n/).each {|x| para << x } - when /^\s*<:insert3>\s*$/ - para=[] - ins.insert3.split(/\n\n/).each {|x| para << x << "\n"} - para=ins.insert3 - when /^\s*<:insert4>\s*$/ - para=[] - ins.insert4.split(/\n\n/).each {|x| para << x << "\n"} - para=ins.insert4 - when /^\s*<:insert5>\s*$/ - para=[] - ins.insert5.split(/\n\n/).each {|x| para << x << "\n"} - when /^\s*<:insert6>\s*$/ - para=[] - ins.insert6.split(/\n\n/).each {|x| para << x << "\n"} - when /^\s*<:insert7>\s*$/ - para=[] - ins.insert7.split(/\n\n/).each {|x| para << x << "\n"} - end - para.each {|x| tuned_file << x } - else tuned_file << para - end - tuned_file.compact! - end - tuned_file - end def name_endnote_seg data=@data @tuned_file=[] diff --git a/lib/sisu/v5/sst_to_s_xml_sax.rb b/lib/sisu/v5/sst_to_s_xml_sax.rb index 5c026c05..80d6269b 100644 --- a/lib/sisu/v5/sst_to_s_xml_sax.rb +++ b/lib/sisu/v5/sst_to_s_xml_sax.rb @@ -60,8 +60,6 @@ module SiSU_SimpleXML_ModelSax require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'dp' # dp.rb include SiSU_Param require_relative 'se' # se.rb @@ -151,7 +149,6 @@ module SiSU_SimpleXML_ModelSax @@xml={ body: [], open: [], close: [], head: [] } def initialize(data='',particulars='') @data,@env,@md=data,particulars.env,particulars.md - @vz=SiSU_Viz::Defaults.new @regx=/^(?:#{Mx[:mk_o]}:p[bn]#{Mx[:mk_c]}\s*)?(?:#{Mx[:lv_o]}[1-9]:(\S*)#{Mx[:lv_c]})?(.+)/ @tab="\t" if @md diff --git a/lib/sisu/v5/texinfo.rb b/lib/sisu/v5/texinfo.rb index 43ab5118..92b7241c 100644 --- a/lib/sisu/v5/texinfo.rb +++ b/lib/sisu/v5/texinfo.rb @@ -61,7 +61,6 @@ module SiSU_TexInfo require_relative 'html' # html.rb require_relative 'dp' # dp.rb include SiSU_Param - include SiSU_Viz #include Stamp ... needed removed arbitrarily 2005w05/1 (warnings about undefined flags) require_relative 'texinfo_format' # texinfo_format.rb include SiSU_TexInfoFormat @@ -74,13 +73,11 @@ module SiSU_TexInfo @@tex_pattern_margin_number="\\\\marginpar.+?\s+" class Source include SiSU_Param - include SiSU_Viz include SiSU_TexInfo def initialize(opt) @opt=opt @md=SiSU_Param::Parameters.new(@opt).get @env=SiSU_Env::InfoEnv.new(@opt.fns) - @vz=SiSU_Viz::Defaults.new end def directories begin @@ -151,7 +148,6 @@ module SiSU_TexInfo def initialize(md,data) @md,@data=md,data @env=SiSU_Env::InfoEnv.new(@md.fns) - @vz=SiSU_Viz::Defaults.new @f=SiSU_Env::FileOp.new(@md) end def songsheet diff --git a/lib/sisu/v5/texinfo_format.rb b/lib/sisu/v5/texinfo_format.rb index 00ee77b3..46a5ed69 100644 --- a/lib/sisu/v5/texinfo_format.rb +++ b/lib/sisu/v5/texinfo_format.rb @@ -61,7 +61,6 @@ module SiSU_TexInfoFormat @@table_pg_break_counter=1 require_relative 'dp' # dp.rb include SiSU_Param - include SiSU_Viz class Texinfo @@tex_1='\\\\~' #?? debug @@tabular="{tabular}" @@ -75,7 +74,6 @@ module SiSU_TexInfoFormat p dob.class p caller end - @vz=SiSU_Viz::Defaults.new end def head t=Time.now diff --git a/lib/sisu/v5/texpdf.rb b/lib/sisu/v5/texpdf.rb index 6579d338..e61595e0 100644 --- a/lib/sisu/v5/texpdf.rb +++ b/lib/sisu/v5/texpdf.rb @@ -64,8 +64,7 @@ module SiSU_TeX SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). error('pstore NOT FOUND (LoadError)') end - require_relative 'defaults' # defaults.rb - include SiSU_Viz + require_relative 'texpdf_parts' # texpdf_parts.rb require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars require_relative 'texpdf_format' # texpdf_format.rb @@ -88,7 +87,6 @@ module SiSU_TeX end require_relative 'se' # se.rb include SiSU_Env - include SiSU_Viz require_relative 'ao' # ao.rb include SiSU_AO include SiSU_TeX @@ -395,6 +393,7 @@ module SiSU_TeX end end class LaTeXcreate + include SiSU_Parts_TeXpdf @@tex_head={ 'a4'=> { p: nil, l: nil }, 'a5'=> { p: nil, l: nil }, @@ -411,9 +410,7 @@ module SiSU_TeX @data=@particulars.ao_array # ao file drawn here @st={ tex: {} } @tex_ml=SiSU_TeX_Pdf::UseTeX.new(@md) - @vz=SiSU_Viz::Defaults.new @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern - @brace_url=SiSU_Viz::Defaults.new.url_decoration l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language @language=l[:n] @translate=SiSU_Translate::Source.new(@md,@language) @@ -810,7 +807,7 @@ module SiSU_TeX end def markup(data) @tex_file=[] - home=@vz.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex + home=the_text.txt_home.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex title=@md.title.full.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex @md.papersize_array.each do |ps| if @md.opt.act[:pdf_p][:set]==:on diff --git a/lib/sisu/v5/texpdf_format.rb b/lib/sisu/v5/texpdf_format.rb index d5defb39..96b5dc91 100644 --- a/lib/sisu/v5/texpdf_format.rb +++ b/lib/sisu/v5/texpdf_format.rb @@ -58,19 +58,19 @@ =end module SiSU_TeX_Pdf + require_relative 'texpdf_parts' # texpdf_parts.rb @@table_pg_break_counter=1 - include SiSU_Viz class BareUrls + include SiSU_Parts_TeXpdf def initialize(md,dob=nil) @md,@dob=md,dob - @brace_url=SiSU_Viz::Defaults.new.url_decoration end def bare_urls @dob.obj=@dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@[a-zA-Z0-9_-]+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - "#{@brace_url.tex_open}\\begin{scriptsize}\\email{\\1}#{@brace_url.tex_close}") + "#{url_decoration.tex_open}\\begin{scriptsize}\\email{\\1}#{url_decoration.tex_close}") @dob.tmp=@dob.tmp.gsub(/(^|[^\\])_/m,'\1\_'). #watch may not work gsub(/(^|[^#{Mx[:lnk_c]}])#{Mx[:url_o]}_?(?:\\?_)?(\S+?)#{Mx[:url_c]}/m, - "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}") + "\\1#{url_decoration.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{url_decoration.tex_close}") @dob end def bare_urls_in_code @@ -81,7 +81,7 @@ module SiSU_TeX_Pdf end end class FormatTextObject - require_relative 'defaults' # defaults.rb + include SiSU_Parts_TeXpdf attr_accessor :string,:string1,:orientation,:url,:dir,:tex @@sys=SiSU_Env::SystemCall.new @@tex_pattern_margin_number=/\\begin\{tiny\}\\hspace\{0mm\}\\end\{tiny\}\{\\marginpar.+?\}\}\}/ @@ -102,7 +102,6 @@ module SiSU_TeX_Pdf end @start_table='' @tx=SiSU_Env::GetInit.new.tex - @brace_rel=SiSU_Viz::Defaults.new.rel_decoration @env ||=SiSU_Env::InfoEnv.new(@md.fns) @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine @make ||=SiSU_Env::ProcessingSettings.new(@md) @@ -517,7 +516,7 @@ module SiSU_TeX_Pdf link.gsub!(/&/,"#{Xx[:protect]}&") url="#{@env.url.root}/" + url str.sub!(/#{Mx[:lnk_o]}[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+#{Mx[:lnk_c]}#{Mx[:rel_o]}:\S+?#{Mx[:rel_c]}/m, - "#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}") + "#{url_decoration.tex_open}\\href{#{url}}{#{link}}#{url_decoration.tex_close}") end while str =~/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+)#{Mx[:lnk_c]}#{Mx[:rel_o]}#?(\S+?)#{Mx[:rel_c]}/m link,url=$1,$2 @@ -533,7 +532,7 @@ module SiSU_TeX_Pdf if ocn_lnk and not ocn_lnk.empty? idx \ ? (str.sub!(rgx_url_internal,"\\hyperlink{#{ocn_lnk}}{#{link}}")) - : (str.sub!(rgx_url_internal,"#{@brace_rel.tex_open}\\hyperlink{#{ocn_lnk}}{#{link}}#{@brace_rel.tex_close}")) + : (str.sub!(rgx_url_internal,"#{url_decoration.tex_open}\\hyperlink{#{ocn_lnk}}{#{link}}#{url_decoration.tex_close}")) else puts %{name tag: "#{url}" not found} str.sub!(rgx_url_internal,"#{link}") @@ -541,7 +540,7 @@ module SiSU_TeX_Pdf #[keep] code that follows uses nametags directly, currently nametags converted to their ocn, related code: |texpdf.rb|@|hypertargets| #idx \ #? (str.sub!(rgx_url_internal,"\\hyperlink{#{url}}{#{link}}")) \ - #: (str.sub!(rgx_url_internal,"#{@brace_rel.tex_open}\\hyperlink{#{url}}{#{link}}#{@brace_rel.tex_close}")) + #: (str.sub!(rgx_url_internal,"#{url_decoration.tex_open}\\hyperlink{#{url}}{#{link}}#{url_decoration.tex_close}")) end str=str.gsub(/#{Xx[:protect]}/,'') end @@ -554,7 +553,7 @@ module SiSU_TeX_Pdf url=url.strip link=z.strip link.gsub!(/&/,"#{Xx[:protect]}&") - str.sub!(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}") + str.sub!(rgx_url_generic,"#{url_decoration.tex_open}\\href{#{url}}{#{link}}#{url_decoration.tex_close}") str=str.gsub(/#{Xx[:protect]}/,'') str else str @@ -578,9 +577,9 @@ module SiSU_TeX_Pdf url=url.strip link=z.strip link.gsub!(/&/,"#{Xx[:protect]}&") - dob.tmp.sub!(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}#{punctuate}") + dob.tmp.sub!(rgx_url_generic,"#{url_decoration.tex_open}\\href{#{url}}{#{link}}#{url_decoration.tex_close}#{punctuate}") dob.tmp.gsub!(/#{Xx[:protect]}/,'') - #dob.tmp=dob.tmp.sub(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}#{punctuate}"). + #dob.tmp=dob.tmp.sub(rgx_url_generic,"#{url_decoration.tex_open}\\href{#{url}}{#{link}}#{url_decoration.tex_close}#{punctuate}"). # gsub(/#{Xx[:protect]}/,'') dob else dob @@ -760,7 +759,6 @@ module SiSU_TeX_Pdf p caller end @tx=SiSU_Env::GetInit.new.tex - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine @ps=@txt if @txt=~/(?:a4|letter|legal|book|a5|b5)/i @lang ||=SiSU_i18n::Languages.new #.list[@md.opt.lng][:xlp] @@ -1236,9 +1234,9 @@ module SiSU_TeX_Pdf end end class SpecialCharacters + include SiSU_Parts_TeXpdf def initialize(md,str,is=:default) @md,@txt,@is=md,str,is - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine end def xetex_code_listings(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list @@ -1380,7 +1378,7 @@ module SiSU_TeX_Pdf if is !=:code \ and is !=:no_urls str=str.gsub(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/, - "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start + "\\1#{url_decoration.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{url_decoration.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start end str=str.gsub(/<:ee>/,''). gsub(//,' '). #proposed change, insert, but may be redundant @@ -1487,13 +1485,12 @@ module SiSU_TeX_Pdf end end class UseTeX + include SiSU_Parts_TeXpdf attr_accessor :url,:txt,:date def initialize(md) @md=md - @vz=SiSU_Viz::Defaults.new @date=SiSU_Env::InfoDate.new # #{@date.year} @copymark='{\\begin{footnotesize}\\raisebox{1ex}{\\copyright}\\end{footnotesize}}' - @brace_url=SiSU_Viz::Defaults.new.url_decoration end def skip "\n\\vspace*{\\smallskipamount} \n" @@ -1532,15 +1529,12 @@ module SiSU_TeX_Pdf "\\rfoot[\\tiny \\href{}{}]{\\textrm{\\thepage}}\n" end def site - if not @vz.url_home.empty? \ - and not @vz.url_txt.empty? + if not the_url.home.empty? \ + and not the_url.home_txt.empty? "\n\\date{\\begin{tiny} \\end{tiny}}" else '' end end - def sitename # owners site, eg freeculture, free.for.all, gutenberg etc. - "\\href{#{@vz.url_home}}{#{@vz.txt_home}}" - end def owner_chapter "Contact Details for Original Promulgating Authority" end @@ -1572,7 +1566,7 @@ module SiSU_TeX_Pdf \\\\ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU} \\begin{tiny}[ #{v[:project]} #{v[:version]} of #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.jus.uio.no/sisu}{www.jus.uio.no/sisu} \\\\ Copyright #{@copymark} 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved. \\\\ SiSU is software for document structuring, publishing and search (with object citation numbering), \\href{http://www.sisudoc.org}{www.sisudoc.org} -\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later, #{@brace_url.tex_open}\\href{http://www.fsf.org/licenses/gpl.html}{http://www.fsf.org/licenses/gpl.html}#{@brace_url.tex_close}. +\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later, #{url_brace.tex_open}\\href{http://www.fsf.org/licenses/gpl.html}{http://www.fsf.org/licenses/gpl.html}#{url_brace.tex_close}. {\\end{footnotesize} \\\\ WOK @@ -1618,64 +1612,6 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ \\listofendnotes WOK end - def doc_tail - dir=SiSU_Env::InfoEnv.new(@md.fns) - v=SiSU_Env::InfoVersion.instance.get_version - sisu_ico=if FileTest.file?("#{dir.path.image_source_include}/sisu.png") - "\\includegraphics*[width=60pt]{#{dir.path.image_source_include}/sisu.png}" - else - SiSU_Screen::Ansi.new( - @md.opt.act[:color_state][:set], - 'WARNING - image directory or image(s) missing:', - %{"#{dir.path.image_source_include}"} - ).warn unless @md.opt.act[:quiet][:set]==:on - " SiSU " - end - url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') - <<-WOK -\\begin{english}[variant=british] -\\subsection*{Information on this document copy and an unofficial List of Some web related information and sources} -\\addcontentsline{toc}{section}{Information on this document copy and an unofficial List of Some web related information and sources} -\\\\ -\"Support Open Standards and Software Libré for the Information Technology Infrastructure\" RA\\subsubsection*{Information on this document copy #{site}} -\\addcontentsline{toc}{subsection}{Information on this document copy} -{\\begin{footnotesize} -\\\\ Generated by \\href{http://www.jus.uio.no/sisu/}{SiSU} found at \\href{http://www.jus.uio.no/sisu/}{www.jus.uio.no/sisu} \\begin{tiny}[ #{v[:project]} #{v[:version]} #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.sisudoc.org}{www.sisudoc.org}. SiSU is software for document structuring, publishing and search (using SiSU: object citation numbering, markup, meta-markup, and system) Copyright #{@copymark} 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved. -\\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later (\\href{http://www.fsf.org/licenses/gpl.html}{www.fsf.org/licenses/gpl.html}). {\\end{footnotesize} -{\\begin{small} -\\\\ W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{#{sisu_ico}}SiSU 1997, current #{@date.year_static}. \\\\ #{sitename} presentations at \\begin{scriptsize}#{site}\\end{scriptsize} \\\\ \\\\ #{@md.title.full} \\textbf{pdf} versions can be found at: \\\\ -{\\end{small} -\\\\ #{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\ -#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\ -\\\\\n#{@md.title.full} \\textbf{html} versions may be found at: \\\\ -#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}\\end{scriptsize}#{@brace_url.tex_close} or \\\\ -#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}\\end{scriptsize}#{@brace_url.tex_close} -\\\\ -\\\\ -\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}{SiSU Manifest} of document output and metadata may be found at: \\\\ -#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}\\end{scriptsize}#{@brace_url.tex_close} -\\\\ -\\\\ - #{sitename} found at: \\begin{scriptsize}#{site}\\end{scriptsize}\\subsubsection*{Links that may be of interest at #{@vz.txt_home} and elsewhere:} -\\addcontentsline{toc}{subsection}{Links that may be of interest} -\\end{english} - WOK - end - def mail_tail #not retested, the old mail_tail is commented out and appended to this program - dir=SiSU_Env::InfoEnv.new(@md.fns) - <<-WOK -\\subsection*{Mail sender details} -\\addcontentsline{toc}{subsection}{Mail sender details} -\\\\ -Mail from: ralph@amissah.com\\\\ -44 20 8789 3452\\\\ -44 77 9669 4448 -\\\\ - \"Support Open Standards and Open Sources for the Information Technology Infrastructure\" RA -\\subsubsection*{Information on this document copy #{site}\\copyright} -Presentations' look and feel generated by \\href{http://www.jus.uio.no/sisu/}{SiSU Scribe} \\href{http://www.jus.uio.no/sisu/}{http://www.jus.uio.no/sisu/} programmed in Ruby on Debian/Gnu/Linux by Copyright \\copyright Ralph Amissah, W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{\\includegraphics*[width=35pt]{#{dir.path.image_source_include}/sisu.png}}for #{sitename}. SiSU Scribe (sisu information structuring unit) produces Electronic Documents, i.e. it generates structured output for use in a number of file formats, including the pdf file produced here. - WOK - end end end __END__ diff --git a/lib/sisu/v5/texpdf_parts.rb b/lib/sisu/v5/texpdf_parts.rb new file mode 100644 index 00000000..d5daf004 --- /dev/null +++ b/lib/sisu/v5/texpdf_parts.rb @@ -0,0 +1,238 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: shared html parts + +=end +module SiSU_Parts_TeXpdf + require_relative 'generic_parts' # generic_parts.rb + include SiSU_Parts_Generic + def the_line_break + ' \\ ' + end + def url_decoration + def tex_open #'{\UseTextSymbol{OML}{<}}' + Dx[:url_o] + end + def tex_close #'{\UseTextSymbol{OML}{>}}' + Dx[:url_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + def the_font + def set_fonts + 'verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' + end + self + end + class TeX + def initialize(papersize='') + @papersize=papersize + end + def a4 + def portrait + def w + 160 + end + def h + 228 + end + def img_px + 450 + end + self + end + def landscape + def w + 238 + end + def h + 160 + end + def img_px + 300 + end + self + end + self + end + def letter + def portrait + def w + 166 + end + def h + 212 + end + def img_px + 468 + end + self + end + def landscape + def w + 226 + end + def h + 166 + end + def img_px + 290 + end + self + end + self + end + def legal + def portrait + def w + 168 + end + def h + 286 + end + def img_px + 474 + end + self + end + def landscape + def w + 296 + end + def h + 166 + end + def img_px + 420 + end + self + end + self + end + def b5 + def portrait + def w + 140 + end + def h + 204 + end + def img_px + 356 + end + self + end + def landscape + def w + 200 + end + def h + 130 + end + def img_px + 260 + end + self + end + self + end + def a5 + def portrait + def w + 112 + end + def h + 162 + end + def img_px + 280 + end + self + end + def landscape + def w + 152 + end + def h + 100 + end + def img_px + 190 + end + self + end + self + end + def dimensions + case @papersize + when /a4/ then a4 + when /letter/ then letter + when /legal/ then legal + when /b5/ then b5 + when /a5/ then a5 + else a4 + end + end + end +end +__END__ diff --git a/lib/sisu/v5/txt_asciidoc.rb b/lib/sisu/v5/txt_asciidoc.rb index 89deca87..3545fcb0 100644 --- a/lib/sisu/v5/txt_asciidoc.rb +++ b/lib/sisu/v5/txt_asciidoc.rb @@ -62,9 +62,9 @@ module SiSU_Txt_AsciiDoc require_relative 'se' # se.rb include SiSU_Env require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb include SiSU_Param - include SiSU_Viz @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source @@ -126,14 +126,12 @@ module SiSU_Txt_AsciiDoc end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{the_text.url_open}\\1#{the_text.url_close}") dob.obj=dob.obj.gsub(/\s*#{Mx[:en_a_o]}([\d*+]+)\s+(.+?)#{Mx[:en_a_c]}/,' footnote:[note\1,\2]'). gsub(/\s*#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/,' footnote:[\1]') dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v5/txt_markdown.rb b/lib/sisu/v5/txt_markdown.rb index 440956be..9bbd85e4 100644 --- a/lib/sisu/v5/txt_markdown.rb +++ b/lib/sisu/v5/txt_markdown.rb @@ -62,9 +62,9 @@ module SiSU_Txt_Markdown require_relative 'se' # se.rb include SiSU_Env require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb include SiSU_Param - include SiSU_Viz @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source @@ -125,14 +125,12 @@ module SiSU_Txt_Markdown end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{the_text.url_open}\\1#{the_text.url_close}") extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v5/txt_plain.rb b/lib/sisu/v5/txt_plain.rb index 6233038f..08f32b2f 100644 --- a/lib/sisu/v5/txt_plain.rb +++ b/lib/sisu/v5/txt_plain.rb @@ -63,9 +63,9 @@ module SiSU_Txt_Plain require_relative 'se' # se.rb include SiSU_Env require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb include SiSU_Param - include SiSU_Viz @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source @@ -127,14 +127,12 @@ module SiSU_Txt_Plain end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{the_text.url_open}\\1#{the_text.url_close}") extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v5/txt_rst.rb b/lib/sisu/v5/txt_rst.rb index 1426f4b3..297a2457 100644 --- a/lib/sisu/v5/txt_rst.rb +++ b/lib/sisu/v5/txt_rst.rb @@ -62,9 +62,9 @@ module SiSU_Txt_rST require_relative 'se' # se.rb include SiSU_Env require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb include SiSU_Param - include SiSU_Viz @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source @@ -126,14 +126,12 @@ module SiSU_Txt_rST end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{the_text.url_open}\\1#{the_text.url_close}") extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v5/txt_shared.rb b/lib/sisu/v5/txt_shared.rb index faf4c9c6..30f54f5a 100644 --- a/lib/sisu/v5/txt_shared.rb +++ b/lib/sisu/v5/txt_shared.rb @@ -58,6 +58,7 @@ =end module SiSU_TextUtils + require_relative 'generic_parts' # generic_parts.rb class Wrap def initialize(para='',n_char_max=76,n_indent=0,n_hang=nil,post='') @para,@n_char_max,@n_indent,@post,=para,n_char_max,n_indent,post diff --git a/lib/sisu/v5/txt_textile.rb b/lib/sisu/v5/txt_textile.rb index cc4bf167..71268d96 100644 --- a/lib/sisu/v5/txt_textile.rb +++ b/lib/sisu/v5/txt_textile.rb @@ -62,12 +62,13 @@ module SiSU_Txt_Textile require_relative 'se' # se.rb include SiSU_Env require_relative 'shared_metadata' # shared_metadata.rb + require_relative 'generic_parts' # generic_parts.rb require_relative 'txt_shared' # txt_shared.rb include SiSU_Param - include SiSU_Viz @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' class Source + include SiSU_Parts_Generic def initialize(opt) @opt=opt unless @opt.fns =~/(.+?)\.(?:-|ssm\.)?sst$/ @@ -126,14 +127,12 @@ module SiSU_Txt_Textile end private class Scroll ]'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{the_text.url_open}\\1#{the_text.url_close}") extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v5/wikispeak.rb b/lib/sisu/v5/wikispeak.rb index 192e1cb7..c8bf1d53 100644 --- a/lib/sisu/v5/wikispeak.rb +++ b/lib/sisu/v5/wikispeak.rb @@ -62,9 +62,9 @@ module SiSU_Wikispeak require_relative 'se' # se.rb include SiSU_Env include SiSU_Param - include SiSU_Viz require_relative 'plaintext_format' # plaintext_format.rb include Format + require_relative 'html_parts' # html_parts.rb require_relative 'txt_shared' @@alt_id_count,@@alt_id_count,@@tablehead,@@number_of_cols=0,0,0,0 @@tablefoot='' @@ -109,7 +109,6 @@ module SiSU_Wikispeak class SplitTextObject / diff --git a/lib/sisu/v5/xhtml.rb b/lib/sisu/v5/xhtml.rb index 914648d9..2327ba30 100644 --- a/lib/sisu/v5/xhtml.rb +++ b/lib/sisu/v5/xhtml.rb @@ -58,8 +58,6 @@ ** Notes: tidy -xml scroll.xhtml >> index.tidy =end module SiSU_XHTML - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars require_relative 'se' # se.rb @@ -152,7 +150,6 @@ module SiSU_XHTML @@xml={ body: [], sisu: [], open: [], close: [], head: [] } def initialize(particulars) @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array - @vz=SiSU_Viz::Defaults.new @tab="\t" @trans=SiSU_XML_Munge::Trans.new(@md) @sys=SiSU_Env::SystemCall.new @@ -369,8 +366,6 @@ WOK format_text.scr_inden_ocn_e_no_paranum end end - if dob.obj !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ - end else # end dob.obj=dob.obj.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj diff --git a/lib/sisu/v5/xhtml_epub2.rb b/lib/sisu/v5/xhtml_epub2.rb index 794c9024..ceed3239 100644 --- a/lib/sisu/v5/xhtml_epub2.rb +++ b/lib/sisu/v5/xhtml_epub2.rb @@ -66,8 +66,6 @@ module SiSU_XHTML_EPUB2 end require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'xml_shared' # xml_shared.rb include SiSU_XML_Munge require_relative 'xhtml_table' # xhtml_table.rb @@ -161,7 +159,6 @@ module SiSU_XHTML_EPUB2 def initialize(particulars) @particulars=particulars @md,@env=particulars.md,particulars.env - @vz=SiSU_Viz::Defaults.new @env,@css=particulars.env,SiSU_Style::CSS.new end def directories @@ -213,7 +210,6 @@ module SiSU_XHTML_EPUB2 @@firstseg=nil def initialize(md=nil,data='') @md,@data=md,data - @vz=SiSU_Viz::Defaults.new @epub=SiSU_XHTML_EPUB2_Format::HeadInformation.new(@md) @tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md @make=SiSU_Env::ProcessingSettings.new(@md) @@ -645,7 +641,6 @@ module SiSU_XHTML_EPUB2 class ScrollHeadAndSegToc < Toc def initialize(md='',toc='',links_guide_toc='') @md,@toc,@links_guide_toc=md,toc,links_guide_toc - @vz=SiSU_Viz::Defaults.new end def in_common toc_shared=[] diff --git a/lib/sisu/v5/xhtml_epub2_concordance.rb b/lib/sisu/v5/xhtml_epub2_concordance.rb index 3484b1d8..02f47d5a 100644 --- a/lib/sisu/v5/xhtml_epub2_concordance.rb +++ b/lib/sisu/v5/xhtml_epub2_concordance.rb @@ -63,8 +63,7 @@ module SiSU_XHTML_EPUB2_Concordance include SiSU_Particulars require_relative 'se' # se.rb include SiSU_Env - require_relative 'defaults' # defaults.rb - include SiSU_Viz + require_relative 'xhtml_parts' # xhtml_parts.rb require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb include SiSU_XHTML_EPUB2_Format class Source @@ -101,13 +100,11 @@ module SiSU_XHTML_EPUB2_Concordance end private class DocTitle - include SiSU_Viz #revisit, both requires (html & xml_shared) needed for stand alone operation (sisu -w [filename]) require_relative 'xhtml_epub2' # xhtml_epub2.rb def initialize(particulars) @particulars,@md=particulars,particulars.md @data=SiSU_XHTML_EPUB2::Source::XHTML_Environment.new(particulars).tuned_file_instructions - @vz=SiSU_Viz::Defaults.new @fnb=@md.fnb @lex_button=%{
    SiSU home} @doc_details =<>#{credits}\n} # footer end end diff --git a/lib/sisu/v5/xhtml_epub2_format.rb b/lib/sisu/v5/xhtml_epub2_format.rb index 4004a446..bbd02a6d 100644 --- a/lib/sisu/v5/xhtml_epub2_format.rb +++ b/lib/sisu/v5/xhtml_epub2_format.rb @@ -58,7 +58,6 @@ =end module SiSU_XHTML_EPUB2_Format - include SiSU_Viz class ParagraphNumber def initialize(md,ocn) @md,@ocn=md,ocn.to_s @@ -1235,6 +1234,7 @@ module SiSU_XHTML_EPUB2_Format end end module SanitizeXML + require_relative 'xhtml_parts' # xhtml_parts.rb def self.xml(x) if x.is_a?(String) x=x.gsub(/ /,' ') if Ep[:alt]==:on @@ -1249,12 +1249,10 @@ module SiSU_XHTML_EPUB2_Format end end class HeadInformation - include SiSU_Viz - attr_reader :md,:rdf,:vz + attr_reader :md,:rdf def initialize(md) @md=md # DublinCore 1 - title - @vz=SiSU_Viz::Defaults.new @css=SiSU_Env::CSS_Stylesheet.new(md) @seg_name_xhtml=(SiSU_XHTML_EPUB2::Source::Seg.new.seg_name_xhtml || []) @seg_name_xhtml_tracker=(SiSU_XHTML_EPUB2::Source::Seg.new.seg_name_xhtml_tracker || []) @@ -1722,15 +1720,16 @@ output_epub_cont_seg.close end def table_close %{ -#{@vz.table_close}} +#{the_table_close}} end def xhtml_close - %{#{@vz.credits_sisu_epub} + %{#{SiSU_Proj_XHTML::Bits.new.credits_sisu_epub} } end end class HeadToc < HeadInformation + include SiSU_Parts_XHTML def initialize(md) super(md) @md=md @@ -1757,16 +1756,16 @@ output_epub_cont_seg.close end def concordance if @md.concord_make - %{#{@vz.margin_css} + %{#{the_margin.css}

    Concordance

    -#{@vz.table_close}} +#{the_table_close}} else - %{#{@vz.margin_css} -#{@vz.table_close}} + %{#{the_margin.css} +#{the_table_close}} end end def links_guide_open(type='horizontal') @@ -1787,40 +1786,40 @@ output_epub_cont_seg.close %{

    Prefix: #{@md.prefix_b}} end def make_seg - concord=concordance_link(@vz.nav_txt_concordance) + concord=concordance_link(the_nav.txt_concordance) %{ +
    - #{@vz.nav_txt_toc_link} + #{the_nav.txt_toc_link} #{concord} -#{@vz.table_close}} +#{the_table_close}} end def manifest #check structure - manifest=manifest_link(@vz.nav_txt_manifest) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} + manifest=manifest_link(the_nav.txt_manifest) + %{#{the_margin.txt_3} + #{the_font.paragraph_font_small} #{manifest} -#{@vz.table_close}} +#{the_table_close}} end def concordance #check structure - concord=concordance_link(@vz.nav_txt_concordance) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} + concord=concordance_link(the_nav.txt_concordance) + %{#{the_margin.txt_3} + #{the_font.paragraph_font_small} #{concord} -#{@vz.table_close}} +#{the_table_close}} end def metadata - %{#{@vz.margin_css} + %{#{the_margin.css}

    MetaData

    -#{@vz.table_close}} +#{the_table_close}} end end class HeadSeg < HeadInformation @@ -1850,8 +1849,8 @@ output_epub_cont_seg.close super(md) end def toc_owner_details - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} + %{#{the_margin.txt_3} +#{the_font.paragraph_font_small} Owner Details @@ -1859,11 +1858,11 @@ output_epub_cont_seg.close -#{@vz.table_close}} +#{the_table_close}} end end class FormatTextObject - @vz=SiSU_Viz::Defaults.new + include SiSU_Parts_XHTML attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o @@ -1907,7 +1906,6 @@ output_epub_cont_seg.close @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') end @p_num=ParagraphNumber.new(@md,@ocn) - @vz=SiSU_Viz::Defaults.new end def nametags_seg(dob) #FIX tags='' @@ -2084,13 +2082,13 @@ output_epub_cont_seg.close end end def bold_para - %{#{@vz.margin_txt_0} + %{#{the_margin.txt_0}

    #{@txt}

    -#{@vz.margin_num_css} +#{the_margin.num_css} #{$ep[:hsp]*3} -#{@vz.table_close}} +#{the_table_close}} end def bold_heading #unused @txt=@txt.gsub(/[1-9]~\S+/,''). @@ -2098,9 +2096,9 @@ output_epub_cont_seg.close %{

    #{@txt}

    -#{@vz.margin_num_css} +#{the_margin.num_css} #{$ep[:hsp]*3} -#{@vz.table_close}} +#{the_table_close}} end def toc_head_copy_at @txt=SanitizeXML.xml(@txt) @@ -2122,7 +2120,6 @@ output_epub_cont_seg.close class FormatScroll < FormatTextObject def initialize(md,txt) super(md,txt) - @vz=SiSU_Viz::Defaults.new end end class FormatSeg < FormatTextObject @@ -2206,7 +2203,7 @@ output_epub_cont_seg.close

    #{@txt}

    -#{@vz.table_close}} +#{the_table_close}} end def navigation_heading5 %{

    diff --git a/lib/sisu/v5/xhtml_epub2_segments.rb b/lib/sisu/v5/xhtml_epub2_segments.rb index 1abc2d1b..ea3e27fa 100644 --- a/lib/sisu/v5/xhtml_epub2_segments.rb +++ b/lib/sisu/v5/xhtml_epub2_segments.rb @@ -131,7 +131,6 @@ WOK attr_reader :seg_name_xhtml,:seg_name_xhtml_tracker def initialize(md='',data='') @md,@data=md,data - @vz=SiSU_Viz::Defaults.new @seg_name_xhtml=@@seg_name_xhtml || nil @seg_name_xhtml_tracker=@@tracker || nil @make=SiSU_Env::ProcessingSettings.new(@md) if @md diff --git a/lib/sisu/v5/xhtml_epub2_tune.rb b/lib/sisu/v5/xhtml_epub2_tune.rb index 7376212a..b4142e2e 100644 --- a/lib/sisu/v5/xhtml_epub2_tune.rb +++ b/lib/sisu/v5/xhtml_epub2_tune.rb @@ -61,6 +61,7 @@ require_relative 'dp' # dp.rb module SiSU_XHTML_EPUB2_Tune require_relative 'se' # se.rb include SiSU_Env; include SiSU_Screen + require_relative 'xhtml_parts' # xhtml_parts.rb require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb #watch @@line_mode='' @@endnote_array=[] @@ -109,12 +110,11 @@ module SiSU_XHTML_EPUB2_Tune end end class Tune + include SiSU_Parts_XHTML def initialize(data,md) @data,@md=data,md - @vz=SiSU_Viz::Defaults.new @sys=SiSU_Env::SystemCall.new @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration end def songsheet begin @@ -261,18 +261,18 @@ module SiSU_XHTML_EPUB2_Tune dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/, %{\n

    \\3
    \n}) end - dob.obj=dob.obj.gsub(/!pick/,%{stellar}). - gsub(/!new/,%{#{$ep[:hsp]}new}). + dob.obj=dob.obj.gsub(/!pick/,%{stellar}). + gsub(/!new/,%{#{$ep[:hsp]}new}). gsub(/<:h(.{1,7}?)>/,'\1'). gsub(/<:to(\d{1,7}?)>/,%{to#{$ep[:hsp]}\{#{$ep[:hsp]}\\1#{$ep[:hsp]}\} }). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). #http ftp matches escaped, no decoration - gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). - gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). + gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration if dob.obj =~/..\/\S+/ \ and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ dob.obj=dob.obj.gsub(/(\.\.\/\S+)/,'\1') end - dob.obj=dob.obj.gsub(//m,'>') end diff --git a/lib/sisu/v5/xhtml_parts.rb b/lib/sisu/v5/xhtml_parts.rb new file mode 100644 index 00000000..7ae6cfc1 --- /dev/null +++ b/lib/sisu/v5/xhtml_parts.rb @@ -0,0 +1,186 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: shared html parts + +=end +module SiSU_Parts_XHTML + require_relative 'generic_parts' # generic_parts.rb + include SiSU_Parts_Generic + def the_line_break + '
    ' + end + def the_table_close + '
    ' + end + def the_url + def home + 'http://www.sisudoc.org/' # used in pdf header + end + def site #used as stub... where there are subdirectories and is different from home + home + end + self + end + def the_url_decoration + def xml_open #'<' + Dx[:url_o] + end + def xml_close #'>' + Dx[:url_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + def the_margin + def txt_0 + %{ +
    +} + end + def txt_1 + %{ +
    } + end + def txt_2 + %{ + +
    +} + end + def txt_3 + %{ + +
    +} + end + def css + ' + +} else %{} end diff --git a/lib/sisu/v5/xml_dom.rb b/lib/sisu/v5/xml_dom.rb index 215b6d61..58fd4b64 100644 --- a/lib/sisu/v5/xml_dom.rb +++ b/lib/sisu/v5/xml_dom.rb @@ -58,8 +58,6 @@ ** Notes: tidy -xml dom.xml >> index.tidy =end module SiSU_XML_DOM - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars require_relative 'se' # se.rb @@ -167,7 +165,6 @@ module SiSU_XML_DOM def initialize(particulars) @env, @md, @ao_arr= particulars.env,particulars.md,particulars.ao_array - @vz=SiSU_Viz::Defaults.new @trans=SiSU_XML_Munge::Trans.new(@md) @sys=SiSU_Env::SystemCall.new end @@ -519,8 +516,6 @@ WOK format_text.scr_inden_ocn_e_no_paranum end end - if dob.obj !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ - end else # end dob.obj=dob.obj.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj diff --git a/lib/sisu/v5/xml_format.rb b/lib/sisu/v5/xml_format.rb index 7959696c..0b319683 100644 --- a/lib/sisu/v5/xml_format.rb +++ b/lib/sisu/v5/xml_format.rb @@ -60,8 +60,8 @@ =end module SiSU_XML_Format require_relative 'dp' # dp.rb - include SiSU_Param - include SiSU_Viz + require_relative 'xml_parts' # xml_parts.rb + include SiSU_Param class ParagraphNumber def initialize(md,paranum) @md=md @@ -86,6 +86,7 @@ module SiSU_XML_Format end end class HeadInformation + include SiSU_Parts_XML def initialize #dc rdf @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords='' @md=@@md @@ -197,7 +198,6 @@ module SiSU_XML_Format if @md.rights.copyright.all # possibly redundant see dc.rights @owner=%{\n} if @md.owner @keywords=%{\n} if @md.keywords - @vz=SiSU_Viz::Defaults.new #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php @index='index' end def meta_content_clean(content='') @@ -279,6 +279,7 @@ WOK end end class FormatTextObject + include SiSU_Parts_XML attr_accessor :md,:txt,:format,:paranum,:p_num,:para_id,:headname,:font def initialize(md,dob) @md,@dob=md,dob @@ -292,7 +293,6 @@ WOK @lnk_url=@lnk_url.gsub(rgx,'') if @lnk_url =~rgx rgx=/~\{\d+\s+(.+?)\}~/ @lnk_url=@lnk_url.gsub(rgx,'\1') if @lnk_url =~rgx - @vz=SiSU_Viz::Defaults.new end def scr_endnote_body "#{@txt} " @@ -368,13 +368,12 @@ WOK end end class HeadInformation - include SiSU_Viz + include SiSU_Parts_XML attr_reader :md,:sfx,:pdf,:rdf,:vz def initialize(md) @md=md @rdf=SiSU_XML_Tags::RDF.new(md) # DublinCore 1 - title - @vz=SiSU_Viz::Defaults.new @stylesheet=SiSU_Style::CSS_HeadInfo.new(md).stylesheet @seg_name_html=(SiSU_HTML::Source::Seg.new.seg_name_html || []) @seg_name_html_tracker=(SiSU_HTML::Source::Seg.new.seg_name_html_tracker || []) @@ -389,7 +388,7 @@ WOK end def table_close %{ -#{@vz.table_close}} +#{the_table_close}} end def html_close #moved %{ @@ -398,597 +397,8 @@ WOK end class XML end - class HeadToc < HeadInformation - def initialize(md) - super(md) - @md=md - @tocband_scroll,@tocband_segtoc=make_scroll,make_seg - end - def scroll_head_navigation_band - pdf=if @md.programs[:pdf] - < - #{make_seg_scroll_pdf} - -WOK - else '' - end - %{
    ' + end + def num_css + ' ' + end + self + end + def the_font + def set_fonts + 'verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' + #'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman' + end + def set_small + 'size="3"' + end + def set_tiny + 'size="2"' + end + def paragraph_font_tiny + %{} + end + def paragraph_font_small + %{} + end + self + end + def the_nav + def txt_concordance + %{ +   A-Z  + } + end + def txt_toc_link + %{ +   toc  + } + end + def txt_manifest + #{png_manifest} document manifest + %{ + [ document manifest ] + } + end + def txt_concordance + %{ +   A-Z  + } + end + self + end +end +module SiSU_Proj_XHTML + require_relative 'se' # se.rb + include SiSU_Env + class Bits + include SiSU_Parts_HTML + def initialize + @v=SiSU_Env::InfoVersion.instance.get_version + end + def credits_sisu_epub + %{
    +

    EPUB generated by #{@v[:project]} v#{@v[:version]}, GPL3

    +
    } + '' + end + end +end +__END__ diff --git a/lib/sisu/v5/xhtml_shared.rb b/lib/sisu/v5/xhtml_shared.rb index 677d7a47..0e7fcf3c 100644 --- a/lib/sisu/v5/xhtml_shared.rb +++ b/lib/sisu/v5/xhtml_shared.rb @@ -58,7 +58,6 @@ =end module SiSU_XHTML_Shared - require_relative 'defaults' # defaults.rb require_relative 'xhtml_table' # xhtml_table.rb class TableXHTML < SiSU_XHTML_Table::TableXHTML end diff --git a/lib/sisu/v5/xhtml_table.rb b/lib/sisu/v5/xhtml_table.rb index 33e4f48e..5e6b2c57 100644 --- a/lib/sisu/v5/xhtml_table.rb +++ b/lib/sisu/v5/xhtml_table.rb @@ -58,12 +58,13 @@ =end module SiSU_XHTML_Table - require_relative 'defaults' # defaults.rb + require_relative 'xhtml_parts' # xhtml_parts.rb class TableXHTML + include SiSU_Parts_XHTML @@tablehead=0 @@tablefoot=[] #watch def initialize(table) - @table_obj,@vz=table,SiSU_Viz::Defaults.new + @table_obj=table end def table table_obj=@table_obj @@ -80,7 +81,7 @@ module SiSU_XHTML_Table trc,nc=[],0 table_row_with_columns.each do |c| c=c.gsub(/^~$/,''). # tilde / empty cell - gsub(/<:br>/,'
    ') + gsub(/<:br>/,the_line_break) trc <<= if table_obj.head_ and nr==0; %{
    #{c}#{c}
    -#{pdf} -
    - #{@vz.banner_band} - -   -#{@vz.table_close} -

    } - end - def concordance_navigation_band(type='') - if type=~/pdf/ - @tocband_concordance=make_concordance - end - %{ - - -
    - #{@vz.banner_band} - - #{@tocband_concordance} - -   - #{@vz.png_nav_toc} -   -#{@vz.table_close} -

    } - end - def seg_head_navigation_band(type='') - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{ - #{@vz.png_nav_nxt} - } if @md.firstseg =~/\S+/ - %{ - - - -} - %{
    - #{@vz.banner_band} - - #{@tocband_segtoc} - -  #{firstseg}  -#{@vz.table_close} -

    } - end - def seg_head_navigation_band_bottom(type='') - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{ - #{@vz.png_nav_nxt} - } if @md.firstseg =~/\S+/ - %{ - - - -} - %{
    -   - - #{@tocband_segtoc} - -  #{firstseg}  -#{@vz.table_close} -

    } - end - def make_seg_scroll_pdf - wgt=Widget.new(@md) - scroll=%{

    - #{@vz.nav_txt_doc_link} -
    - - #{scroll} - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.pdf}#{wgt.odf} - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -
    } - end - def make_scroll_seg_pdf - seg='' - wgt=Widget.new(@md) - seg=%{

    - #{@vz.nav_txt_toc_link} -
    - - #{seg} - #{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -
    - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -
    } - end - def make_concordance - wgt=Widget.new(@md) - %{ - - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -
    - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -
    } - end - def head - %{#{doc_type} - - - #{@md.html_title} - - -#{@rdf.rdftoc} -#{@rdf.metatag_html} -#{@stylesheet.css_head} - -#{@vz.color_body} - - -} - end - def links_guide_open(type='horizontal') - if type=='vertical'; links_guide_vertical_open - else links_guide_horizontal_open - end - end - def links_guide_close #(type='horizontal') - insert='' - insert=if @md.sfx_src =~/s?/ - link='http://sisudoc.org' #get from defaults - url='sisudoc.org' - insert= %{ -

  • - - #{url} - -
  • - - -} - end - %{ #{insert} -} - end - def prefix_a - end - def rights - copyright=meta_content_clean(@md.rights.copyright.all) - rights=copyright(/^\s*Copyright\s+\(C\)/,'Copyright © ') - %{

    Rights: #{rights}

    -

    } - end - def prefix_b - %{

    Prefix: #{@md.prefix_b}

    } - end - def scroll_head_title_banner_open - %{

    -#{@md.icon} -
    -#{@vz.banner_instrument_cover_band_scr}} - end - def seg_head_title_banner_open - %{
    - #{@md.icon} -
    -#{@vz.banner_instrument_cover_band_seg}} - end - def make_scroll - concord=concordance_link(@vz.nav_txt_concordance) - %{ - -
    - #{@vz.nav_txt_doc_link} - - #{concord} -#{@vz.table_close}} - end - def make_seg - concord=concordance_link(@vz.nav_txt_concordance) - %{ - -
    - #{@vz.nav_txt_toc_link} - - - #{concord} -#{@vz.table_close}} - end - def manifest #check structure - manifest=manifest_link(@vz.nav_txt_manifest) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} - #{manifest} - -#{@vz.table_close}} - end - def concordance #check structure - concord=concordance_link(@vz.nav_txt_concordance) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} - #{concord} - -#{@vz.table_close}} - end - def metadata - %{#{@vz.margin_css} -

    - - MetaData - -

    -#{@vz.table_close}} - end - def seg_tail - %{ -
    -

     

    - - - -
    - #{@vz.banner_band} - -
    - #{@tocband_segtoc} -
    -
    -

     

    -#{@vz.credits_splash} -#{@vz.credits_sisu} - - - - - - -
    - - -} - end - def scroll_tail #debug - nav=scroll_head_navigation_band - %{ -
    -#{nav} -#{@vz.credits_splash} -#{@vz.credits_sisu} - - - - - - -
    - - -} - end - def seg_navigation_tail #this is a bug area, look up and "tidy" - #nav=scroll_head_navigation_band - %{ -
    -

     

    -#{@vz.credits_splash} -#{@vz.credits_sisu} - - - - - - -
    - - -} - end - end - class HeadSeg < HeadInformation - def initialize(md) #(md='') - super(md) - end - def head - %{#{doc_type} - - - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - - -#{@rdf.rdfseg} -#{@rdf.metatag_html} -#{@vz.font_css_table_file} - -#{@vz.color_body} - - -} - end - def title_banner(title,subtitle,creator) - end - def dot_control_pre_next - %{ - - -} - pre=%{} if f_pre==true - nxt=%{} if f_nxt==true - %{
    - - #{@vz.png_nav_dot_pre} - - - - #{@vz.png_nav_dot_toc} - - - - #{@vz.png_nav_dot_nxt} - -#{@vz.table_close}} - end - def toc_nav(f_pre=false,f_nxt=false,use=1) - pre=nxt='' - toc=%{ - - #{@vz.png_nav_toc} - - - - #{@vz.png_nav_pre} - - - - #{@vz.png_nav_nxt} - -
    - -#{pre} -#{toc} -#{nxt} -
    -#{@vz.table_close}} - end - def toc_next2 - toc_nav(false,true).dup - end - def toc_pre_next2 - toc_nav(true,true).dup - end - def toc_pre2 - toc_nav(true,false,2).dup - end - def doc_types #used in seg_nav_band ### - wgt=Widget.new(@md) - #dir=SiSU_Env::InfoEnv.new(@md.fns) - if @md.concord_make - %{ - - - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -
    - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -
    } - else - %{ - - - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -
    - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -
    } - end - end - def navigation_table - %{ -
    - - - } - end - def navigation_table1 - %{ -
    - } - end - def navigation_table2 - %{ -
    - } - end - def header_advert_local_1 - dir=SiSU_Env::InfoEnv.new(@fns) - %{
    - -
    - - #{@md.ad_alt} - -

    -#{@vz.table_close} -} - end - def header_advert_local_2 - dir=SiSU_Env::InfoEnv.new(@fns) - %{

    - -
    - - #{@md.ad_alt} - -

    -#{@vz.table_close} -} - end - def header_advert_external - dir=SiSU_Env::InfoEnv.new(@fns) - %{

    - -
    - - #{@md.ad_alt} - -

    -#{@vz.table_close} -} - end - def credit - %{ -

    -#{@vz.credits_splash} -#{@vz.credits_sisu} - - - - - - -
    -} - end - def navigation_band(segtocband,seg_table_top_control) #change name to navigaion_band_banner - %{ - - - -
    -#{@vz.banner_band} - - #{doc_types} - - #{segtocband} -
    -#{seg_table_top_control}} - end - def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless - %{ -
    - - - -
    - #{doc_types} - - #{segtocband} -
    - #{seg_table_top_control} -
    -} - end - def endnote_mark -%{ -

    -


    -

    } - end - def endnote_section_open -%{ -
    -} - end - def endnote_section_close -%{ -
    -} #revisit - end - def head - %{#{doc_type} - - - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - - -#{@rdf.rdfseg} -#{@rdf.metatag_html} -#{@stylesheet.css_head} - -#{@vz.color_body} - - -} - end - def title_banner(title,subtitle,creator) - %{ -
    -

    - #{title} -

    -

    - #{subtitle} -

    -

    - #{creator} -

    -

    - copy @ - - #{@vz.txt_home} - -

    -
    -} - end - end - class HeadScroll < HeadToc - def initialize(md) #(md='') - super(md) - end - def toc_owner_details - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} - - Owner Details - -     - - - -#{@vz.table_close}} - end - def table - %{ - -
    - -#{@vz.paragraph_txt}} - end - def table1 - %{ -
    -#{@vz.paragraph_txt}} - end - def table2 - %{ -
    -#{@vz.paragraph_txt}} - end - end class FormatTextObject - @vz=SiSU_Viz::Defaults.new + include SiSU_Parts_XML attr_accessor :md,:dob,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o @@ -1034,7 +444,6 @@ WOK end end @dob=t_o if defined? t_o.is - @vz=SiSU_Viz::Defaults.new end def endnote_body %{ @@ -1183,13 +592,13 @@ WOK end end def bold_para - %{#{@vz.margin_txt_0} + %{#{the_margin.txt_0}

    #{@txt}

    -#{@vz.margin_num_css} +#{the_margin.num_css}     -#{@vz.table_close}} +#{the_table_close}} end def bold_header @txt=@txt.gsub(/[1-9]~(\S+)/,''). @@ -1197,9 +606,9 @@ WOK %{

    #{@txt}

    -#{@vz.margin_num_css} +#{the_margin.num_css}     -#{@vz.table_close}} +#{the_table_close}} end def toc_head_copy_at %{

    #{@txt}

    \n} @@ -1215,9 +624,9 @@ WOK end end class FormatScroll < FormatTextObject + include SiSU_Parts_XML def initialize(md,txt) super(md,txt) - @vz=SiSU_Viz::Defaults.new end end class FormatSeg < FormatTextObject @@ -1240,11 +649,11 @@ WOK
    - + #{@txt}

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

    @@ -1252,11 +661,11 @@ WOK

    - + #{@txt}

    -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev4 %{ @@ -1266,7 +675,7 @@ WOK

    #{@txt}

    -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev5 end @@ -1344,7 +753,7 @@ WOK

    #{@txt}

    -#{@vz.table_close}} +#{the_table_close}} end def navigation_header5 %{

    diff --git a/lib/sisu/v5/xml_odf_odt.rb b/lib/sisu/v5/xml_odf_odt.rb index e120d7b9..b2957e54 100644 --- a/lib/sisu/v5/xml_odf_odt.rb +++ b/lib/sisu/v5/xml_odf_odt.rb @@ -63,7 +63,7 @@ module SiSU_XML_ODF_ODT require_relative 'ao' # ao.rb require_relative 'se' # se.rb include SiSU_Env - include SiSU_Viz + require_relative 'xml_parts' # xml_parts.rb require_relative 'xml_odf_odt_format' # xml_odf_odt_format.rb include SiSU_XML_ODF_ODT_Format require_relative 'shared_metadata' # shared_metadata.rb @@ -128,8 +128,8 @@ module SiSU_XML_ODF_ODT end private class Scroll \1'). #http ftp matches escaped, no decoration gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration dob.obj= if dob.is==:para \ and dob.indent.to_s =~/[0-9]/ \ and dob.indent == dob.hang @@ -441,7 +439,7 @@ module SiSU_XML_ODF_ODT end def footnote_urls(str) str=str.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) str=text_link(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/ str=text_link_relative(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/ str @@ -516,9 +514,9 @@ module SiSU_XML_ODF_ODT dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1'). #http ftp matches escaped, no decoration gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i| set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : '' parablock=group_clean(parablock) @@ -541,9 +539,9 @@ module SiSU_XML_ODF_ODT dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1'). #http ftp matches escaped, no decoration gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}) #http ftp matches with decoration dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i| set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : '' parablock=group_clean(parablock) diff --git a/lib/sisu/v5/xml_odf_odt_format.rb b/lib/sisu/v5/xml_odf_odt_format.rb index 03db3f9d..64bf1315 100644 --- a/lib/sisu/v5/xml_odf_odt_format.rb +++ b/lib/sisu/v5/xml_odf_odt_format.rb @@ -60,7 +60,6 @@ module SiSU_XML_ODF_ODT_Format require_relative 'dp' # dp.rb include SiSU_Param - include SiSU_Viz class ParagraphNumber def initialize(make,paranum) @make=make @@ -146,7 +145,6 @@ module SiSU_XML_ODF_ODT_Format end rgx=/#{Mx[:en_a_o]}\d+\s+(.+?)#{Mx[:en_a_c]}/ @txt=@txt.gsub(rgx,'\1') if @txt =~rgx - @vz=SiSU_Viz::Defaults.new end def scr_endnote_body "#{@txt} " @@ -173,7 +171,6 @@ module SiSU_XML_ODF_ODT_Format def initialize(md,dob,p_num) @md,@dob,@p_num=md,dob,p_num @txt=dob.obj - @vz=SiSU_Viz::Defaults.new if @md.fns != @@fns @@table_counter=0 @@fns=@md.fns diff --git a/lib/sisu/v5/xml_parts.rb b/lib/sisu/v5/xml_parts.rb new file mode 100644 index 00000000..c08fc05c --- /dev/null +++ b/lib/sisu/v5/xml_parts.rb @@ -0,0 +1,194 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Git + + + + * Ralph Amissah + + + + ** Description: shared html parts + +=end +module SiSU_Parts_XML + require_relative 'generic_parts' # generic_parts.rb + include SiSU_Parts_Generic + def the_line_break + '
    ' + end + def the_table_close + ' +

    ' + end + def the_url_decoration + def xml_open #'<' + Dx[:url_o] + end + def xml_close #'>' + Dx[:url_c] + end + def txt_open + '<' + end + def txt_close + '>' + end + self + end + def the_color + def white + '#ffffff' + end + def black + '#000000' + end + def grey_pale + '#eeeeee' + end + def grey_medium + '#cccccc' + end + def grey + '#999999' + end + def blue_ink + '#003399' + end + def blue_tinge + '#e3ecef' + end + def yellow_light + '#fff3b6' + end + def table1 + 'ffffcc' + end + def table2 + 'c0d0f0' + end + def band1 + %{"#{white}"} + end + def band2 + %{"#{white}"} + end + self + end + def the_png + def _url_path_image_base #used for html image display + "#{Xx[:html_relative2]}_sisu/image" + end + def ico + %{ } + end + def png_home + %{#{the_text.home} -->} + end + def png_home_button + rel=@dir.path_rel_links.html_scroll_2 + %{#{the_text.home} -->} + end + self + end + def the_font + def set_fonts + 'verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman' + #'verdana, arial, georgia, tahoma, sans-serif, helvetica, "times new roman", times, roman' + end + def set_face + %{face="#{set_fonts}"} + end + #def set_color + # 'color="#000000"' + #end + #def set_size_endnote + # 'size="3"' + #end + #def set_small + # 'size="3"' + #end + #def set_tiny + # 'size="2"' + #end + #def paragraph_font_tiny + # %{} + #end + #def paragraph_font_small + # %{} + #end + self + end + def the_banner + def home_button_only + %{ + #{the_png.png_home_button} + } + end + def banner_band + %{ + + +
    + + #{the_png.png_home} + + +#{the_table_close}} + end + self + end +end +module SiSU_Proj_XML + require_relative 'html_parts' # html_parts.rb + require_relative 'se' # se.rb + include SiSU_Env + class Bits < SiSU_Proj_HTML::Bits + end +end +__END__ diff --git a/lib/sisu/v5/xml_sax.rb b/lib/sisu/v5/xml_sax.rb index 17ff4327..87205488 100644 --- a/lib/sisu/v5/xml_sax.rb +++ b/lib/sisu/v5/xml_sax.rb @@ -58,8 +58,6 @@ =end module SiSU_XML_SAX - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'se_hub_particulars' # se_hub_particulars.rb include SiSU_Particulars require_relative 'se' # se.rb @@ -168,7 +166,6 @@ module SiSU_XML_SAX def initialize(particulars) @env, @md, @ao_arr= particulars.env,particulars.md,particulars.ao_array - @vz=SiSU_Viz::Defaults.new @trans=SiSU_XML_Munge::Trans.new(@md) @sys=SiSU_Env::SystemCall.new end diff --git a/lib/sisu/v5/xml_shared.rb b/lib/sisu/v5/xml_shared.rb index 2a8ac27e..a5f5e114 100644 --- a/lib/sisu/v5/xml_shared.rb +++ b/lib/sisu/v5/xml_shared.rb @@ -57,13 +57,13 @@ ** Description: common file for xml generation =end module SiSU_XML_Munge + require_relative 'xml_parts' # xml_parts.rb class Trans - require_relative 'defaults' # defaults.rb + include SiSU_Parts_XML def initialize(md) @md=md @sys=SiSU_Env::SystemCall.new @dir=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration if @md.sem_tag @ab ||=semantic_tags.default end @@ -297,7 +297,7 @@ module SiSU_XML_Munge gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, '\1'). #watch, compare html_tune gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1') #escaped urls not linked, deal with later else @@ -307,7 +307,7 @@ module SiSU_XML_Munge dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ') end dob.obj=dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}\\1#{the_url_decoration.xml_close}}). gsub(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}"). gsub(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}"). gsub(/ |#{Mx[:nbsp]}/m,' '). @@ -470,8 +470,8 @@ end module SiSU_XML_Tags #Format require_relative 'dp' # dp.rb include SiSU_Param - include SiSU_Viz class RDF + include SiSU_Parts_XML def initialize(md='',seg_name=[],tracker=0) @full_title=@subtitle=@author=@subject=@description=@publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@copyright=@owner=@keywords='' @md=md @@ -595,7 +595,6 @@ module SiSU_XML_Tags #Format end content=meta_content_clean(@md.keywords) @keywords=%{ \n} if @md.keywords - @vz=SiSU_Viz::Defaults.new end def meta_content_clean(content='') content=if not content.nil? @@ -654,8 +653,8 @@ WOK def metatag_html #values strung together, because some empty, and resulting output (line breaks) is much better </,1] @@ -124,7 +122,6 @@ module SiSU_Tables @@tablefoot=[] #watch def initialize(table,id='') @table_obj,@id=table,id - @vz=SiSU_Viz::Defaults.new end def spaces Ax[:spaces] @@ -181,7 +178,14 @@ module SiSU_Tables @@tablehead=0 @@tablefoot=[] def initialize(one) - @one,@parablock,@vz=one,one,SiSU_Viz::Defaults.new + @one,@parablock=one,one + end + def table_close + '
    ' + end + def margin_numless + '
    ' end def table_head(inf) %{ @@ -193,7 +197,7 @@ module SiSU_Tables
    } end def table_end(tablefoot='') - %{
    #{@vz.margin_numless}#{@vz.margin_numless} #{@vz.table_close} + %{
    #{the_margin_numless}#{the_margin_numless} #{the_table_close} #{tablefoot}} end def table_row(inf,h=false) @@ -216,13 +220,15 @@ module SiSU_Tables @@tablefoot << m if m @parablock=@parablock.gsub(//,'') @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u - if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head($1) + if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u + @parablock=table_head($1) end if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock=table_end + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @parablock=table_end end end if @@tablehead==1 -- cgit v1.2.3