diff options
Diffstat (limited to 'lib')
143 files changed, 3427 insertions, 5304 deletions
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/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 <link rel="shortcut icon" href="#{@image_src}/rb7.ico" /> <link href="../_sisu/css/html.css" rel="stylesheet"> </head> - <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en"> + <body lang="en" xml:lang="en"> <table summary="band" border="0" cellpadding="3" cellspacing="0"> <tr><td width="20%"> <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0"> - <tr><td align="left" bgcolor="#ffffff"> + <tr><td align="left"> <br /><a href="http://sisudoc.org/" target="_top"> <b>SiSU</b> </a> @@ -543,11 +543,11 @@ module SiSU_CGI_SQL def tail <<-'WOK' <br /><hr /><br /> -<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="2" border="0"> +<table summary="SiSU summary" cellpadding="2" border="0"> <!-- widget sisu --> <tr><td valign="top" width="10%"> <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0"> - <tr><td align="left" bgcolor="#ffffff"> + <tr><td align="left"> <br /><a href="http://sisudoc.org/" target="_top"> <b>SiSU</b> </a> 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/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 <<WOK /* SiSU table output stylesheet */ body { color: black; - background: #{@vz.color_white}; + background: #{the_color.white}; } p { display: block; line-height: 1.5; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; } a:link { - color: #{@vz.color_blue_ink}; + color: #{the_color.blue_ink}; text-decoration: none; } a:visited { - color: #{@vz.color_blue_ink}; + color: #{the_color.blue_ink}; text-decoration: none; - /* background-color: #{@vz.color_blue_tinge}; */ + /* background-color: #{the_color.blue_tinge}; */ } a:hover { - color: #{@vz.color_black}; + color: #{the_color.black}; text-decoration: underline; - background-color: #{@vz.color_yellow_light}; + background-color: #{the_color.yellow_light}; } a:active { - color: #{@vz.color_blue_ink}; + color: #{the_color.blue_ink}; text-decoration: underline; } WOK @@ -1679,14 +1677,14 @@ WOK end def homepage #stylesheet for index, home page <<WOK - body {color: black; background: #{@vz.color_white}; margin:10px 10px 0px 10px; padding:0px;} + body {color: black; background: #{the_color.white}; margin:10px 10px 0px 10px; padding:0px;} p { line-height: 1.5 } - a:link {color: #{@vz.color_blue_ink}; text-decoration: none; } - a:visited {color: #{@vz.color_blue_ink}; text-decoration: none; } - a:hover {color: #{@vz.color_black}; text-decoration: underline; background-color: #{@vz.color_yellow_light};} - a:active {color: #{@vz.color_blue_ink}; text-decoration: underline;} + a:link {color: #{the_color.blue_ink}; text-decoration: none; } + a:visited {color: #{the_color.blue_ink}; text-decoration: none; } + a:hover {color: #{the_color.black}; text-decoration: underline; background-color: #{the_color.yellow_light};} + a:active {color: #{the_color.blue_ink}; text-decoration: underline;} #banner { - background:#{@vz.color_white}; + background:#{the_color.white}; } #column_left { width:25%; @@ -1697,7 +1695,7 @@ WOK #column_center { width:55%; float:left; - background:#{@vz.color_white}; + background:#{the_color.white}; padding-bottom:10px; } #column_right { @@ -1707,7 +1705,7 @@ WOK padding-bottom:10px; } p,h1,pre { - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; margin:0px 10px 10px 10px; } h1 { @@ -1757,7 +1755,7 @@ WOK } dc { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: blue; background-color: #dddddd; font-weight: normal; @@ -1775,7 +1773,7 @@ WOK } keywords,copyright { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: red; background-color: #dddddd; font-weight: normal; @@ -1831,7 +1829,7 @@ WOK } text,text[class|="norm"] { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; text-align: justify; font-weight: normal; font-size: 100%; @@ -2377,7 +2375,7 @@ WOK endnote { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -2389,7 +2387,7 @@ WOK endnote_indent { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -2499,7 +2497,7 @@ WOK } dc { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: blue; background-color: #dddddd; font-weight: normal; @@ -2517,7 +2515,7 @@ WOK } keywords,copyright { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: red; background-color: #dddddd; font-weight: normal; @@ -2569,7 +2567,7 @@ WOK } text { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; text-align: justify; font-size: 100%; line-height: 150%; @@ -3128,7 +3126,7 @@ WOK endnote { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -3140,7 +3138,7 @@ WOK endnote_indent { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -3177,7 +3175,7 @@ WOK } dc,sc { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: blue; background-color: #dddddd; font-weight: normal; @@ -3194,7 +3192,7 @@ WOK } keywords,copyright { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: red; background-color: #dddddd; font-weight: normal; @@ -3247,7 +3245,7 @@ WOK } para { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; /* font-weight: normal; */ text-align: justify; font-size: 100%; @@ -3261,12 +3259,12 @@ WOK text-align: left; } para.norm { - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; } para.h1, title { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-size: 120%; font-weight: bold; text-align: left; @@ -3336,7 +3334,7 @@ WOK endnote { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -3348,7 +3346,7 @@ WOK endnote_indent { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -3402,7 +3400,7 @@ WOK } p { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-size: 100%; font-weight: normal; line-height: 150%; @@ -3424,7 +3422,7 @@ WOK text-indent: 5% } p.h1 { - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: bold; line-height: 120%; margin-left: 10mm; 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/v5/defaults.rb b/lib/sisu/v5/defaults.rb deleted file mode 100644 index 0ea154b2..00000000 --- a/lib/sisu/v5/defaults.rb +++ /dev/null @@ -1,1214 +0,0 @@ -# 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/defaults.rb;hb=HEAD> - - * Ralph Amissah - <ralph@amissah.com> - <ralph.amissah@gmail.com> - - ** 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 - %{ <link rel="stylesheet" href="./#{@dir.path.style}/homepage.css" type="text/css" />} - end - #% text #changed from txt to avoid naming conflicts #FOLLOW - 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 txt_generator_comment - %{ <!- #{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!)" http://www.sisudoc.org/ ->} - 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 - %{<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">} - 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 - %{<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">} - 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 - %{<p class="normal">} - end - def paragraph_endnote - %{<p class="endnote">} - end - def paragraph_font_tiny - %{<font #{font_tiny} #{font_face}>} - end - def paragraph_font_small - %{<font #{font_small} #{font_face}>} - end - #% table - def table_close - '</td></tr> -</table>' - 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 - '</p> </td><td width="4%" align="right" valign="top">' - end - def margin_numless - '</td><td width="4%" align="right" valign="top">' - end - def margin_num_css - '</td> -<td width="2%" align="right" valign="top"> ' - end - def margin_txt_w1 - %{<table summary="" width=#{table_width_txt_r} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width="6%" align="right"> </td> -<td width="90%" valign="top" align="justify">} - end - def margin_txt_w2 - %{<table summary="" width=#{table_width_txt_r} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width="10%" align="right"> </td> -<td width="86%" valign="top" align="justify">} - end - def margin_txt_0 - %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width=#{indent_level_0} align="right"> -</td><td valign="top" align="justify">} - end - def margin_txt_1 - %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width=#{indent_level_1} align="right"></td><td valign="top" align="justify">} - end - def margin_txt_2 - %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width=#{indent_level_2} align="right"> -</td> -<td valign="top" align="justify">} - end - def margin_txt_3 - %{<table summary="" width=#{table_width_txt} border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td width=#{indent_level_3} align="right"> -</td> -<td valign="top" align="justify">} - end - def margin_css - '<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> -<tr><td valign="top" align="justify"> ' - end - #% png - def png_ico - %{ <link rel="shortcut icon" href="../_sisu/image/#{icon_ico}" />} - end - def png_sisu #check url path - %{ <a href="#{@url.sisu}"> - <img border="0" width="160" height="60" src="#{url_path_image}/#{icon_sisu}" alt="SiSU" /> - </a>} - end - def png_site - %{<img src="#{url_path_image}/#{icon_site}" alt="@" border="0" />} - end - def png_nav - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_bluebell}" alt="Contents" />} - end - def png_manifest - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_manifest}" alt="Document Manifest" />} - end - def png_doc - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_doc}" alt="Full Text" />} - end - def png_toc - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_toc}" alt="TOC linked" />} - end - def png_odf - %{<img border="0" height="18" width="18" src="#{url_path_image_sys}/#{icon_odf}" alt="ODF/ODT" />} - end - def png_epub - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_epub}" alt="EPUB" />} - end - def png_pdf - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF" />} - end - def png_pdf_portrait - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF portrait" />} - end - def png_pdf_landscape - %{<img border="0" height="15" width="18" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF landscape" />} - end - def png_home - #dir=SiSU_Env::InfoEnv.new #(@fns) - %{<img border="0" src="#{url_path_image_base}/#{icon_home_button}" alt="#{txt_home} -->" />} - #%{<img border="0" src="#{dir.url.images_local}/#{icon_home_button}" alt="#{txt_home} -->" />} - end - def png_home_button - rel=@dir.path_rel_links.html_scroll_2 - %{<img border="0" src="#{rel}/#{icon_home_button}" alt="#{txt_home} -->" />} - end - #% png_nav #not currently used - #% nav_txt - def nav_txt_homepage - %{ <font face="#{font_fonts}" size="2"> - home - </font> } - end - def nav_txt_toc_link - %{ <font face="#{font_fonts}" size="2"> - toc - </font> } - end - def nav_txt_doc_link - %{ <font face="#{font_fonts}" size="2"> - scroll - </font> } - end - def nav_txt_manifest - #{png_manifest} document manifest - %{ <font face="#{font_fonts}" size="2"> - [ document manifest ] - </font> } - end - def nav_txt_concordance - %{ <font face="#{font_fonts}" size="2"> - A-Z - </font> } - end - def nav_txt_pdf_portrait - %{ <font face="#{font_fonts}" size="2"> - pdf - </font> } - end - def nav_txt_pdf_landscape - %{ <font face="#{font_fonts}" size="2"> - pdf - </font> } - end - #% banner - def banner_home_button_only - %{<a href="#{url_site}/"> - #{png_home_button} - </a>} - end - def banner_band #yellow_dark now white - %{<table summary="home button" width="100%" border="0" cellpadding="3" bgcolor= "#ffffff" align="center"> -<tr><td align="left" valign="middle" bgcolor="#{color_white}"> - <a href="#{url_site}/" target="_top"> - #{png_home} - </a> -</td> -<td width="90%"> -#{table_close}} - end - def banner_instrument_cover_band_scr - '<table summary="scroll instrument cover band" width="100%" border="0" cellpadding="8" bgcolor="#ffffff" align="center"> -<tr><td align="center">' - end - def banner_instrument_cover_band_seg - '<table summary="segment instrument cover band, title, author, location" width="100%" border="0" cellpadding="8" bgcolor="#ffffff" align="center"> -<tr><td align="center">' - 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 -<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0"> -WOK - end - def widget_sisu_text -<<WOK - <p class="tiny"><font color="#666666" size="2"> - Output generated by - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) - </font></p> -WOK - end - def widget_sisu -<<WOK -<!-- widget sisu --> -<tr><td valign="top" width="100%"> -<!-- SiSU Rights --> -#{widget_sisu_text} -</td></tr> -WOK - end - def widget_sisu_verbose -<<WOK -<!-- widget sisu --> -<tr><td valign="top" width="10%"> - <p class="tiny_left"><font color="#666666" size="2"> - <a href="#{url_sisu}"> - <img border="0" src="../_sisu/image/sisu.png" alt="SiSU" width="120" height="39" /> - </a> - </font></p> -</td><td valign="top" width="45%"> -<!-- SiSU Rights --> - <p class="tiny_left"><font color="#666666" size="2"> - Output generated by - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) - <br /> - <a href="#{url_sisu}"> - <b>#{@v[:project]}</b> - </a> - Copyright <sup>©</sup> Ralph Amissah - 1997, current #{@date.year_static}. - All Rights Reserved. - <br /> - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - is software for document structuring, publishing and search, - <br /> - <a href="#{url_sisu}"> - www.sisudoc.org/ - </a> - and - <a href="#{url_sisudoc}"> - www.sisudoc.org - </a> - <br /> - <i>w3 since October 3 1993</i> - <a href="mailto:ralph@amissah.com"> - ralph@amissah.com - </a> - </font></p> -</td><td valign="top" width="45%"> - <p class="tiny_left"><font color="#666666" size="2"> - #{@v[:project]} using: - <br />Standard SiSU markup syntax, - <br />Standard SiSU meta-markup syntax, and the - <br />Standard SiSU <u>object citation numbering</u> and system, (object/text positioning system) - <br /> - Copyright <sup>©</sup> Ralph Amissah 1997, current #{@date.year_static}. - All Rights Reserved. - </font></p> -</td></tr> -WOK - end - def widget_way_better - <<WOK -<!-- widget way better --> -<tr><td valign="top" width="10%"> - <p class="tiny_left"><font color="#666666" size="2"> - <a href="http://www.gnu.org/licenses/gpl.html"> - <img border="0" src="../_sisu/image/gplv3_free_software.png" alt="GPLv3" width="127" height="51" /> - </a> - </font></p> -</td><td valign="top" width="45%"> - <p class="tiny_left"><font color="#666666" size="2"> - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - is released under - <a href="http://www.gnu.org/licenses/gpl.html">GPLv3</a> - or later, - #{url_decoration.xml_open}<a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a>#{url_decoration.xml_close} - </font></p> -</td><td valign="top" width="45%"> - <p class="tiny_left"><font color="#666666" size="2"> - #{@v[:project]}, developed using - <a href="http://www.ruby-lang.org/en/"> - Ruby - </a> - on - <a href="http://www.debian.org/"> - Debian/Gnu/Linux - </a> - software infrastructure, - with the usual GPL (or OSS) suspects. - <br /> - 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é. - <br /> - Get With the Future - <a href="http://www.sisudoc.org/"> - Way Better! - </a> - </font></p> -</td></tr> -WOK - end - #% credits - def credits_sisu_manifest - widget_sisu_text - end - def credits_sisu - %{<div class="substance"> -<table summary="SiSU summary" bgcolor="#ffffff" cellpadding="4" border="0"> -<tr><td> - #{widget_sisu} -</table></div>} - '' - end - def credits_splash - end - def credits_sisu_epub - %{<div class="substance"> -<p class="center"><a href="http://www.openebook.org"><b>EPUB</b></a> generated by <a href="http://www.sisudoc.org"><b>#{@v[:project]}</b></a> v#{@v[:version]}, GPL3</p> -</div>} - '' - 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 - <<WOK -<html><head> -<title>SiSU</title> -<meta http-equiv="refresh" content="0, url=http://www.sisudoc.org/sisu/SiSU/"> -</head> -<body> -SiSU informtion provided at <a href="http://www.sisudoc.org/sisu/SiSU/">www.sisudoc.org/sisu/SiSU</a><p /> -If your browser supports redirection, you will be escorted there shortly. -</body> -</html> -WOK - end - def homepage - <<WOK -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -<title>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</title> -<meta name="dc.title" content="SiSU - SiSU information Structuring Universe, Structured information Serialised Units, #{@date.year_static}" /> -<meta name="dc.creator" content="Ralph Amissah" /> -<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, EPUB, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" /> -<meta name="dc.publisher" content= "SiSU http://www.sisudoc.org/" /> -<meta name="dc.language" content="en" /> -<meta name="dc.rights" content="Copyright Ralph Amissah" /> -<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/" /> -<link rel="stylesheet" href="./#{@dir.path.style}/harvest.css" type="text/css" /> -<link rel="shortcut icon" href="./_sisu/image/rb7.ico" /> -</head> - -<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en"> -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a> - -<h1>SiSU</h1> -<p> -[<a href="http://sisudoc.org/sisu_manual/en/html/sisu/toc.html">Manual</a>] -</p> -<p> -[<a href="http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary">Source</a>] -[<a href="http://lists.sisudoc.org/listinfo/sisu">List Info (sisu@lists.sisudoc.org)</a>] -</p> - -<h1>SiSU Markup Samples</h1> -<p> -[<a href="http://git.sisudoc.org/gitweb/?p=doc/sisu-markup-samples.git;a=summary">Source</a>] -[<a href="http://sisudoc.org/sisu_markup_samples.html">Output</a>] -</p> - -<hr /> - -<h2 class="top_band_tiny"> - Structured information, Serialized Units - - <a href="http://www.sisudoc.org" target="_top"> - <www.sisudoc.org> - </a> - or - <a href="http://www.jus.uio.no/sisu/" target="_top"> - <www.jus.uio.no/sisu/> - </a> -software for electronic texts, document collections, books, digital libraries & search, with "atomic search" & text locating system (shared object citation numbering: "<i>ocn</i>"). -Outputs include: plaintext, HTML, EPUB, ODT (OpenDocumentText), (XHTML, XML,) LaTeX, PDF, SQL (PostgreSQL and SQLite). -</h2> -<p class="small"> -<a href="mailto:sisu@lists.sisudoc.org"> -<sisu@lists.sisudoc.org> -</a> -<a href="http://lists.sisudoc.org/listinfo/sisu"> -<http://lists.sisudoc.org/listinfo/sisu> -</a> -</p> -<p class="small"> -<a href="mailto:ralph@amissah.com"> -<ralph@amissah.com> -</a> -<a href="mailto:ralph.amissah@gmail.com"> -<ralph.amissah@gmail.com> -</a> -</p> -<p class="tiny"> -#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!), #{@date.year_static}. -</p> -<p class="tiny"> -w3 since October 3 1993. -</p> -</body> -</html> -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 <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_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 047ce9f9..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,11 +331,11 @@ module SiSU_HTML @@toc[:seg] <<<<WOK <center> <table><tr><td> -<p><font color="#222222" #{@font.face} size="2"> -(relatively static) RSS feeds for DOCUMENTS:<br /> -<a href="../rssfeed/documents.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a> http://www.jus.uio.no/lm/rssfeed/documents.xml<br /> -<a href="../rssfeed/tradelaw.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a> http://www.jus.uio.no/lm/rssfeed/tradelaw.xml<br /> -<a href="../rssfeed/environmental.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a> http://www.jus.uio.no/lm/rssfeed/environmental.xml<br /> +<p><font color="#222222" #{the_font.set_face} size="2"> +(relatively static) RSS feeds for DOCUMENTS:<br> +<a href="../rssfeed/documents.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a> http://www.jus.uio.no/lm/rssfeed/documents.xml<br> +<a href="../rssfeed/tradelaw.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a> http://www.jus.uio.no/lm/rssfeed/tradelaw.xml<br> +<a href="../rssfeed/environmental.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a> http://www.jus.uio.no/lm/rssfeed/environmental.xml<br> <center><a href="mailto:info@address.com" target="_top">info@address.com</a></center> </font></p> </td></tr></table> @@ -383,7 +380,7 @@ WOK toc[:seg_mini]=format_toc.mini_lev0 title=if dob.ocn ==0 then linkname else - @@toc[:scr] << '<br />' + @@toc[:scr] << '<br>' %{<b><a href="##{@ocn_html_identifier}#{dob.ocn}">#{linkname}</a></b>} end txt_obj={ txt: title } @@ -425,7 +422,7 @@ WOK else linkname end else - @@toc[:scr] << '<br />' + @@toc[:scr] << '<br>' %{<b><a href="##{@ocn_html_identifier}#{dob.ocn}">#{linkname}</a></b>} end txt_obj={ txt: title } @@ -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,11 +659,11 @@ 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 ||= %{<p />#{@md.prefix_a}\n} + tmp_head ||= %{<p>#{@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..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 @@ -136,7 +133,7 @@ module SiSU_Concordance @fnb=@md.fnb @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="#{@file.path_rel_links.html_seg_2}_sisu/image/sisu.png" alt="SiSU home -->"></a>} @doc_details =<<WOK -<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.html_segtoc}"><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.author}</p></td></tr></table> +<table summary="links to text related to this rudimentary index" width="96%" border="0" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.html_segtoc}"><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.author}</p></td></tr></table> WOK @make=SiSU_Env::ProcessingSettings.new(@md) end @@ -176,10 +173,10 @@ WOK #{toc} <div class="#{div_class}"> #{@doc_details} -<p>Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.<br />[For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]</p> +<p>Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.<br>[For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]</p> <p>(The word listing/index is Case sensitive: Capitalized words appear before lower case)</p> <p> - <b>word</b> (number of occurences)<br />linked references to word within document <br /> + <b>word</b> (number of occurences)<br>linked references to word within document <br> [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.] </p> <p> @@ -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 c34759cf..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 @@ -71,10 +71,10 @@ module SiSU_HTML_Format if @ocn.to_i==0 \ or @ocn.empty? '' + elsif @make.build.html_strict? + %{<label class="ocn">#{@ocn}</label>} else - name=(@make.build.html_strict?) ? '' : %{ name="#{@ocn}"} - @ocn.gsub(/^(\d+|)$/, - %{<label class="ocn"><a#{name} href="##{@ocn_html_identifier}#{@ocn}" class="lnkocn">\\1</a></label>}) + %{<label class="ocn"><a name="#{@ocn}" class="lnkocn">#{@ocn}</a></label>} end else '' @@ -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 %{ <table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> <tr> -<td align="center" bgcolor=#{@vz.color_band2}> +<td align="center" bgcolor=#{the_color.band2}> #{wgt.manifest(page)} #{wgt.search} </tr></table>} @@ -172,14 +172,6 @@ module SiSU_HTML_Format def rdf SiSU_XML_Tags::RDF.new(md) end - def doc_type - %{<!DOCTYPE html> -<html>\n} - end - def table_close - %{ </font> -#{@vz.table_close}} - end def button_home(page=:seg) button=%{ <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0">\n <tr><td align="left" bgcolor="#ffffff">\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 - %{<td align="center" bgcolor=#{@vz.color_band2}> + %{<td align="center" bgcolor=#{the_color.band2}> <a href="../index.html" target="_top"> - #{@vz.nav_txt_homepage}</a> + #{the_nav.txt_homepage}</a> </td> } end def scroll(text) if @md.fns =~ /\.(?:-|ssm\.)?sst$/ - %{<td align="center" bgcolor=#{@vz.color_band2}> + %{<td align="center" bgcolor=#{the_color.band2}> <a href="#{Xx[:html_relative1]}html/#{@file.base_filename.html_scroll}" target="_top"> #{text} </a> @@ -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 - %{<td align="center" bgcolor=#{@vz.color_band2}> - <font face="#{@vz.font_fonts}" size="2"> - #{brace_url.xml_open}<a href="#{manifest_lnk}" target="_top">#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}</a>#{brace_url.xml_close} + %{<td align="center" bgcolor=#{the_color.band2}> + <font face="#{the_font.set_fonts}" size="2"> + #{the_url_decoration.xml_open}<a href="#{manifest_lnk}" target="_top">#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}</a>#{the_url_decoration.xml_close} </font> </td>} else - %{<td align="center" bgcolor=#{@vz.color_band2}> + %{<td align="center" bgcolor=#{the_color.band2}> <a href="#{manifest_lnk}" target="_top"> - #{@vz.nav_txt_manifest} + #{the_nav.txt_manifest} </a> </td>} end @@ -291,7 +283,7 @@ module SiSU_HTML_Format #{make_scroll_search_form_and_manifest_link} </td> WOK - %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}> <tr><td width="20%"> #{button_home(:scroll)} </td> @@ -300,8 +292,8 @@ WOK </td> <td width="20%"> -#{@vz.table_close} -<p />} +#{the_table_close} +<p>} else '' end end @@ -316,15 +308,15 @@ WOK else '' end if @make.build.html_top_band? - %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}> <tr><td width="20%"> #{button_home} </td> <td width="75%" align="center"> #{doc_types} #{up_button} -#{@vz.table_close} -<p />} +#{the_table_close} +<p>} else '' end end @@ -344,7 +336,7 @@ WOK else '' end if @make.build.html_top_band? - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}> <tr><td width="20%"> #{button_home(page)} </td> @@ -353,8 +345,8 @@ WOK </td> <td width="5%" align="right"> #{firstseg} -#{@vz.table_close} -<p />} +#{the_table_close} +<p>} else '' end end @@ -376,8 +368,8 @@ WOK end def make_scroll_search_form_and_manifest_link wgt=SiSU_HTML_Format::Widget.new(@md) - %{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_doc_link} + %{<td align="center" bgcolor=#{the_color.band2}> + #{the_nav.txt_doc_link} </td> } %{<table summary="toc segment and scroll with pdf" border="0" cellpadding="3" cellspacing="0"> @@ -389,13 +381,13 @@ WOK def make_scroll_seg_pdf seg='' wgt=SiSU_HTML_Format::Widget.new(@md) - seg=%{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_toc_link} + seg=%{<td align="center" bgcolor=#{the_color.band2}> + #{the_nav.txt_toc_link} </td> } %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> <tr> -<td align="center" bgcolor=#{@vz.color_band2}> +<td align="center" bgcolor=#{the_color.band2}> #{wgt.manifest} #{wgt.search} </tr></table>} @@ -404,14 +396,15 @@ WOK wgt=SiSU_HTML_Format::Widget.new(@md) %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> <tr> -<td align="center" bgcolor=#{@vz.color_band2}> +<td align="center" bgcolor=#{the_color.band2}> #{wgt.manifest} #{wgt.search} </tr></table>} end def head rdf=SiSU_XML_Tags::RDF.new(@md) - %{#{doc_type} + %{<!DOCTYPE html> +<html> <head> <meta charset="utf-8"> <title> @@ -421,34 +414,31 @@ WOK #{rdf.metatag_html} #{@stylesheet.css_head} </head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a>} +<body lang="#{@md.opt.lng}"> +<a name="top" id="top"></a>} 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"> @@ -463,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"> @@ -513,7 +502,7 @@ WOK rights=SiSU_HTML_Tune::CleanHTML.new(@md.rights.all).clean_for_html rights=rights.gsub(/^\s*Copyright\s+\(C\)/,'Copyright <sup>©</sup> ') %{<p class="small_left">Rights: #{rights}</p> -<p />} +<p>} end self end @@ -523,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> @@ -594,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> @@ -608,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> @@ -619,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> @@ -644,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} @@ -659,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} @@ -680,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> @@ -712,7 +698,7 @@ WOK #{toc} #{nxt} <td> -#{@vz.table_close}} +#{the_table_close}} end def toc_next2 toc_nav(false,true).dup @@ -741,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> @@ -784,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> @@ -814,18 +799,19 @@ WOK end def head_seg rdf=SiSU_XML_Tags::RDF.new(@md) - %{#{doc_type} + %{<!DOCTYPE html> +<html> <head> <meta charset="utf-8"> <title> #{@seg_name_html[@seg_name_html_tracker]} - #{@md.html_title} </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> #{rdf.metatag_html} #{@stylesheet.css_head_seg} </head> -#{@vz.color_body} +<body lang="#{@md.opt.lng}"> <a name="top" id="top"></a>} end def title_banner(title,subtitle,creator) @@ -842,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> @@ -855,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"> @@ -864,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 @@ -901,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='' @@ -920,15 +905,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 << %{<a name="#{t}" ></a>}) - else - tags=(t =~/^[#{Mx[:ocn_id_char]}][0-9.]+$/) \ - ? tags #check what can be sorted in ao - : (tags << %{<a name="#{t}" ></a>}) - end + tags=(t =~/^[0-9.]+$/) \ + ? tags #check what can be sorted in ao + : (tags << %{<a name="#{t}" ></a>}) end end tags @@ -1021,7 +1000,7 @@ WOK end def heading_normal(tag,attrib) section_break=(tag=~/h[1-5]/) \ - ? '<br /><hr width=90% /><br />' + ? '<br><hr width=90% /><br>' : '' %{#{section_break} <div class="substance"> @@ -1135,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} @@ -1167,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 %{ @@ -1298,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/harvest.rb b/lib/sisu/v5/html_harvest.rb index 87f81bc9..c3a4030b 100644 --- a/lib/sisu/v5/harvest.rb +++ b/lib/sisu/v5/html_harvest.rb @@ -63,8 +63,8 @@ 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 '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) diff --git a/lib/sisu/v5/harvest_author_format.rb b/lib/sisu/v5/html_harvest_author_format.rb index 92709673..92709673 100644 --- a/lib/sisu/v5/harvest_author_format.rb +++ b/lib/sisu/v5/html_harvest_author_format.rb diff --git a/lib/sisu/v5/harvest_authors.rb b/lib/sisu/v5/html_harvest_authors.rb index 8db14eee..0fa079d6 100644 --- a/lib/sisu/v5/harvest_authors.rb +++ b/lib/sisu/v5/html_harvest_authors.rb @@ -59,7 +59,8 @@ =end module SiSU_HarvestAuthors - require_relative 'harvest_author_format' # harvest_author_format.rb + 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/harvest_topics.rb b/lib/sisu/v5/html_harvest_topics.rb index b2e83683..ab74968c 100644 --- a/lib/sisu/v5/harvest_topics.rb +++ b/lib/sisu/v5/html_harvest_topics.rb @@ -60,8 +60,8 @@ =end module SiSU_HarvestTopics - require_relative 'harvest_author_format' # 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 7c3cdf0f..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 @@ -104,7 +101,7 @@ module SiSU_FormatShared w=%{width="#{w}"} if w h=%{height="#{h}"} if h c=m[/"(.+?)"/m,1] - caption=%{<br /><p class="caption">#{c}</p>} if c + caption=%{<br><p class="caption">#{c}</p>} if c png=m.scan(/\S+/)[0] ins=if u \ and u.strip !~/^image$/ @@ -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" @@ -265,13 +262,13 @@ GSUB parablock=parablock.gsub(/<!f.+?!>/,'') @@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]}/, - %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">}) + %{<table summary="normal text css" width="100%" border="0" cellpadding="2" align="center">}) if parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@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 45ee2aae..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,11 +261,11 @@ 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) - info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'<br />') + info=info.to_s.gsub(/(?:#{Mx[:br_line]}|\\)+/,'<br>') @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td><p class="left">#{info}</p></td></tr>\n} end def links(url,lnk,target) @@ -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> @@ -901,7 +900,7 @@ SiSU manifest: #{@md.title.full} <link rel="shortcut icon" href="#{@f.path_rel_links.html_scroll_css}_sisu/image_sys/rb7.ico" /> #{@stylesheet.css_head} </head> -<body lang="en" xml:lang="en"> +<body lang="#{@md.opt.lng}"> #{format_head_toc.seg_head_navigation_band(:manifest)} WOK if make.build.manifest_minitoc? @@ -963,26 +962,26 @@ WOK <a href="#links">metadata suggested links (if any)</a> </p> </div> -<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> +<table summary="normal text css" width="100%" border="0" cellpadding="2" align="center"> WOK published_versions @manifest[:html] << '</table>' @manifest[:html] <<<<WOK <h2 class="small"><a name="output">#{@translate.manifest_description_output}</a></h2> -<table summary="available output/filetypes" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> +<table summary="available output/filetypes" width="100%" border="0" cellpadding="2" align="center"> <tr> <th class="left"><p class="bold">#{@translate.filetype_description}</p></th><th class="left"><p class="bold">#{@translate.filename}</p></th><th class="right"><p class="right"><b>#{@translate.file_size}</b></p><p class="tiny_right">(kB)</p></th></tr> WOK output_tests @manifest[:html] << '</table>' @manifest[:html] <<<<WOK -<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> +<table summary="normal text css" width="100%" border="0" cellpadding="2" align="center"> WOK source_tests @manifest[:html] << '</table>' @manifest[:html] <<<<WOK <h2 class="small"><a name="metadata">#{@translate.manifest_description_metadata}</a></h2> -<table summary="document metadata" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> +<table summary="document metadata" width="100%" border="0" cellpadding="2" align="center"> <tr> <th class="left"><p class="bold">#{@translate.metadata}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th></tr> WOK metadata_tests @@ -991,7 +990,7 @@ WOK WOK @manifest[:html] <<<<WOK <p class="bold"><a name="links">#{@translate.suggested_links}:</a></p> -<table summary="suggested links" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> +<table summary="suggested links" width="100%" border="0" cellpadding="2" align="center"> WOK links_tests @manifest[:html] <<<<WOK @@ -999,7 +998,7 @@ WOK WOK @manifest[:html] <<<<WOK <h2 class="small"><a name="languages">#{@translate.language_version_list}</a></h2> -<table summary="language versions" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> +<table summary="language versions" width="100%" border="0" cellpadding="2" align="center"> <tr> <th class="left"><p class="bold">#{@translate.filename}</p></th><th class="left"><p class="bold">#{@translate.description}</p></th><th class="right"><p class="right"> </p></th></tr> WOK @@ -1009,8 +1008,8 @@ WOK </table> </div> <div> -<br /> -#{vz.credits_sisu_manifest} +<br> +#{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</title> +<meta http-equiv="refresh" content="0, url=http://www.sisudoc.org/sisu/SiSU/"> +</head> +<body> +SiSU informtion provided at <a href="http://www.sisudoc.org/sisu/SiSU/">www.sisudoc.org/sisu/SiSU</a><p /> +If your browser supports redirection, you will be escorted there shortly. +</body> +</html> +WOK + end + def homepage + <<WOK +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +<title>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</title> +<meta name="dc.title" content="SiSU - SiSU information Structuring Universe, Structured information Serialised Units, #{@date.year_static}" /> +<meta name="dc.creator" content="Ralph Amissah" /> +<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, EPUB, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" /> +<meta name="dc.publisher" content= "SiSU http://www.sisudoc.org/" /> +<meta name="dc.language" content="en" /> +<meta name="dc.rights" content="Copyright Ralph Amissah" /> +<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/" /> +<link rel="stylesheet" href="./#{@dir.path.style}/harvest.css" type="text/css" /> +<link rel="shortcut icon" href="./_sisu/image/rb7.ico" /> +</head> + +<body lang="en" xml:lang="en"> +<a name="top" id="top"></a> +<a name="up" id="up"></a> +<a name="start" id="start"></a> + +<h1>SiSU</h1> +<p> +[<a href="http://sisudoc.org/sisu_manual/en/html/sisu/toc.html">Manual</a>] +</p> +<p> +[<a href="http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary">Source</a>] +[<a href="http://lists.sisudoc.org/listinfo/sisu">List Info (sisu@lists.sisudoc.org)</a>] +</p> + +<h1>SiSU Markup Samples</h1> +<p> +[<a href="http://git.sisudoc.org/gitweb/?p=doc/sisu-markup-samples.git;a=summary">Source</a>] +[<a href="http://sisudoc.org/sisu_markup_samples.html">Output</a>] +</p> + +<hr /> + +<h2 class="top_band_tiny"> + Structured information, Serialized Units + + <a href="http://www.sisudoc.org" target="_top"> + <www.sisudoc.org> + </a> + or + <a href="http://www.jus.uio.no/sisu/" target="_top"> + <www.jus.uio.no/sisu/> + </a> +software for electronic texts, document collections, books, digital libraries & search, with "atomic search" & text locating system (shared object citation numbering: "<i>ocn</i>"). +Outputs include: plaintext, HTML, EPUB, ODT (OpenDocumentText), (XHTML, XML,) LaTeX, PDF, SQL (PostgreSQL and SQLite). +</h2> +<p class="small"> +<a href="mailto:sisu@lists.sisudoc.org"> +<sisu@lists.sisudoc.org> +</a> +<a href="http://lists.sisudoc.org/listinfo/sisu"> +<http://lists.sisudoc.org/listinfo/sisu> +</a> +</p> +<p class="small"> +<a href="mailto:ralph@amissah.com"> +<ralph@amissah.com> +</a> +<a href="mailto:ralph.amissah@gmail.com"> +<ralph.amissah@gmail.com> +</a> +</p> +<p class="tiny"> +#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!), #{@date.year_static}. +</p> +<p class="tiny"> +w3 since October 3 1993. +</p> +</body> +</html> +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 57b45639..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*/) @@ -145,7 +142,7 @@ module SiSU_HTML_Promo @prod['form'] ? %{<p class="pane">#{@prod['form']}</p>} : '' end def nick - @prod['nick'] ? %{(#{@prod['nick']})<br />} : '' + @prod['nick'] ? %{(#{@prod['nick']})<br>} : '' end def update @prod['update'] ? %{<p class="pane">Updated: #{@prod['update']}</p>} : '' @@ -186,7 +183,7 @@ module SiSU_HTML_Promo else nil end form=if action - '<br />' + @env.widget.search_form('hyperestraier',action,'',table) + '<br>' + @env.widget.search_form('hyperestraier',action,'',table) else '' end form @@ -208,7 +205,7 @@ module SiSU_HTML_Promo end end def image - @prod['image'] ? %{<img border="0" src="../_sisu/image/#{@prod['image']}" /><br />} : '' + @prod['image'] ? %{<img border="0" src="../_sisu/image/#{@prod['image']}" /><br>} : '' end def url_link @url_=if @prod['url'] =~/https?:/ @@ -296,7 +293,7 @@ module SiSU_HTML_Promo def output_form_sponsor(type,id) cell=cell(@ad[:promo][type][id],prod_id) <<-WOK -<br /> +<br> #{cell.site_link} #{cell.blurb} #{cell.links} @@ -306,7 +303,7 @@ module SiSU_HTML_Promo prod_id=id.gsub(/id_/,'') cell=cell(@ad[:promo][type][id],prod_id) <<WOK -<br /> +<br> #{cell.site_link} #{cell.author} #{cell.year} @@ -330,7 +327,7 @@ WOK prod_type=((id=~/id_(?:[0-9x]){10,13}/i) ? 'isbn' : 'id') id_detail=%{<p class="pane">#{prod_type}: #{prod_id}</p>} <<WOK -<br /> +<br> #{cell.site_link} #{cell.author} #{cell.year} @@ -346,7 +343,7 @@ WOK prod_id=id.gsub(/id_/,'') cell=cell(@ad[:promo][type][id],prod_id) <<WOK -<br /> +<br> #{cell.site_link} #{cell.editor} #{cell.issn} @@ -363,7 +360,7 @@ WOK cell=cell(@ad[:promo][type][id],prod_id) #translate date (dd month yyyy) from 2007-03-04 and ruby conversion <<WOK -<br /> +<br> #{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..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 @@ -134,7 +133,7 @@ module SiSU_HTML_Scroll end elsif dob.is==:break \ and dob.from==:markup - '<br /><hr width=90% /><br />' + '<br><hr width=90% /><br>' 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..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 @@ -443,7 +442,7 @@ module SiSU_HTML_Seg @@seg[:tocband_banner] \ << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) @@seg[:tocband_bannerless] \ - << '<br />' \ + << '<br>' \ << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) if @title_banner_ @@seg[:headings] \ @@ -570,24 +569,22 @@ module SiSU_HTML_Seg sto.table elsif dob.is==:break \ and dob.from==:markup - '<br /><hr width=90% /><br />' + '<br><hr width=90% /><br>' 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 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 <!e_!> #?? workpoint - if dob.obj =~/<a name="_\d+" href="#-\d+"> <sup>/ #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 <!e_!> #?? workpoint + if dob.obj =~/<a name="_\d+" href="#-\d+"> <sup>/ #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 <SiSU_XHTML_Table::TableXHTML + require_relative 'xhtml_table' # xhtml_table.rb + require_relative 'html_parts' # html_parts.rb + class TableHTML < SiSU_XHTML_Table::TableXHTML + include SiSU_Parts_HTML end end __END__ diff --git a/lib/sisu/v5/html_tune.rb b/lib/sisu/v5/html_tune.rb index 026a1177..7cd2a920 100644 --- a/lib/sisu/v5/html_tune.rb +++ b/lib/sisu/v5/html_tune.rb @@ -61,11 +61,12 @@ require_relative 'dp' # dp.rb module SiSU_HTML_Tune require_relative 'se' # se.rb include SiSU_Env; include SiSU_Screen + require_relative 'html_parts' # html_parts.rb require_relative 'html_format' # html_format.rb #watch @@line_mode='' @@endnote_array=[] @@endnote_call_counter=1 - @@table_align='<table summary='' width="96%" border="0" bgcolor="white" cellpadding="0" col="3"> + @@table_align='<table summary='' width="96%" border="0" cellpadding="0" col="3"> <tr ...><td width="2%" align="right">  \;</td> <td width="94%" valign="top" align="justify">' @@ -119,16 +120,15 @@ 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,'<br />') + gsub(/[\\]{2}/m,'<br>') end end class Tune + include SiSU_Parts_HTML 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,@md) - @brace_url=SiSU_Viz::Defaults.new.url_decoration end def songsheet begin @@ -187,7 +187,7 @@ module SiSU_HTML_Tune w=%{width="#{w}"} if w h=%{height="#{h}"} if h c=m[/"(.+?)"/m,1] - caption=%{<br /><p class="caption">#{c}</p>} if c + caption=%{<br><p class="caption">#{c}</p>} if c png=m.scan(/\S+/)[0] image_path=@md.file.output_path.html_seg.rel_image #image_path=(@md.fns =~/\.-ss[tm]$/) \ @@ -230,13 +230,13 @@ module SiSU_HTML_Tune dob.obj=dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/, %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n}) end - dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_choice}" alt="stellar">}). - gsub(/!new/,%{ <img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_new}" alt="new">}). + dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images}/#{the_icon.i_choice}" alt="stellar">}). + gsub(/!new/,%{ <img border="0" height="15" width="15" src="#{@env.url.images}/#{the_icon.i_new}" alt="new">}). gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>'). gsub(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> '). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #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}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}). - 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]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}<a href="mailto:\\1">\\1</a>#{the_url_decoration.xml_close}}). + 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 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+)/,'<a href="\1">\1</a>') @@ -245,9 +245,9 @@ module SiSU_HTML_Tune and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ dob.obj=dob.obj.gsub(/\.\.(\/\S+)/,%{<a href="#{Xx[:html_relative2]}\1">\1</a>}) end - dob.obj=dob.obj.gsub(/<a href=":/,%{<a href="#{@vz.url_site}/}). - gsub(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/}). - gsub(/<a href="#{Xx[:html_relative2]}\//,%{<a href="#{@vz.url_site}/}) + dob.obj=dob.obj.gsub(/<a href=":/,%{<a href="#{the_url.site}/}). + gsub(/<a href="\.\.\//,%{<a href="#{the_url.site}/}). + gsub(/<a href="#{Xx[:html_relative2]}\//,%{<a href="#{the_url.site}/}) else dob.obj=dob.obj.gsub(/</m,'<').gsub(/>/m,'>') end @@ -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]}/,'<br />') unless dob.is==:table + dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>') unless dob.is==:table dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 10ac6f23..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' @@ -257,16 +255,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..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' @@ -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_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/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/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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data) @md,@data=md,data - @brace_url=SiSU_Viz::Defaults.new.url_decoration - @vz=SiSU_Viz::Defaults.new @tab="\t" @@notes=:end @manpage={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] } @@ -300,9 +297,9 @@ WOK "\n.I \\1\\2#{Mx[:br_line]}") unless dob.is==:code dob.obj=dob.obj.gsub(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/, - "\\1 #{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3"). + "\\1 #{the_text.url_open}\\2#{the_text.url_close}\\3"). gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/, - "\\1#{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3") + "\\1#{the_text.url_open}\\2#{the_text.url_close}\\3") @manpage[:endnotes]=extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_b_c]}/m,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v5/manpage_format.rb b/lib/sisu/v5/manpage_format.rb index d255d133..98f37f67 100644 --- a/lib/sisu/v5/manpage_format.rb +++ b/lib/sisu/v5/manpage_format.rb @@ -60,7 +60,6 @@ module SiSU_ManpageFormat require_relative 'dp' # dp.rb include SiSU_Param - include SiSU_Viz class ParagraphNumber def initialize(paranum) @paranum=/(\d+)/m.match(paranum)[1] @@ -80,7 +79,6 @@ module SiSU_ManpageFormat @md,@dob=md,dob rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:en_a_c]}/ @dob.obj.gsub!(rgx,'\1') if @dob.obj =~rgx - @vz=SiSU_Viz::Defaults.new end def scr_endnote_body "<endnote>#{@dob.obj}</endnote> " 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'po4a_set' # po4a_set.rb include SiSU_Po4aUtils @@endnotes={ para: [], end: [] } def initialize(fn,data_src,data_trn,md_src,md_trn,wrap_width) @@ -181,8 +178,6 @@ module SiSU_Po4a @md=(md_trn.nil?) \ ? md_src : md_trn - @brace_url=SiSU_Viz::Defaults.new.url_decoration - @vz=SiSU_Viz::Defaults.new @tab="\t" @@endnotes_=(@md.opt.selections.str =~/--endnote/) ? true : false # --footnote @br=(@md.opt.selections.str =~/--dos/) ? "\r\n" : "\n" # --unix @@ -871,7 +866,6 @@ GSUB gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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 1f3f7ca8..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 <Source + include SiSU_Parts_Generic def initialize(md) @manifest={ txt: [], txt_title: [] } @md,@fns=md,md.fns @@ -129,7 +130,6 @@ module SiSU_QRcode 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 @f.make_path(@f.output_path.qrcode.dir) end def spaces @@ -165,7 +165,7 @@ module SiSU_QRcode kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] <<<<WOK #{id} #{kb} - #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close} + #{the_text.url_open}#{url}/#{file}#{the_text.url_close} WOK end def summarize_html_seg(id,file,pth='',rel='',url='',img='● ') @@ -173,14 +173,14 @@ WOK kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] <<<<WOK #{id} #{kb} - #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close} + #{the_text.url_open}#{url}/#{file}#{the_text.url_close} WOK end def summarize_sources(id,file,pth,rel,url) 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 @@ -199,7 +199,7 @@ WOK kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] <<<<WOK #{id} #{dgst[1]} #{kb} - #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close} + #{the_text.url_open}#{url}/#{file}#{the_text.url_close} WOK end def published_manifests? @@ -247,7 +247,7 @@ WOK def published_languages(id,file) flv=published_manifests? flv.each do |l| - @manifest[:txt] << "#{l[:l]} #{@brace_url.txt_open}#{l[:mu]}#{@brace_url.txt_close}\n" + @manifest[:txt] << "#{l[:l]} #{the_text.url_open}#{l[:mu]}#{the_text.url_close}\n" end end def metadata(id,info) @@ -263,7 +263,7 @@ WOK elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root) else url end - @manifest[:txt] << %{#{url} #{lnk} #{@brace_url.txt_open}#{static}#{@brace_url.txt_close}\n} + @manifest[:txt] << %{#{url} #{lnk} #{the_text.url_open}#{static}#{the_text.url_close}\n} end def output_tests if FileTest.file?(@f.place_file.html_segtoc.dir)==true @@ -731,11 +731,11 @@ WOK end @manifest[:txt] <<<<WOK #{@translate.manifest_description_metadata} - #{@brace_url.txt_open}#{@en_manifest}#{@brace_url.txt_close} + #{the_text.url_open}#{@en_manifest}#{the_text.url_close} WOK metadata_tests @manifest[:txt_title] <<<<WOK - #{@brace_url.txt_open}#{@en_manifest}#{@brace_url.txt_close} + #{the_text.url_open}#{@en_manifest}#{the_text.url_close} WOK source_tests @manifest[:txt] <<<<WOK diff --git a/lib/sisu/v5/rexml.rb b/lib/sisu/v5/rexml.rb index c83d64a9..18041cf7 100644 --- a/lib/sisu/v5/rexml.rb +++ b/lib/sisu/v5/rexml.rb @@ -70,7 +70,6 @@ module SiSU_Rexml include SiSU_Param require_relative 'se' # se.rb include SiSU_Env - include SiSU_Viz class Rexml begin require 'rexml/document' \ diff --git a/lib/sisu/v5/se_createsite.rb b/lib/sisu/v5/se_createsite.rb index 1e5d4ef6..943cf8c5 100644 --- a/lib/sisu/v5/se_createsite.rb +++ b/lib/sisu/v5/se_createsite.rb @@ -59,6 +59,7 @@ =end module SiSU_Create_Site require_relative 'constants' # constants.rb + require_relative 'html_parts' # html_parts.rb require_relative 'utils' # utils.rb require_relative 'utils_screen_text_color' # utils_screen_text_color.rb require_relative 'se_info_env' # se_info_env.rb @@ -78,13 +79,12 @@ module SiSU_Create_Site @init=SiSU_Env::GetInit.new @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd @rc=SiSU_Env::GetInit.new.sisu_yaml.rc - @vz=SiSU_Viz::Defaults.new - @vz_home=SiSU_Viz::Home.new + @home_set=SiSU_Proj_HTML::Home.new end def create_default_sisu_homepage(action=:none) if action==:none puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (no action taken)} - else + else # turned off, unless something other than :none passed puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (in order to replace default sisu homepage)} filename_homepage= @env.path.webserv + '/' \ @@ -94,8 +94,8 @@ module SiSU_Create_Site + @env.path.base_markup_dir_stub + '/toc.html' file_homepage=File.new(filename_homepage,'w') file_home_toc=File.new(filename_home_toc,'w') - file_homepage << @vz_home.homepage - file_home_toc << @vz_home.homepage + file_homepage << @home_set.homepage + file_home_toc << @home_set.homepage file_homepage.close file_home_toc.close end @@ -109,8 +109,7 @@ module SiSU_Create_Site FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") end else - create_default_sisu_homepage(:none) - #create_default_sisu_homepage(:default) + create_default_sisu_homepage(:none) # :default end end def cp_images(src_path,dest_path) 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/se_get_init.rb b/lib/sisu/v5/se_get_init.rb index 04aa633c..a74e22f9 100644 --- a/lib/sisu/v5/se_get_init.rb +++ b/lib/sisu/v5/se_get_init.rb @@ -78,7 +78,8 @@ module SiSU_Get_Init end end def tex - @@tx ||=SiSU_Viz::TeX.new + require_relative 'texpdf_parts' # texpdf_parts.rb + @@tx ||=SiSU_Parts_TeXpdf::TeX.new end def rc_path_options [ diff --git a/lib/sisu/v5/se_info_env.rb b/lib/sisu/v5/se_info_env.rb index bf8de180..495b7a04 100644 --- a/lib/sisu/v5/se_info_env.rb +++ b/lib/sisu/v5/se_info_env.rb @@ -60,6 +60,7 @@ @@current_document=Dir.pwd #nil #'' module SiSU_Info_Env require_relative 'se_envcall' # se_envcall.rb + require_relative 'html_parts' # html_parts.rb begin require 'singleton' require 'fileutils' @@ -573,7 +574,7 @@ module SiSU_Info_Env def widget #needs (md) #move @rc=SiSU_Env::GetInit.new.sisu_yaml.rc @ad=SiSU_Env::GetInit.new.ads - @vz=SiSU_Viz::Defaults.new + @html_bits=SiSU_Proj_HTML::Bits.new @flag={ ad: false, md: false, @@ -581,13 +582,14 @@ module SiSU_Info_Env rc: false } def promo? - @flag[:ad]=if @md.flag_promo && @ad[:flag_promo] + @flag[:ad]=if @md.flag_promo \ + && @ad[:flag_promo] @flag[:md]=true true - elsif defined? @vz.widget_promo \ - and not @vz.widget_promo.nil? \ - and @vz.widget_promo.is_a?(Array) \ - and @vz.widget_promo.length > 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(/>/,'>'). gsub(/<br(?: \/)?>/,'<br />') @@ -938,13 +939,13 @@ WOK '\1<text:a xl:type="simple" xl:href="\2">\2</text:a>') #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}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{the_url_decoration.xml_close}}) #http ftp matches with decoration else @inf.gsub(/(https?:\/\/[^<>()'"\s]+)/, - %{#{url_brace.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{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}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{the_url_decoration.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol end <<WOK <text:p text:style-name="P1">#{@tag.capitalize}: #{@inf}</text:p> 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 <url> 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 <url> 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 <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/xhtml_parts.rb;hb=HEAD> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data,wrap_width) @md,@data,@wrap_width=md,data,wrap_width @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.selections.str when /--footnote/ then false @@ -166,7 +164,6 @@ WOK end def plaintext_tail # env=SiSU_Env::InfoEnv.new(@md.fns) - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -188,7 +185,7 @@ at: * #{generator} * #{rubyv} * #{lastdone} -* SiSU #{vz.url_sisu} +* SiSU #{the_url.sisu_txt} WOK end def decorate @@ -445,7 +442,7 @@ WOK gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data,wrap_width) @md,@data,@wrap_width=md,data,wrap_width @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.selections.str when /--footnote/ then false @@ -201,7 +199,6 @@ WOK end def plaintext_tail # env=SiSU_Env::InfoEnv.new(@md.fns) - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -223,7 +220,7 @@ at: * #{generator} * #{rubyv} * #{lastdone} -* SiSU #{vz.url_sisu} +* SiSU #{the_url.sisu_txt} WOK end def decorate @@ -480,7 +477,7 @@ WOK gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data,wrap_width) @md,@data,@wrap_width=md,data,wrap_width @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.selections.str when /--footnote/ then false @@ -203,7 +201,6 @@ WOK end def plaintext_tail # env=SiSU_Env::InfoEnv.new(@md.fns) - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -225,7 +222,7 @@ at: * #{generator} * #{rubyv} * #{lastdone} -* SiSU #{vz.url_sisu} +* SiSU #{the_url.sisu_txt} WOK end def decorate @@ -464,7 +461,7 @@ WOK gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data,wrap_width) @md,@data,@wrap_width=md,data,wrap_width @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.selections.str when /--footnote/ then false @@ -202,7 +200,6 @@ WOK end def plaintext_tail # env=SiSU_Env::InfoEnv.new(@md.fns) - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -224,7 +221,7 @@ at: * #{generator} * #{rubyv} * #{lastdone} -* SiSU #{vz.url_sisu} +* SiSU #{the_url.sisu_txt} WOK end def decorate @@ -442,7 +439,7 @@ WOK gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data,wrap_width) @md,@data,@wrap_width=md,data,wrap_width @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.selections.str when /--footnote/ then false @@ -202,7 +201,6 @@ WOK end def plaintext_tail # env=SiSU_Env::InfoEnv.new(@md.fns) - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -224,7 +222,7 @@ at: * #{generator} * #{rubyv} * #{lastdone} -* SiSU #{vz.url_sisu} +* SiSU #{the_url.sisu_txt} WOK end def decorate @@ -435,7 +433,7 @@ WOK gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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/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/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 <Source require_relative 'plaintext_format' # plaintext_format.rb include Format - include SiSU_Viz @@alt_id_count=0 @@dp=nil attr_reader :format,:lev,:text,:ocn,:lev_para_ocn @@ -155,14 +154,13 @@ module SiSU_Wikispeak end end class Scroll <Source - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_TextUtils + include SiSU_Parts_HTML @@endnotes_para=[] @@wiki={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] } @@dp=nil def initialize(data,md) @data,@md=data,md - @vz=SiSU_Viz::Defaults.new @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern @regx=/^(?:(?:#{Mx[:br_line]}\s*|#{Mx[:br_nl]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]}\s*)?(.+)/ #fix Mx[:lv_o] #m # 2004w18 pb pn removal added @tab="\t" @@ -189,7 +187,6 @@ WOK end end def wiki_tail - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -333,7 +330,7 @@ WOK para=format_text.scr_indent_one_no_paranum end end - if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ + if para !~/#{the_margin.txt_0}|#{the_margin.txt_1}|#{the_margin.txt_2}/ # i don't get the condition for no paranum end if para =~/<:center>/ 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 2d89bc68..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=[] @@ -850,7 +845,7 @@ module SiSU_XHTML_EPUB2 <link rel="stylesheet" href="css/xhtml.css" type="text/css" /> <style type="text/css"> img { max-width: 100%; } </style> </head> - <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en"> + <body xml:lang="en"> <div class="svg_outer"> <div class="svg_inner"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 #{@md.make.cover_image[:w]} #{@md.make.cover_image[:h]}" preserveAspectRatio="xMidYMid meet"> 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=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home"></a>} @doc_details =<<WOK @@ -150,8 +147,6 @@ WOK end end class Words - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb include SiSU_XHTML_EPUB2_Format require_relative 'se' # se.rb @@ -159,7 +154,6 @@ WOK def initialize(particulars) @particulars=particulars begin - @vz=SiSU_Viz::Defaults.new @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array @path="#{@env.processing_path.epub}" @freq=Hash.new(0) @@ -323,7 +317,7 @@ WOK end # special cases endnotes and header levels 1 - 3 end - credits=@vz.credits_sisu_epub + credits=SiSU_Proj_XHTML::Bits.new.credits_sisu_epub @file_concordance << %{</div>>#{credits}</body>\n</html>} # footer end end diff --git a/lib/sisu/v5/xhtml_epub2_format.rb b/lib/sisu/v5/xhtml_epub2_format.rb index 751aa32b..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 || []) @@ -1330,7 +1328,7 @@ application/epub+zip <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> #{@css.xhtml_epub} </head> - #{@vz.color_body} + <body lang="#{@md.opt.lng}"> <div class="content"> <div class="substance"> <label class="ocn"><a href="#o#{dob.ocn}" class="lnkocn">#{dob.ocn}</a></label> @@ -1722,15 +1720,16 @@ output_epub_cont_seg.close end def table_close %{ </font> -#{@vz.table_close}} +#{the_table_close}} end def xhtml_close - %{#{@vz.credits_sisu_epub} + %{#{SiSU_Proj_XHTML::Bits.new.credits_sisu_epub} </body> </html>} end end class HeadToc < HeadInformation + include SiSU_Parts_XHTML def initialize(md) super(md) @md=md @@ -1753,20 +1752,20 @@ output_epub_cont_seg.close <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> #{@css.xhtml_epub} </head> - #{@vz.color_body}} + <body lang="#{@md.opt.lng}">} 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}} +#{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 %{<p class="small_left">Prefix: #{@md.prefix_b}} 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 - 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}} 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 end class HeadSeg < HeadInformation @@ -1837,7 +1836,7 @@ output_epub_cont_seg.close <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> #{@css.xhtml_epub} </head> - #{@vz.color_body}} + <body lang="#{@md.opt.lng}">} end def endnote_mark %{ @@ -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} <a href="#owner.details"> Owner Details <font size="1" color="#777777"> @@ -1859,11 +1858,11 @@ output_epub_cont_seg.close </font> </a> </font> -#{@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} <p class="bold"> #{@txt} </p> -#{@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 %{<p class="bold"> #{@txt} </p> -#{@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 <p class="bold"> #{@txt} </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_heading5 %{<p class="bold"> 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 afeff30e..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=[] @@ -77,7 +78,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 +90,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 @@ -109,13 +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 - @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 end def songsheet begin @@ -262,18 +261,18 @@ module SiSU_XHTML_EPUB2_Tune dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/, %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n}) end - dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_choice}" alt="stellar" />}). - gsub(/!new/,%{#{$ep[:hsp]}<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />}). + dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{the_icon.i_choice}" alt="stellar" />}). + gsub(/!new/,%{#{$ep[:hsp]}<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{the_icon.i_new}" alt="new" />}). gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>'). gsub(/<:to(\d{1,7}?)>/,%{<a href="#to\\1">to#{$ep[:hsp]}\{#{$ep[:hsp]}\\1#{$ep[:hsp]}\}</a> }). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #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}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}). - 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]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}<a href="mailto:\\1">\\1</a>#{the_url_decoration.xml_close}}). + 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 if dob.obj =~/..\/\S+/ \ and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ dob.obj=dob.obj.gsub(/(\.\.\/\S+)/,'<a href="\1">\1</a>') end - dob.obj=dob.obj.gsub(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/}) + dob.obj=dob.obj.gsub(/<a href="\.\.\//,%{<a href="#{the_url.site}/}) else dob.obj=dob.obj.gsub(/</m,'<').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 <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/xhtml_parts.rb;hb=HEAD> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** Description: shared html parts + +=end +module SiSU_Parts_XHTML + 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_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 + %{<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_css + '</td> +<td width="2%" align="right" valign="top"> ' + 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 + %{<font #{set_tiny} #{set_face}>} + end + def paragraph_font_small + %{<font #{set_small} #{set_face}>} + end + self + end + def the_nav + def txt_concordance + %{ <font face="#{the_font.set_fonts}" size="2"> + A-Z + </font> } + end + def txt_toc_link + %{ <font face="#{the_font.set_fonts}" size="2"> + toc + </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 +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 + %{<div class="substance"> +<p class="center"><a href="http://www.openebook.org"><b>EPUB</b></a> generated by <a href="http://www.sisudoc.org"><b>#{@v[:project]}</b></a> v#{@v[:version]}, GPL3</p> +</div>} + '' + 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>/,'<br />') + gsub(/<:br>/,the_line_break) trc <<= if table_obj.head_ and nr==0; %{<th width="#{table_obj.widths[nc]}%">#{c}</th>} else %{<td width="#{table_obj.widths[nc]}%">#{c}</td>} 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=%{<meta name="owner" content="#{@md.owner}" />\n} if @md.owner @keywords=%{<meta name="keywords" content="#{@md.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 "<endnote>#{@txt}</endnote> " @@ -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 %{ </font> -#{@vz.table_close}} +#{the_table_close}} end def html_close #moved %{</body> @@ -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] - <<WOK -<td align="center" width="60%"> - #{make_seg_scroll_pdf} -</td> -WOK - else '' - end - %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td>#{pdf} -<td width="20%"> - -#{@vz.table_close} -<p />} - end - def concordance_navigation_band(type='') - if type=~/pdf/ - @tocband_concordance=make_concordance - end - %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td> -<td width="60%" align="center"> - #{@tocband_concordance} -</td> -<td width="20%" align="right"> - <a href="index.html" target="_top" alt="->"> - #{@vz.png_nav_toc} - </a> -#{@vz.table_close} -<p />} - end - def seg_head_navigation_band(type='') - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" alt="->"> - #{@vz.png_nav_nxt} - </a>} if @md.firstseg =~/\S+/ - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td> -<td width="60%" align="center"> - #{@tocband_segtoc} -</td> -<td width="20%" align="right"> - #{firstseg} -#{@vz.table_close} -<p />} - end - def seg_head_navigation_band_bottom(type='') - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" alt="->"> - #{@vz.png_nav_nxt} - </a>} if @md.firstseg =~/\S+/ - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - -</td> -<td width="60%" align="center"> - #{@tocband_segtoc} -</td> -<td width="20%" align="right"> - #{firstseg} -#{@vz.table_close} -<p />} - end - def make_seg_scroll_pdf - wgt=Widget.new(@md) - scroll=%{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_doc_link} -</td> -} - %{<table summary="toc segment and scroll with pdf" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{scroll} - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.pdf}#{wgt.odf} - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - def make_scroll_seg_pdf - seg='' - wgt=Widget.new(@md) - seg=%{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_toc_link} -</td> -} - %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{seg} - #{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - def make_concordance - wgt=Widget.new(@md) - %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - def head - %{#{doc_type} -<head> - <title> - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@rdf.rdftoc} -#{@rdf.metatag_html} -#{@stylesheet.css_head} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a>} - 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= %{ - <li class="ref"> - <a href="#{link}" target="_top"> - #{url} - </a> - </li> - </ul> -</div> -} - end - %{ #{insert} -<!- quick ref -!>} - end - def prefix_a - end - def rights - copyright=meta_content_clean(@md.rights.copyright.all) - rights=copyright(/^\s*Copyright\s+\(C\)/,'Copyright <sup>©</sup> ') - %{<p class="small_left">Rights: #{rights}</p> -<p />} - end - def prefix_b - %{<p class="small_left">Prefix: #{@md.prefix_b}<p />} - end - def scroll_head_title_banner_open - %{<center> -#{@md.icon} -</center> -#{@vz.banner_instrument_cover_band_scr}} - end - def seg_head_title_banner_open - %{<center> - #{@md.icon} -</center> -#{@vz.banner_instrument_cover_band_seg}} - end - def make_scroll - concord=concordance_link(@vz.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} -</td> -<td align="center" bgcolor="white"> - #{concord} -#{@vz.table_close}} - end - def make_seg - concord=concordance_link(@vz.nav_txt_concordance) - %{<table summary="toc segment" border="0" cellpadding="3" cellspacing="0"> -<tr><td align="center" bgcolor="white"> - #{@vz.nav_txt_toc_link} -</td> -<td align="center" bgcolor="white"> - <font size=2> - #{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} - </font> -#{@vz.table_close}} - end - def concordance #check structure - concord=concordance_link(@vz.nav_txt_concordance) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} - #{concord} - </font> -#{@vz.table_close}} - end - def metadata - %{#{@vz.margin_css} - <h4 class="toc"> - <a href="#{@metalink}"> - <i>MetaData</i> - </a> - </h4> -#{@vz.table_close}} - end - def seg_tail - %{ -<div class="main_column"> -<p> <p> -<table summary="toc segment tail" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td> -<td width="60%"> - <center> - #{@tocband_segtoc} - </center> -</td></tr> -</table> -<p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits"></a> -</div> -</div> -</div> -} - end - def scroll_tail #debug - nav=scroll_head_navigation_band - %{ -<div class="main_column"> -#{nav} -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits"></a> -</div> -</div> -</div> -} - end - def seg_navigation_tail #this is a bug area, look up and "tidy" - #nav=scroll_head_navigation_band - %{ -<div class="main_column"> -<p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits"></a> -</div> -</div> -</div> -} - end - end - class HeadSeg < HeadInformation - def initialize(md) #(md='') - super(md) - end - def head - %{#{doc_type} -<head> - <title> - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@rdf.rdfseg} -#{@rdf.metatag_html} -#{@vz.font_css_table_file} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a>} - end - def title_banner(title,subtitle,creator) - end - def dot_control_pre_next - %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> -<tr><td align="left"> - <a href="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_dot_pre} - </a> -</td> -<td align="center"> - <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_dot_toc} - </a> -</td> -<td align="right"> - <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_dot_nxt} - </a> -#{@vz.table_close}} - end - def toc_nav(f_pre=false,f_nxt=false,use=1) - pre=nxt='' - toc=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_toc} - </a> -</td>} - pre=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_pre} - </a> -</td>} if f_pre==true - nxt=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_nxt} - </a> -</td>} if f_nxt==true - %{<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0"> -<tr> -#{pre} -#{toc} -#{nxt} -<td> -#{@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 - %{ -<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - else - %{ -<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - end - def navigation_table - %{<table summary="navigation segment table" width=#{@vz.table_width_1} 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"> -<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"> -<tr><td valign="top"> - <font size="2">} - end - def header_advert_local_1 - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <center> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="http://#{@md.ad_url}#{Sfx[:xhtml]}" target="_top"> - <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}"> - </a> - <p /> -#{@vz.table_close} -</center>} - end - def header_advert_local_2 - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <center> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="#{@md.ad_url}#{Sfx[:xhtml]}" target="_top"> - <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}"> - </a> - <p /> -#{@vz.table_close} -</center>} - end - def header_advert_external - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <center> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="#{@md.ad_url}#{Sfx[:xhtml]}" target="external"> - <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}"> - </a> - <p /> -#{@vz.table_close} -</center>} - end - def credit - %{ -<div class="main_column"> -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits" id="credits"></a> -</div></div> -} - end - def navigation_band(segtocband,seg_table_top_control) #change name to navigaion_band_banner - %{<table summary="segment navigation band with banner" bgcolor=#{@vz.color_band1} width="100%"><tr> -<td width="20%" align="left"> -#{@vz.banner_band} -</td> -<td width="60%" align="center"> - #{doc_types} -</td> -<td width="20%" align="right"> - #{segtocband} -</td></tr> -</table> -#{seg_table_top_control}} - end - def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless - %{ -<div class="main_column"> - <table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr> - <td width="70%" align="center"> - #{doc_types} - </td> - <td width="30%" align="right"> - #{segtocband} - </td></tr> - </table> - #{seg_table_top_control} -</div> -} - end - def endnote_mark -%{ -<p class="center" id="endnotes"> - <hr class="endnote" /> -</p>} - end - def endnote_section_open -%{ -<div class="endnote"> -} - end - def endnote_section_close -%{ -</div> -} #revisit - end - def head - %{#{doc_type} -<head> - <title> - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@rdf.rdfseg} -#{@rdf.metatag_html} -#{@stylesheet.css_head} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a>} - end - def title_banner(title,subtitle,creator) - %{ -<div class="summary"> - <p class="tiny"> - #{title} - </p> - <p class="tiny"> - #{subtitle} - </p> - <p class="tiny"> - #{creator} - </p> - <p class="tiny"> - copy @ - <a href="#{@vz.url_home}"> - #{@vz.txt_home} - </a> - </p> -</div> -} - end - end - class HeadScroll < HeadToc - def initialize(md) #(md='') - super(md) - end - def toc_owner_details - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} - <a href="#owner.details"> - Owner Details - <font size="1" color="#777777"> - - </font> - </a> - </font> -#{@vz.table_close}} - end - def table - %{<table summary="scroll table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0"> -<tr><th width=#{@@indent['level_1']} align="right"> -</th> -<td valign="top"> -#{@vz.paragraph_txt}} - end - def table1 - %{<table summary="scroll table1" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} #{@vz.color_color_table1} align="justify"> -<tr><td valign="top"> -#{@vz.paragraph_txt}} - end - def table2 - %{<table summary="scroll table2" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} #{@vz.color_color_table2} align="justify"> -<tr><td valign="top"> -#{@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} <p class="bold"> #{@txt} </p> -#{@vz.margin_num_css} +#{the_margin.num_css} -#{@vz.table_close}} +#{the_table_close}} end def bold_header @txt=@txt.gsub(/[1-9]~(\S+)/,'<a name="\1"></a>'). @@ -1197,9 +606,9 @@ WOK %{<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} @@ -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 <tr><td width ="20"> </td> <td> - <font size="3" #{@vz.font_face}> + <font size="3" #{the_font.set_face}> <b>#{@txt}</b> </font> </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev3 #change bold use css %{<p /> @@ -1252,11 +661,11 @@ WOK <tr><td width ="20"> </td> <td> - <font size="3" #{@vz.font_face}> + <font size="3" #{the_font.set_face}> <b>#{@txt}</b> </font> </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev4 %{<table summary="navigation segment level 4"> @@ -1266,7 +675,7 @@ WOK <p> #{@txt} </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev5 end @@ -1344,7 +753,7 @@ WOK <p class="bold"> #{@txt} </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_header5 %{<p class="bold"> 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 <Source - require_relative 'defaults' # defaults.rb require_relative 'txt_shared' # txt_shared.rb + include SiSU_Parts_XML @@img_count=0 @@odf={ body: [], head: [], toc: [], metadata: [], tail: [], book_idx: [], endnotes: [] } @@docstart=true @@ -137,9 +137,7 @@ module SiSU_XML_ODF_ODT def initialize(particulars) @md,@env,@ao_array=particulars.md,particulars.env,particulars.ao_array @make=SiSU_Env::ProcessingSettings.new(@md) - @vz=SiSU_Viz::Defaults.new @tab="\t" - @brace_url=SiSU_Viz::Defaults.new.url_decoration @br=(@md.opt.act[:maintenance][:set]==:on) \ ? '' : '' end @@ -422,9 +420,9 @@ module SiSU_XML_ODF_ODT dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '<text:a xl:type="simple" xl:href="\1">\1</text:a>'). #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}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{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}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{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]}/, '<text:a xl:type="simple" xl:href="\1">\1</text:a>'). #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}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{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]}/, '<text:a xl:type="simple" xl:href="\1">\1</text:a>'). #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}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{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 "<endnote>#{@txt}</endnote> " @@ -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 <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_XML + 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_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 + %{ <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_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 + 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]}/, '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\2">\1</link>'). #watch, compare html_tune gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\\1">\\1</link>#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\\1">\\1</link>#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\1">\1</link>') #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=%{ <meta name="keywords" content="#{content}" />\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 <<WOK #{@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} -#{@vz.txt_generator} -#{@vz.png_ico} +#{SiSU_Proj_XML::Bits.new.txt_generator} +#{the_png.ico} WOK end end diff --git a/lib/sisu/v5/xml_tables.rb b/lib/sisu/v5/xml_tables.rb index fe957a99..76ecffe1 100644 --- a/lib/sisu/v5/xml_tables.rb +++ b/lib/sisu/v5/xml_tables.rb @@ -58,13 +58,11 @@ =end module SiSU_Tables - require_relative 'defaults' # defaults.rb - include SiSU_Viz class Table #_xml @@tablehead=0 @@tablefoot=[] #watch #bug??? #check was @@tablefoot def initialize(one,ocn='') - @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Viz::Defaults.new + @one,@parablock,@ocn=one,one,ocn end def table_split #% used but, no longer operational, revisit @new_content=[] @@ -79,7 +77,7 @@ module SiSU_Tables @@tablehead=0 @@tablefoot=[] def initialize(one,ocn='') - @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Viz::Defaults.new + @one,@parablock,@ocn=one,one,ocn end def table m=@parablock[/<!f(.+?)!>/,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 + '</td></tr> +</table>' + end + def margin_numless + '</td><td width="4%" align="right" valign="top">' end def table_head(inf) %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> @@ -193,7 +197,7 @@ module SiSU_Tables <table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">} end def table_end(tablefoot='') - %{</table>#{@vz.margin_numless}#{@vz.margin_numless} #{@vz.table_close} + %{</table>#{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(/<!f.+?!>/,'') @@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 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/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_', 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 <<WOK /* SiSU table output stylesheet */ body { color: black; - background: #{@vz.color_white}; + background: #{the_color.white}; } p { display: block; line-height: 1.5; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; } a:link { - color: #{@vz.color_blue_ink}; + color: #{the_color.blue_ink}; text-decoration: none; } a:visited { - color: #{@vz.color_blue_ink}; + color: #{the_color.blue_ink}; text-decoration: none; - /* background-color: #{@vz.color_blue_tinge}; */ + /* background-color: #{the_color.blue_tinge}; */ } a:hover { - color: #{@vz.color_black}; + color: #{the_color.black}; text-decoration: underline; - background-color: #{@vz.color_yellow_light}; + background-color: #{the_color.yellow_light}; } a:active { - color: #{@vz.color_blue_ink}; + color: #{the_color.blue_ink}; text-decoration: underline; } WOK @@ -1679,14 +1677,14 @@ WOK end def homepage #stylesheet for index, home page <<WOK - body {color: black; background: #{@vz.color_white}; margin:10px 10px 0px 10px; padding:0px;} + body {color: black; background: #{the_color.white}; margin:10px 10px 0px 10px; padding:0px;} p { line-height: 1.5 } - a:link {color: #{@vz.color_blue_ink}; text-decoration: none; } - a:visited {color: #{@vz.color_blue_ink}; text-decoration: none; } - a:hover {color: #{@vz.color_black}; text-decoration: underline; background-color: #{@vz.color_yellow_light};} - a:active {color: #{@vz.color_blue_ink}; text-decoration: underline;} + a:link {color: #{the_color.blue_ink}; text-decoration: none; } + a:visited {color: #{the_color.blue_ink}; text-decoration: none; } + a:hover {color: #{the_color.black}; text-decoration: underline; background-color: #{the_color.yellow_light};} + a:active {color: #{the_color.blue_ink}; text-decoration: underline;} #banner { - background:#{@vz.color_white}; + background:#{the_color.white}; } #column_left { width:25%; @@ -1697,7 +1695,7 @@ WOK #column_center { width:55%; float:left; - background:#{@vz.color_white}; + background:#{the_color.white}; padding-bottom:10px; } #column_right { @@ -1707,7 +1705,7 @@ WOK padding-bottom:10px; } p,h1,pre { - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; margin:0px 10px 10px 10px; } h1 { @@ -1757,7 +1755,7 @@ WOK } dc { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: blue; background-color: #dddddd; font-weight: normal; @@ -1775,7 +1773,7 @@ WOK } keywords,copyright { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: red; background-color: #dddddd; font-weight: normal; @@ -1831,7 +1829,7 @@ WOK } text,text[class|="norm"] { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; text-align: justify; font-weight: normal; font-size: 100%; @@ -2377,7 +2375,7 @@ WOK endnote { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -2389,7 +2387,7 @@ WOK endnote_indent { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -2499,7 +2497,7 @@ WOK } dc { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: blue; background-color: #dddddd; font-weight: normal; @@ -2517,7 +2515,7 @@ WOK } keywords,copyright { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: red; background-color: #dddddd; font-weight: normal; @@ -2569,7 +2567,7 @@ WOK } text { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; text-align: justify; font-size: 100%; line-height: 150%; @@ -3128,7 +3126,7 @@ WOK endnote { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -3140,7 +3138,7 @@ WOK endnote_indent { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -3177,7 +3175,7 @@ WOK } dc,sc { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: blue; background-color: #dddddd; font-weight: normal; @@ -3194,7 +3192,7 @@ WOK } keywords,copyright { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; color: red; background-color: #dddddd; font-weight: normal; @@ -3247,7 +3245,7 @@ WOK } para { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; /* font-weight: normal; */ text-align: justify; font-size: 100%; @@ -3261,12 +3259,12 @@ WOK text-align: left; } para.norm { - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; } para.h1, title { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-size: 120%; font-weight: bold; text-align: left; @@ -3336,7 +3334,7 @@ WOK endnote { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -3348,7 +3346,7 @@ WOK endnote_indent { display: block; font-size: small; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: normal; line-height: 150%; text-align: justify; @@ -3402,7 +3400,7 @@ WOK } p { display: block; - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-size: 100%; font-weight: normal; line-height: 150%; @@ -3424,7 +3422,7 @@ WOK text-indent: 5% } p.h1 { - font-family: #{fonts}; + font-family: #{the_font.set_fonts}; font-weight: bold; line-height: 120%; margin-left: 10mm; 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 diff --git a/lib/sisu/v6/defaults.rb b/lib/sisu/v6/defaults.rb deleted file mode 100644 index 185e28e7..00000000 --- a/lib/sisu/v6/defaults.rb +++ /dev/null @@ -1,1214 +0,0 @@ -# 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/defaults.rb;hb=HEAD> - - * Ralph Amissah - <ralph@amissah.com> - <ralph.amissah@gmail.com> - - ** 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 - %{ <link href="./#{@dir.path.style}/homepage.css" rel="stylesheet">} - end - #% text #changed from txt to avoid naming conflicts #FOLLOW - 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 txt_generator_comment - %{ <!- #{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!)" http://www.sisudoc.org/ ->} - 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 - %{<body lang="en" xml:lang="en">} - 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 - %{<body lang="en" xml:lang="en">} - 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 - %{<p class="normal">} - end - def paragraph_endnote - %{<p class="endnote">} - end - def paragraph_font_tiny - %{<font #{font_tiny} #{font_face}>} - end - def paragraph_font_small - %{<font #{font_small} #{font_face}>} - end - #% table - def table_close - '</td></tr> -</table>' - 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 - '</p> </td><td width="4%" align="right" valign="top">' - end - def margin_numless - '</td><td width="4%" align="right" valign="top">' - end - def margin_num_css - '</td> -<td width="2%" align="right" valign="top"> ' - end - def margin_txt_w1 - %{<table summary="" width=#{table_width_txt_r} border="0" cellpadding="2" align="center"> -<tr><td width="6%" align="right"> </td> -<td width="90%" valign="top" align="justify">} - end - def margin_txt_w2 - %{<table summary="" width=#{table_width_txt_r} border="0" cellpadding="2" align="center"> -<tr><td width="10%" align="right"> </td> -<td width="86%" valign="top" align="justify">} - end - def margin_txt_0 - %{<table summary="" width=#{table_width_txt} border="0" cellpadding="2" align="center"> -<tr><td width=#{indent_level_0} align="right"> -</td><td valign="top" align="justify">} - end - def margin_txt_1 - %{<table summary="" width=#{table_width_txt} border="0" cellpadding="2" align="center"> -<tr><td width=#{indent_level_1} align="right"></td><td valign="top" align="justify">} - end - def margin_txt_2 - %{<table summary="" width=#{table_width_txt} border="0" cellpadding="2" align="center"> -<tr><td width=#{indent_level_2} align="right"> -</td> -<td valign="top" align="justify">} - end - def margin_txt_3 - %{<table summary="" width=#{table_width_txt} border="0" cellpadding="2" align="center"> -<tr><td width=#{indent_level_3} align="right"> -</td> -<td valign="top" align="justify">} - end - def margin_css - '<table summary="normal text css" width="100%" border="0" cellpadding="2" align="center"> -<tr><td valign="top" align="justify"> ' - end - #% png - def png_ico - %{ <link rel="shortcut icon" href="../_sisu/image/#{icon_ico}" />} - end - def png_sisu #check url path - %{ <a href="#{@url.sisu}"> - <img border="0" width="160" height="60" src="#{url_path_image}/#{icon_sisu}" alt="SiSU" /> - </a>} - end - def png_site - %{<img src="#{url_path_image}/#{icon_site}" alt="@" border="0" />} - end - def png_nav - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_bluebell}" alt="Contents" />} - end - def png_manifest - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_manifest}" alt="Document Manifest" />} - end - def png_doc - %{<img border="0" height="15" width="15" src="#{url_path_image_sys}/#{icon_doc}" alt="Full Text" />} - end - def png_toc - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_toc}" alt="TOC linked" />} - end - def png_odf - %{<img border="0" height="18" width="18" src="#{url_path_image_sys}/#{icon_odf}" alt="ODF/ODT" />} - end - def png_epub - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_epub}" alt="EPUB" />} - end - def png_pdf - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF" />} - end - def png_pdf_portrait - %{<img border="0" height="18" width="15" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF portrait" />} - end - def png_pdf_landscape - %{<img border="0" height="15" width="18" src="#{url_path_image_sys}/#{icon_pdf}" alt="PDF landscape" />} - end - def png_home - #dir=SiSU_Env::InfoEnv.new #(@fns) - %{<img border="0" src="#{url_path_image_base}/#{icon_home_button}" alt="#{txt_home} -->" />} - #%{<img border="0" src="#{dir.url.images_local}/#{icon_home_button}" alt="#{txt_home} -->" />} - end - def png_home_button - rel=@dir.path_rel_links.html_scroll_2 - %{<img border="0" src="#{rel}/#{icon_home_button}" alt="#{txt_home} -->" />} - end - #% png_nav #not currently used - #% nav_txt - def nav_txt_homepage - %{ <font face="#{font_fonts}" size="2"> - home - </font> } - end - def nav_txt_toc_link - %{ <font face="#{font_fonts}" size="2"> - toc - </font> } - end - def nav_txt_doc_link - %{ <font face="#{font_fonts}" size="2"> - scroll - </font> } - end - def nav_txt_manifest - #{png_manifest} document manifest - %{ <font face="#{font_fonts}" size="2"> - [ document manifest ] - </font> } - end - def nav_txt_concordance - %{ <font face="#{font_fonts}" size="2"> - A-Z - </font> } - end - def nav_txt_pdf_portrait - %{ <font face="#{font_fonts}" size="2"> - pdf - </font> } - end - def nav_txt_pdf_landscape - %{ <font face="#{font_fonts}" size="2"> - pdf - </font> } - end - #% banner - def banner_home_button_only - %{<a href="#{url_site}/"> - #{png_home_button} - </a>} - end - def banner_band #yellow_dark now white - %{<table summary="home button" width="100%" border="0" cellpadding="3" align="center"> -<tr><td align="left" valign="middle"> - <a href="#{url_site}/" target="_top"> - #{png_home} - </a> -</td> -<td width="90%"> -#{table_close}} - end - def banner_instrument_cover_band_scr - '<table summary="scroll instrument cover band" width="100%" border="0" cellpadding="8" align="center"> -<tr><td align="center">' - end - def banner_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 - #% 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 -<table summary="SiSU summary" cellpadding="4" border="0"> -WOK - end - def widget_sisu_text -<<WOK - <p class="tiny"><font color="#666666" size="2"> - Output generated by - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) - </font></p> -WOK - end - def widget_sisu -<<WOK -<!-- widget sisu --> -<tr><td valign="top" width="100%"> -<!-- SiSU Rights --> -#{widget_sisu_text} -</td></tr> -WOK - end - def widget_sisu_verbose -<<WOK -<!-- widget sisu --> -<tr><td valign="top" width="10%"> - <p class="tiny_left"><font color="#666666" size="2"> - <a href="#{url_sisu}"> - <img border="0" src="../_sisu/image/sisu.png" alt="SiSU" width="120" height="39" /> - </a> - </font></p> -</td><td valign="top" width="45%"> -<!-- SiSU Rights --> - <p class="tiny_left"><font color="#666666" size="2"> - Output generated by - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - #{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]}) - <br /> - <a href="#{url_sisu}"> - <b>#{@v[:project]}</b> - </a> - Copyright <sup>©</sup> Ralph Amissah - 1997, current #{@date.year_static}. - All Rights Reserved. - <br /> - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - is software for document structuring, publishing and search, - <br /> - <a href="#{url_sisu}"> - www.sisudoc.org/ - </a> - and - <a href="#{url_sisudoc}"> - www.sisudoc.org - </a> - <br /> - <i>w3 since October 3 1993</i> - <a href="mailto:ralph@amissah.com"> - ralph@amissah.com - </a> - </font></p> -</td><td valign="top" width="45%"> - <p class="tiny_left"><font color="#666666" size="2"> - #{@v[:project]} using: - <br />Standard SiSU markup syntax, - <br />Standard SiSU meta-markup syntax, and the - <br />Standard SiSU <u>object citation numbering</u> and system, (object/text positioning system) - <br /> - Copyright <sup>©</sup> Ralph Amissah 1997, current #{@date.year_static}. - All Rights Reserved. - </font></p> -</td></tr> -WOK - end - def widget_way_better - <<WOK -<!-- widget way better --> -<tr><td valign="top" width="10%"> - <p class="tiny_left"><font color="#666666" size="2"> - <a href="http://www.gnu.org/licenses/gpl.html"> - <img border="0" src="../_sisu/image/gplv3_free_software.png" alt="GPLv3" width="127" height="51" /> - </a> - </font></p> -</td><td valign="top" width="45%"> - <p class="tiny_left"><font color="#666666" size="2"> - <a href="#{url_sisu}"> - #{@v[:project]} - </a> - is released under - <a href="http://www.gnu.org/licenses/gpl.html">GPLv3</a> - or later, - #{url_decoration.xml_open}<a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a>#{url_decoration.xml_close} - </font></p> -</td><td valign="top" width="45%"> - <p class="tiny_left"><font color="#666666" size="2"> - #{@v[:project]}, developed using - <a href="http://www.ruby-lang.org/en/"> - Ruby - </a> - on - <a href="http://www.debian.org/"> - Debian/Gnu/Linux - </a> - software infrastructure, - with the usual GPL (or OSS) suspects. - <br /> - 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é. - <br /> - Get With the Future - <a href="http://www.sisudoc.org/"> - Way Better! - </a> - </font></p> -</td></tr> -WOK - end - #% credits - def credits_sisu_manifest - widget_sisu_text - end - def credits_sisu - %{<div class="substance"> -<table summary="SiSU summary" cellpadding="4" border="0"> -<tr><td> - #{widget_sisu} -</table></div>} - '' - end - def credits_splash - end - def credits_sisu_epub - %{<div class="substance"> -<p class="center"><a href="http://www.openebook.org"><b>EPUB</b></a> generated by <a href="http://www.sisudoc.org"><b>#{@v[:project]}</b></a> v#{@v[:version]}, GPL3</p> -</div>} - '' - 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 - <<WOK -<html><head> -<title>SiSU</title> -<meta http-equiv="refresh" content="0, url=http://www.sisudoc.org/sisu/SiSU/"> -</head> -<body> -SiSU informtion provided at <a href="http://www.sisudoc.org/sisu/SiSU/">www.sisudoc.org/sisu/SiSU</a><p /> -If your browser supports redirection, you will be escorted there shortly. -</body> -</html> -WOK - end - def homepage - <<WOK -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -<title>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</title> -<meta name="dc.title" content="SiSU - SiSU information Structuring Universe, Structured information Serialised Units, #{@date.year_static}" /> -<meta name="dc.creator" content="Ralph Amissah" /> -<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, EPUB, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" /> -<meta name="dc.publisher" content= "SiSU http://www.sisudoc.org/" /> -<meta name="dc.language" content="en" /> -<meta name="dc.rights" content="Copyright Ralph Amissah" /> -<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/" /> -<link rel="stylesheet" href="./#{@dir.path.style}/harvest.css" type="text/css" /> -<link rel="shortcut icon" href="./_sisu/image/rb7.ico" /> -</head> - -<body lang="en" xml:lang="en"> -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a> - -<h1>SiSU</h1> -<p> -[<a href="http://sisudoc.org/sisu_manual/en/html/sisu/toc.html">Manual</a>] -</p> -<p> -[<a href="http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary">Source</a>] -[<a href="http://lists.sisudoc.org/listinfo/sisu">List Info (sisu@lists.sisudoc.org)</a>] -</p> - -<h1>SiSU Markup Samples</h1> -<p> -[<a href="http://git.sisudoc.org/gitweb/?p=doc/sisu-markup-samples.git;a=summary">Source</a>] -[<a href="http://sisudoc.org/sisu_markup_samples.html">Output</a>] -</p> - -<hr /> - -<h2 class="top_band_tiny"> - Structured information, Serialized Units - - <a href="http://www.sisudoc.org" target="_top"> - <www.sisudoc.org> - </a> - or - <a href="http://www.jus.uio.no/sisu/" target="_top"> - <www.jus.uio.no/sisu/> - </a> -software for electronic texts, document collections, books, digital libraries & search, with "atomic search" & text locating system (shared object citation numbering: "<i>ocn</i>"). -Outputs include: plaintext, HTML, EPUB, ODT (OpenDocumentText), (XHTML, XML,) LaTeX, PDF, SQL (PostgreSQL and SQLite). -</h2> -<p class="small"> -<a href="mailto:sisu@lists.sisudoc.org"> -<sisu@lists.sisudoc.org> -</a> -<a href="http://lists.sisudoc.org/listinfo/sisu"> -<http://lists.sisudoc.org/listinfo/sisu> -</a> -</p> -<p class="small"> -<a href="mailto:ralph@amissah.com"> -<ralph@amissah.com> -</a> -<a href="mailto:ralph.amissah@gmail.com"> -<ralph.amissah@gmail.com> -</a> -</p> -<p class="tiny"> -#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!), #{@date.year_static}. -</p> -<p class="tiny"> -w3 since October 3 1993. -</p> -</body> -</html> -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 <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_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] <<<<WOK <center> <table><tr><td> -<p><font color="#222222" #{@font.face} size="2"> +<p><font color="#222222" #{the_font.set_face} size="2"> (relatively static) RSS feeds for DOCUMENTS:<br> <a href="../rssfeed/documents.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a> http://www.jus.uio.no/lm/rssfeed/documents.xml<br> <a href="../rssfeed/tradelaw.xml"><img border="0" height="14" width="36" src="../_sisu/image/rss.png" alt="RSS feed"></a> http://www.jus.uio.no/lm/rssfeed/tradelaw.xml<br> @@ -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 ||= %{<p>#{@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 abefdf2f..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 @@ -71,10 +71,11 @@ module SiSU_HTML_Format if @ocn.to_i==0 \ or @ocn.empty? '' + elsif @make.build.html_strict? + %{<label class="ocn">#{@ocn}</label>} else - name=(@make.build.html_strict?) ? '' : %{ name="#{@ocn}"} - @ocn.gsub(/^(\d+|)$/, - %{<label class="ocn" id="#{@ocn}">\\1</label>}) + %{<label class="ocn"><a name="#{@ocn}" class="lnkocn">#{@ocn}</a></label>} + #%{<label class="ocn" id="#{@ocn}">#{@ocn}</label>} end else '' @@ -97,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 @@ -164,7 +165,7 @@ module SiSU_HTML_Format %{ <table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> <tr> -<td align="center" bgcolor=#{@vz.color_band2}> +<td align="center" bgcolor=#{the_color.band2}> #{wgt.manifest(page)} #{wgt.search} </tr></table>} @@ -172,14 +173,6 @@ module SiSU_HTML_Format def rdf SiSU_XML_Tags::RDF.new(md) end - def doc_type - %{<!DOCTYPE html> -<html>\n} - end - def table_close - %{ </font> -#{@vz.table_close}} - end def button_home(page=:seg) button=%{ <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0">\n <tr><td align="left" bgcolor="#ffffff">\n} if @md.make.home_button_image.is_a?(Hash) @@ -206,6 +199,7 @@ module SiSU_HTML_Format end end class Widget < HeadInformation + include SiSU_Parts_HTML def initialize(md) super(md) @md=md @@ -216,15 +210,15 @@ module SiSU_HTML_Format @make=SiSU_Env::ProcessingSettings.new(md) end def home - %{<td align="center" bgcolor=#{@vz.color_band2}> + %{<td align="center" bgcolor=#{the_color.band2}> <a href="../index.html" target="_top"> - #{@vz.nav_txt_homepage}</a> + #{the_nav.txt_homepage}</a> </td> } end def scroll(text) if @md.fns =~ /\.(?:-|ssm\.)?sst$/ - %{<td align="center" bgcolor=#{@vz.color_band2}> + %{<td align="center" bgcolor=#{the_color.band2}> <a href="#{Xx[:html_relative1]}html/#{@file.base_filename.html_scroll}" target="_top"> #{text} </a> @@ -257,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 - %{<td align="center" bgcolor=#{@vz.color_band2}> - <font face="#{@vz.font_fonts}" size="2"> - #{brace_url.xml_open}<a href="#{manifest_lnk}" target="_top">#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}</a>#{brace_url.xml_close} + %{<td align="center" bgcolor=#{the_color.band2}> + <font face="#{the_font.set_fonts}" size="2"> + #{the_url_decoration.xml_open}<a href="#{manifest_lnk}" target="_top">#{@md.file.output_path.manifest.url}/#{@file.base_filename.manifest}</a>#{the_url_decoration.xml_close} </font> </td>} else - %{<td align="center" bgcolor=#{@vz.color_band2}> + %{<td align="center" bgcolor=#{the_color.band2}> <a href="#{manifest_lnk}" target="_top"> - #{@vz.nav_txt_manifest} + #{the_nav.txt_manifest} </a> </td>} end @@ -291,7 +284,7 @@ module SiSU_HTML_Format #{make_scroll_search_form_and_manifest_link} </td> WOK - %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}> <tr><td width="20%"> #{button_home(:scroll)} </td> @@ -300,7 +293,7 @@ WOK </td> <td width="20%"> -#{@vz.table_close} +#{the_table_close} <p>} else '' end @@ -316,14 +309,14 @@ WOK else '' end if @make.build.html_top_band? - %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}> <tr><td width="20%"> #{button_home} </td> <td width="75%" align="center"> #{doc_types} #{up_button} -#{@vz.table_close} +#{the_table_close} <p>} else '' end @@ -344,7 +337,7 @@ WOK else '' end if @make.build.html_top_band? - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> + %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{the_color.band1}> <tr><td width="20%"> #{button_home(page)} </td> @@ -353,7 +346,7 @@ WOK </td> <td width="5%" align="right"> #{firstseg} -#{@vz.table_close} +#{the_table_close} <p>} else '' end @@ -376,8 +369,8 @@ WOK end def make_scroll_search_form_and_manifest_link wgt=SiSU_HTML_Format::Widget.new(@md) - %{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_doc_link} + %{<td align="center" bgcolor=#{the_color.band2}> + #{the_nav.txt_doc_link} </td> } %{<table summary="toc segment and scroll with pdf" border="0" cellpadding="3" cellspacing="0"> @@ -389,13 +382,13 @@ WOK def make_scroll_seg_pdf seg='' wgt=SiSU_HTML_Format::Widget.new(@md) - seg=%{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_toc_link} + seg=%{<td align="center" bgcolor=#{the_color.band2}> + #{the_nav.txt_toc_link} </td> } %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> <tr> -<td align="center" bgcolor=#{@vz.color_band2}> +<td align="center" bgcolor=#{the_color.band2}> #{wgt.manifest} #{wgt.search} </tr></table>} @@ -404,47 +397,49 @@ WOK wgt=SiSU_HTML_Format::Widget.new(@md) %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> <tr> -<td align="center" bgcolor=#{@vz.color_band2}> +<td align="center" bgcolor=#{the_color.band2}> #{wgt.manifest} #{wgt.search} </tr></table>} end def head - %{#{doc_type} + rdf=SiSU_XML_Tags::RDF.new(@md) + %{<!DOCTYPE html> +<html> <head> <meta charset="utf-8"> <title> #{@md.html_title} </title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +#{rdf.metatag_html} #{@stylesheet.css_head} </head> -#{@vz.color_body} +<body lang="#{@md.opt.lng}"> <a name="top" id="top"></a>} 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"> @@ -459,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"> @@ -519,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> @@ -590,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> @@ -604,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> @@ -615,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> @@ -640,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} @@ -655,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} @@ -676,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> @@ -708,7 +699,7 @@ WOK #{toc} #{nxt} <td> -#{@vz.table_close}} +#{the_table_close}} end def toc_next2 toc_nav(false,true).dup @@ -737,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> @@ -780,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> @@ -809,7 +799,9 @@ WOK } #revisit end def head_seg - %{#{doc_type} + rdf=SiSU_XML_Tags::RDF.new(@md) + %{<!DOCTYPE html> +<html> <head> <meta charset="utf-8"> <title> @@ -817,9 +809,10 @@ WOK #{@md.html_title} </title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> +#{rdf.metatag_html} #{@stylesheet.css_head_seg} </head> -#{@vz.color_body} +<body lang="#{@md.opt.lng}"> <a name="top" id="top"></a>} end def title_banner(title,subtitle,creator) @@ -836,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> @@ -849,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"> @@ -858,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 @@ -895,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='' @@ -1123,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} @@ -1155,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 %{ @@ -1286,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/harvest.rb b/lib/sisu/v6/html_harvest.rb index 09c1b883..b1bd7ca5 100644 --- a/lib/sisu/v6/harvest.rb +++ b/lib/sisu/v6/html_harvest.rb @@ -63,8 +63,8 @@ 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 '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) diff --git a/lib/sisu/v6/harvest_author_format.rb b/lib/sisu/v6/html_harvest_author_format.rb index c5081193..c5081193 100644 --- a/lib/sisu/v6/harvest_author_format.rb +++ b/lib/sisu/v6/html_harvest_author_format.rb diff --git a/lib/sisu/v6/harvest_authors.rb b/lib/sisu/v6/html_harvest_authors.rb index e48c4f78..14b18ca0 100644 --- a/lib/sisu/v6/harvest_authors.rb +++ b/lib/sisu/v6/html_harvest_authors.rb @@ -59,7 +59,8 @@ =end module SiSU_HarvestAuthors - require_relative 'harvest_author_format' # harvest_author_format.rb + 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/harvest_topics.rb b/lib/sisu/v6/html_harvest_topics.rb index 2b80565e..3daafe3d 100644 --- a/lib/sisu/v6/harvest_topics.rb +++ b/lib/sisu/v6/html_harvest_topics.rb @@ -60,8 +60,8 @@ =end module SiSU_HarvestTopics - require_relative 'harvest_author_format' # 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 1ac7f4d4..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> @@ -901,7 +900,7 @@ SiSU manifest: #{@md.title.full} <link rel="shortcut icon" href="#{@f.path_rel_links.html_scroll_css}_sisu/image_sys/rb7.ico" /> #{@stylesheet.css_head} </head> -<body lang="en" xml:lang="en"> +<body lang="#{@md.opt.lng}"> #{format_head_toc.seg_head_navigation_band(:manifest)} WOK if make.build.manifest_minitoc? @@ -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</title> +<meta http-equiv="refresh" content="0, url=http://www.sisudoc.org/sisu/SiSU/"> +</head> +<body> +SiSU informtion provided at <a href="http://www.sisudoc.org/sisu/SiSU/">www.sisudoc.org/sisu/SiSU</a><p /> +If your browser supports redirection, you will be escorted there shortly. +</body> +</html> +WOK + end + def homepage + <<WOK +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +<title>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</title> +<meta name="dc.title" content="SiSU - SiSU information Structuring Universe, Structured information Serialised Units, #{@date.year_static}" /> +<meta name="dc.creator" content="Ralph Amissah" /> +<meta name="dc.subject" content= "document structuring, ebook, publishing, PDF, LaTeX, XML, ODF, EPUB, SQL, postgresql, sqlite, electronic book, electronic publishing, electronic document, electronic citation, data structure, citation systems, granular search, digital library" /> +<meta name="dc.publisher" content= "SiSU http://www.sisudoc.org/" /> +<meta name="dc.language" content="en" /> +<meta name="dc.rights" content="Copyright Ralph Amissah" /> +<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/" /> +<link rel="stylesheet" href="./#{@dir.path.style}/harvest.css" type="text/css" /> +<link rel="shortcut icon" href="./_sisu/image/rb7.ico" /> +</head> + +<body lang="en" xml:lang="en"> +<a name="top" id="top"></a> +<a name="up" id="up"></a> +<a name="start" id="start"></a> + +<h1>SiSU</h1> +<p> +[<a href="http://sisudoc.org/sisu_manual/en/html/sisu/toc.html">Manual</a>] +</p> +<p> +[<a href="http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary">Source</a>] +[<a href="http://lists.sisudoc.org/listinfo/sisu">List Info (sisu@lists.sisudoc.org)</a>] +</p> + +<h1>SiSU Markup Samples</h1> +<p> +[<a href="http://git.sisudoc.org/gitweb/?p=doc/sisu-markup-samples.git;a=summary">Source</a>] +[<a href="http://sisudoc.org/sisu_markup_samples.html">Output</a>] +</p> + +<hr /> + +<h2 class="top_band_tiny"> + Structured information, Serialized Units + + <a href="http://www.sisudoc.org" target="_top"> + <www.sisudoc.org> + </a> + or + <a href="http://www.jus.uio.no/sisu/" target="_top"> + <www.jus.uio.no/sisu/> + </a> +software for electronic texts, document collections, books, digital libraries & search, with "atomic search" & text locating system (shared object citation numbering: "<i>ocn</i>"). +Outputs include: plaintext, HTML, EPUB, ODT (OpenDocumentText), (XHTML, XML,) LaTeX, PDF, SQL (PostgreSQL and SQLite). +</h2> +<p class="small"> +<a href="mailto:sisu@lists.sisudoc.org"> +<sisu@lists.sisudoc.org> +</a> +<a href="http://lists.sisudoc.org/listinfo/sisu"> +<http://lists.sisudoc.org/listinfo/sisu> +</a> +</p> +<p class="small"> +<a href="mailto:ralph@amissah.com"> +<ralph@amissah.com> +</a> +<a href="mailto:ralph.amissah@gmail.com"> +<ralph.amissah@gmail.com> +</a> +</p> +<p class="tiny"> +#{@v[:project]} #{@v[:version]} of #{@v[:date_stamp]} (#{@v[:date]}) (n*x and Ruby!), #{@date.year_static}. +</p> +<p class="tiny"> +w3 since October 3 1993. +</p> +</body> +</html> +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 <!e_!> #?? workpoint - if dob.obj =~/<a name="_\d+" href="#-\d+"> <sup>/ #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 <!e_!> #?? workpoint + if dob.obj =~/<a name="_\d+" href="#-\d+"> <sup>/ #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 <SiSU_XHTML_Table::TableXHTML + require_relative 'xhtml_table' # xhtml_table.rb + require_relative 'html_parts' # html_parts.rb + class TableHTML < SiSU_XHTML_Table::TableXHTML + include SiSU_Parts_HTML end end __END__ diff --git a/lib/sisu/v6/html_tune.rb b/lib/sisu/v6/html_tune.rb index b655b7d1..48bce66e 100644 --- a/lib/sisu/v6/html_tune.rb +++ b/lib/sisu/v6/html_tune.rb @@ -61,6 +61,7 @@ require_relative 'dp' # dp.rb module SiSU_HTML_Tune require_relative 'se' # se.rb include SiSU_Env; include SiSU_Screen + require_relative 'html_parts' # html_parts.rb require_relative 'html_format' # html_format.rb #watch @@line_mode='' @@endnote_array=[] @@ -123,12 +124,11 @@ module SiSU_HTML_Tune end end class Tune + include SiSU_Parts_HTML 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,@md) - @brace_url=SiSU_Viz::Defaults.new.url_decoration end def songsheet begin @@ -230,13 +230,13 @@ module SiSU_HTML_Tune dob.obj=dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/, %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n}) end - dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_choice}" alt="stellar">}). - gsub(/!new/,%{ <img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_new}" alt="new">}). + dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images}/#{the_icon.i_choice}" alt="stellar">}). + gsub(/!new/,%{ <img border="0" height="15" width="15" src="#{@env.url.images}/#{the_icon.i_new}" alt="new">}). gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>'). gsub(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> '). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #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}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}). - 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]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}<a href="mailto:\\1">\\1</a>#{the_url_decoration.xml_close}}). + 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 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+)/,'<a href="\1">\1</a>') @@ -245,9 +245,9 @@ module SiSU_HTML_Tune and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ dob.obj=dob.obj.gsub(/\.\.(\/\S+)/,%{<a href="#{Xx[:html_relative2]}\1">\1</a>}) end - dob.obj=dob.obj.gsub(/<a href=":/,%{<a href="#{@vz.url_site}/}). - gsub(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/}). - gsub(/<a href="#{Xx[:html_relative2]}\//,%{<a href="#{@vz.url_site}/}) + dob.obj=dob.obj.gsub(/<a href=":/,%{<a href="#{the_url.site}/}). + gsub(/<a href="\.\.\//,%{<a href="#{the_url.site}/}). + gsub(/<a href="#{Xx[:html_relative2]}\//,%{<a href="#{the_url.site}/}) else dob.obj=dob.obj.gsub(/</m,'<').gsub(/>/m,'>') end diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb index 87c7040e..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' @@ -257,16 +255,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..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' @@ -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_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/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/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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data) @md,@data=md,data - @brace_url=SiSU_Viz::Defaults.new.url_decoration - @vz=SiSU_Viz::Defaults.new @tab="\t" @@notes=:end @manpage={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] } @@ -300,9 +297,9 @@ WOK "\n.I \\1\\2#{Mx[:br_line]}") unless dob.is==:code dob.obj=dob.obj.gsub(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/, - "\\1 #{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3"). + "\\1 #{the_text.url_open}\\2#{the_text.url_close}\\3"). gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/, - "\\1#{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3") + "\\1#{the_text.url_open}\\2#{the_text.url_close}\\3") @manpage[:endnotes]=extract_endnotes(dob) dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_b_c]}/m,'[^\1]'). # endnote marker marked up diff --git a/lib/sisu/v6/manpage_format.rb b/lib/sisu/v6/manpage_format.rb index 72f7668b..13b70980 100644 --- a/lib/sisu/v6/manpage_format.rb +++ b/lib/sisu/v6/manpage_format.rb @@ -60,7 +60,6 @@ module SiSU_ManpageFormat require_relative 'dp' # dp.rb include SiSU_Param - include SiSU_Viz class ParagraphNumber def initialize(paranum) @paranum=/(\d+)/m.match(paranum)[1] @@ -80,7 +79,6 @@ module SiSU_ManpageFormat @md,@dob=md,dob rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:en_a_c]}/ @dob.obj.gsub!(rgx,'\1') if @dob.obj =~rgx - @vz=SiSU_Viz::Defaults.new end def scr_endnote_body "<endnote>#{@dob.obj}</endnote> " 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'po4a_set' # po4a_set.rb include SiSU_Po4aUtils @@endnotes={ para: [], end: [] } def initialize(fn,data_src,data_trn,md_src,md_trn,wrap_width) @@ -181,8 +178,6 @@ module SiSU_Po4a @md=(md_trn.nil?) \ ? md_src : md_trn - @brace_url=SiSU_Viz::Defaults.new.url_decoration - @vz=SiSU_Viz::Defaults.new @tab="\t" @@endnotes_=(@md.opt.selections.str =~/--endnote/) ? true : false # --footnote @br=(@md.opt.selections.str =~/--dos/) ? "\r\n" : "\n" # --unix @@ -871,7 +866,6 @@ GSUB gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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 b4a84f22..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 <Source + include SiSU_Parts_Generic def initialize(md) @manifest={ txt: [], txt_title: [] } @md,@fns=md,md.fns @@ -129,7 +130,6 @@ module SiSU_QRcode 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 @f.make_path(@f.output_path.qrcode.dir) end def spaces @@ -165,7 +165,7 @@ module SiSU_QRcode kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] <<<<WOK #{id} #{kb} - #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close} + #{the_text.url_open}#{url}/#{file}#{the_text.url_close} WOK end def summarize_html_seg(id,file,pth='',rel='',url='',img='● ') @@ -173,14 +173,14 @@ WOK kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] <<<<WOK #{id} #{kb} - #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close} + #{the_text.url_open}#{url}/#{file}#{the_text.url_close} WOK end def summarize_sources(id,file,pth,rel,url) 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 @@ -199,7 +199,7 @@ WOK kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] <<<<WOK #{id} #{dgst[1]} #{kb} - #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close} + #{the_text.url_open}#{url}/#{file}#{the_text.url_close} WOK end def published_manifests? @@ -247,7 +247,7 @@ WOK def published_languages(id,file) flv=published_manifests? flv.each do |l| - @manifest[:txt] << "#{l[:l]} #{@brace_url.txt_open}#{l[:mu]}#{@brace_url.txt_close}\n" + @manifest[:txt] << "#{l[:l]} #{the_text.url_open}#{l[:mu]}#{the_text.url_close}\n" end end def metadata(id,info) @@ -263,7 +263,7 @@ WOK elsif url =~/^\.\.\// then url.gsub(/^\.(\.)?/,@env.url.root) else url end - @manifest[:txt] << %{#{url} #{lnk} #{@brace_url.txt_open}#{static}#{@brace_url.txt_close}\n} + @manifest[:txt] << %{#{url} #{lnk} #{the_text.url_open}#{static}#{the_text.url_close}\n} end def output_tests if FileTest.file?(@f.place_file.html_segtoc.dir)==true @@ -731,11 +731,11 @@ WOK end @manifest[:txt] <<<<WOK #{@translate.manifest_description_metadata} - #{@brace_url.txt_open}#{@en_manifest}#{@brace_url.txt_close} + #{the_text.url_open}#{@en_manifest}#{the_text.url_close} WOK metadata_tests @manifest[:txt_title] <<<<WOK - #{@brace_url.txt_open}#{@en_manifest}#{@brace_url.txt_close} + #{the_text.url_open}#{@en_manifest}#{the_text.url_close} WOK source_tests @manifest[:txt] <<<<WOK diff --git a/lib/sisu/v6/rexml.rb b/lib/sisu/v6/rexml.rb index 9e6ee4eb..db5019f4 100644 --- a/lib/sisu/v6/rexml.rb +++ b/lib/sisu/v6/rexml.rb @@ -70,7 +70,6 @@ module SiSU_Rexml include SiSU_Param require_relative 'se' # se.rb include SiSU_Env - include SiSU_Viz class Rexml begin require 'rexml/document' \ diff --git a/lib/sisu/v6/se_createsite.rb b/lib/sisu/v6/se_createsite.rb index e6aa2a6e..ce31b460 100644 --- a/lib/sisu/v6/se_createsite.rb +++ b/lib/sisu/v6/se_createsite.rb @@ -59,6 +59,7 @@ =end module SiSU_Create_Site require_relative 'constants' # constants.rb + require_relative 'html_parts' # html_parts.rb require_relative 'utils' # utils.rb require_relative 'utils_screen_text_color' # utils_screen_text_color.rb require_relative 'se_info_env' # se_info_env.rb @@ -78,13 +79,12 @@ module SiSU_Create_Site @init=SiSU_Env::GetInit.new @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd @rc=SiSU_Env::GetInit.new.sisu_yaml.rc - @vz=SiSU_Viz::Defaults.new - @vz_home=SiSU_Viz::Home.new + @home_set=SiSU_Proj_HTML::Home.new end def create_default_sisu_homepage(action=:none) if action==:none puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (no action taken)} - else + else # turned off, unless something other than :none passed puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (in order to replace default sisu homepage)} filename_homepage= @env.path.webserv + '/' \ @@ -94,8 +94,8 @@ module SiSU_Create_Site + @env.path.base_markup_dir_stub + '/toc.html' file_homepage=File.new(filename_homepage,'w') file_home_toc=File.new(filename_home_toc,'w') - file_homepage << @vz_home.homepage - file_home_toc << @vz_home.homepage + file_homepage << @home_set.homepage + file_home_toc << @home_set.homepage file_homepage.close file_home_toc.close end @@ -109,8 +109,7 @@ module SiSU_Create_Site FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") end else - create_default_sisu_homepage(:none) - #create_default_sisu_homepage(:default) + create_default_sisu_homepage(:none) # :default end end def cp_images(src_path,dest_path) 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/se_get_init.rb b/lib/sisu/v6/se_get_init.rb index b5f8fd16..7452bb66 100644 --- a/lib/sisu/v6/se_get_init.rb +++ b/lib/sisu/v6/se_get_init.rb @@ -78,7 +78,8 @@ module SiSU_Get_Init end end def tex - @@tx ||=SiSU_Viz::TeX.new + require_relative 'texpdf_parts' # texpdf_parts.rb + @@tx ||=SiSU_Parts_TeXpdf::TeX.new end def rc_path_options [ diff --git a/lib/sisu/v6/se_info_env.rb b/lib/sisu/v6/se_info_env.rb index d00868b1..e8342783 100644 --- a/lib/sisu/v6/se_info_env.rb +++ b/lib/sisu/v6/se_info_env.rb @@ -60,6 +60,7 @@ @@current_document=Dir.pwd #nil #'' module SiSU_Info_Env require_relative 'se_envcall' # se_envcall.rb + require_relative 'html_parts' # html_parts.rb begin require 'singleton' require 'fileutils' @@ -573,7 +574,7 @@ module SiSU_Info_Env def widget #needs (md) #move @rc=SiSU_Env::GetInit.new.sisu_yaml.rc @ad=SiSU_Env::GetInit.new.ads - @vz=SiSU_Viz::Defaults.new + @html_bits=SiSU_Proj_HTML::Bits.new @flag={ ad: false, md: false, @@ -581,13 +582,14 @@ module SiSU_Info_Env rc: false } def promo? - @flag[:ad]=if @md.flag_promo && @ad[:flag_promo] + @flag[:ad]=if @md.flag_promo \ + && @ad[:flag_promo] @flag[:md]=true true - elsif defined? @vz.widget_promo \ - and not @vz.widget_promo.nil? \ - and @vz.widget_promo.is_a?(Array) \ - and @vz.widget_promo.length > 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(/>/,'>'). gsub(/<br(?: \/)?>/,'<br />') @@ -938,13 +939,13 @@ WOK '\1<text:a xl:type="simple" xl:href="\2">\2</text:a>') #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}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{the_url_decoration.xml_close}}) #http ftp matches with decoration else @inf.gsub(/(https?:\/\/[^<>()'"\s]+)/, - %{#{url_brace.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{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}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{the_url_decoration.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol end <<WOK <text:p text:style-name="P1">#{@tag.capitalize}: #{@inf}</text:p> 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 <url> 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 <url> 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 <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/xhtml_parts.rb;hb=HEAD> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data,wrap_width) @md,@data,@wrap_width=md,data,wrap_width @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.selections.str when /--footnote/ then false @@ -166,7 +164,6 @@ WOK end def plaintext_tail # env=SiSU_Env::InfoEnv.new(@md.fns) - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -188,7 +185,7 @@ at: * #{generator} * #{rubyv} * #{lastdone} -* SiSU #{vz.url_sisu} +* SiSU #{the_url.sisu_txt} WOK end def decorate @@ -445,7 +442,7 @@ WOK gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data,wrap_width) @md,@data,@wrap_width=md,data,wrap_width @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.selections.str when /--footnote/ then false @@ -201,7 +199,6 @@ WOK end def plaintext_tail # env=SiSU_Env::InfoEnv.new(@md.fns) - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -223,7 +220,7 @@ at: * #{generator} * #{rubyv} * #{lastdone} -* SiSU #{vz.url_sisu} +* SiSU #{the_url.sisu_txt} WOK end def decorate @@ -480,7 +477,7 @@ WOK gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data,wrap_width) @md,@data,@wrap_width=md,data,wrap_width @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.selections.str when /--footnote/ then false @@ -203,7 +201,6 @@ WOK end def plaintext_tail # env=SiSU_Env::InfoEnv.new(@md.fns) - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -225,7 +222,7 @@ at: * #{generator} * #{rubyv} * #{lastdone} -* SiSU #{vz.url_sisu} +* SiSU #{the_url.sisu_txt} WOK end def decorate @@ -464,7 +461,7 @@ WOK gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data,wrap_width) @md,@data,@wrap_width=md,data,wrap_width @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.selections.str when /--footnote/ then false @@ -202,7 +200,6 @@ WOK end def plaintext_tail # env=SiSU_Env::InfoEnv.new(@md.fns) - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -224,7 +221,7 @@ at: * #{generator} * #{rubyv} * #{lastdone} -* SiSU #{vz.url_sisu} +* SiSU #{the_url.sisu_txt} WOK end def decorate @@ -442,7 +439,7 @@ WOK gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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 <Source - require_relative 'defaults' # defaults.rb - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_Parts_Generic + include SiSU_TextUtils @@endnotes={ para: [], end: [] } def initialize(md,data,wrap_width) @md,@data,@wrap_width=md,data,wrap_width @env=SiSU_Env::InfoEnv.new(@md.fns) - @brace_url=SiSU_Viz::Defaults.new.url_decoration @tab="\t" @@endnotes_=case md.opt.selections.str when /--footnote/ then false @@ -202,7 +201,6 @@ WOK end def plaintext_tail # env=SiSU_Env::InfoEnv.new(@md.fns) - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -224,7 +222,7 @@ at: * #{generator} * #{rubyv} * #{lastdone} -* SiSU #{vz.url_sisu} +* SiSU #{the_url.sisu_txt} WOK end def decorate @@ -435,7 +433,7 @@ WOK gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). 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/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 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 <Source require_relative 'plaintext_format' # plaintext_format.rb include Format - include SiSU_Viz @@alt_id_count=0 @@dp=nil attr_reader :format,:lev,:text,:ocn,:lev_para_ocn @@ -155,14 +154,13 @@ module SiSU_Wikispeak end end class Scroll <Source - require_relative 'txt_shared' # txt_shared.rb - include SiSU_TextUtils + include SiSU_TextUtils + include SiSU_Parts_HTML @@endnotes_para=[] @@wiki={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] } @@dp=nil def initialize(data,md) @data,@md=data,md - @vz=SiSU_Viz::Defaults.new @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern @regx=/^(?:(?:#{Mx[:br_line]}\s*|#{Mx[:br_nl]}\s*)?#{Mx[:lv_o]}\d:(\S*?)#{Mx[:lv_c]}\s*)?(.+)/ #fix Mx[:lv_o] #m # 2004w18 pb pn removal added @tab="\t" @@ -189,7 +187,6 @@ WOK end end def wiki_tail - vz=SiSU_Viz::Defaults.new generator="Generated by: #{@md.sisu_version[:project]} #{@md.sisu_version[:version]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" if @md.sisu_version[:version] lastdone="Last Generated on: #{Time.now}" rubyv="Ruby version: #{@md.ruby_version}" @@ -333,7 +330,7 @@ WOK para=format_text.scr_indent_one_no_paranum end end - if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ + if para !~/#{the_margin.txt_0}|#{the_margin.txt_1}|#{the_margin.txt_2}/ # i don't get the condition for no paranum end if para =~/<:center>/ 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=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home"></a>} @doc_details =<<WOK @@ -150,8 +147,6 @@ WOK end end class Words - require_relative 'defaults' # defaults.rb - include SiSU_Viz require_relative 'xhtml_epub2_format' # xhtml_epub2_format.rb include SiSU_XHTML_EPUB2_Format require_relative 'se' # se.rb @@ -159,7 +154,6 @@ WOK def initialize(particulars) @particulars=particulars begin - @vz=SiSU_Viz::Defaults.new @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array @path="#{@env.processing_path.epub}" @freq=Hash.new(0) @@ -323,7 +317,7 @@ WOK end # special cases endnotes and header levels 1 - 3 end - credits=@vz.credits_sisu_epub + credits=SiSU_Proj_XHTML::Bits.new.credits_sisu_epub @file_concordance << %{</div>>#{credits}</body>\n</html>} # footer end end diff --git a/lib/sisu/v6/xhtml_epub2_format.rb b/lib/sisu/v6/xhtml_epub2_format.rb index d654937e..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 || []) @@ -1330,7 +1328,7 @@ application/epub+zip <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> #{@css.xhtml_epub} </head> - #{@vz.color_body} + <body lang="#{@md.opt.lng}"> <div class="content"> <div class="substance"> <label class="ocn"><a href="#o#{dob.ocn}" class="lnkocn">#{dob.ocn}</a></label> @@ -1722,15 +1720,16 @@ output_epub_cont_seg.close end def table_close %{ </font> -#{@vz.table_close}} +#{the_table_close}} end def xhtml_close - %{#{@vz.credits_sisu_epub} + %{#{SiSU_Proj_XHTML::Bits.new.credits_sisu_epub} </body> </html>} end end class HeadToc < HeadInformation + include SiSU_Parts_XHTML def initialize(md) super(md) @md=md @@ -1753,20 +1752,20 @@ output_epub_cont_seg.close <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> #{@css.xhtml_epub} </head> - #{@vz.color_body}} + <body lang="#{@md.opt.lng}">} 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}} +#{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 %{<p class="small_left">Prefix: #{@md.prefix_b}} 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 - 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}} 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 end class HeadSeg < HeadInformation @@ -1837,7 +1836,7 @@ output_epub_cont_seg.close <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> #{@css.xhtml_epub} </head> - #{@vz.color_body}} + <body lang="#{@md.opt.lng}">} end def endnote_mark %{ @@ -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} <a href="#owner.details"> Owner Details <font size="1" color="#777777"> @@ -1859,11 +1858,11 @@ output_epub_cont_seg.close </font> </a> </font> -#{@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} <p class="bold"> #{@txt} </p> -#{@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 %{<p class="bold"> #{@txt} </p> -#{@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 <p class="bold"> #{@txt} </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_heading5 %{<p class="bold"> 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 4188ae24..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=[] @@ -77,7 +78,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 +90,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 @@ -109,13 +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 - @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 end def songsheet begin @@ -262,18 +261,18 @@ module SiSU_XHTML_EPUB2_Tune dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/, %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n}) end - dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_choice}" alt="stellar" />}). - gsub(/!new/,%{#{$ep[:hsp]}<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />}). + dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{the_icon.i_choice}" alt="stellar" />}). + gsub(/!new/,%{#{$ep[:hsp]}<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{the_icon.i_new}" alt="new" />}). gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>'). gsub(/<:to(\d{1,7}?)>/,%{<a href="#to\\1">to#{$ep[:hsp]}\{#{$ep[:hsp]}\\1#{$ep[:hsp]}\}</a> }). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #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}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}). - 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]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{the_url_decoration.xml_open}<a href="mailto:\\1">\\1</a>#{the_url_decoration.xml_close}}). + 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 if dob.obj =~/..\/\S+/ \ and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ dob.obj=dob.obj.gsub(/(\.\.\/\S+)/,'<a href="\1">\1</a>') end - dob.obj=dob.obj.gsub(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/}) + dob.obj=dob.obj.gsub(/<a href="\.\.\//,%{<a href="#{the_url.site}/}) else dob.obj=dob.obj.gsub(/</m,'<').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 <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/xhtml_parts.rb;hb=HEAD> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** Description: shared html parts + +=end +module SiSU_Parts_XHTML + 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_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 + %{<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_css + '</td> +<td width="2%" align="right" valign="top"> ' + 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 + %{<font #{set_tiny} #{set_face}>} + end + def paragraph_font_small + %{<font #{set_small} #{set_face}>} + end + self + end + def the_nav + def txt_concordance + %{ <font face="#{the_font.set_fonts}" size="2"> + A-Z + </font> } + end + def txt_toc_link + %{ <font face="#{the_font.set_fonts}" size="2"> + toc + </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 +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 + %{<div class="substance"> +<p class="center"><a href="http://www.openebook.org"><b>EPUB</b></a> generated by <a href="http://www.sisudoc.org"><b>#{@v[:project]}</b></a> v#{@v[:version]}, GPL3</p> +</div>} + '' + 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>/,'<br />') + gsub(/<:br>/,the_line_break) trc <<= if table_obj.head_ and nr==0; %{<th width="#{table_obj.widths[nc]}%">#{c}</th>} else %{<td width="#{table_obj.widths[nc]}%">#{c}</td>} 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=%{<meta name="owner" content="#{@md.owner}" />\n} if @md.owner @keywords=%{<meta name="keywords" content="#{@md.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 "<endnote>#{@txt}</endnote> " @@ -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 %{ </font> -#{@vz.table_close}} +#{the_table_close}} end def html_close #moved %{</body> @@ -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] - <<WOK -<td align="center" width="60%"> - #{make_seg_scroll_pdf} -</td> -WOK - else '' - end - %{<table summary="table of contents scroll navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td>#{pdf} -<td width="20%"> - -#{@vz.table_close} -<p />} - end - def concordance_navigation_band(type='') - if type=~/pdf/ - @tocband_concordance=make_concordance - end - %{<table summary="concordance navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td> -<td width="60%" align="center"> - #{@tocband_concordance} -</td> -<td width="20%" align="right"> - <a href="index.html" target="_top" alt="->"> - #{@vz.png_nav_toc} - </a> -#{@vz.table_close} -<p />} - end - def seg_head_navigation_band(type='') - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" alt="->"> - #{@vz.png_nav_nxt} - </a>} if @md.firstseg =~/\S+/ - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td> -<td width="60%" align="center"> - #{@tocband_segtoc} -</td> -<td width="20%" align="right"> - #{firstseg} -#{@vz.table_close} -<p />} - end - def seg_head_navigation_band_bottom(type='') - if type=~/pdf/ - @tocband_segtoc=make_scroll_seg_pdf - end - firstseg=%{<a href="#{@md.firstseg}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" alt="->"> - #{@vz.png_nav_nxt} - </a>} if @md.firstseg =~/\S+/ - %{<table summary="table of contents segment navigation band" id="toc" width="100%" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - -</td> -<td width="60%" align="center"> - #{@tocband_segtoc} -</td> -<td width="20%" align="right"> - #{firstseg} -#{@vz.table_close} -<p />} - end - def make_seg_scroll_pdf - wgt=Widget.new(@md) - scroll=%{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_doc_link} -</td> -} - %{<table summary="toc segment and scroll with pdf" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{scroll} - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.pdf}#{wgt.odf} - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - def make_scroll_seg_pdf - seg='' - wgt=Widget.new(@md) - seg=%{<td align="center" bgcolor=#{@vz.color_band2}> - #{@vz.nav_txt_toc_link} -</td> -} - %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{seg} - #{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - def make_concordance - wgt=Widget.new(@md) - %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - def head - %{#{doc_type} -<head> - <title> - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@rdf.rdftoc} -#{@rdf.metatag_html} -#{@stylesheet.css_head} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a>} - 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= %{ - <li class="ref"> - <a href="#{link}" target="_top"> - #{url} - </a> - </li> - </ul> -</div> -} - end - %{ #{insert} -<!- quick ref -!>} - end - def prefix_a - end - def rights - copyright=meta_content_clean(@md.rights.copyright.all) - rights=copyright(/^\s*Copyright\s+\(C\)/,'Copyright <sup>©</sup> ') - %{<p class="small_left">Rights: #{rights}</p> -<p />} - end - def prefix_b - %{<p class="small_left">Prefix: #{@md.prefix_b}<p />} - end - def scroll_head_title_banner_open - %{<center> -#{@md.icon} -</center> -#{@vz.banner_instrument_cover_band_scr}} - end - def seg_head_title_banner_open - %{<center> - #{@md.icon} -</center> -#{@vz.banner_instrument_cover_band_seg}} - end - def make_scroll - concord=concordance_link(@vz.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} -</td> -<td align="center" bgcolor="white"> - #{concord} -#{@vz.table_close}} - end - def make_seg - concord=concordance_link(@vz.nav_txt_concordance) - %{<table summary="toc segment" border="0" cellpadding="3" cellspacing="0"> -<tr><td align="center" bgcolor="white"> - #{@vz.nav_txt_toc_link} -</td> -<td align="center" bgcolor="white"> - <font size=2> - #{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} - </font> -#{@vz.table_close}} - end - def concordance #check structure - concord=concordance_link(@vz.nav_txt_concordance) - %{#{@vz.margin_txt_3} - #{@vz.paragraph_font_small} - #{concord} - </font> -#{@vz.table_close}} - end - def metadata - %{#{@vz.margin_css} - <h4 class="toc"> - <a href="#{@metalink}"> - <i>MetaData</i> - </a> - </h4> -#{@vz.table_close}} - end - def seg_tail - %{ -<div class="main_column"> -<p> <p> -<table summary="toc segment tail" bgcolor=#{@vz.color_band1}> -<tr><td width="20%"> - #{@vz.banner_band} -</td> -<td width="60%"> - <center> - #{@tocband_segtoc} - </center> -</td></tr> -</table> -<p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits"></a> -</div> -</div> -</div> -} - end - def scroll_tail #debug - nav=scroll_head_navigation_band - %{ -<div class="main_column"> -#{nav} -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits"></a> -</div> -</div> -</div> -} - end - def seg_navigation_tail #this is a bug area, look up and "tidy" - #nav=scroll_head_navigation_band - %{ -<div class="main_column"> -<p> </p> -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits"></a> -</div> -</div> -</div> -} - end - end - class HeadSeg < HeadInformation - def initialize(md) #(md='') - super(md) - end - def head - %{#{doc_type} -<head> - <title> - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@rdf.rdfseg} -#{@rdf.metatag_html} -#{@vz.font_css_table_file} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a>} - end - def title_banner(title,subtitle,creator) - end - def dot_control_pre_next - %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> -<tr><td align="left"> - <a href="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_dot_pre} - </a> -</td> -<td align="center"> - <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_dot_toc} - </a> -</td> -<td align="right"> - <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_dot_nxt} - </a> -#{@vz.table_close}} - end - def toc_nav(f_pre=false,f_nxt=false,use=1) - pre=nxt='' - toc=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_toc} - </a> -</td>} - pre=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@seg_name_html[@seg_name_html_tracker-use]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_pre} - </a> -</td>} if f_pre==true - nxt=%{<td align="center" bgcolor=#{@vz.color_band1}> - <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top"> - #{@vz.png_nav_nxt} - </a> -</td>} if f_nxt==true - %{<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0"> -<tr> -#{pre} -#{toc} -#{nxt} -<td> -#{@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 - %{ -<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - else - %{ -<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - end - def navigation_table - %{<table summary="navigation segment table" width=#{@vz.table_width_1} 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"> -<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"> -<tr><td valign="top"> - <font size="2">} - end - def header_advert_local_1 - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <center> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="http://#{@md.ad_url}#{Sfx[:xhtml]}" target="_top"> - <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}"> - </a> - <p /> -#{@vz.table_close} -</center>} - end - def header_advert_local_2 - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <center> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="#{@md.ad_url}#{Sfx[:xhtml]}" target="_top"> - <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}"> - </a> - <p /> -#{@vz.table_close} -</center>} - end - def header_advert_external - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <center> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="#{@md.ad_url}#{Sfx[:xhtml]}" target="external"> - <img border="0" src="#{dir.url.images_local}/#{@md.ad_png}" alt="#{@md.ad_alt}"> - </a> - <p /> -#{@vz.table_close} -</center>} - end - def credit - %{ -<div class="main_column"> -#{@vz.credits_splash} -#{@vz.credits_sisu} -<a name="bottom" id="bottom"></a> -<a name="down" id="down"></a> -<a name="end" id="end"></a> -<a name="finish" id="finish"></a> -<a name="stop" id="stop"></a> -<a name="credits" id="credits"></a> -</div></div> -} - end - def navigation_band(segtocband,seg_table_top_control) #change name to navigaion_band_banner - %{<table summary="segment navigation band with banner" bgcolor=#{@vz.color_band1} width="100%"><tr> -<td width="20%" align="left"> -#{@vz.banner_band} -</td> -<td width="60%" align="center"> - #{doc_types} -</td> -<td width="20%" align="right"> - #{segtocband} -</td></tr> -</table> -#{seg_table_top_control}} - end - def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless - %{ -<div class="main_column"> - <table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr> - <td width="70%" align="center"> - #{doc_types} - </td> - <td width="30%" align="right"> - #{segtocband} - </td></tr> - </table> - #{seg_table_top_control} -</div> -} - end - def endnote_mark -%{ -<p class="center" id="endnotes"> - <hr class="endnote" /> -</p>} - end - def endnote_section_open -%{ -<div class="endnote"> -} - end - def endnote_section_close -%{ -</div> -} #revisit - end - def head - %{#{doc_type} -<head> - <title> - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@rdf.rdfseg} -#{@rdf.metatag_html} -#{@stylesheet.css_head} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a>} - end - def title_banner(title,subtitle,creator) - %{ -<div class="summary"> - <p class="tiny"> - #{title} - </p> - <p class="tiny"> - #{subtitle} - </p> - <p class="tiny"> - #{creator} - </p> - <p class="tiny"> - copy @ - <a href="#{@vz.url_home}"> - #{@vz.txt_home} - </a> - </p> -</div> -} - end - end - class HeadScroll < HeadToc - def initialize(md) #(md='') - super(md) - end - def toc_owner_details - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} - <a href="#owner.details"> - Owner Details - <font size="1" color="#777777"> - - </font> - </a> - </font> -#{@vz.table_close}} - end - def table - %{<table summary="scroll table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0"> -<tr><th width=#{@@indent['level_1']} align="right"> -</th> -<td valign="top"> -#{@vz.paragraph_txt}} - end - def table1 - %{<table summary="scroll table1" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} #{@vz.color_color_table1} align="justify"> -<tr><td valign="top"> -#{@vz.paragraph_txt}} - end - def table2 - %{<table summary="scroll table2" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} #{@vz.color_color_table2} align="justify"> -<tr><td valign="top"> -#{@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} <p class="bold"> #{@txt} </p> -#{@vz.margin_num_css} +#{the_margin.num_css} -#{@vz.table_close}} +#{the_table_close}} end def bold_header @txt=@txt.gsub(/[1-9]~(\S+)/,'<a name="\1"></a>'). @@ -1197,9 +606,9 @@ WOK %{<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} @@ -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 <tr><td width ="20"> </td> <td> - <font size="3" #{@vz.font_face}> + <font size="3" #{the_font.set_face}> <b>#{@txt}</b> </font> </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev3 #change bold use css %{<p /> @@ -1252,11 +661,11 @@ WOK <tr><td width ="20"> </td> <td> - <font size="3" #{@vz.font_face}> + <font size="3" #{the_font.set_face}> <b>#{@txt}</b> </font> </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev4 %{<table summary="navigation segment level 4"> @@ -1266,7 +675,7 @@ WOK <p> #{@txt} </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_toc_lev5 end @@ -1344,7 +753,7 @@ WOK <p class="bold"> #{@txt} </p> -#{@vz.table_close}} +#{the_table_close}} end def navigation_header5 %{<p class="bold"> 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 <Source - require_relative 'defaults' # defaults.rb require_relative 'txt_shared' # txt_shared.rb + include SiSU_Parts_XML @@img_count=0 @@odf={ body: [], head: [], toc: [], metadata: [], tail: [], book_idx: [], endnotes: [] } @@docstart=true @@ -137,9 +137,7 @@ module SiSU_XML_ODF_ODT def initialize(particulars) @md,@env,@ao_array=particulars.md,particulars.env,particulars.ao_array @make=SiSU_Env::ProcessingSettings.new(@md) - @vz=SiSU_Viz::Defaults.new @tab="\t" - @brace_url=SiSU_Viz::Defaults.new.url_decoration @br=(@md.opt.act[:maintenance][:set]==:on) \ ? '' : '' end @@ -422,9 +420,9 @@ module SiSU_XML_ODF_ODT dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '<text:a xl:type="simple" xl:href="\1">\1</text:a>'). #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}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{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}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{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]}/, '<text:a xl:type="simple" xl:href="\1">\1</text:a>'). #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}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{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]}/, '<text:a xl:type="simple" xl:href="\1">\1</text:a>'). #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}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="mailto:\\1">\\1</text:a>#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{the_url_decoration.xml_open}<text:a xl:type="simple" xl:href="\\1">\\1</text:a>#{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 "<endnote>#{@txt}</endnote> " @@ -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 <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_XML + 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_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 + %{ <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_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 + 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]}/, '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\2">\1</link>'). #watch, compare html_tune gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\\1">\\1</link>#{@brace_url.xml_close}}). + %{#{the_url_decoration.xml_open}<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\\1">\\1</link>#{the_url_decoration.xml_close}}). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '<link xmlns:xl="http://www.w3.org/1999/xlink" xl:type="simple" xl:href="\1">\1</link>') #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=%{ <meta name="keywords" content="#{content}" />\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 <<WOK #{@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} -#{@vz.txt_generator} -#{@vz.png_ico} +#{SiSU_Proj_XML::Bits.new.txt_generator} +#{the_png.ico} WOK end end diff --git a/lib/sisu/v6/xml_tables.rb b/lib/sisu/v6/xml_tables.rb index eedd74d5..468963ff 100644 --- a/lib/sisu/v6/xml_tables.rb +++ b/lib/sisu/v6/xml_tables.rb @@ -58,13 +58,11 @@ =end module SiSU_Tables - require_relative 'defaults' # defaults.rb - include SiSU_Viz class Table #_xml @@tablehead=0 @@tablefoot=[] #watch #bug??? #check was @@tablefoot def initialize(one,ocn='') - @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Viz::Defaults.new + @one,@parablock,@ocn=one,one,ocn end def table_split #% used but, no longer operational, revisit @new_content=[] @@ -79,7 +77,7 @@ module SiSU_Tables @@tablehead=0 @@tablefoot=[] def initialize(one,ocn='') - @one,@parablock,@ocn,@vz=one,one,ocn,SiSU_Viz::Defaults.new + @one,@parablock,@ocn=one,one,ocn end def table m=@parablock[/<!f(.+?)!>/,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 + '</td></tr> +</table>' + end + def margin_numless + '</td><td width="4%" align="right" valign="top">' end def table_head(inf) %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center"> @@ -193,7 +197,7 @@ module SiSU_Tables <table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">} end def table_end(tablefoot='') - %{</table>#{@vz.margin_numless}#{@vz.margin_numless} #{@vz.table_close} + %{</table>#{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(/<!f.+?!>/,'') @@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 |