aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v3/cgi_pgsql.rb18
-rw-r--r--lib/sisu/v3/cgi_sql_common.rb39
-rw-r--r--lib/sisu/v3/cgi_sqlite.rb16
-rw-r--r--lib/sisu/v3/character_encoding.rb378
-rw-r--r--lib/sisu/v3/composite.rb4
-rw-r--r--lib/sisu/v3/concordance.rb6
-rw-r--r--lib/sisu/v3/constants.rb43
-rw-r--r--lib/sisu/v3/dal.rb71
-rw-r--r--lib/sisu/v3/dal_character_check.rb8
-rw-r--r--lib/sisu/v3/dal_doc_objects.rb282
-rw-r--r--lib/sisu/v3/dal_doc_str.rb24
-rw-r--r--lib/sisu/v3/dal_expand_insertions.rb28
-rw-r--r--lib/sisu/v3/dal_hash_digest.rb4
-rw-r--r--lib/sisu/v3/dal_idx.rb85
-rw-r--r--lib/sisu/v3/dal_numbering.rb16
-rw-r--r--lib/sisu/v3/dal_syntax.rb18
-rw-r--r--lib/sisu/v3/db_columns.rb24
-rw-r--r--lib/sisu/v3/db_create.rb45
-rw-r--r--lib/sisu/v3/db_import.rb72
-rw-r--r--lib/sisu/v3/db_load_tuple.rb8
-rw-r--r--lib/sisu/v3/db_remove.rb10
-rw-r--r--lib/sisu/v3/db_select.rb13
-rw-r--r--lib/sisu/v3/db_sqltxt.rb2
-rw-r--r--lib/sisu/v3/dbi.rb2
-rw-r--r--lib/sisu/v3/dbi_discreet.rb6
-rw-r--r--lib/sisu/v3/defaults.rb122
-rw-r--r--lib/sisu/v3/digests.rb6
-rw-r--r--lib/sisu/v3/epub.rb24
-rw-r--r--lib/sisu/v3/epub_concordance.rb4
-rw-r--r--lib/sisu/v3/epub_format.rb74
-rw-r--r--lib/sisu/v3/epub_segments.rb31
-rw-r--r--lib/sisu/v3/epub_tune.rb4
-rw-r--r--lib/sisu/v3/harvest_authors.rb19
-rw-r--r--lib/sisu/v3/harvest_topics.rb130
-rw-r--r--lib/sisu/v3/help.rb259
-rw-r--r--lib/sisu/v3/html.rb25
-rw-r--r--lib/sisu/v3/html_format.rb114
-rw-r--r--lib/sisu/v3/html_promo.rb4
-rw-r--r--lib/sisu/v3/html_scroll.rb36
-rw-r--r--lib/sisu/v3/html_segments.rb30
-rw-r--r--lib/sisu/v3/html_tune.rb4
-rw-r--r--lib/sisu/v3/hub.rb79
-rw-r--r--lib/sisu/v3/manifest.rb44
-rw-r--r--lib/sisu/v3/manpage.rb8
-rw-r--r--lib/sisu/v3/manpage_format.rb5
-rw-r--r--lib/sisu/v3/odf.rb182
-rw-r--r--lib/sisu/v3/odf_format.rb68
-rw-r--r--lib/sisu/v3/options.rb682
-rw-r--r--lib/sisu/v3/param.rb122
-rw-r--r--lib/sisu/v3/particulars.rb10
-rw-r--r--lib/sisu/v3/plaintext.rb4
-rw-r--r--lib/sisu/v3/plaintext_format.rb2
-rw-r--r--lib/sisu/v3/po4a.rb12
-rw-r--r--lib/sisu/v3/po4a_set.rb2
-rw-r--r--lib/sisu/v3/qrcode.rb34
-rw-r--r--lib/sisu/v3/response.rb6
-rw-r--r--lib/sisu/v3/screen_text_color.rb28
-rw-r--r--lib/sisu/v3/shared_images.rb2
-rw-r--r--lib/sisu/v3/shared_markup_alt.rb4
-rw-r--r--lib/sisu/v3/shared_metadata.rb18
-rw-r--r--lib/sisu/v3/shared_sem.rb6
-rw-r--r--lib/sisu/v3/shared_sisupod_source.rb43
-rw-r--r--lib/sisu/v3/shared_txt.rb2
-rw-r--r--lib/sisu/v3/shared_xml.rb6
-rw-r--r--lib/sisu/v3/sitemaps.rb7
-rw-r--r--lib/sisu/v3/sst_convert_markup.rb14
-rw-r--r--lib/sisu/v3/sst_do_inline_footnotes.rb32
-rw-r--r--lib/sisu/v3/sst_identify_markup.rb6
-rw-r--r--lib/sisu/v3/sst_to_s_xml_sax.rb2
-rw-r--r--lib/sisu/v3/sysenv.rb255
-rw-r--r--lib/sisu/v3/texinfo_format.rb4
-rw-r--r--lib/sisu/v3/texpdf.rb39
-rw-r--r--lib/sisu/v3/texpdf_format.rb5
-rw-r--r--lib/sisu/v3/urls.rb5
-rw-r--r--lib/sisu/v3/webrick.rb195
-rw-r--r--lib/sisu/v3/xhtml_table.rb2
-rw-r--r--lib/sisu/v3/xml_format.rb44
-rw-r--r--lib/sisu/v3/xml_tables.rb12
78 files changed, 1801 insertions, 2298 deletions
diff --git a/lib/sisu/v3/cgi_pgsql.rb b/lib/sisu/v3/cgi_pgsql.rb
index f78f65f5..1264d922 100644
--- a/lib/sisu/v3/cgi_pgsql.rb
+++ b/lib/sisu/v3/cgi_pgsql.rb
@@ -75,7 +75,7 @@ module SiSU_CGI_PgSQL
available_db_table=`psql --list` # system call requires psql
available_db=available_db_table.scan(/(#{Db[:name_prefix]}\S+)/) if not available_db_table.nil?
if available_db \
- and available_db.class==Array
+ and available_db.is_a?(Array)
available_db.flatten.each do |x|
serve << x.gsub(/#{Db[:name_prefix]}(\S+)/,'\1')
end
@@ -144,10 +144,10 @@ module SiSU_CGI_PgSQL
@l,@t,@q,@c=l,t,q,cse
end
def string
- search={ :search => [], :flag => false }
+ search={ search: [], flag: false }
if @t =~/\S+/ or @q =~/\S+/
- if @t =~/\S+/; unescaped_search=CGI.unescape(@t)
- elsif @q =~/\S+/; unescaped_search=CGI.unescape(@q)
+ if @t =~/\S+/ then unescaped_search=CGI.unescape(@t)
+ elsif @q =~/\S+/ then unescaped_search=CGI.unescape(@q)
end
search_construct=[]
unescaped_search=if @c
@@ -171,12 +171,10 @@ module SiSU_CGI_PgSQL
def search_query1
<<-'WOK_SQL'
@search_text,@search_endnotes='',''
- search[:text].flatten.each {|x| @search_text << "#{x} AND " }
- @search_text=@search_text.gsub(/AND\s+$/m,''). #watch
- gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')
- search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " }
- @search_endnotes=@search_endnotes.gsub(/AND\s+$/m,''). #watch
- gsub(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')
+ @search_text=search[:text].flatten.join(' AND ')
+ @search_text=@search_text.gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')
+ @search_endnotes=search[:endnotes].flatten.join(' AND ')
+ @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')
end
WOK_SQL
end
diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb
index 401b67f6..18e1ab1e 100644
--- a/lib/sisu/v3/cgi_sql_common.rb
+++ b/lib/sisu/v3/cgi_sql_common.rb
@@ -292,8 +292,8 @@ module SiSU_CGI_SQL
@date_modified=q['dtm'] if q['dtm']=~/\S/
@date_available=q['dta'] if q['dta']=~/\S/
@date_valid=q['dtv'] if q['dtv']=~/\S/
- @filename=if q['doc'] and q['search'] !~/search db/; q['doc']
- elsif q['fns']=~/\S/; q['fns']
+ @filename=if q['doc'] and q['search'] !~/search db/ then q['doc']
+ elsif q['fns']=~/\S/ then q['fns']
end
@@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000
@@offset=q['off'] if q['off']=~/\d+/ # 0
@@ -301,19 +301,19 @@ module SiSU_CGI_SQL
end
def text_to_match(identifier='')
m={
- :string => /#{identifier}\s*(.+?)/,
- :string => /#{identifier}\s*(.+?)(?:;|\n|\r|$)/,
- :word => /#{identifier}[\s(]*(\S+)/
+ string: /#{identifier}\s*(.+?)/,
+ string: /#{identifier}\s*(.+?)(?:;|\n|\r|$)/,
+ word: /#{identifier}[\s(]*(\S+)/
}
search_string=if @search_field =~m[:word]
- search_string=if @search_field =~m[:braces]; m[:braces].match(@search_field)[1]
- elsif @search_field =~m[:string]; m[:string].match(@search_field)[1]
+ search_string=if @search_field =~m[:braces] then m[:braces].match(@search_field)[1]
+ elsif @search_field =~m[:string] then m[:string].match(@search_field)[1]
else
str=m[:word].match(@search_field)[1]
str=str.gsub(/[()]/,'')
str
end
- search_string=search_string.strip.search_string.gsub(/\s+/,'+')
+ search_string=search_string.strip.gsub(/\s+/,'+')
#else
# "__"
end
@@ -328,10 +328,10 @@ module SiSU_CGI_SQL
def initialize(conn,search_for,q,c)
@conn=conn
@text_search_flag=false
- @sql_statement={ :body => '', :endnotes => '', :range => '' }
+ @sql_statement={ body: '', endnotes: '', range: '' }
#@offset||=@@offset
#@offset+=@@limit
- search={ :text => [], :endnotes => [] }
+ search={ text: [], endnotes: [] }
cse=(c =~/\S/) ? true : false
st=DBI_SearchString.new('doc_objects.clean',search_for.text1,q['s1'],cse).string
se=DBI_SearchString.new('endnotes.clean',search_for.text1,q['s1'],cse).string
@@ -512,7 +512,7 @@ module SiSU_CGI_SQL
</center>}
end
else
- if page.to_s =~ /^1$/; ''
+ if page.to_s =~ /^1$/ then ''
elsif page.to_s =~ /^2$/
%{<br /><center>
<a href="#{can.previous}">
@@ -650,9 +650,9 @@ module SiSU_CGI_SQL
@counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','',''
FCGI.each_cgi do |cgi|
begin # all code goes in begin section
- @search={ :text => [], :endnotes => [] }
+ @search={ text: [], endnotes: [] }
q=CGI.new
- @db=if cgi['db'] =~/\S+/;
+ @db=if cgi['db'] =~/\S+/
@stub=/#{@db_name_prefix}(\S+)/.match(cgi['db'])[1]
cgi['db']
else
@@ -661,13 +661,13 @@ module SiSU_CGI_SQL
end
checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','',''
result_type=(cgi['view']=~/text/) \
- ? result_type={ :index => '', :text => 'checked'}
- : result_type={ :index => 'checked', :text => ''}
+ ? result_type={ index: '', text: 'checked'}
+ : result_type={ index: 'checked', text: ''}
@@limit=if cgi['sql_match_limit'].to_s=~/2500/
- checked_sql_limit={ :l1000 => '', :l2500 => 'checked'}
+ checked_sql_limit={ l1000: '', l2500: 'checked'}
'2500'
else
- checked_sql_limit={ :l1000 => 'checked', :l2500 => ''}
+ checked_sql_limit={ l1000: 'checked', l2500: ''}
'1000'
end
checked_echo='checked' if cgi['echo'] =~/\S/
@@ -1024,8 +1024,9 @@ module SiSU_CGI_SQL
if cgi['view']=~/text/ \
or (cgi['view']!~/index/ and cgi['search'] !~/search db/) #% txt endnotes
@counter_endn_ocn+=1
- matched_endnote=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) \
- ? matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>})
+ matched_endnote=(@search_regx.to_s.is_a?(String) \
+ && @search_regx.to_s=~/\S\S+/) \
+ ? (matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>}))
: e['body']
output=%{#{title}<hr><font size="2">note <b><a href="#{path_endnotes(location,@ln)}#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{path_html_doc(location,@ln)}##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}}
else #elsif cgi['view']=~/index/ #doc #FIX #% idx endnotes
diff --git a/lib/sisu/v3/cgi_sqlite.rb b/lib/sisu/v3/cgi_sqlite.rb
index ccb1fb50..78ae0f9a 100644
--- a/lib/sisu/v3/cgi_sqlite.rb
+++ b/lib/sisu/v3/cgi_sqlite.rb
@@ -141,10 +141,10 @@ module SiSU_CGI_SQLite
@l,@t,@q=l,t,q
end
def string
- search={ :search => [], :flag => false }
+ search={ search: [], flag: false }
if @t =~/\S+/ or @q =~/\S+/
- if @t =~/\S+/; unescaped_search=CGI.unescape(@t)
- elsif @q =~/\S+/; unescaped_search=CGI.unescape(@q)
+ if @t =~/\S+/ then unescaped_search=CGI.unescape(@t)
+ elsif @q =~/\S+/ then unescaped_search=CGI.unescape(@q)
end
search_construct=[]
unescaped_search=unescaped_search.gsub(/\s*(AND|OR)\s*/,"%' \) \\1 #{@l} LIKE \( '%").
@@ -163,12 +163,10 @@ module SiSU_CGI_SQLite
def search_query1
<<-'WOK_SQL'
@search_text,@search_endnotes='',''
- search[:text].flatten.each {|x| @search_text << "#{x} AND " }
- @search_text=@search_text.gsub(/AND\s+$/m,'').
- gsub(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
- search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " }
- @search_endnotes=@search_endnotes.gsub(/AND\s+$/m,'').
- gsub(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
+ @search_text=search[:text].flatten.join(' AND ')
+ @search_text=@search_text.gsub(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
+ @search_endnotes=search[:endnotes].flatten.join(' AND ')
+ @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')
end
WOK_SQL
end
diff --git a/lib/sisu/v3/character_encoding.rb b/lib/sisu/v3/character_encoding.rb
deleted file mode 100644
index 17bf336b..00000000
--- a/lib/sisu/v3/character_encoding.rb
+++ /dev/null
@@ -1,378 +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 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>
-
- * Download:
- <http://www.sisudoc.org/sisu/en/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: modules related to locales, character encoding for different
- output generators [requires kirbybase]
-
-=end
-module SiSU_CharacterEncode
- require 'kirbybase'
- require_relative 'sysenv' # sysenv.rb
- class Characters
- attr_accessor(:character_encoding,:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name)
- def initialize(&block)
- instance_eval(&block)
- end
- end
- class Create <Characters
- def initialize
- #NOTE places character_encoding.tbl in correct subdirectory ./_sisu_processing/encoding
- @db=KirbyBase.new #default database location, pwd
- @ce_tbl=@db.create_table.documents(:character_encoding, :glyph,:String, :dec,:Integer, :hex,:String, :rb,:String, :html,:String, :html_name,:String, :tex,:String, :tex_licr,:String, :tex_alt,:String, :name,:String)
- end
- def db
- x=CharacterEncoding.new.table
- #x.each {|y| puts y[2].inspect}
- x.each do |c|
- #puts "#{c[0]}, #{c[1]}, #{c[2]}, #{c[3]}, #{c[4]}, #{c[5]}, #{c[6]}, #{c[7]}, #{c[8]}, #{c[9]}"
- @ce_tbl.insert(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9])
- end
- end
- end
- class Query
- def initialize(find='',show='')
- #NOTE character_encoding.tbl not read from subdirectory ./_sisu_processing/encoding
- @db=KirbyBase.new #default database location, pwd
- @ce_tbl=@db.get_table(:character_encoding)
- @find=find
- end
- def selected(selected,show)
- @y=[]
- selected.each do |x|
- @y<<case show
- when 'glyph'; x.glyph
- when 'dec'; x.dec
- when 'hex'; x.hex
- when 'rb'; x.rb
- when 'html'; x.html
- when 'html_name'; x.html_name
- when 'tex'; x.tex
- when 'ot1'; x.ot1
- when 'ts1'; x.ts1
- when 'name'; x.name
- else x.hex
- end
- end
- #@ce_tbl.select(:glyph,:name) { |r| r.hex==hex }.each do |r|
- # puts '%s %s' % [r.glyph, r.name]
- #end
- #:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name
- #list=['number','glyph','html','hex','rb','tex','ot1','ts1','name']
- end
- def hex(hex,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.hex==hex }
- selected(select,show)
- @y
- end
- def dec(dec,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.dec==dec }
- selected(select,show)
- @y
- end
- def name(name,show)
- select=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name) { |r| r.name =~ /#{name}/ }
- selected(select,show)
- @y
- end
- def report
- puts @ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name).to_report
- end
- def table
- selected=@ce_tbl.select
- #selected=@ce_tbl.select(:glyph,:dec,:hex,:rb,:html,:html_name,:tex,:tex_licr,:tex_alt,:name)
- selected.each do |c|
- puts '%s %s %s %s %s %s %s %s %s %s' % [c.glyph,c.dec,c.hex,c.rb,c.html,c.html_name,c.tex,c.tex_licr,c.tex_alt,c.name]
- #puts "#{c.glyph}, #{c.dec}, #{c.hex}, #{c.rb}, #{c.html}, #{c.name}, #{c.tex}, #{c.tec_licr}, #{c.tex_alt}, #{c.c_name}"
- end
- end
- end
- class CharacterEncoding
- def table
- x=[]
-#:glyph, :dec,:hex, :rb, :xml , :html_name, :tex, :tex_licr, :tex_alt, :name
- x=[
- ['', 9, '', '', '&#009;', nil, '', '', '', 'Horizontal tab' ],
- ['', 15, '', '', '&#015;', nil, '', '', '', 'Line feed' ],
- ['', 17, '', '', '&#017;', nil, '', '', '', 'Carriage return' ],
- [' ', 32, '40', '\40', '&#032;', nil, '', '', '', 'Space' ],
- ['!', 33, '41', '\41', '&#033;', nil, '!', '!', '!', 'Punctuation Exclamation !' ],
- ['', 34, '42', '\42', '&#034;', '&quot;', '', '', '', 'Punctuation Quotation mark' ],
- ['#', 35, '43', '\43', '&#035;', nil, '{\#}', '\#', '', 'Hash mark #' ],
- ['$', 36, '44', '\44', '&#036;', nil, '{\$}', '\textdollar', '', 'Dollar sign $' ],
- ['%', 37, '45', '\45', '&#037;', nil, '{\%}', '\%', '', 'Percent sign %' ],
- ['&', 38, '46', '\46', '&#038;', '&amp;', '{\&}', '\&', '', 'Ampersand &' ],
- ['\'', 39, '47', '\47', '&#039;', nil, '', '', '', 'Apostrophe \''],
- ['(', 40, '50', '\50', '&#040;', nil, '', '', '', 'Left parenthesis (' ],
- [')', 41, '51', '\51', '&#041;', nil, '', '', '', 'Right parenthesis )' ],
- ['*', 42, '52', '\52', '&#042;', nil, '', '', '', 'Asterisk *' ],
- ['+', 43, '53', '\53', '&#043;', nil, '', '', '', 'Plus sign +' ],
- [',', 44, '54', '\54', '&#044;', nil, ',', ',', ',', 'Puncutation Comma ,' ],
- ['-', 45, '55', '\55', '&#045;', nil, '-', '-', '-', 'Puncutation Hyphen -' ],
- ['.', 46, '56', '\56', '&#046;', nil, '.', '.', '.', 'Puncutation Period .' ],
- ['/', 47, '57', '\57', '&#047;', nil, '/', '/', '/', 'Puncutation Slash /' ],
- ['0', 48, '60', '\60', '&#048;', nil, '0', '0', '0', 'Digit zero 0' ],
- ['1', 49, '61', '\61', '&#049;', nil, '1', '1', '1', 'Digit one 1' ],
- ['2', 50, '62', '\62', '&#050;', nil, '2', '2', '2', 'Digit two 2' ],
- ['3', 51, '63', '\63', '&#051;', nil, '3', '3', '3', 'Digit three 3' ],
- ['4', 52, '64', '\64', '&#052;', nil, '4', '4', '4', 'Digit four 4' ],
- ['5', 53, '65', '\65', '&#053;', nil, '5', '5', '5', 'Digit five 5' ],
- ['6', 54, '66', '\66', '&#054;', nil, '6', '6', '6', 'Digit six 6' ],
- ['7', 55, '67', '\67', '&#055;', nil, '7', '7', '7', 'Digit seven 7' ],
- ['8', 56, '70', '\70', '&#056;', nil, '8', '8', '8', 'Digit eight 8' ],
- ['9', 57, '71', '\71', '&#057;', nil, '9', '9', '9', 'Digit nine 9' ],
- [':', 58, '72', '\72', '&#058;', nil, '', '', '', 'Punctuation Colon :' ],
- [';', 59, '73', '\73', '&#059;', nil, '', '', '', 'Punctuation Semicolon ;' ],
- ['<', 60, '74', '\74', '&#060;', '&lt;', '', '', '', 'Less than <' ],
- ['=', 61, '75', '\75', '&#061;', nil, '', '', '', 'Equals sign =' ],
- ['>', 62, '76', '\76', '&#062;', '&gt;', '', '', '', 'Greater than >' ],
- ['?', 63, '77', '\77', '&#063;', nil, '?', '?', '?', 'Punctuation Question mark ?' ],
- ['@', 64, '100', '\100', '&#064;', nil, '', '', '', 'Commercial at sign @' ],
- ['A', 65, '101', '\101', '&#065;', nil, 'A', 'A', 'A', 'Captial A' ],
- ['B', 66, '102', '\102', '&#066;', nil, 'B', 'B', 'B', 'Captial B' ],
- ['C', 67, '103', '\103', '&#067;', nil, 'C', 'C', 'C', 'Captial C' ],
- ['D', 68, '104', '\104', '&#068;', nil, 'D', 'D', 'D', 'Captial D' ],
- ['E', 69, '105', '\105', '&#069;', nil, 'E', 'E', 'E', 'Captial E' ],
- ['F', 70, '106', '\106', '&#070;', nil, 'F', 'F', 'F', 'Captial F' ],
- ['G', 71, '107', '\107', '&#071;', nil, 'G', 'G', 'G', 'Captial G' ],
- ['H', 72, '110', '\110', '&#072;', nil, 'H', 'H', 'H', 'Captial H' ],
- ['I', 73, '111', '\111', '&#073;', nil, 'I', 'I', 'I', 'Captial I' ],
- ['J', 74, '112', '\112', '&#074;', nil, 'J', 'J', 'J', 'Captial J' ],
- ['K', 75, '113', '\113', '&#075;', nil, 'K', 'K', 'K', 'Captial K' ],
- ['L', 76, '114', '\114', '&#076;', nil, 'L', 'L', 'L', 'Captial L' ],
- ['M', 77, '115', '\115', '&#077;', nil, 'M', 'M', 'M', 'Captial M' ],
- ['N', 78, '116', '\116', '&#078;', nil, 'N', 'N', 'N', 'Captial N' ],
- ['O', 79, '117', '\117', '&#079;', nil, 'O', 'O', 'O', 'Captial O' ],
- ['P', 80, '120', '\120', '&#080;', nil, 'P', 'P', 'P', 'Captial P' ],
- ['Q', 81, '121', '\121', '&#081;', nil, 'Q', 'Q', 'Q', 'Captial Q' ],
- ['R', 82, '122', '\122', '&#082;', nil, 'R', 'R', 'R', 'Captial R' ],
- ['S', 83, '123', '\123', '&#083;', nil, 'S', 'S', 'S', 'Captial S' ],
- ['T', 84, '124', '\124', '&#084;', nil, 'T', 'T', 'T', 'Captial T' ],
- ['U', 85, '125', '\125', '&#085;', nil, 'U', 'U', 'U', 'Captial U' ],
- ['V', 86, '126', '\126', '&#086;', nil, 'V', 'V', 'V', 'Captial V' ],
- ['W', 87, '127', '\127', '&#087;', nil, 'W', 'W', 'W', 'Captial W' ],
- ['X', 88, '130', '\130', '&#088;', nil, 'X', 'X', 'X', 'Captial X' ],
- ['Y', 89, '131', '\131', '&#089;', nil, 'Y', 'Y', 'Y', 'Captial Y' ],
- ['Z', 90, '132', '\132', '&#090;', nil, 'Z', 'Z', 'Z', 'Captial Z' ],
- ['[', 91, '133', '\133', '&#091;', nil, '', '', '', 'Left square bracket [' ],
- ['\\', 92, '134', '\134', '&#092;', nil, '', '\textbackslash', '', 'Backslash \\'],
- [']', 93, '135', '\135', '&#093;', nil, '', '', '', 'Right square bracket ]' ],
- ['^', 94, '136', '\136', '&#094;', nil, '', '', '', 'Caret ^' ],
- ['_', 95, '137', '\137', '&#095;', nil, '{\_}', '\textunderscore', '', 'Underscore _' ],
- ['`', 96, '140', '\140', '&#096;', nil, '', '', '', 'Grave accent `' ],
- ['a', 97, '141', '\141', '&#097;', nil, 'a', 'a', 'a', 'Small a' ],
- ['b', 98, '142', '\142', '&#098;', nil, 'b', 'b', 'b', 'Small b' ],
- ['c', 99, '143', '\143', '&#099;', nil, 'c', 'c', 'c', 'Small c' ],
- ['d', 100, '144', '\144', '&#100;', nil, 'd', 'd', 'd', 'Small d' ],
- ['e', 101, '145', '\145', '&#101;', nil, 'e', 'e', 'e', 'Small e' ],
- ['f', 102, '146', '\146', '&#102;', nil, 'f', 'f', 'f', 'Small f' ],
- ['g', 103, '147', '\147', '&#103;', nil, 'g', 'g', 'g', 'Small g' ],
- ['h', 104, '150', '\150', '&#104;', nil, 'h', 'h', 'h', 'Small h' ],
- ['i', 105, '151', '\151', '&#105;', nil, 'i', 'i', 'i', 'Small i' ],
- ['j', 106, '152', '\152', '&#106;', nil, 'j', 'j', 'j', 'Small j' ],
- ['k', 107, '153', '\153', '&#107;', nil, 'k', 'k', 'k', 'Small k' ],
- ['l', 108, '154', '\154', '&#108;', nil, 'l', 'l', 'l', 'Small l' ],
- ['m', 109, '155', '\155', '&#109;', nil, 'm', 'm', 'm', 'Small m' ],
- ['n', 110, '156', '\156', '&#110;', nil, 'n', 'n', 'n', 'Small n' ],
- ['o', 111, '157', '\157', '&#111;', nil, 'o', 'o', 'o', 'Small o' ],
- ['p', 112, '160', '\160', '&#112;', nil, 'p', 'p', 'p', 'Small p' ],
- ['q', 113, '161', '\161', '&#113;', nil, 'q', 'q', 'q', 'Small q' ],
- ['r', 114, '162', '\162', '&#114;', nil, 'r', 'r', 'r', 'Small r' ],
- ['s', 115, '163', '\163', '&#115;', nil, 's', 's', 's', 'Small s' ],
- ['t', 116, '164', '\164', '&#116;', nil, 't', 't', 't', 'Small t' ],
- ['u', 117, '165', '\165', '&#117;', nil, 'u', 'u', 'u', 'Small u' ],
- ['v', 118, '166', '\166', '&#118;', nil, 'v', 'v', 'v', 'Small v' ],
- ['w', 119, '167', '\167', '&#119;', nil, 'w', 'w', 'w', 'Small w' ],
- ['x', 120, '170', '\170', '&#120;', nil, 'x', 'x', 'x', 'Small x' ],
- ['y', 121, '171', '\171', '&#121;', nil, 'y', 'y', 'y', 'Small y' ],
- ['z', 122, '172', '\172', '&#122;', nil, 'z', 'z', 'z', 'Small z' ],
- ['{', 123, '173', '\173', '&#123;', nil, '{\{}', '\{', '', 'Left curly brace {' ],
- ['|', 124, '174', '\174', '&#124;', nil, '', '', '', 'Vertical bar / pipe |' ],
- ['}', 125, '175', '\175', '&#125;', nil, '{\}}', '\}', '', 'Right curly brace }' ],
- ['~', 126, '176', '\176', '&#126;', nil, '', '', '', 'Tilde ~' ],
- ['', 127, '177', '', '&#127;', nil, '', '', '', ' ' ],
- ['', 128, '200', '', '&#128;', nil, '', '', '', ' ' ],
- ['', 129, '201', '', '&#129;', nil, '', '', '', ' ' ],
- ['\'', 130, '202', '', '&#130;', nil, '', '', '', 'Low left single quote \''],
- [' ', 131, '203', '', '&#131;', nil, '', '', '', 'Florin ' ],
- ['"', 132, '204', '', '&#132;', nil, '', '', '', 'Low left double quote "' ],
- ['…', 133, '205', '\342\200\246', '&#133;', nil, '…', '\textellipsis', '', 'Ellipsis …' ],
- ['†', 134, '206', '\342\200\240', '&#134;', nil, '†', '\textdagger', '', 'Dagger †' ],
- ['‡', 135, '207', '\342\200\241', '&#135;', nil, '‡', '\textdaggerbl', '', 'Double dagger ‡' ],
- ['^', 136, '210', '', '&#136;', nil, '', '', '', 'Circumflex ^' ],
- ['', 137, '211', '', '&#137;', nil, '', '', '', 'Permil ' ],
- ['', 138, '212', '', '&#138;', nil, '', '', '', 'Capital S, caron ' ],
- ['<', 139, '213', '', '&#139;', nil, '', '', '', 'Less than sign (see &060;) <' ],
- ['', 140, '214', '', '&#140;', nil, '', '', '', 'Capital OE ligature ' ],
- ['', 141, '215', '', '&#141;', nil, '', '', '', ' ' ],
- ['', 142, '216', '', '&#142;', nil, '', '', '', 'Capital Z, caron ' ],
- ['', 143, '217', '', '&#143;', nil, '', '', '', ' ' ],
- ['', 144, '220', '', '&#144;', nil, '', '', '', ' ' ],
- ['', 145, '221', '', '&#145;', nil, '', '', '', 'Left single quote ' ],
- ['', 146, '222', '', '&#146;', nil, '', '', '', 'Right single quote ' ],
- ['', 147, '223', '', '&#147;', nil, '', '', '', 'Left double quote ' ],
- ['', 148, '224', '', '&#148;', nil, '', '', '', 'Right double quote ' ],
- ['', 149, '225', '', '&#149;', nil, '', '', '', 'Bullet ' ],
- ['-', 150, '226', '', '&#150;', nil, '', '', '', 'En dash -' ],
- ['', 151, '227', '', '&#151;', nil, '', '', '', 'Em dash -' ],
- ['~', 152, '230', '', '&#152;', nil, '', '', '', 'Tilde (see &126;) ~' ],
- ['t', 153, '231', '', '&#153;', nil, '', '', '', 'Trademark t' ],
- ['', 154, '232', '', '&#154;', nil, '', '', '', 'small s, caron ' ],
- ['', 155, '233', '', '&#155;', nil, '', '', '', 'Greater than sign (see &062;) ' ],
- ['', 156, '234', '', '&#156;', nil, '', '', '', 'Small oe ligature ' ],
- ['', 157, '235', '', '&#157;', nil, '', '', '', ' ' ],
- ['', 158, '236', '', '&#158;', nil, '', '', '', 'Small z, caron ' ],
- ['', 159, '237', '', '&#159;', nil, '', '', '', 'Capital Y, umlaut ' ],
- ['', 160, '240', '', '&#160;', '&nbsp;', '', '', '', 'Non-breaking space ' ],
- ['¡', 161, '241', '\302\241', '&#161;', '&iexcl;', '¡', '', '', 'Inverted exclamation ' ],
- ['¢', 162, '242', '\302\242', '&#162;', '&cent;', '¢', '', '', 'Cent sign ¢' ],
- ['£', 163, '243', '\302\243', '&#163;', '&pound;', '£', '\textsterling', '', 'Pound sign £' ],
- ['¤', 164, '244', '\302\244', '&#164;', '&curren;', '¤', '\textcurrency', '', 'General currency sign ' ],
- ['¥', 165, '245', '\302\245', '&#165;', '&yen;', '¥', '', '', 'Yen sign ¥' ],
- ['¦', 166, '246', '\302\246', '&#166;', '&brvbar;', '¦', '', '', 'Broken vertical bar ' ],
- ['§', 167, '247', '\302\247', '&#167;', '&sect;', '§', '\textsection', '', 'Section sign §' ],
- ['¨', 168, '250', '\302\250', '&#168;', '&uml;', '¨', '\"', '', 'Umlaut ' ],
- ['©', 169, '251', '\302\251', '&#169;', '&copy;', '©', '\copyright', '\textcopyright', 'Copyright ©' ],
- ['ª', 170, '252', '\302\252', '&#170;', '&ordf;', 'ª', '', '', 'Feminine ordinal ª' ],
- ['«', 171, '253', '\302\253', '&#171;', '&laquo;', '«', '', '', 'Left angle quote «' ],
- ['¬', 172, '254', '\302\254', '&#172;', '&not;', '¬', '', '', 'Not sign ' ],
- ['­', 173, '255', '\302\255', '&#173;', '&shy;', '­', '', '', 'Soft hyphen ' ],
- ['®', 174, '256', '\302\256', '&#174;', '&reg;', '®', '', '', 'Registered trademark ®' ],
- ['¯', 175, '257', '\302\257', '&#175;', '&macr;', '¯', '', '', 'Macron accent ' ],
- ['°', 176, '260', '\302\260', '&#176;', '&deg;', '°', '', '', 'Degree sign °' ],
- ['±', 177, '261', '\302\261', '&#177;', '&plusmin;', '±', '', '', 'Plus or minus ±' ],
- ['²', 178, '262', '\302\262', '&#178;', '&sup2;', '²', '', '', 'Superscript 2 ²' ],
- ['³', 179, '263', '\302\263', '&#179;', '&sup3;', '³', '', '', 'Superscript 3 ³' ],
- ['', 180, '264', '\302\264', '&#180;', '&acute;', ''', '', '', 'Acute accent ' ],
- ['µ', 181, '265', '\302\265', '&#181;', '&micro;', 'µ', '', '', 'Micro sign (Greek mu) µ' ],
- ['¶', 182, '266', '\302\266', '&#182;', '&para;', '¶', '\textparagraph', '', 'Paragraph sign ¶' ],
- ['·', 183, '267', '\302\267', '&#183;', '&middot;', %q{·}, '', %q{}, 'Middle dot ' ],
- ['¸', 184, '270', '\302\270', '&#184;', '&cedil;', '¸', '', '', 'Cedilla ' ],
- ['¹', 185, '271', '\302\271', '&#185;', '&sup1;', '¹', '', '', 'Superscript 1 ¹' ],
- ['º', 186, '272', '\302\272', '&#186;', '&ordm;', 'º', '', '', 'Masculine ordinal º' ],
- ['»', 187, '273', '\302\273', '&#187;', '&raquo;', '»', '', '', 'Right angle quote ' ],
- ['¼', 188, '274', '\302\274', '&#188;', '&frac14;', '¼', '', '', 'Fraction one quarter ¼' ],
- ['½', 189, '275', '\302\275', '&#189;', '&frac12;', '½', '', '', 'Fraction on half ½' ],
- ['¾', 190, '276', '\302\276', '&#190;', '&frac34;', '¾', '', '', 'Fraction three quarters ¾' ],
- ['¿', 191, '277', '\302\277', '&#191;', '&iquest;', '¿', '', '', 'Inverted question mark ¿' ],
- ['À', 192, '300', '\303\200', '&#192;', '&Agrave;', 'À', '\`{A}', '', 'Capital A, grave accent À' ],
- ['Á', 193, '301', '\303\201', '&#193;', '&Aacute;', 'Á', %q{\'{A}}, '', 'Capital A, acute accent Á' ],
- ['Â', 194, '302', '\303\202', '&#194;', '&Acirc;', 'Â', '^{A}', '', 'Capital A, circumflex accent Â' ],
- ['Ã', 195, '303', '\303\203', '&#195;', '&Atilde;', 'Ã', '~{A}', '', 'Capital A, tilde Ã' ],
- ['Ä', 196, '304', '\303\204', '&#196;', '&Auml;', 'Ä', '"{A}', '', 'Capital A, umlaut Ä' ],
- ['Å', 197, '305', '\303\205', '&#197;', '&Aring;', 'Å', 'r{A}', '', 'Capital A, ring Å' ],
- ['Æ', 198, '306', '\303\206', '&#198;', '&AElig;', 'Æ', 'AE', '', 'Capital AE ligature Æ' ],
- ['Ç', 199, '307', '\303\207', '&#199;', '&Ccedil;', 'Ç', '', '', 'Capital C, cedilla Ç' ],
- ['È', 200, '310', '\303\210', '&#200;', '&Egrave;', 'È', '`{E}', '', 'Capital E, grave accent È' ],
- ['É', 201, '311', '\303\211', '&#201;', '&Eacute;', 'É', ''{E}', '', 'Capital E, acute accent É' ],
- ['Ê', 202, '312', '\303\212', '&#202;', '&Ecirc;', 'Ê', '^{E}', '', 'Capital E, circumflex accent Ê' ],
- ['Ë', 203, '313', '\303\213', '&#203;', '&Euml;', 'Ë', '"{E}', '', 'Capital E, umlaut Ë' ],
- ['Ì', 204, '314', '\303\214', '&#204;', '&Igrave;', 'Ì', '`{I}', '', 'Capital I, grave accent Ì' ],
- ['Í', 205, '315', '\303\215', '&#205;', '&Iacute;', 'Í', ''{I}', '', 'Capital I, acute accent Í' ],
- ['Î', 206, '316', '\303\216', '&#206;', '&Icirc;', 'Î', '^{I}', '', 'Capital I, circumflex accent Î' ],
- ['Ï', 207, '317', '\303\217', '&#207;', '&Iuml;', 'Ï', '"{I}', '', 'Capital I, umlaut Ï' ],
- ['Ð', 208, '320', '\303\220', '&#208;', '&ETH;', 'Ð', '', '', 'Capital eth, Icelandic ' ],
- ['Ñ', 209, '321', '\303\221', '&#209;', '&Ntilde;', 'Ñ', '', '', 'Capital N, tilde Ñ' ],
- ['Ò', 210, '322', '\303\222', '&#210;', '&Ograve;', 'Ò', '`{O}', '', 'Capital O, grave accent Ò' ],
- ['Ó', 211, '323', '\303\223', '&#211;', '&Oacute;', 'Ó', ''{O}', '', 'Capital O, acute accent Ó' ],
- ['Ô', 212, '324', '\303\224', '&#212;', '&Ocirc;', 'Ô', '^{O}', '', 'Capital O, circumflex accent Ô' ],
- ['Õ', 213, '325', '\303\225', '&#213;', '&Otilde;', 'Õ', '~{O}', '', 'Capital O, tilde Õ' ],
- ['Ö', 214, '326', '\303\226', '&#214;', '&Ouml;', 'Ö', '"{O}', '', 'Capital O, umlaut Ö' ],
- ['×', 215, '327', '\303\227', '&#215;', '&times;', '×', '', '', 'Multiply sign ×' ],
- ['Ø', 216, '330', '\303\230', '&#216;', '&Oslash;', 'Ø', 'O', '', 'Capital O, slash Ø' ],
- ['Ù', 217, '331', '\303\231', '&#217;', '&Ugrave;', 'Ù', '', '', 'Capital U, grave accent Ù' ],
- ['Ú', 218, '332', '\303\232', '&#218;', '&Uacute;', 'Ú', '', '', 'Capital U, acute accent Ú' ],
- ['Û', 219, '333', '\303\233', '&#219;', '&Ucirc;', 'Û', '', '', 'Capital U, circumflex accent Û' ],
- ['Ü', 220, '334', '\303\234', '&#220;', '&Uuml;', 'Ü', '', '', 'Capital U, umlaut Ü' ],
- ['Ý', 221, '335', '\303\235', '&#221;', '&Yacute;', 'Ý', '', '', 'Capital Y, acute accent Ý' ],
- ['Þ', 222, '336', '\303\236', '&#222;', '&THORN;', 'Þ', '', '', 'Capital thorn, Icelandic Þ' ],
- ['ß', 223, '337', '\303\237', '&#223;', '&szlig;', 'ß', '', '', 'Small sz ligature, German ß' ],
- ['à', 224, '340', '\303\240', '&#224;', '&agrave;', 'à', '\`{a}', '', 'Small a, grave accent à' ],
- ['á', 225, '341', '\303\241', '&#225;', '&aacute;', 'á', %q{\'{a}}, '', 'Small a, acute accent á' ],
- ['â', 226, '342', '\303\242', '&#226;', '&acirc;', 'â', '\^{a}', '', 'Small a, circumflex accent â' ],
- ['ã', 227, '343', '\303\243', '&#227;', '&atilde;', 'ã', '\~{a}', '', 'Small a, tilde ã' ],
- ['ä', 228, '344', '\303\244', '&#228;', '&auml;', 'ä', '\"{a}', '', 'Small a, umlaut ä' ],
- ['å', 229, '345', '\303\245', '&#229;', '&aring;', 'å', '\r{a}', '', 'Small a, ring å' ],
- ['æ', 230, '346', '\303\246', '&#230;', '&aelig;', 'æ', '\ae', '', 'Small ae ligature æ' ],
- ['ç', 231, '347', '\303\257', '&#231;', '&ccedil;', 'ç', '', '', 'Small c, cedilla ç' ],
- ['è', 232, '350', '\303\250', '&#232;', '&egrave;', 'è', '\`{e}', '', 'Small e, grave accent è' ],
- ['é', 233, '351', '\303\251', '&#233;', '&eacute;', 'é', %q{\'{e}}, '', 'Small e, acute accent é' ],
- ['ê', 234, '352', '\303\252', '&#234;', '&ecirc;', 'ê', '\^{e}', '', 'Small e, circumflex accent ê' ],
- ['ë', 235, '353', '\303\253', '&#235;', '&euml;', 'ë', '\"{e}', '', 'Small e, umlaut ë' ],
- ['ì', 236, '354', '\303\254', '&#236;', '&igrave;', 'ì', '\`{i}', '', 'Small i, grave accent ì' ],
- ['í', 237, '355', '\303\255', '&#237;', '&iacute;', 'í', '\'{i}', '', 'Small i, acute accent í' ],
- ['î', 238, '356', '\303\256', '&#238;', '&icirc;', 'î', '\^{i}', '', 'Small i, circumflex accent î' ],
- ['ï', 239, '357', '\303\257', '&#239;', '&iuml;', 'ï', '\"{i}', '', 'Small i, umlaut ï' ],
- ['ð', 240, '360', '\303\260', '&#240;', '&eth;', 'ð', '', '', 'Small eth, Icelandic ð' ],
- ['ñ', 241, '361', '\303\261', '&#241;', '&ntilde;', 'ñ', '', '', 'Small n, tilde ñ' ],
- ['ò', 242, '362', '\303\262', '&#242;', '&ograve;', 'ò', '\`{o}', '', 'Small o, grave accent ò' ],
- ['ó', 243, '363', '\303\263', '&#243;', '&oacute;', 'ó', %q{\'{o}}, '', 'Small o, acute accent ó' ],
- ['ô', 244, '364', '\303\264', '&#244;', '&ocirc;', 'ô', '\^{o}', '', 'Small o, circumflex accent ô' ],
- ['õ', 245, '365', '\303\265', '&#245;', '&otilde;', 'õ', '\^{o}', '', 'Small o, tilde õ' ],
- ['ö', 246, '366', '\303\266', '&#246;', '&ouml;', 'ö', '\"{o}', '', 'Small o, umlaut ö' ],
- ['÷', 247, '367', '\303\267', '&#247;', '&divide;', '÷', '', '', 'Divide sign ÷' ],
- ['ø', 248, '370', '\303\270', '&#248;', '&oslash;', 'ø', '', '', 'Small o, slash ø' ],
- ['ù', 249, '371', '\303\271', '&#249;', '&ugrave;', 'ù', '\`{u}', '', 'Small u, grave accent ù' ],
- ['ú', 250, '372', '\303\272', '&#250;', '&uacute;', 'ú', %q{\'{u}}, '', 'Small u, acute accent ú' ],
- ['û', 251, '373', '\303\273', '&#251;', '&ucirc;', 'û', '\^{u}', '', 'Small u, circumflex accent û' ],
- ['ü', 252, '374', '\303\274', '&#252;', '&uuml;', 'ü', '\"{u}', '', 'Small u, umlaut ü' ],
- ['ý', 253, '375', '\303\275', '&#253;', '&yacute;', 'ý', '', '', 'Small y, acute accent ý' ],
- ['þ', 254, '376', '\303\276', '&#254;', '&thorn;', 'þ', '', '', 'Small thorn, Icelandic þ' ],
- ['ÿ', 255, '377', '\303\277', '&#255;', '&yuml;', 'ÿ', '', '', 'Smally y, umlaut ÿ' ],
- ['∝', , '', '', '&#8733;', '&prop;', '∝', '', '', 'proportional to U+221D (8733) ∝' ],
- ['∞', , '', '', '&#8734;', '&infin;', '∞', '', '', 'infinity U+221E (8734) ∞' ],
-]
- end
- end
-end
-__END__
diff --git a/lib/sisu/v3/composite.rb b/lib/sisu/v3/composite.rb
index 90ec28dc..d73b0c73 100644
--- a/lib/sisu/v3/composite.rb
+++ b/lib/sisu/v3/composite.rb
@@ -160,8 +160,8 @@ module SiSU_Assemble
file[:prepared] << "\n% |#{fni}|@|^|>>ok\n"
@code_flag=false
insert_array.each do |i|
- @code_flag=if i =~/^code\{/; true
- elsif i =~/^\}code/; false
+ @code_flag=if i =~/^code\{/ then true
+ elsif i =~/^\}code/ then false
else @code_flag
end
if not @code_flag \
diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v3/concordance.rb
index 2a3b585a..84245643 100644
--- a/lib/sisu/v3/concordance.rb
+++ b/lib/sisu/v3/concordance.rb
@@ -118,7 +118,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 --&gt;"></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">&nbsp;</td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.html_segtoc}" #{@vz.js_toc}><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" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right">&nbsp;</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
end
def create
@@ -134,7 +134,7 @@ WOK
div_class='content0'
end
top_band=if make.build.html_top_band?
- head_banner.concordance_navigation_band('pdf')
+ head_banner.concordance_navigation_band
else ''
end
<<WOK
@@ -151,10 +151,8 @@ WOK
<link rel="generator" href="http://www.jus.uio.no/sisu" />
<link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
#{stylesheet.css_head_seg}
- #{@vz.js_head}
</head>
<body>
- #{@vz.js_top}
#{top_band}
#{toc}
<div class="#{div_class}">
diff --git a/lib/sisu/v3/constants.rb b/lib/sisu/v3/constants.rb
index 2921b670..b38e3313 100644
--- a/lib/sisu/v3/constants.rb
+++ b/lib/sisu/v3/constants.rb
@@ -57,6 +57,7 @@
=end
#Ax,Xx,Mx,Rx,Hx,Dx,Px,Ep,Db,Gt,Tex=Array.new(11){{}}
+YEAR='2012'
Sfx={ txt: '.txt', html: '.html', xhtml: '.xhtml', xml: '.xml', epub: '.epub', epub_xhtml: '.xhtml', odt: '.odt', pdf: '.pdf'}
Ax={
tab: "\t",
@@ -97,8 +98,8 @@ Mx={
br_nl: '╲', #lB ▌ 』 ┘
br_paragraph: '█', #FB █ 9608 # PP ∥ 8741 #▐ #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616
br_obj: 'break_obj',
- br_page: 'break_page',
- br_page_new: 'break_page_new',
+ br_page: '┼',
+ br_page_new: '╋',
lnk_o: '⌠', lnk_c: '⌡', #'⌈' '⌋' '⌠' '⌡' #Mx[:lnk_o: '◁'; Mx[:lnk_c: '▷' #‹ ›
url_o: '「', url_c: '」',
rel_o: '⌈', rel_c: '⌋',
@@ -202,25 +203,25 @@ Ep={
f_opf: 'content.opf',
}
Db={
- name_prefix: "SiSU#{SiSU_version_dir}e_",
- name_prefix_db: "sisu_#{SiSU_version_dir}e_",
- col_title: 800,
- col_title_part: 400,
- col_title_edition: 10,
- col_name: 600,
- col_creator_misc_short: 100,
- col_language: 100,
- col_language_char: 6,
- col_date_text: 10,
- col_classify_txt_long: 600,
- col_classify_txt_short: 600,
- col_classify_short: 200,
- col_classify_identify: 256,
- col_classify_library: 30,
- col_classify_small: 16,
- col_filename: 256,
- col_digest: 64,
- col_filesize: 10,
+ name_prefix: "SiSU#{SiSU_version_dir}f_",
+ name_prefix_db: "sisu_#{SiSU_version_dir}f_",
+ col_title: 800,
+ col_title_part: 400,
+ col_title_edition: 10,
+ col_name: 600,
+ col_creator_misc_short: 100,
+ col_language: 100,
+ col_language_char: 6,
+ col_date_text: 10,
+ col_classify_txt_long: 600,
+ col_classify_txt_short: 600,
+ col_classify_short: 200,
+ col_classify_identify: 256,
+ col_classify_library: 30,
+ col_classify_small: 16,
+ col_filename: 256,
+ col_digest: 64,
+ col_filesize: 10,
col_info_note: 2500,
}
Gt={
diff --git a/lib/sisu/v3/dal.rb b/lib/sisu/v3/dal.rb
index 6c7fef79..0e816091 100644
--- a/lib/sisu/v3/dal.rb
+++ b/lib/sisu/v3/dal.rb
@@ -100,7 +100,7 @@ module SiSU_DAL
@fnm=@make_fns.marshal.dal_metadata
@fnc=@make_fns.marshal.dal_content
@idx_sst=@make_fns.marshal.dal_idx_sst_rel_html_seg
- @idx_tex=@make_fns.marshal.dal_idx_sst_rel
+ @idx_raw=@make_fns.marshal.dal_idx_sst_rel
@idx_html=@make_fns.marshal.dal_idx_html
@idx_xhtml=@make_fns.marshal.dal_idx_xhtml
@map_nametags=@make_fns.marshal.dal_map_nametags
@@ -163,7 +163,7 @@ module SiSU_DAL
SiSU_DAL::Instantiate.new
end
end
- def get_idx_tex #reads dal idx.tex, #unless does not exist then creates first
+ def get_idx_raw
begin
dal=[]
unless @@fns==@opt.fns \
@@ -173,7 +173,7 @@ module SiSU_DAL
: @opt.fns
@@idx_arr[:tex]=[]
end
- dal=(@@idx_arr[:tex].empty?) ? read_idx_tex : @@idx_arr[:tex].dup #check
+ dal=(@@idx_arr[:tex].empty?) ? read_idx_raw : @@idx_arr[:tex].dup #check
rescue
SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
__LINE__.to_s + ':' + __FILE__
@@ -273,13 +273,7 @@ module SiSU_DAL
if @opt.fno =~/\.txz$/
Dir.chdir(@opt.f_pth[:pth])
end
- file_array=@env.read_source_file(fn)
- file_array.each do |l|
- if l =~/\r\n/; l.gsub!(/\r\n/,"\n")
- end
- end
- meta=file_array.dup
- meta=meta.join.split("\n\n") #check whether can be eliminated, some of these are large objects to have twice
+ meta=file_array=@env.source_file_processing_array(fn)
@md=SiSU_Param::Parameters::Instructions.new(meta,@opt).extract
meta=nil
dal=SiSU_DAL::Make.new(fn,@md,file_array).song
@@ -294,72 +288,56 @@ module SiSU_DAL
def read_fnm
dal=[]
dal=if FileTest.file?(@fnm)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@fnm){ |f| dal=Marshal.load(f)})
- : (File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)})
+ File.open(@fnm,'r:utf-8'){ |f| dal=Marshal.load(f)}
else SiSU_DAL::Source.new(@opt).create_dal
end
end
def read_fnc
dal=[]
dal=if FileTest.file?(@fnc)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@fnc){ |f| dal=Marshal.load(f)})
- : (File.open(@fnc,'r:utf-8'){ |f| dal=Marshal.load(f)})
+ File.open(@fnc,'r:utf-8'){ |f| dal=Marshal.load(f)}
else SiSU_DAL::Source.new(@opt).create_dal
end
end
def read_idx_sst
m=[]
m=if FileTest.file?(@idx_sst)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_sst){ |f| m=Marshal.load(f)})
- : (File.open(@idx_sst,'r:utf-8'){ |f| m=Marshal.load(f)})
+ File.open(@idx_sst,'r:utf-8'){ |f| m=Marshal.load(f)}
else nil
end
end
- def read_idx_tex
+ def read_idx_raw
m=[]
- m=if FileTest.file?(@idx_tex)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_tex){ |f| m=Marshal.load(f)})
- : (File.open(@idx_tex,'r:utf-8'){ |f| m=Marshal.load(f)})
+ m=if FileTest.file?(@idx_raw)
+ File.open(@idx_raw,'r:utf-8'){ |f| m=Marshal.load(f)}
else nil
end
end
def read_idx_html
m=[]
m=if FileTest.file?(@idx_html)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_html){ |f| m=Marshal.load(f)})
- : (File.open(@idx_html,'r:utf-8'){ |f| m=Marshal.load(f)})
+ File.open(@idx_html,'r:utf-8'){ |f| m=Marshal.load(f)}
else nil
end
end
def read_idx_xhtml
m=[]
m=if FileTest.file?(@idx_xhtml)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@idx_xhtml){ |f| m=Marshal.load(f)})
- : (File.open(@idx_xhtml,'r:utf-8'){ |f| m=Marshal.load(f)})
+ File.open(@idx_xhtml,'r:utf-8'){ |f| m=Marshal.load(f)}
else nil
end
end
def read_map_nametags
m=[]
m=if FileTest.file?(@map_nametags)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@map_nametags){ |f| m=Marshal.load(f)})
- : (File.open(@map_nametags,'r:utf-8'){ |f| m=Marshal.load(f)})
+ File.open(@map_nametags,'r:utf-8'){ |f| m=Marshal.load(f)}
else nil
end
end
def read_map_ocn_htmlseg
m=[]
m=if FileTest.file?(@map_ocn_htmlseg)
- (RUBY_VERSION < '1.9') \
- ? (File.open(@map_ocn_htmlseg){ |f| m=Marshal.load(f)})
- : (File.open(@map_ocn_htmlseg,'r:utf-8'){ |f| m=Marshal.load(f)})
+ File.open(@map_ocn_htmlseg,'r:utf-8'){ |f| m=Marshal.load(f)}
else nil
end
end
@@ -445,18 +423,18 @@ module SiSU_DAL
end
def make_marshal_content
marshal_dal=@make.marshal.dal_content
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def make_marshal_metadata
marshal_dal=@make.marshal.dal_metadata
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def idx_html_hard_output
if @md.book_idx \
and @md.opt.cmd =~/M/
filename_meta=@cf.file_meta_idx_html
- unless @data.nil? #REMOVE earliest possible
- @data.each {|s| p s.inspect + "\n" unless s.class==String}
+ if @data.is_a?(Array)
+ @data.each {|s| p s.inspect + "\n" unless s.is_a?(String)}
@data.each {|s| filename_meta.puts s.strip + "\n" unless s.strip.empty?}
end
else
@@ -466,27 +444,27 @@ module SiSU_DAL
end
def make_marshal_idx_sst_html_seg
marshal_dal=@make.marshal.dal_idx_sst_rel_html_seg
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def make_marshal_idx_sst_rel
marshal_dal=@make.marshal.dal_idx_sst_rel
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def make_marshal_idx_html
marshal_dal=@make.marshal.dal_idx_html
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def make_marshal_idx_xhtml
marshal_dal=@make.marshal.dal_idx_xhtml
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Array
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
end
def make_marshal_map_nametags
marshal_dal=@make.marshal.dal_map_nametags
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Hash
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
end
def make_marshal_map_name_ocn_htmlseg
marshal_dal=@make.marshal.dal_map_ocn_htmlseg
- File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.class==Hash
+ File.open(marshal_dal,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
end
end
class Make
@@ -501,7 +479,6 @@ module SiSU_DAL
def song
reset
data=@data
- data=data.join.split("\n\n")
data=SiSU_DAL_Insertions::Insertions.new(@md,data).expand_insertions? # dal_expand_insertions.rb
data=SiSU_DAL_SubstituteAndInsert::SI.new(@md,data).substitutions_and_insertions? # dal_substitutions_and_insertions.rb
data,metadata=SiSU_DAL_DocumentStructureExtract::Build.new(@md,data).identify_parts # dal_doc_str.rb
diff --git a/lib/sisu/v3/dal_character_check.rb b/lib/sisu/v3/dal_character_check.rb
index fdba5086..f20d4106 100644
--- a/lib/sisu/v3/dal_character_check.rb
+++ b/lib/sisu/v3/dal_character_check.rb
@@ -78,8 +78,6 @@ module SiSU_DAL_CharacterCheck
gsub(/<br>/,"#{Mx[:br_line]}"). #needed by xml, xhtml etc.
gsub(/\t/,' ').
gsub(/\342\200\231/u,"'"). #if dob =~/’/ #Avoid #&lsquo; &rsquo; #&ldquo; &rdquo;
- gsub(/�/u,' '). #watch, replace with char code
- gsub(/·/u,'*').
gsub(/\\copy(?:right)?\b/,'&#169;').
gsub(/\\trademark\b|\\tm\b/,'&#174;')
dob.obj=dob.obj + "\n"
@@ -87,13 +85,15 @@ module SiSU_DAL_CharacterCheck
case dob.obj
when /\^~/ #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+
sub_dob=dob.obj.dup
- @endnote_array << sub_dob.gsub(/\n/,'').gsub(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip
+ @endnote_array << sub_dob.gsub(/\n/,'').
+ gsub(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).
+ strip
endnote_no+=1
dob=nil if dob.obj =~/\^~ .+/ #watch, removes 'binary' endnote now in endnote array for later insertion
end
end
end
- @tuned_file << dob unless dob.nil?
+ @tuned_file << dob if dob.is_a?(Object)
end
@tuned_file=@tuned_file.flatten.compact
[@tuned_file,@endnote_array]
diff --git a/lib/sisu/v3/dal_doc_objects.rb b/lib/sisu/v3/dal_doc_objects.rb
index dd2c9cf0..f77348ec 100644
--- a/lib/sisu/v3/dal_doc_objects.rb
+++ b/lib/sisu/v3/dal_doc_objects.rb
@@ -71,7 +71,7 @@ module SiSU_DAL_DocumentStructure
def metadata(tags)
of= @of #String, classification - group
is= :meta #String, classification - specific type
- tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag
+ tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag
obj= nil
@of,@is,@tags,@obj=of,is,tags,obj
self
@@ -86,10 +86,10 @@ module SiSU_DAL_DocumentStructure
def metadata(h,o=nil)
of= @of #String, classification - group
is= :meta #String, classification - specific type
- tag= h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tag= h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
@of,@is,@tag,@obj,@digest,@tmp=of,is,tag,obj,digest,tmp
self
end
@@ -135,27 +135,27 @@ module SiSU_DAL_DocumentStructure
end
of= @of #String, classification - group
is= :heading #String, classification - specific type
- name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
- ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
- toc_= h[:toc_] || ((defined? o.toc_) ? o.toc_ : false) #Bool, do not include in toc, (relevant to headings)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
+ ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
+ toc_= h[:toc_] || ((defined? o.toc_) ? o.toc_ : false) #Bool, do not include in toc, (relevant to headings)
+ ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
- autonum_= if h[:autonum_].nil?; ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses
+ autonum_= if h[:autonum_].nil? then ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses
else h[:autonum_]
end
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@lv,@ln,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@toc_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,name,tags,obj,idx,ocn,odv,osp,node,parent,toc_,ocn_,note_,autonum_,digest,tmp
self
end
@@ -175,48 +175,48 @@ module SiSU_DAL_DocumentStructure
def paragraph(h,o=nil)
of= @of #String, classification - group
is= :para #String, classification - specific type
- name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
indent= h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level
- hang= h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level
- bullet_=h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted?
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ hang= h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level
+ bullet_=h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted?
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
+ ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp
self
end
def docinfo(h,o=nil)
of= @of #String, classification - group
is= :docinfo #String, classification - specific type
- name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
- tags= h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
idx= nil #String, book index provided?
ocn= nil #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
indent= nil #Integer, indent level
- hang= nil #Integer, indent level
+ hang= nil #Integer, indent level
bullet_=false #Bool, bulleted?
note_= false #Bool, endnotes/footnotes? (processing optimization)
- image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
+ ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp
self
end
@@ -231,95 +231,95 @@ module SiSU_DAL_DocumentStructure
def code(h,o=nil)
of= @of #String, classification - group #alt 'code'
is= :code #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- number_= h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not?
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ number_= h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not?
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,number_,note_,ocn_,digest,tmp
self
end
def block(h,o=nil)
of= @of #String, classification - group
is= :block #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
self
end
def group(h,o=nil)
of= @of #String, classification - group
is= :group #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
self
end
def alt(h,o=nil) #see block
of= @of #String, classification - group
is= :alt #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
self
end
def verse(h,o=nil) #part of poem decide how you deal with this
of= @of #String, classification - group
is= :verse #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- ocn_= if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
@h=nil
self
@@ -335,22 +335,22 @@ module SiSU_DAL_DocumentStructure
def table(h,o=nil)
of= @of #String, classification - group
is= :table #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- cols= h[:cols] || ((defined? o.cols) ? o.cols : nil)
- widths= h[:widths] || ((defined? o.widths) ? o.widths : nil)
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- head_= h[:head_] || ((defined? o.head_) ? o.head_ : false)
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ cols= h[:cols] || ((defined? o.cols) ? o.cols : nil)
+ widths= h[:widths] || ((defined? o.widths) ? o.widths : nil)
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ head_= h[:head_] || ((defined? o.head_) ? o.head_ : false)
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@digest,@tmp=of,is,tags,cols,widths,obj,idx,ocn,odv,osp,parent,head_,note_,ocn_,digest,tmp
self
end
@@ -365,20 +365,20 @@ module SiSU_DAL_DocumentStructure
def image(h,o=nil) #not yet used, and what of a paragraph containing several images, consider
of= @of #String, classification - group
is= :image #String, classification - specific type
- tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- size= h[:size] || ((defined? o.size) ? o.size : nil)
- idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
- ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
- odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
- osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
- parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
- note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
- ocn_=if h[:ocn_].nil?; ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ size= h[:size] || ((defined? o.size) ? o.size : nil)
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
else h[:ocn_]
end
- digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@tags,@obj,@size,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@digest,@tmp=of,is,tags,obj,size,idx,ocn,odv,osp,parent,note_,ocn_,digest,tmp
self
end
@@ -392,12 +392,12 @@ module SiSU_DAL_DocumentStructure
def xml_dom(h,o=nil)
of= @of #String, classification - group
is= :xml_dom #String, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content
- lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
- ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
- node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
- status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status open or close
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content
+ lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6
+ ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
+ node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
+ status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status open or close
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@obj,@status,@node,@lv,@ln,@tmp=of,is,obj,status,node,lv,ln,tmp
self
end
@@ -411,8 +411,8 @@ module SiSU_DAL_DocumentStructure
def comment(h,o=nil)
of= @of #String, classification - group
is= :comment #String, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@obj,@tmp=of,is,obj,tmp
self
end
@@ -426,16 +426,16 @@ module SiSU_DAL_DocumentStructure
def break(h,o=nil) #decide how to deal with, perhaps no obj?
of= @of #String, classification - group
is= :break #String, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@obj,@tmp=of,is,obj,tmp
self
end
def insert(h,o=nil) #decide how to deal with, could mimic paragraph?
of= @of #String, classification - group
is= :insert #String, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@obj,@tmp=of,is,obj,tmp
self
end
diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb
index ab5f9199..012e7a33 100644
--- a/lib/sisu/v3/dal_doc_str.rb
+++ b/lib/sisu/v3/dal_doc_str.rb
@@ -233,11 +233,11 @@ module SiSU_DAL_DocumentStructureExtract
end
else nil
end
- when /^[<\[](?:br)?:(?:pa?r|o(?:bj|---)?)[>\]]\s*$/ #[br:par] #[br:obj]
+ when /^<(?:br)?:(?:pa?r|o(?:bj|---)?)>\s*$/ #[br:par] #[br:obj]
SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_obj])
- when /^(?:[<\[](?:br)?:pg[>\]]|<?:pb>?)\s*$/ #[br:pg]
+ when /^(?:-\\\\-|<:pb>)\s*$/ #[br:pg]
SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page])
- when /^[<\[](?:br)?:pg?n[>\]]\s*$/ #[br:pgn]
+ when /^(?:=\\\\=|<:pn>)\s*$/ #[br:pgn]
SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new])
else #paragraph
image=image_test(t_o)
@@ -363,8 +363,8 @@ module SiSU_DAL_DocumentStructureExtract
t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
t_o
else
- if t_o !~/^table\{/ \
- and not t_o.nil?
+ if t_o.is_a?(String) \
+ and t_o !~/^table\{/
t_o=t_o.gsub(/^\n+/m,''). #check added for ruby 1.9.2 not needed in 1.8 series (tested in v2)
gsub(/\n+/m,"#{Mx[:tc_p]}")
@rows += t_o + Mx[:tc_c]
@@ -385,8 +385,7 @@ module SiSU_DAL_DocumentStructureExtract
t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h) #t_o=SiSU_DAL_DocumentStructure::ObjectLayout.new.insert(h)
end
if @@flag['code'] \
- and t_o.class==String \
- and not t_o.nil? #you may need to introduce t_o.class==String test more widely
+ and t_o.is_a?(String)
sub_array=t_o.dup + "#{Mx[:br_nl]}"
@line_mode=sub_array.scan(/.+/)
@line_mode=[]
@@ -461,7 +460,7 @@ module SiSU_DAL_DocumentStructureExtract
if @@flag['poem'] \
or @@flag['group'] \
or @@flag['alt']
- if t_o.class==String
+ if t_o.is_a?(String)
t_o=t_o.gsub(/\n/m,"#{Mx[:br_nl]}").
gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}").
gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")
@@ -527,7 +526,7 @@ module SiSU_DAL_DocumentStructureExtract
lines.each do |line|
line=if line =~/\S/ \
and line !~/^code\{|^\}code/ \
- and line.class != Hash
+ and not line.is_a?(Hash)
@@counter+=1 if @@flag['code']
line=line.gsub(/\s\s/,"#{Mx[:nbsp]*2}").
gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")
@@ -858,10 +857,9 @@ module SiSU_DAL_DocumentStructureExtract
tuned_file=tuned_file.flatten
end
def tags(o)
- tag=if o[:status]=='open'
- %{<#{o[:lv]} id="#{o[:node]}">}
- else "</#{o[:lv]}>"
- end
+ tag=(o[:status]=='open') \
+ ? %{<#{o[:lv]} id="#{o[:node]}">}
+ : "</#{o[:lv]}>"
ln=case o[:lv]
when 'A'; 1
when 'B'; 2
diff --git a/lib/sisu/v3/dal_expand_insertions.rb b/lib/sisu/v3/dal_expand_insertions.rb
index 5903d242..2ec4945f 100644
--- a/lib/sisu/v3/dal_expand_insertions.rb
+++ b/lib/sisu/v3/dal_expand_insertions.rb
@@ -72,33 +72,33 @@ module SiSU_DAL_Insertions
end
file_type_names={}
file_type_names[:gen],file_type_names[:src]=[],[]
- file_type_names[:gen] <<= if cmd_list =~ /y/; "~^ { document manifest }#{lnk[:manifest]}"
+ file_type_names[:gen] <<= if cmd_list =~ /y/ then "~^ { document manifest }#{lnk[:manifest]}"
end
- file_type_names[:gen] <<= if cmd_list =~ /h/; [" { html, segmented text }#{lnk[:html_toc]}"," { html, scroll, document in one }#{lnk[:html_doc]}"]
+ file_type_names[:gen] <<= if cmd_list =~ /h/ then [" { html, segmented text }#{lnk[:html_toc]}"," { html, scroll, document in one }#{lnk[:html_doc]}"]
end
- file_type_names[:gen] <<= if cmd_list =~ /e/; [" { epub }#{lnk[:epub]}"]
+ file_type_names[:gen] <<= if cmd_list =~ /e/ then [" { epub }#{lnk[:epub]}"]
end
- file_type_names[:gen] <<= if cmd_list =~ /p/; [" { pdf, landscape }#{lnk[:pdf_landscape]}"," { pdf, portrait }#{lnk[:pdf_portrait]}"]
+ file_type_names[:gen] <<= if cmd_list =~ /p/ then [" { pdf, landscape }#{lnk[:pdf_landscape]}"," { pdf, portrait }#{lnk[:pdf_portrait]}"]
end
- file_type_names[:gen] <<= if cmd_list =~ /o/; " { odf:odt, open document text }#{lnk[:odt]}"
+ file_type_names[:gen] <<= if cmd_list =~ /o/ then " { odf:odt, open document text }#{lnk[:odt]}"
end
- file_type_names[:gen] <<= if cmd_list =~ /b/; " { xhtml scroll }#{lnk[:xhtml]}"
+ file_type_names[:gen] <<= if cmd_list =~ /b/ then " { xhtml scroll }#{lnk[:xhtml]}"
end
- file_type_names[:gen] <<= if cmd_list =~ /x/; " { xml, sax }#{lnk[:xml_sax]}"
+ file_type_names[:gen] <<= if cmd_list =~ /x/ then " { xml, sax }#{lnk[:xml_sax]}"
end
- file_type_names[:gen] <<= if cmd_list =~ /X/; " { xml, dom }#{lnk[:xml_dom]}"
+ file_type_names[:gen] <<= if cmd_list =~ /X/ then " { xml, dom }#{lnk[:xml_dom]}"
end
- file_type_names[:gen] <<= if cmd_list =~ /a/; " { plain text utf-8 }#{lnk[:txt]}"
+ file_type_names[:gen] <<= if cmd_list =~ /a/ then " { plain text utf-8 }#{lnk[:txt]}"
end
- file_type_names[:gen] <<= if cmd_list =~ /g/; 'wiki.txt'
+ file_type_names[:gen] <<= if cmd_list =~ /g/ then 'wiki.txt'
end
- file_type_names[:gen] <<= if cmd_list =~ /w/; " { concordance }#{lnk[:html_concordance]}"
+ file_type_names[:gen] <<= if cmd_list =~ /w/ then " { concordance }#{lnk[:html_concordance]}"
end
- file_type_names[:gen] <<= if cmd_list =~ /N/; " { dcc, document content certificate (digests) }#{lnk[:digest]}"
+ file_type_names[:gen] <<= if cmd_list =~ /N/ then " { dcc, document content certificate (digests) }#{lnk[:digest]}"
end
- file_type_names[:src] <<= if source and cmd_shortcut =~ /s/; " { markup source text }#{lnk[:source]}"
+ file_type_names[:src] <<= if source and cmd_shortcut =~ /s/ then " { markup source text }#{lnk[:source]}"
end
- file_type_names[:src] <<= if cmd_shortcut =~ /S/; " { markup source (zipped) pod }#{lnk[:sisupod]}"
+ file_type_names[:src] <<= if cmd_shortcut =~ /S/ then " { markup source (zipped) pod }#{lnk[:sisupod]}"
end
file_type_names[:gen]=file_type_names[:gen].flatten
file_type_names[:src]=file_type_names[:src].flatten
diff --git a/lib/sisu/v3/dal_hash_digest.rb b/lib/sisu/v3/dal_hash_digest.rb
index c30048db..8718c461 100644
--- a/lib/sisu/v3/dal_hash_digest.rb
+++ b/lib/sisu/v3/dal_hash_digest.rb
@@ -72,13 +72,13 @@ module SiSU_DAL_Hash
sha_ =(@env.digest.type=='sha256' ? true : false)
sha_ ? (require 'digest/sha2') : (require 'digest/md5')
data.each do |t_o|
- unless t_o.obj.class==Array
+ unless t_o.obj.is_a?(Array)
t_o.obj=t_o.obj.strip
end
if (t_o.of !=:structure \
&& t_o.of !=:comment \
&& t_o.of !=:layout) \
- && t_o.ocn.class==Fixnum
+ && t_o.ocn.is_a?(Fixnum)
if sha_
for hash_class in [ Digest::SHA256 ]
@tuned_file << stamped(t_o,hash_class)
diff --git a/lib/sisu/v3/dal_idx.rb b/lib/sisu/v3/dal_idx.rb
index 63735bde..db4ba9c1 100644
--- a/lib/sisu/v3/dal_idx.rb
+++ b/lib/sisu/v3/dal_idx.rb
@@ -79,7 +79,11 @@ module SiSU_DAL_BookIndex
&& dob.ln==4
@seg=dob.name
end
- idx_array << "#{dob.idx}~#{dob.ocn}~#{@seg}" if defined? dob.idx and not (dob.idx.nil? or dob.idx.empty?)
+ if defined? dob.idx \
+ and dob.idx.is_a?(String) \
+ and not dob.idx.empty?
+ idx_array << "#{dob.idx}~#{dob.ocn}~#{@seg}"
+ end
tuned_file << dob if dob
end
idx_array=construct_idx_array(idx_array) if idx_array.length > 0
@@ -113,35 +117,42 @@ module SiSU_DAL_BookIndex
def construct_book_index(idx_array)
the_idx={}
idx_array.each do |idx|
- idx_lst=idx[:rough_idx].scan(/[^|:]+/)
- idx_lst[0]=idx_lst[0].strip
- if idx_lst[0] =~/.+?\+\d+/
- use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2]
- else use=idx_lst[0]
- end
- use=use[0].chr.capitalize + use[1,use.length]
- the_idx[use]={} unless the_idx[use] and defined? the_idx[use]
- idx_lst.each do |i|
- i=i.strip
- i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/
- x=if idx_lst.length==1 or idx_lst[0].gsub(/\+\d+/,'')==i
- the_idx[use]['term_node_lev1']=[] unless the_idx[use]['term_node_lev1'] and defined? the_idx[use]['term_node_lev1']
- x=if r
- the_idx[use]['term_node_lev1'] << { ocn: idx[:ocn], range: "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", seg: idx[:seg] }
- "#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
- else
- the_idx[use]['term_node_lev1'] << { ocn: idx[:ocn], seg: idx[:seg] }
- "#{i} #{idx[:ocn]}"
- end
- else
- the_idx[use]['term_node_lev2']={} unless the_idx[use]['term_node_lev2'] and defined? the_idx[use]['term_node_lev2']
- the_idx[use]['term_node_lev2'][i]=[] unless the_idx[use]['term_node_lev2'][i] and defined? the_idx[use]['term_node_lev2'][i]
- x=if r
- the_idx[use]['term_node_lev2'][i] << { ocn: idx[:ocn], range: "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", seg: idx[:seg] }
- "#{idx_lst[0]}:#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
+ if idx[:rough_idx] =~/[|]/ \
+ && idx[:rough_idx] !~/[:]/
+ if @md.opt.cmd =~/[MVv]/
+ p 'book index error? --> ' + idx[:rough_idx]
+ end
+ else
+ idx_lst=idx[:rough_idx].scan(/[^|:]+/)
+ idx_lst[0]=idx_lst[0].strip
+ if idx_lst[0] =~/.+?\+\d+/
+ use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2]
+ else use=idx_lst[0]
+ end
+ use=use[0].chr.capitalize + use[1,use.length]
+ the_idx[use]={} unless the_idx[use] and defined? the_idx[use]
+ idx_lst.each do |i|
+ i=i.strip
+ i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/
+ x=if idx_lst.length==1 or idx_lst[0].gsub(/\+\d+/,'')==i
+ the_idx[use]['term_node_lev1']=[] unless the_idx[use]['term_node_lev1'] and defined? the_idx[use]['term_node_lev1']
+ x=if r
+ the_idx[use]['term_node_lev1'] << { ocn: idx[:ocn], range: "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", seg: idx[:seg] }
+ "#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
+ else
+ the_idx[use]['term_node_lev1'] << { ocn: idx[:ocn], seg: idx[:seg] }
+ "#{i} #{idx[:ocn]}"
+ end
else
- the_idx[use]['term_node_lev2'][i] << { ocn: idx[:ocn], seg: idx[:seg] }
- "#{idx_lst[0]}:#{i} #{idx[:ocn]}"
+ the_idx[use]['term_node_lev2']={} unless the_idx[use]['term_node_lev2'] and defined? the_idx[use]['term_node_lev2']
+ the_idx[use]['term_node_lev2'][i]=[] unless the_idx[use]['term_node_lev2'][i] and defined? the_idx[use]['term_node_lev2'][i]
+ x=if r
+ the_idx[use]['term_node_lev2'][i] << { ocn: idx[:ocn], range: "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", seg: idx[:seg] }
+ "#{idx_lst[0]}:#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
+ else
+ the_idx[use]['term_node_lev2'][i] << { ocn: idx[:ocn], seg: idx[:seg] }
+ "#{idx_lst[0]}:#{i} #{idx[:ocn]}"
+ end
end
end
end
@@ -193,7 +204,7 @@ module SiSU_DAL_BookIndex
idx[:xhtml] << %{\n<p class="letter" id="numeral">0 - 9</p>}
the_idx.each do |i|
i.each do |x|
- if x.class==String
+ if x.is_a?(String)
f=/^(\S)/.match(x)[1]
if letter < f
while letter < f
@@ -216,11 +227,11 @@ module SiSU_DAL_BookIndex
@q=idx[:html].index(idx[:html].last)
@r=idx[:xhtml].index(idx[:xhtml].last)
print "\n" + x + ', ' if @md.opt.cmd =~/V/
- elsif x.class==Array
+ elsif x.is_a?(Array)
p 'array error? -->'
print x
- elsif x.class==Hash
- if x['term_node_lev1'].class==Array
+ elsif x.is_a?(Hash)
+ if x['term_node_lev1'].is_a?(Array)
x['term_node_lev1'].each do |a|
if a[:range]
idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, }
@@ -283,13 +294,13 @@ module SiSU_DAL_BookIndex
def screen_print(the_idx)
the_idx.each do |i|
i.each do |x|
- if x.class==String
+ if x.is_a?(String)
print "\n" + x + ', '
- elsif x.class==Array
+ elsif x.is_a?(Array)
p 'array error? -->'
print x
- elsif x.class==Hash
- if x['term_node_lev1'].class==Array
+ elsif x.is_a?(Hash)
+ if x['term_node_lev1'].is_a?(Array)
x['term_node_lev1'].each do |a|
if a[:range]
print a[:range] + ', '
diff --git a/lib/sisu/v3/dal_numbering.rb b/lib/sisu/v3/dal_numbering.rb
index c0bb4cb1..f81563f3 100644
--- a/lib/sisu/v3/dal_numbering.rb
+++ b/lib/sisu/v3/dal_numbering.rb
@@ -82,7 +82,7 @@ module SiSU_DAL_Numbering
&& dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX
dob.obj=dob.obj.gsub(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks
end
- unless dob.obj.class==Array
+ unless dob.obj.is_a?(Array)
dob.obj=dob.obj.gsub(/^\s+/,'').
gsub(/\s$/,"\n")
end
@@ -160,7 +160,7 @@ module SiSU_DAL_Numbering
if dob.ln==no1
t_no1+=1; t_no2=0; t_no3=0
title_no="#{t_no1}"
- if not @md.seg_names.nil? \
+ if @md.seg_names.is_a?(Array) \
and not @md.seg_names.include?(title_no)
if dob.ln==no1
dob.name="#{title_no}" if not dob.name
@@ -303,7 +303,7 @@ module SiSU_DAL_Numbering
possible_seg_name=$1
possible_seg_name=possible_seg_name.gsub(/(?:[:,-]|\W)/,'.').
gsub(/\.$/,'')
- if not @md.seg_names.nil? \
+ if @md.seg_names.is_a?(Array) \
and not @md.seg_names.include?(possible_seg_name)
dob.name=possible_seg_name
dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/
@@ -313,7 +313,7 @@ module SiSU_DAL_Numbering
end
if dob.ln==4 \
and dob.name #extract segment name from embedded document structure info
- if not @md.seg_names.nil? \
+ if @md.seg_names.is_a?(Array) \
and not @md.seg_names.include?(dob.name)
dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/
@md.seg_names << dob.name
@@ -323,7 +323,7 @@ module SiSU_DAL_Numbering
and not dob.name #if still no segment name, provide a numerical one
pf='_' #pg='' #may use e.g. '' or '~' or '_'
segn_auto="#{pf}#{art_filename_auto.to_s}"
- if not @md.seg_names.nil? \
+ if @md.seg_names.is_a?(Array) \
and not @md.seg_names.include?(segn_auto)
dob.name=segn_auto
dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs
@@ -435,9 +435,9 @@ module SiSU_DAL_Numbering
and dob.obj !~/\A\s*\Z/m \
and dob.is !=:layout
@md.set_heading_seg=true
- head=if @md.title.main ; dob.ln,dob.name,dob.obj=4,'seg',@md.title.main
- else dob.ln,dob.name,dob.obj=4,'seg','[segment]'
- end
+ head=@md.title.main \
+ ? (dob.ln,dob.name,dob.obj=4,'seg',@md.title.main)
+ : (dob.ln,dob.name,dob.obj=4,'seg','[segment]')
@tuned_file << head
end
end
diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb
index 5b308009..b21f94a5 100644
--- a/lib/sisu/v3/dal_syntax.rb
+++ b/lib/sisu/v3/dal_syntax.rb
@@ -141,7 +141,11 @@ module SiSU_DAL_Syntax
&& dob.is !=:comment \
&& dob.is !=:code \
&& dob.is !=:table
- dob.obj=dob.obj.gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}").
+ dob.obj=dob.obj.gsub(/^-\\\\-\s*$/,"#{Mx[:br_page]}").
+ gsub(/^=\\\\=\s*$/,"#{Mx[:br_page_new]}").
+ gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}").
+ gsub(/(?:<:?pb>)/,"#{Mx[:br_page]}"). # depreciated
+ gsub(/(?:<:?pn>)/,"#{Mx[:br_page_new]}"). # depreciated
gsub(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}") # depreciated
end
dob
@@ -234,7 +238,7 @@ module SiSU_DAL_Syntax
def substitutions(dob)
dob=dob.dup
dob=if defined? @md.make.substitute[:match_and_replace] \
- and @md.make.substitute[:match_and_replace].class == Array
+ and @md.make.substitute[:match_and_replace].is_a?(Array)
dob=if dob.is !=:meta \
&& dob.is !=:heading_insert \
&& dob.is !=:code \
@@ -281,8 +285,10 @@ module SiSU_DAL_Syntax
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+/; embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
- elsif w =~/^\/_\s+/; italicise(w)
+ w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/
+ embolden(w) #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!
+ elsif w =~/^\/_\s+/
+ italicise(w)
else w
end
end
@@ -453,8 +459,8 @@ module SiSU_DAL_Syntax
dob=fontface(dob)
dob.obj=dob.obj.gsub(/<[:e]\s+(.+?)!?>/,
"#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}"). #not tested
- gsub(/^\s*_\*\s*/,
- "#{Mx[:gl_bullet]}"). #bullets, shortcut
+ gsub(/(^|#{Mx[:br_nl]})\s*_\*\s*/,
+ "\\1#{Mx[:gl_bullet]}"). #bullets, shortcut
gsub(/=\{(.+?)\}/,
"#{Mx[:idx_o]}\\1#{Mx[:idx_c]}").
gsub(/^\s*_([1-9])\*\s*/,
diff --git a/lib/sisu/v3/db_columns.rb b/lib/sisu/v3/db_columns.rb
index 5ae17707..7c4fa9eb 100644
--- a/lib/sisu/v3/db_columns.rb
+++ b/lib/sisu/v3/db_columns.rb
@@ -295,7 +295,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.creator.author_detail \
- and @md.creator.author_detail.class==Array \
+ and @md.creator.author_detail.is_a?(Array) \
and @md.creator.author_detail.length > 0
txt=''
@md.creator.author_detail.each do |h|
@@ -366,7 +366,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.creator.editor_detail \
- and @md.creator.editor_detail.class==Array \
+ and @md.creator.editor_detail.is_a?(Array) \
and @md.creator.editor_detail.length > 0
txt=@md.creator.editor_detail #dc
txt=''
@@ -394,7 +394,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.creator.contributor_detail \
- and @md.creator.contributor_detail.class==Array \
+ and @md.creator.contributor_detail.is_a?(Array) \
and @md.creator.contributor_detail.length > 0
txt=@md.creator.contributor_detail #dc
txt=''
@@ -422,7 +422,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.creator.illustrator_detail \
- and @md.creator.illustrator_detail.class==Array \
+ and @md.creator.illustrator_detail.is_a?(Array) \
and @md.creator.illustrator_detail.length > 0
txt=@md.creator.illustrator_detail
txt=''
@@ -450,7 +450,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.creator.photographer_detail \
- and @md.creator.photographer_detail.class==Array \
+ and @md.creator.photographer_detail.is_a?(Array) \
and @md.creator.photographer_detail.length > 0
txt=@md.creator.photographer_detail
txt=''
@@ -478,7 +478,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.creator.translator_detail \
- and @md.creator.translator_detail.class==Array \
+ and @md.creator.translator_detail.is_a?(Array) \
and @md.creator.translator_detail.length > 0
txt=''
@md.creator.translator_detail.each do |h|
@@ -505,7 +505,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.creator.prepared_by_detail \
- and @md.creator.prepared_by_detail.class==Array \
+ and @md.creator.prepared_by_detail.is_a?(Array) \
and @md.creator.prepared_by_detail.length > 0
txt=@md.creator.prepared_by_detail
txt=''
@@ -533,7 +533,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.creator.digitized_by_detail \
- and @md.creator.digitized_by_detail.class==Array \
+ and @md.creator.digitized_by_detail.is_a?(Array) \
and @md.creator.digitized_by_detail.length > 0
txt=@md.creator.digitized_by_detail
txt=''
@@ -561,7 +561,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.creator.audio_detail \
- and @md.creator.audio_detail.class==Array \
+ and @md.creator.audio_detail.is_a?(Array) \
and @md.creator.audio_detail.length > 0
txt=@md.creator.audio_detail
txt=''
@@ -589,7 +589,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.creator.video_detail \
- and @md.creator.video_detail.class==Array \
+ and @md.creator.video_detail.is_a?(Array) \
and @md.creator.video_detail.length > 0
txt=''
@md.creator.video_detail.each do |h|
@@ -1891,7 +1891,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.dgst \
- and @md.dgst.class==Array \
+ and @md.dgst.is_a?(Array) \
and @md.dgst[1]=~/\S+/
txt=@md.dgst[1]
["#{name}, ","'#{txt}', "]
@@ -2025,7 +2025,7 @@ module SiSU_DbColumns
end
def tuple
t=if defined? @md.dgst_skin \
- and @md.dgst_skin.class==Array \
+ and @md.dgst_skin.is_a?(Array) \
and @md.dgst_skin[1]=~/\S+/
txt=@md.dgst_skin[1]
txt=special_character_escape(txt)
diff --git a/lib/sisu/v3/db_create.rb b/lib/sisu/v3/db_create.rb
index 9fe35193..e302a94f 100644
--- a/lib/sisu/v3/db_create.rb
+++ b/lib/sisu/v3/db_create.rb
@@ -99,7 +99,7 @@ module SiSU_DbCreate
create tables metadata_and_text
data import through ruby transfer
} if @opt.cmd =~/[VM]/
- @conn.execute(%{
+ create_metadata_and_text=%{
CREATE TABLE metadata_and_text (
tid BIGINT PRIMARY KEY,
/* title */
@@ -201,8 +201,9 @@ module SiSU_DbCreate
/* types CHAR(1) NULL, */
/* writing_focus_nationality VARCHAR(100) NULL, */
);
- })
- @comment.psql.metadata_and_text if @comment
+ }
+ @conn.execute(create_metadata_and_text)
+ @comment.psql.metadata_and_text if @comment
end
def doc_objects # create doc_objects base
print %{
@@ -210,7 +211,7 @@ module SiSU_DbCreate
create tables doc_objects
data import through ruby transfer
} if @opt.cmd =~/[VM]/
- @conn.execute(%{
+ create_doc_objects=%{
CREATE TABLE doc_objects (
lid BIGINT PRIMARY KEY,
metadata_tid BIGINT REFERENCES metadata_and_text,
@@ -219,6 +220,7 @@ module SiSU_DbCreate
ocns VARCHAR(6),
clean TEXT NULL,
body TEXT NULL,
+ book_idx TEXT NULL,
seg VARCHAR(256) NULL,
lev_an VARCHAR(1),
lev SMALLINT NULL,
@@ -242,8 +244,9 @@ module SiSU_DbCreate
digest_all CHAR(#{@@dl}),
types CHAR(1) NULL
);
- })
- @comment.psql.doc_objects if @comment
+ }
+ @conn.execute(create_doc_objects)
+ @comment.psql.doc_objects if @comment
end
def endnotes
print %{
@@ -251,7 +254,7 @@ module SiSU_DbCreate
create tables endnotes
data import through ruby transfer
} if @opt.cmd =~/[VM]/
- @conn.execute(%{
+ create_endnotes=%{
CREATE TABLE endnotes (
nid BIGINT PRIMARY KEY,
document_lid BIGINT REFERENCES doc_objects,
@@ -264,8 +267,9 @@ module SiSU_DbCreate
digest_clean CHAR(#{@@dl}),
metadata_tid BIGINT REFERENCES metadata_and_text
);
- })
- @comment.psql.endnotes if @comment
+ }
+ @conn.execute(create_endnotes)
+ @comment.psql.endnotes if @comment
end
def endnotes_asterisk
print %{
@@ -273,7 +277,7 @@ module SiSU_DbCreate
create tables endnotes_asterisk
data import through ruby transfer
} if @opt.cmd =~/[VM]/
- @conn.execute(%{
+ create_endnotes_asterisk=%{
CREATE TABLE endnotes_asterisk (
nid BIGINT PRIMARY KEY,
document_lid BIGINT REFERENCES doc_objects,
@@ -286,8 +290,9 @@ module SiSU_DbCreate
digest_clean CHAR(#{@@dl}),
metadata_tid BIGINT REFERENCES metadata_and_text
);
- })
- @comment.psql.endnotes_asterisk if @comment
+ }
+ @conn.execute(create_endnotes_asterisk)
+ @comment.psql.endnotes_asterisk if @comment
end
def endnotes_plus
print %{
@@ -295,7 +300,7 @@ module SiSU_DbCreate
create tables endnotes_plus
data import through ruby transfer
} if @opt.cmd =~/[VM]/
- @conn.execute(%{
+ create_endnotes_plus=%{
CREATE TABLE endnotes_plus (
nid BIGINT PRIMARY KEY,
document_lid BIGINT REFERENCES doc_objects,
@@ -308,8 +313,9 @@ module SiSU_DbCreate
digest_clean CHAR(#{@@dl}),
metadata_tid BIGINT REFERENCES metadata_and_text
);
- })
- @comment.psql.endnotes_plus if @comment
+ }
+ @conn.execute(create_endnotes_plus)
+ @comment.psql.endnotes_plus if @comment
end
def urls # create doc_objects file links mapping
print %{
@@ -318,7 +324,7 @@ module SiSU_DbCreate
create tables urls
data import through ruby transfer
} if @opt.cmd =~/[VM]/
- @conn.execute(%{
+ create_urls=%{
CREATE TABLE urls (
metadata_tid BIGINT REFERENCES metadata_and_text,
plaintext varchar(512),
@@ -338,8 +344,9 @@ module SiSU_DbCreate
markup varchar(512),
sisupod varchar(512)
);
- })
- @comment.psql.urls if @comment
+ }
+ @conn.execute(create_urls)
+ @comment.psql.urls if @comment
end
self
end
@@ -483,6 +490,8 @@ module SiSU_DbCreate
IS 'text object - substantive text: clean, stripped of markup';},
%{COMMENT ON COLUMN doc_objects.body
IS 'text object - substantive text: light html markup';},
+ %{COMMENT ON COLUMN doc_objects.book_idx
+ IS 'book index creation information for paragraph, if provided';},
%{COMMENT ON COLUMN doc_objects.lev1
IS 'document structure, level number 1';},
%{COMMENT ON COLUMN doc_objects.lev2
diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb
index 03f5d221..ae808cf8 100644
--- a/lib/sisu/v3/db_import.rb
+++ b/lib/sisu/v3/db_import.rb
@@ -73,10 +73,12 @@ module SiSU_DbImport
@cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
@env=SiSU_Env::InfoEnv.new(@opt.fns)
@dal="#{@env.processing_path.dal}"
- if @opt.fns.empty? or @opt.cmd.empty?; @fnb=''
+ @fnb=if @opt.fns.empty? \
+ or @opt.cmd.empty?
+ ''
else
@md=SiSU_Param::Parameters.new(@opt).get
- @fnb=@md.fnb
+ @md.fnb
end
@suffix=@opt.fns[/(?:.+?)(?:\.ssm\.sst|\.-?sst)/,1]
@fnc="#{@dal}/#{@opt.fns}.content.rbm"
@@ -276,16 +278,18 @@ module SiSU_DbImport
@col[:lev],txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.ln,data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'',''
@col[:lid]+=1
txt=endnotes(txt).extract_any
- @col[:body]=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_minus
- @col[:body]=special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- @col[:plaintext]=strip_markup(@col[:plaintext])
- @col[:plaintext]=clean_searchable_text(@col[:plaintext])
- if @en[0]; @en_a,@en_z=@en[0].first,@en[0].last
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_minus
+ @col[:body]=special_character_escape(body)
+ plaintext=@col[:body].dup
+ plaintext=strip_markup(plaintext)
+ @col[:plaintext]=clean_searchable_text(plaintext)
+ book_idx=data.idx ? data.idx : ''
+ @col[:book_idx]=clean_searchable_text(book_idx)
+ if @en[0] then @en_a,@en_z=@en[0].first,@en[0].last
end
- if @en_ast[0]; @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last
+ if @en_ast[0] then @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last
end
- if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last
+ if @en_pls[0] then @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last
end
t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
@tuple_array << t.tuple
@@ -310,11 +314,13 @@ module SiSU_DbImport
@env=SiSU_Env::InfoEnv.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
txt=endnotes(txt).extract_any
- @col[:body]=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
- @col[:body]=special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- @col[:plaintext]=strip_markup(@col[:plaintext])
- @col[:plaintext]=clean_searchable_text(@col[:plaintext])
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
+ @col[:body]=special_character_escape(body)
+ plaintext=@col[:body].dup
+ plaintext=strip_markup(plaintext)
+ @col[:plaintext]=clean_searchable_text(plaintext)
+ book_idx=data.idx ? data.idx : ''
+ @col[:book_idx]=clean_searchable_text(book_idx)
@en_a,@en_z=@en[0].first,@en[0].last if @en[0]
@en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
@en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
@@ -340,11 +346,13 @@ module SiSU_DbImport
@env=SiSU_Env::InfoEnv.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
txt=endnotes(txt).extract_any
- @col[:body]=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
- @col[:body]=special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- @col[:plaintext]=strip_markup(@col[:plaintext])
- @col[:plaintext]=clean_searchable_text(@col[:plaintext])
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
+ @col[:body]=special_character_escape(body)
+ plaintext=@col[:body].dup
+ plaintext=strip_markup(plaintext)
+ @col[:plaintext]=clean_searchable_text(plaintext)
+ book_idx=data.idx ? data.idx : ''
+ @col[:book_idx]=clean_searchable_text(book_idx)
@en_a,@en_z=@en[0].first,@en[0].last if @en[0]
@en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
@en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
@@ -368,11 +376,13 @@ module SiSU_DbImport
@env=SiSU_Env::InfoEnv.new(@md.fns)
@base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"
txt=endnotes(txt).extract_any
- @col[:body]=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
- @col[:body]=special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- @col[:plaintext]=strip_markup(@col[:plaintext])
- @col[:plaintext]=clean_searchable_text(@col[:plaintext])
+ body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus
+ @col[:body]=special_character_escape(body)
+ plaintext=@col[:body].dup
+ plaintext=strip_markup(plaintext)
+ @col[:plaintext]=clean_searchable_text(plaintext)
+ book_idx=data.idx ? data.idx : ''
+ @col[:book_idx]=clean_searchable_text(book_idx)
@en_a,@en_z=@en[0].first,@en[0].last if @en[0]
@en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
@en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
@@ -408,7 +418,7 @@ module SiSU_DbImport
@en_a,@en_z=@en[0].first,@en[0].last if @en[0]
@en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0]
@en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0]
- @col[:body]=if data.is==:table
+ body=if data.is==:table
SiSU_FormatShared::CSS_Format.new(@md,data).html_table
elsif data.is==:code
SiSU_FormatShared::CSS_Format.new(@md,data).code
@@ -425,10 +435,12 @@ module SiSU_DbImport
else
SiSU_FormatShared::CSS_Format.new(@md,data).norm
end
- @col[:body]=special_character_escape(@col[:body])
- @col[:plaintext]=@col[:body].dup
- @col[:plaintext]=strip_markup(@col[:plaintext])
- @col[:plaintext]=clean_searchable_text(@col[:plaintext])
+ @col[:body]=special_character_escape(body)
+ plaintext=@col[:body].dup
+ plaintext=strip_markup(plaintext)
+ @col[:plaintext]=clean_searchable_text(plaintext)
+ book_idx=data.idx ? data.idx : ''
+ @col[:book_idx]=clean_searchable_text(book_idx)
t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint)
@tuple_array << t.tuple
@en,@en_ast,@en_pls=[],[],[]
diff --git a/lib/sisu/v3/db_load_tuple.rb b/lib/sisu/v3/db_load_tuple.rb
index 39ea9022..f55ce66c 100644
--- a/lib/sisu/v3/db_load_tuple.rb
+++ b/lib/sisu/v3/db_load_tuple.rb
@@ -78,11 +78,11 @@ module SiSU_DbTuple
end
def tuple #% import line
sql_entry=if @col[:en_a]
- "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, t_of, t_is, node, parent, digest_clean, digest_all) " +
- "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
+ "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, t_of, t_is, node, parent, digest_clean, digest_all) " +
+ "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
else
- "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, t_of, t_is, node, parent, digest_clean, digest_all) " +
- "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
+ "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, t_of, t_is, node, parent, digest_clean, digest_all) " +
+ "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"
end
if @opt.cmd =~/M/
if @opt.cmd =~/V/
diff --git a/lib/sisu/v3/db_remove.rb b/lib/sisu/v3/db_remove.rb
index 6d481cb4..3371a9be 100644
--- a/lib/sisu/v3/db_remove.rb
+++ b/lib/sisu/v3/db_remove.rb
@@ -71,19 +71,21 @@ module SiSU_DbRemove
: false
end
del_id=if driver_sqlite3
- @conn.get_first_value(%{
+ remove_selected=%{
SELECT tid
FROM metadata_and_text
WHERE src_filename = '#{@opt.fns}'
AND metadata_and_text.language_document_char = '#{@opt.lng}'
- ;}).to_i
+ ;}
+ @conn.get_first_value(remove_selected).to_i
else
- x=@conn.select_one(%{
+ remove_selected=%{
SELECT metadata_and_text.tid
FROM metadata_and_text
WHERE metadata_and_text.src_filename = '#{@opt.fns}'
AND metadata_and_text.language_document_char = '#{@opt.lng}'
- ;})
+ ;}
+ x=@conn.select_one(remove_selected)
x ? (x.join.to_i) : nil
end
if del_id
diff --git a/lib/sisu/v3/db_select.rb b/lib/sisu/v3/db_select.rb
index 932bc551..a013c00b 100644
--- a/lib/sisu/v3/db_select.rb
+++ b/lib/sisu/v3/db_select.rb
@@ -78,7 +78,7 @@ module SiSU_DbSelect
puts %{no connection with #{@sql_type} database established, createdb "#{@db.sqlite.db}"?}
exit
end
- if @conn.class==NilClass
+ if @conn.is_a?(NilClass)
db=@sql_type=='sqlite' \
? @db.sqlite.db
: @db.psql.db
@@ -94,7 +94,9 @@ module SiSU_DbSelect
@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+')
- elsif @opt.fns and @opt.fns.inspect =~/create/; nil #sort variations later
+ elsif @opt.fns \
+ and @opt.fns.inspect =~/create/
+ nil #sort variations later
else nil
end
else nil
@@ -181,14 +183,13 @@ module SiSU_DbSelect
else '???'
end
tell.puts_grey if @opt.cmd =~/v/
- when /^--update$/
when /^--remove$/
db_exist?
@sdb_remove_doc.remove
when /^--index$/
db_exist?
@sdb_index.create_indexes
- when /^droptable(s)?$/
+ when /^--droptable(s)?$/
db_exist?
@sdb_no.drop.tables
when /^--dropindex(es)?$/
@@ -209,6 +210,10 @@ module SiSU_DbSelect
puts @job
end
end
+ if @opt.act[:psql][:set]==:on \
+ and @opt.mod.inspect !~/--(?:createdb|init(?:ialize)?|create(?:all)?|createtables?|recreate|cr(eate)?lex|cr(eate)?metadata|import|update|remove|index|droptable(s)?|dropindex(es)?|dropall|drop)/
+ SiSU_Screen::Ansi.new(@opt.cmd,"--pg requires further instruction").warn unless @opt.cmd =~/[q]/
+ end
begin
rescue; @sdb.output_dir?
end
diff --git a/lib/sisu/v3/db_sqltxt.rb b/lib/sisu/v3/db_sqltxt.rb
index f6651724..53c15ed3 100644
--- a/lib/sisu/v3/db_sqltxt.rb
+++ b/lib/sisu/v3/db_sqltxt.rb
@@ -68,7 +68,7 @@ module SiSU_DbText
end
def clean_searchable_text(arr) #produce clean, searchable, plaintext from document source
txt_arr,en=[],[]
- arr=arr.class==String ? arr.split(/\n+/m) : arr
+ arr=(arr.is_a?(String)) ? arr.split(/\n+/m) : arr
arr.each do |s|
s=s.gsub(/([*\/_-])\{(.+?)\}\1/m,'\2').
gsub(/^(?:block|group|poem|code)\{/m,'').gsub(/^\}(?:block|group|poem|code)/m,'').
diff --git a/lib/sisu/v3/dbi.rb b/lib/sisu/v3/dbi.rb
index 535ab0f2..cd44b808 100644
--- a/lib/sisu/v3/dbi.rb
+++ b/lib/sisu/v3/dbi.rb
@@ -107,8 +107,6 @@ module SiSU_DBI
puts %{manually create the database: "#{@db.db}" if it does not yet exist}
#sudo su -p postgres; createdb #{@db.db}; #[createuser?]
end
- SiSU_DbDBI::Case.new(@opt,@conn,@sql_type).cases
- @conn=DBI.connect(@db.dbi,@db.user,@db.db)
ensure
end
end
diff --git a/lib/sisu/v3/dbi_discreet.rb b/lib/sisu/v3/dbi_discreet.rb
index 49313a93..07814a1a 100644
--- a/lib/sisu/v3/dbi_discreet.rb
+++ b/lib/sisu/v3/dbi_discreet.rb
@@ -106,7 +106,7 @@ module SiSU_DBI_Discreet #% database building
puts msg
exit
end
- if conn.class==NilClass
+ if conn.is_a?(NilClass)
puts msg
exit
end
@@ -168,7 +168,9 @@ module SiSU_DBI_Discreet #% database building
@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+')
- elsif @opt.fns and @opt.fns.inspect =~/create/; nil #sort variations later
+ elsif @opt.fns \
+ and @opt.fns.inspect =~/create/
+ nil #sort variations later
else nil
end
else nil
diff --git a/lib/sisu/v3/defaults.rb b/lib/sisu/v3/defaults.rb
index 0c45ecdd..0b1c4d6c 100644
--- a/lib/sisu/v3/defaults.rb
+++ b/lib/sisu/v3/defaults.rb
@@ -77,78 +77,6 @@ module SiSU_Viz
def html_hardspace
'&nbsp;'
end
- #% php
- def php_persist
- end
- #% javascript #kxjs knxjs
- def js_home
- end
- def js_infobox
- end
- def js_knxjs
- end
- def js_head
- end
- def js_top
- end
- def js_sisu
- end
- def js_home
- end
- def js_sponsor
- end
- def js_books
- end
- def js_journals
- end
- def js_conferences
- end
- def js_services
- end
- def js_catalogue
- end
- def js_doc
- end
- def js_toc
- end
- def js_seg
- end
- def js_mail
- end
- def js_manifest
- end
- def js_status
- end
- def js_next
- end
- def js_prev
- end
- def js_plaintext
- end
- def js_portrait
- end
- def js_landscape
- end
- def js_pdf
- end
- def js_epub
- end
- def js_odf
- end
- def js_concordance
- end
- def js_instruments
- end
- def js_external
- end
- def js_gopher
- end
- def js_ftp
- end
- def js_law
- end
- def js_disclaimer
- end
def semantic_tags
def default
{
@@ -738,9 +666,9 @@ module SiSU_Viz
gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
m='\b(' + r + ')\b'
make[:str]
- make[:regx]=if x =~/i/; /#{m}/i
- else /#{m}/
- end
+ make[:regx]=(x =~/i/) \
+ ? (/#{m}/i)
+ : (/#{m}/)
else nil
end
end
@@ -759,9 +687,9 @@ module SiSU_Viz
gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided
m='\b(' + r + ')\b'
make[:str]
- make[:regx]=if x =~/i/; /#{m}/i
- else /#{m}/
- end
+ make[:regx]=(x =~/i/) \
+ ? (/#{m}/i)
+ : (/#{m}/)
else nil
end
make
@@ -783,8 +711,6 @@ module SiSU_Viz
def paragraph_table
%{<p align="left"><font #{font_small} #{font_color} #{font_face}>}
end
- def paragraph_table_xml
- end
def paragraph_tiny
%{<p class="tiny">}
end
@@ -1187,7 +1113,7 @@ module SiSU_Viz
#% banner
def banner_home
%{ <center>
- <a href="#{url_site}/" target="_top" #{js_home}>
+ <a href="#{url_site}/" target="_top">
#{png_site}
</a>
<br />
@@ -1202,23 +1128,23 @@ module SiSU_Viz
end
def banner_home_guide
%{ <br />
- <a href="#{url_site}/" target="_top" #{js_home}>
+ <a href="#{url_site}/" target="_top">
#{png_doc} LM toc
</a>
- <a href="../treaties.and.organisations/lm.chronological" target="_top" #{js_instruments}>
+ <a href="../treaties.and.organisations/lm.chronological" target="_top">
#{png_doc} LM 20**
</a>
<br />}
end
def banner_home_button_only
- %{<a href="#{url_site}/" #{js_home}>
+ %{<a href="#{url_site}/">
#{png_home_button}
</a>}
end
def banner_home_button #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}" width="10%">
- <a href="#{url_site}/" #{js_home}>
+ <a href="#{url_site}/">
#{png_home_button}
</a>
</td>
@@ -1230,7 +1156,7 @@ module SiSU_Viz
<tr><td width="20%">
<table summary="home button" width="100%" border="0" cellpadding="3" align="center">
<tr><td align="center" valign="middle" bgcolor="#{color_white}">
- <a href="#{url_site}/" target="_top" #{js_home}>
+ <a href="#{url_site}/" target="_top">
#{png_home}
</a>
</td></tr>
@@ -1240,7 +1166,7 @@ module SiSU_Viz
<table summary="other contents buttons" border="0" cellpadding="3" cellspacing="0">
<tr><td align="center" bgcolor=#{color_band2}>
<font face="arial" size="2">
- <a href="toc" target="_top" #{js_toc}>
+ <a href="toc" target="_top">
&nbsp;This&nbsp;text's&nbsp;sub-&nbsp;
<br />
&nbsp;Table&nbsp;of&nbsp;Contents&nbsp;
@@ -1254,12 +1180,12 @@ module SiSU_Viz
#{table_close}}
end
def banner_url_txt_sisu
- %{<a href="#{url_sisu}/sisu" target="_top" #{js_home}>SiSU</a>}
+ %{<a href="#{url_sisu}/sisu" target="_top">SiSU</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" #{js_home}>
+ <a href="#{url_site}/" target="_top">
#{png_home}
</a>
</td>
@@ -1541,7 +1467,7 @@ WOK
<<WOK
<p class="tiny"><font color="#666666" size="2">
Output generated by
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
#{@v[:project]}
</a>
#{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]})
@@ -1562,7 +1488,7 @@ WOK
<!-- widget sisu -->
<tr><td valign="top" width="10%">
<p class="tiny_left"><font color="#666666" size="2">
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
<img border="0" src="../_sisu/image/sisu.png" alt="SiSU" width="120" height="39" />
</a>
</font></p>
@@ -1570,33 +1496,33 @@ WOK
<!-- SiSU Rights -->
<p class="tiny_left"><font color="#666666" size="2">
Output generated by
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
#{@v[:project]}
</a>
#{@v[:version]} #{@v[:date]} (#{@v[:date_stamp]})
<br />
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
<b>#{@v[:project]}</b>
</a>
Copyright <sup>&copy;</sup> Ralph Amissah
1997, current #{@date.year_static}.
All Rights Reserved.
<br />
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
#{@v[:project]}
</a>
is software for document structuring, publishing and search,
<br />
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
www.sisudoc.org/
</a>
and
- <a href="#{url_sisudoc}" #{js_sisu}>
+ <a href="#{url_sisudoc}">
www.sisudoc.org
</a>
<br />
<i>w3 since October 3 1993</i>
- <a href="mailto:ralph@amissah.com" #{js_mail}>
+ <a href="mailto:ralph@amissah.com">
ralph@amissah.com
</a>
</font></p>
@@ -1624,7 +1550,7 @@ WOK
</font></p>
</td><td valign="top" width="45%">
<p class="tiny_left"><font color="#666666" size="2">
- <a href="#{url_sisu}" #{js_sisu}>
+ <a href="#{url_sisu}">
#{@v[:project]}
</a>
is released under
diff --git a/lib/sisu/v3/digests.rb b/lib/sisu/v3/digests.rb
index 5ffabb58..129b6b10 100644
--- a/lib/sisu/v3/digests.rb
+++ b/lib/sisu/v3/digests.rb
@@ -208,9 +208,9 @@ module SiSU_DigestView
if image_source
para_image = image_source + '/' + i
@image_name << i
- @image_dgst << if @dg =~/^sha(?:2|256)$/; sys.sha256(para_image)
- else sys.md5(para_image)
- end
+ @image_dgst << (@dg =~/^sha(?:2|256)$/) \
+ ? sys.sha256(para_image)
+ : sys.md5(para_image)
else
@image_name << ' '*16 + i + ' [image missing]'
@image_dgst << ''
diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb
index 06021574..a4dce6ab 100644
--- a/lib/sisu/v3/epub.rb
+++ b/lib/sisu/v3/epub.rb
@@ -142,7 +142,6 @@ module SiSU_EPUB
def tuned_file_instructions
@tell=SiSU_Screen::Ansi.new(@md.opt.cmd)
@md.opt.cmd=@md.opt.cmd.gsub(/H/,'h')
- @md.file_type='html' if @md.opt.cmd =~/[hon]/
directories
dal_array=@particulars.dal_array # dal file drawn here
@tuned_file_array=SiSU_EPUB_Tune::Tune.new(dal_array,@md).songsheet
@@ -336,7 +335,8 @@ module SiSU_EPUB
and link !~/#/ #% keep eye on link
p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,link)
end
- title=if dob.obj !~/Document Information/; linkname
+ title=if dob.obj !~/Document Information/
+ linkname
else
link='metadata'
%{<b><a href="#{link}#{Sfx[:epub_xhtml]}">#{linkname}</a></b>}
@@ -357,9 +357,9 @@ module SiSU_EPUB
end
else
@@toc[:scr] << '<br />'
- link=if dob.ln; dob.ln
- else ''
- end
+ link=(dob.ln) \
+ ? dob.ln
+ : ''
%{<b><a href="##{link}">#{linkname}</a></b>}
end
txt_obj={ txt: title }
@@ -489,10 +489,6 @@ module SiSU_EPUB
dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge
toc_shared << dochead #<< ads.div.major
segtoc << format_head_toc.head #<< ads.div.major
- if SiSU_EPUB_Format::HeadToc.method_defined? :toc_head_escript
- toc_shared << format_head_toc.toc_head_escript
- segtoc << format_head_toc.toc_head_escript
- end
if defined? @md.rights.all \
and @md.rights.all
rights=format_head_toc.rights.all
@@ -503,8 +499,6 @@ module SiSU_EPUB
prefix_b=format_head_toc.prefix_b
prefix_b=SiSU_EPUB_Tune::CleanXHTML.new(prefix_b).clean
end
- seg_toc_band=format_head_toc.seg_head_navigation_band
- seg_toc_band_bottom=format_head_toc.seg_head_navigation_band_bottom
tmp_head=nil
doc_title_endnote=@md.title.full.gsub(/(\*+)/,'<sup><a href="#endnotes">\1</a></sup>')
tmp_head=doc_title_endnote + "\n"
@@ -521,7 +515,6 @@ module SiSU_EPUB
toc_shared << format_txt_obj.center_bold
segtoc << format_txt_obj.center_bold
end
- segtoc << seg_toc_band
tmp_head=nil
if defined? @md.prefix_a \
and @md.prefix_a
@@ -552,7 +545,6 @@ module SiSU_EPUB
segtoc << prefix_b
end
#Segtoc tail added here
- segtoc << seg_toc_band_bottom
segtoc << format_head_toc.xhtml_close
segtoc=segtoc.flatten.compact #watch
SiSU_EPUB::Source::Output.new(@md,segtoc).segtoc
@@ -666,14 +658,14 @@ module SiSU_EPUB
def segtoc
begin
if @make.build.toc?
- filename_html_index=@make_file.epub.xhtml_index
+ filename_xhtml=@make_file.epub.xhtml_index
@output.each do |para|
para=para.strip
unless para =~/\A\s*\Z/
- filename_html_index.puts para,"\n"
+ filename_xhtml.puts para,"\n"
end
end
- filename_html_index.close
+ filename_xhtml.close
end
rescue
SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error do
diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb
index df975a48..b8db317d 100644
--- a/lib/sisu/v3/epub_concordance.rb
+++ b/lib/sisu/v3/epub_concordance.rb
@@ -105,7 +105,7 @@ module SiSU_EPUB_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="../_sisu/image/sisu.png" alt="SiSU home --&gt;"></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">&nbsp;</td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.epub}" #{@vz.js_toc}><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table>
+<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">&nbsp;</td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.epub}"><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table>
WOK
end
def create
@@ -219,7 +219,7 @@ WOK
&& line.ln==4
@seg=line.name
end
- if line.ocn.to_s =~/\d+/; toy=line.ocn.to_s
+ if line.ocn.to_s =~/\d+/ then toy=line.ocn.to_s
end
if toy =~/\d+/ \
and toy !~/^0$/
diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb
index c08ae492..70636fb1 100644
--- a/lib/sisu/v3/epub_format.rb
+++ b/lib/sisu/v3/epub_format.rb
@@ -1233,7 +1233,7 @@ WOK
end
def doc_type_xhtml
<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -1277,7 +1277,7 @@ WOK
#simple, make sure full-path of rootfile points to metadata.opf
#epub_metadata.opf content.opf
<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version='1.0' encoding='utf-8'?>
<container version="1.0"
xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
@@ -1298,7 +1298,7 @@ WOK
#{dob.obj} -
#{@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' />
#{@css.xhtml_epub}
</head>
#{@vz.color_body}
@@ -1435,7 +1435,7 @@ WOK
end
def package_open
<<WOK
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version='1.0' encoding='utf-8'?>
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="EPB-UUID" version="2.0">
WOK
end
@@ -1658,25 +1658,10 @@ WOK
end
self
end
- def toc_head_escript
- end
- def seg_head_escript
- end
def table_close
%{ </font>
#{@vz.table_close}}
end
- def buttons_home
- %{<!- home and index buttons -!>
- #{@vz.banner_home_and_index_buttons}
-<!- home and index buttons -!>}
- end
- def copyat
- %{<p class="tiny">copy @
- <a href="#{@vz.url_home}" #{@vz.js_home}>
- #{@vz.txt_home}
- </a></p>}
- end
def xhtml_close
%{#{@vz.credits_sisu_epub}
</body>
@@ -1689,28 +1674,12 @@ WOK
@md=md
@tocband_segtoc=make_seg
end
- def seg_head_navigation_band
- firstseg=%{<a href="#{@md.firstseg}#{Sfx[:epub_xhtml]}" target="_top">
- #{@vz.epub_png_nav_nxt}
- </a>} if @md.firstseg =~/\S+/
- DISABLE[:epub][:internal_navigation] \
- ? ''
- : %{<p class="align_right">#{firstseg}</p>}
- end
- def seg_head_navigation_band_bottom
- firstseg=%{<a href="#{@md.firstseg}#{Sfx[:epub_xhtml]}" target="_top">
- #{@vz.epub_png_nav_nxt}
- </a>} if @md.firstseg =~/\S+/
- DISABLE[:epub][:internal_navigation] \
- ? ''
- : %{<p class="align_right">#{firstseg}</p>}
- end
def manifest_link(text)
- %{ <a href="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" target="_top" #{@vz.js_manifest}>#{text}</a>}
+ %{ <a href="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" target="_top">#{text}</a>}
end
def concordance_link(text)
if @md.concord_make
- %{<a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}>
+ %{<a href="#{@md.file.base_filename.html_concordance}" target="_top">
#{text}
</a>}
else ''
@@ -1719,17 +1688,16 @@ WOK
def head
%{#{doc_type}
<head>
-<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
#{@css.xhtml_epub}
</head>
-#{@vz.color_body}
-#{@vz.js_top}}
+#{@vz.color_body}}
end
def concordance
if @md.concord_make
%{#{@vz.margin_css}
<h4 class="toc">
- <a href="./#{@md.file.base_filename.html_concordance}" #{@vz.js_concordance}>
+ <a href="./#{@md.file.base_filename.html_concordance}">
<i>Concordance</i>
</a>
</h4>
@@ -1740,9 +1708,9 @@ WOK
end
end
def links_guide_open(type='horizontal')
- if type=='vertical'; links_guide_vertical_open
- else links_guide_horizontal_open
- end
+ (type=='vertical') \
+ ? links_guide_vertical_open
+ : links_guide_horizontal_open
end
def prefix_a
end
@@ -1787,7 +1755,7 @@ WOK
def metadata
%{#{@vz.margin_css}
<h4 class="toc">
- <a href="#{@metalink}" #{@vz.js_metalink}>
+ <a href="#{@metalink}">
<i>MetaData</i>
</a>
</h4>
@@ -1805,7 +1773,7 @@ WOK
#{@seg_name_xhtml[@seg_name_xhtml_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' />
#{@css.xhtml_epub}
</head>
#{@vz.color_body}}
@@ -1838,7 +1806,7 @@ WOK
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
- if t_o.class==Hash
+ if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
@ocn =t_o[:ocn] || nil
@ocn_display =t_o[:ocn_display] || nil
@@ -1853,12 +1821,12 @@ WOK
if @format and not @format.empty?
if @format=~/^\d:(\S+)/ #need more reliable marker #if @format =~ /#{Rx[:lv]}/
headname=$1 #format[/\d~(\S+)/m,1]
- @headname=if headname =~/^[a-zA-Z]/; %{<id="#{headname}">} #consider: h_#{headname}
- else %{<id="h#{headname}"></a>}
- end
- @headname=if headname =~/^[a-zA-Z]/; %{<a name="#{headname}" id="#{headname}"></a>} #consider: h_#{headname}
- else %{<a name="h#{headname}" id="h#{headname}"></a>}
- end
+ @headname=(headname =~/^[a-zA-Z]/) \
+ ? %{<id="#{headname}">}
+ : %{<id="h#{headname}"></a>}
+ @headname=(headname =~/^[a-zA-Z]/) \
+ ? %{<a name="#{headname}" id="#{headname}"></a>}
+ : %{<a name="h#{headname}" id="h#{headname}"></a>}
end
end
elsif t_o.class.inspect =~/Object/
diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb
index 57e6580b..5a3f3092 100644
--- a/lib/sisu/v3/epub_segments.rb
+++ b/lib/sisu/v3/epub_segments.rb
@@ -271,9 +271,9 @@ WOK
@@get_hash_to=dob.name
@@get_hash_fn=dob.name
end
- if dob.obj.class==String
+ if dob.obj.is_a?(String)
markup(dob)
- elsif dob.obj.class==Array
+ elsif dob.obj.is_a?(Array)
dob.obj.each do |pg|
markup(pg)
end
@@ -298,9 +298,9 @@ WOK
and @md.creator.author
@author=%{<b>#{@md.creator.author}</b>\n}
end
- ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
+ ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
@p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display }
format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@@ -309,9 +309,9 @@ WOK
end
if @@is2==1
heading2=@@heading2
- ocn=if heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
+ ocn=(heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
@p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display }
format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@@ -320,9 +320,9 @@ WOK
end
if @@is3==1
heading3=@@heading3
- ocn=if heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
+ ocn=(heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
@p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display }
format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@@ -331,9 +331,9 @@ WOK
end
if @@is4==1
heading4=@@heading4
- ocn=if heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
+ ocn=(heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
@p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display }
format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)
@@ -359,7 +359,8 @@ WOK
sto.seg_heading4 # work on see SplitTextObject
elsif dob.ln==5
sto.seg_heading5
- elsif dob.ln==6; sto.seg_heading6
+ elsif dob.ln==6
+ sto.seg_heading6
end
elsif dob.is==:para
if dob.indent \
diff --git a/lib/sisu/v3/epub_tune.rb b/lib/sisu/v3/epub_tune.rb
index 3a5669c6..1362815e 100644
--- a/lib/sisu/v3/epub_tune.rb
+++ b/lib/sisu/v3/epub_tune.rb
@@ -96,7 +96,7 @@ module SiSU_EPUB_Tune
end
def clean
html=@html
- str=if html.class==String
+ str=if html.is_a?(String)
html
else html.obj
end
@@ -238,7 +238,7 @@ module SiSU_EPUB_Tune
gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'').
- gsub(/^#{Mx[:gl_bullet]}/m,'●&nbsp;&nbsp;').
+ gsub(/#{Mx[:gl_bullet]}/m,'●&nbsp;&nbsp;').
gsub(/#{Mx[:nbsp]}/,'&nbsp;').
gsub(/<(p|br)>/,'<\1 />')
dob.obj=SiSU_EPUB_Tune::CleanXHTML.new(dob.obj).clean
diff --git a/lib/sisu/v3/harvest_authors.rb b/lib/sisu/v3/harvest_authors.rb
index 6036816d..1846584a 100644
--- a/lib/sisu/v3/harvest_authors.rb
+++ b/lib/sisu/v3/harvest_authors.rb
@@ -117,7 +117,7 @@ module SiSU_HarvestAuthors
if para=~ rgx[:date]
@date=rgx[:date].match(para)[1]
end
- break if @title and @subtitle and @author and @date
+ break if @title && @subtitle && @author && @date
end
@fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title
if @title \
@@ -157,7 +157,7 @@ module SiSU_HarvestAuthors
idx_array.each do |idx|
idx[:author][:last_first_format_a].each do |author|
author=author.strip
- if @@the_idx_authors[lang][author].class==NilClass
+ if @@the_idx_authors[lang][author].is_a?(NilClass)
@@the_idx_authors[lang][author]={ md: [] }
end
@@the_idx_authors[lang][author][:md] << { filename: idx[:filename], file: idx[:file], author: idx[:author], title: idx[:title], date: idx[:date], page: idx[:page], lang: idx[:lang] }
@@ -201,7 +201,7 @@ module SiSU_HarvestAuthors
def html_file_close
@the_idx.keys.each do |lng|
@output[lng][:html].close
- @output[lng][:html_mnt].close if @output[lng][:html_mnt].class==File
+ @output[lng][:html_mnt].close if @output[lng][:html_mnt].is_a?(File)
end
end
def html_print
@@ -305,12 +305,12 @@ WOK
</html>
WOK
@the_idx.keys.each do |lng|
- @output[lng][:html_mnt] << a if @output[lng][:html_mnt].class==File
+ @output[lng][:html_mnt] << a if @output[lng][:html_mnt].is_a?(File)
@output[lng][:html] << a
end
end
def do_html(lng,html)
- @output[lng][:html_mnt] << html if @output[lng][:html_mnt].class==File
+ @output[lng][:html_mnt] << html if @output[lng][:html_mnt].is_a?(File)
@output[lng][:html] << html
end
def do_string_name(lng,attrib,string)
@@ -324,7 +324,7 @@ WOK
while @letter < f
if @alph.length > 0
@letter=@alph.shift
- if @output[lng][:html_mnt].class==File
+ if @output[lng][:html_mnt].is_a?(File)
@output[lng][:html_mnt] << %{\n<p class="letter"><a name="#{@letter}"></p>#{@letter}</a><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
end
@output[lng][:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
@@ -340,7 +340,7 @@ WOK
do_string_name(lng,'',a)
name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_')
x = %{<p class="author"><a name="#{name}">#{a[0]}</a></p>}
- if @output[lng][:html_mnt].class==File
+ if @output[lng][:html_mnt].is_a?(File)
@output[lng][:html_mnt] << x
end
@output[lng][:html] << x
@@ -354,15 +354,16 @@ WOK
x[:file] + '.' + lng + '.html'
elsif @env.output_dir_structure.by? == :filename
"../#{x[:file]}/#{x[:page]}"
+ else '' #error
end
work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="#{manifest_at}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ]
- works<<=(@output[lng][:html_mnt].class==File) \
+ works<<=(@output[lng][:html_mnt].is_a?(File)) \
? (work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>]&nbsp;&nbsp;#{x[:date]} <a href="file://#{manifest_at}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}]))
: work
end
works.sort_by {|x| x[0]}.each do |x|
@output[lng][:html] << x[1]
- @output[lng][:html_mnt] << x[2] if @output[lng][:html_mnt].class==File
+ @output[lng][:html_mnt] << x[2] if @output[lng][:html_mnt].is_a?(File)
end
end
end
diff --git a/lib/sisu/v3/harvest_topics.rb b/lib/sisu/v3/harvest_topics.rb
index 3487ab6b..762f4be0 100644
--- a/lib/sisu/v3/harvest_topics.rb
+++ b/lib/sisu/v3/harvest_topics.rb
@@ -104,10 +104,10 @@ module SiSU_HarvestTopics
rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
rgx[:title]=/^@title:[ ]+(.+)/
rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m
- rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)\n/m
+ rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)(?:\n\n|\n\s+:\S|\n%)/m
data.each do |para|
if para=~ rgx[:idx]
- @idx_list=rgx[:idx].match(para)[1]
+ @idx_list=(rgx[:idx].match(para)[1]).split(/\s*\n\s*/).join
end
if para=~ rgx[:title]
@title=rgx[:title].match(para)[1]
@@ -118,7 +118,7 @@ module SiSU_HarvestTopics
if para=~ rgx[:author]
@author_format=rgx[:author].match(para)[1]
end
- break if @title and @subtitle and @author and @idx_lst
+ break if @title && @subtitle && @author && @idx_lst
end
@fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title
if @title \
@@ -233,8 +233,8 @@ module SiSU_HarvestTopics
end
@idx_a.each do |c|
if c.length > 1 \
- and c.class == Array
- if c[2].class == Hash
+ and c.is_a?(Array)
+ if c[2].is_a?(Hash)
c[1].each do |alt|
v=key_create(c,alt)
@the_a << [v, c[2]] if v
@@ -242,8 +242,8 @@ module SiSU_HarvestTopics
end
end
if c.length > 2 \
- and c.class == Array
- if c[3].class == Hash
+ and c.is_a?(Array)
+ if c[3].is_a?(Hash)
c[2].each do |alt|
v=key_create(c,alt)
@the_a << [v, c[3]] if v
@@ -251,8 +251,8 @@ module SiSU_HarvestTopics
end
end
if c.length > 3 \
- and c.class == Array
- if c[4].class == Hash
+ and c.is_a?(Array)
+ if c[4].is_a?(Hash)
c[3].each do |alt|
v=key_create(c,alt)
@the_a << [v, c[4]] if v
@@ -260,8 +260,8 @@ module SiSU_HarvestTopics
end
end
if c.length > 4 \
- and c.class == Array
- if c[5].class == Hash
+ and c.is_a?(Array)
+ if c[5].is_a?(Hash)
c[4].each do |alt|
v=key_create(c,alt)
@the_a << [v, c[5]] if v
@@ -269,8 +269,8 @@ module SiSU_HarvestTopics
end
end
if c.length > 5 \
- and c.class == Array
- if c[6].class == Hash
+ and c.is_a?(Array)
+ if c[6].is_a?(Hash)
c[5].each do |alt|
v=key_create(c,alt)
@the_a << [v, c[6]] if v
@@ -278,8 +278,7 @@ module SiSU_HarvestTopics
end
end
end
- y=@the_a.sort_by { |x| x[0] }
- #y.each {|z| puts z}
+ y=@the_a.sort_by { |x| x[0] } #; y.each {|z| puts z}
end
def construct_book_topic_hash(y)
@the_h={}
@@ -325,7 +324,7 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2] ||={}
end
- #puts ' '*2 + x2
+ #puts ' '*2 + x2
if extract >= 3
y.each_pair do |x3,y|
if extract == 3
@@ -334,7 +333,7 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2][x3] ||={}
end
- #puts ' '*3 + x3
+ #puts ' '*3 + x3
if extract == 4
y.each_pair do |x4,y|
if extract == 4
@@ -343,14 +342,14 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2][x3][x4] ||={}
end
- #puts ' '*4 + x4
+ #puts ' '*4 + x4
if extract == 5
y.each_pair do |x5,y|
if extract == 5
@the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] }
@the_h[x0][x1][x2][x3][x4][x5][:md] << y
end
- #puts ' '*5 + x5
+ #puts ' '*5 + x5
end
end
end
@@ -369,22 +368,22 @@ module SiSU_HarvestTopics
end
def traverse_base
@the_h.each_pair do |x0,y|
- puts ' '*0 + x0 if x0.class == String
- if y.class == Hash
+ puts ' '*0 + x0 if x0.is_a?(String)
+ if y.is_a?(Hash)
y.each_pair do |x1,y|
- puts ' '*1 + x1 if x1.class == String
- if y.class == Hash
+ puts ' '*1 + x1 if x1.is_a?(String)
+ if y.is_a?(Hash)
y.each_pair do |x2,y|
- puts ' '*2 + x2 if x2.class == String
- if y.class == Hash
+ puts ' '*2 + x2 if x2.is_a?(String)
+ if y.is_a?(Hash)
y.each_pair do |x3,y|
- puts ' '*3 + x3 if x3.class == String
- if y.class == Hash
+ puts ' '*3 + x3 if x3.is_a?(String)
+ if y.is_a?(Hash)
y.each_pair do |x4,y|
- puts ' '*4 + x4 if x4.class == String
- if y.class == Hash
+ puts ' '*4 + x4 if x4.is_a?(String)
+ if y.is_a?(Hash)
y.each_pair do |x5,y|
- puts ' '*5 + x5 if x5.class == String
+ puts ' '*5 + x5 if x5.is_a?(String)
end
end
end
@@ -399,37 +398,37 @@ module SiSU_HarvestTopics
end
def traverse
@the_h.each_pair do |x0,y|
- puts ' '*0 + x0 if x0.class == String
- if y.class == Hash
+ puts ' '*0 + x0 if x0.is_a?(String)
+ if y.is_a?(Hash)
if y.has_key?(:md)
y[:md].each { |x| puts ' '*5 + x[:title] }
end
y.each_pair do |x1,y|
- puts ' '*1 + x1 if x1.class == String
- if y.class == Hash
+ puts ' '*1 + x1 if x1.is_a?(String)
+ if y.is_a?(Hash)
if y.has_key?(:md)
y[:md].each { |x| puts ' '*5 + x[:title] }
end
y.each_pair do |x2,y|
- puts ' '*2 + x2 if x2.class == String
- if y.class == Hash
+ puts ' '*2 + x2 if x2.is_a?(String)
+ if y.is_a?(Hash)
if y.has_key?(:md)
y[:md].each { |x| puts ' '*5 + x[:title] }
end
y.each_pair do |x3,y|
- puts ' '*3 + x3 if x3.class == String
- if y.class == Hash
+ puts ' '*3 + x3 if x3.is_a?(String)
+ if y.is_a?(Hash)
if y.has_key?(:md)
y[:md].each { |x| puts ' '*5 + x[:title] }
end
y.each_pair do |x4,y|
- puts ' '*4 + x4 if x4.class == String
- if y.class == Hash
+ puts ' '*4 + x4 if x4.is_a?(String)
+ if y.is_a?(Hash)
if y.has_key?(:md)
y[:md].each { |x| puts ' '*5 + x[:title] }
end
y.each_pair do |x5,y|
- puts ' '*5 + x4 if x4.class == String
+ puts ' '*5 + x4 if x4.is_a?(String)
end
end
end
@@ -480,7 +479,7 @@ module SiSU_HarvestTopics
def html_file_close
@the_idx.keys.each do |lng|
@output[lng][:html].close
- @output[lng][:html_mnt].close if @output[lng][:html_mnt].class==File
+ @output[lng][:html_mnt].close if @output[lng][:html_mnt].is_a?(File)
end
end
def html_print
@@ -496,23 +495,23 @@ module SiSU_HarvestTopics
def html_body_traverse
@the_idx.each_pair do |x0,y|
lng=x0
- if x0.class == String
+ if x0.is_a?(String)
#do_string_name(lng,'lev0',x0)
#puts ' '*0 + x0
end
- if y.class == Hash
+ if y.is_a?(Hash)
if y.has_key?(:md)
y[:md].each do |x|
- #do_hash(lng,attrib,x) #lv==0 ?
+ #do_hash(lng,attrib,x) #lv==0 ?
#puts ' '*5 + x[:title]
end
end
y.each_pair do |x1,y|
- if x1.class == String
+ if x1.is_a?(String)
do_string_name(lng,'lev0',x1)
#puts ' '*1 + x1
end
- if y.class == Hash
+ if y.is_a?(Hash)
if y.has_key?(:md)
y[:md].each do |x|
do_hash(lng,0,x)
@@ -520,11 +519,11 @@ module SiSU_HarvestTopics
end
end
y.each_pair do |x2,y|
- if x2.class == String
+ if x2.is_a?(String)
do_string(lng,'lev1',x2)
#puts ' '*2 + x2
end
- if y.class == Hash
+ if y.is_a?(Hash)
if y.has_key?(:md)
y[:md].each do |x|
do_hash(lng,1,x)
@@ -532,11 +531,11 @@ module SiSU_HarvestTopics
end
end
y.each_pair do |x3,y|
- if x3.class == String
+ if x3.is_a?(String)
do_string(lng,'lev2',x3)
#puts ' '*3 + x3
end
- if y.class == Hash
+ if y.is_a?(Hash)
if y.has_key?(:md)
y[:md].each do |x|
do_hash(lng,2,x)
@@ -544,11 +543,11 @@ module SiSU_HarvestTopics
end
end
y.each_pair do |x4,y|
- if x4.class == String
+ if x4.is_a?(String)
do_string(lng,'lev3',x4)
#puts ' '*4 + x4
end
- if y.class == Hash
+ if y.is_a?(Hash)
if y.has_key?(:md)
y[:md].each do |x|
do_hash(lng,3,x)
@@ -556,7 +555,7 @@ module SiSU_HarvestTopics
end
end
y.each_pair do |x5,y|
- if x5.class == String
+ if x5.is_a?(String)
do_string(lng,'lev4',x5)
#puts ' '*5 + x5
end
@@ -667,7 +666,7 @@ WOK
</html>
WOK
@the_idx.keys.each do |lng|
- @output[lng][:html_mnt] << a if @output[lng][:html_mnt].class==File
+ @output[lng][:html_mnt] << a if @output[lng][:html_mnt].is_a?(File)
@output[lng][:html] << a
end
end
@@ -675,12 +674,12 @@ WOK
@output[lng][:html] << html
end
def do_html_maintenance(lng,html)
- @output[lng][:html_mnt] << html if @output[lng][:html_mnt].class==File
+ @output[lng][:html_mnt] << html if @output[lng][:html_mnt].is_a?(File)
end
def do_string(lng,attrib,string)
html=%{<p class="#{attrib}">#{string}</p>}
do_html(lng,html)
- do_html_maintenance(lng,html) if @output[lng][:html_mnt].class==File
+ do_html_maintenance(lng,html) if @output[lng][:html_mnt].is_a?(File)
end
def do_string_default(lng,attrib,string)
html=%{<p class="#{attrib}">#{string}</p>}
@@ -688,7 +687,7 @@ WOK
end
def do_string_maintenance(lng,attrib,string)
html=%{<p class="#{attrib}">#{string}</p>}
- do_html_maintenance(lng,html) if @output[lng][:html_mnt].class==File
+ do_html_maintenance(lng,html) if @output[lng][:html_mnt].is_a?(File)
end
def do_string_name(lng,attrib,string)
f=/^(\S)/.match(string)[1]
@@ -701,7 +700,7 @@ WOK
while @letter < f
if @alph.length > 0
@letter=@alph.shift
- if @output[lng][:html_mnt].class==File
+ if @output[lng][:html_mnt].is_a?(File)
@output[lng][:html_mnt] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
end
@output[lng][:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>}
@@ -712,7 +711,7 @@ WOK
name=string.strip.gsub(/\s+/,'_')
html=%{<p class="#{attrib}"><a name="#{name}">#{string}</a></p>}
do_html(lng,html)
- do_html_maintenance(lng,html) if @output[lng][:html_mnt].class==File
+ do_html_maintenance(lng,html) if @output[lng][:html_mnt].is_a?(File)
end
def do_array(lng,lv,array)
lv+=1
@@ -733,7 +732,7 @@ WOK
do_string_default(lng,attrib,html)
end
def do_hash_md_maintenance(lng,attrib,hash)
- if @output[lng][:html_mnt].class==File #should not be run for presentation output
+ if @output[lng][:html_mnt].is_a?(File) #should not be run for presentation output
html=%{[<a href="#{hash[:file]}.sst">src</a>]&nbsp;&nbsp;<a href="file://#{@env.path.output}/#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}}
do_string_maintenance(lng,attrib,html)
end
@@ -765,16 +764,15 @@ WOK
end
end
def do_case(lng,lv,a)
- y = a.class
- case
- when y==String
+ case a
+ when String
attrib="lev#{lv}"
if a=~/S/
lv==0 ? do_string_name(lng,attrib,a) : do_string(lng,attrib,a)
end
- when y==Array
+ when Array
do_array(lng,lv,a)
- when y==Hash
+ when Hash
do_hash(lng,lv,a)
end
end
diff --git a/lib/sisu/v3/help.rb b/lib/sisu/v3/help.rb
index 9ca8ef20..0ab87fdd 100644
--- a/lib/sisu/v3/help.rb
+++ b/lib/sisu/v3/help.rb
@@ -63,9 +63,9 @@ module SiSU_Help
require_relative 'i18n' # i18n.rb
def initialize(request='',color='')
@request,@color=request,color
- if color =~/color_off/; @cX=SiSU_Screen::Ansi.new('k').cX
- else @cX=SiSU_Screen::Ansi.new('yes').cX
- end
+ @cX=(color =~/color_off/) \
+ ? (SiSU_Screen::Ansi.new('k').cX)
+ : (SiSU_Screen::Ansi.new('yes').cX)
fns='help_example_dummy_file_name.sst'
@env=SiSU_Env::InfoEnv.new(fns)
@db=SiSU_Env::InfoDb.new
@@ -397,9 +397,12 @@ sisu
Note: files for SiSU should be in UTF-8 character encoding.
#{@cX.cyan}Data text markup#{@cX.off} (alternative to available html subset)
- #{@cX.green}% SiSU 0.38#{@cX.off} [statement on first line of document, declared file-type identifier, SiSU markup document, markup used is version 0.38]
- #{@cX.green}:A~#{@cX.off} heading/title [levels :A to :C available (and beneath that 1 to 6)]
+ #{@cX.green}% SiSU 2.00#{@cX.off} [statement on first line of document, declared file-type identifier, SiSU markup document, markup used is version 0.38]
+
+ #{@cX.green}A~#{@cX.off} heading/title [levels A to C available (and beneath that 1 to 6)]
+
#{@cX.green}1~#{@cX.off}filename heading [segmentation level, levels 1 to 6 available]
+
#{@cX.green}!{#{@cX.off}emphasis#{@cX.green}}!#{@cX.off}
#{@cX.green}*{#{@cX.off}bold text#{@cX.green}}*#{@cX.off}
#{@cX.green}_{#{@cX.off}underscore#{@cX.green}}_#{@cX.off}
@@ -409,18 +412,28 @@ sisu
#{@cX.green},{#{@cX.off}subscript#{@cX.green}},#{@cX.off}
#{@cX.green}+{#{@cX.off}inserted text#{@cX.green}}+#{@cX.off}
#{@cX.green}-{#{@cX.off}strikethrough#{@cX.green}}-#{@cX.off}
+
------------------------------------------
#{@cX.cyan}Indentation and bullets#{@cX.off}
+
#{@cX.green}_1#{@cX.off} indent paragraph one level
+
#{@cX.green}_2#{@cX.off} indent paragraph two steps
+
#{@cX.green}_*#{@cX.off} bullet text
+
#{@cX.green}_1*#{@cX.off} bullet text, first indent
+
------------------------------------------
#{@cX.cyan}Numbered List#{@cX.off} (not to be confused with headings/titles, (document structure))
+
#{@cX.green}##{@cX.off} numbered list numbered list 1., 2., 3, etc.
+
#{@cX.green}_##{@cX.off} numbered list numbered list indented second level a., b., c., d., etc.
+
------------------------------------------
#{@cX.cyan}Endnotes#{@cX.off}
+
#{@cX.green}~{#{@cX.off}footnote/endnote#{@cX.green}}~#{@cX.off} endnote#{@cX.green}~{#{@cX.off}self contained endnote marker & endnote in one#{@cX.green}}~#{@cX.off}
#{@cX.green}~{*#{@cX.off}asterisk footnote/endnote#{@cX.green}}~#{@cX.off}
editor's annotations, square bracket notes
@@ -430,8 +443,10 @@ sisu
alternative endnote pair notation
#{@cX.green}~^#{@cX.off} endnote marker
#{@cX.green}^~#{@cX.off} endnote text following the paragraph in which the marker occurs
+
------------------------------------------
#{@cX.cyan}Links#{@cX.off}
+
http://url.org on its own would be automatically marked up and hyperlinked to itself
#{@cX.green}{#{@cX.off} [text to link] #{@cX.green}}#{@cX.off}http://url.org
#{@cX.green}{#{@cX.off}image.png#{@cX.green}}#{@cX.off}http://url.org
@@ -450,19 +465,24 @@ sisu
if a server host name has been provided/configured, will provide a list of available output types that would be generated using the shortcut command and the markup file provided, i.e. output generated using the command (as configured):
"sisu -3sS markup_source_filename.sst"
using server host, directory stub, filename to compose the link.
+
------------------------------------------
adding fixed names in html, manual location marker/tagging
#{@cX.green}*~[name]#{@cX.off} <a name="[name]">
+
------------------------------------------
#{@cX.green}~##{@cX.off} unnumbered paragraph (place marker at end of paragraph)
#{@cX.green}-##{@cX.off} unnumbered paragraph, delete when not required (place marker at end of paragraph) [used in dummy headings, eg. for segmented html]
+
------------------------------------------
manual page breaks (LaTeX/pdf)
#{@cX.green}<:pb>#{@cX.off} page break, which breaks a page, starting a new page in single column text and a new column in double column text
#{@cX.green}<:pn>#{@cX.off} page new, which starts a new page, in both single and double column text (leaving an empty column in double column text if necessary).
Note: page breaks are usually introduced to pdfs either as header instructions, indicating that pages should break at given levels
+
------------------------------------------
#{@cX.cyan}Composite documents#{@cX.off}
+
It is possible to build a document by creating a master document that requires other documents. The documents required may complete documents that could be generated independently, or they could be markup snippets, prepared so as to be easily available to be placed within another text. If the calling document is a master document (built mainly from other documents), it should be named with the suffix #{@cX.blue}.ssm#{@cX.off} Within this document you would provide information on the other documents that should be included within the text. These may be other documents that would be processed in a regular way, or markup bits prepared only for inclusion within a master document #{@cX.blue}.sst#{@cX.off} regular markup file, or #{@cX.blue}.ssi#{@cX.off} (insert/information) A secondary file of the composite document is built prior to processing with the same prefix and the suffix #{@cX.blue}.ssm.sst#{@cX.off}
#{@cX.cyan}#basic sisu markup alternatives#{@cX.off}
@@ -522,9 +542,9 @@ WOK
@links: { SiSU }http://www.jus.uio.no/sisu { FSF }http://www.fsf.org
-:A~ A Sample Document
+A~ A Sample Document
-:B~ just for fun
+B~ just for fun
1~ This is Chapter One or Article One
@@ -570,9 +590,9 @@ WOK
@links:
{ SiSU }http://www.jus.uio.no/sisu { FSF }http://www.fsf.org
-:A~ @title @author
+A~ @title @author
-:B~ just for fun
+B~ just for fun
1~ This is Chapter One or Article One
@@ -600,109 +620,79 @@ Header tags appear at the beginning of a document and provide meta information o
All header instructions take either the form #{@cX.green}@headername:#{@cX.off} followed on the next line by an indented sub-category header if any #{@cX.green}:sub-headername:#{@cX.off}.
#{@cX.green}@indentifier:#{@cX.off} information or instructions
where the #{@cX.green}"identifier"#{@cX.off} is a tag recognised by the program, and the #{@cX.green}"information"#{@cX.off} or #{@cX.green}"instructions"#{@cX.off} belong to the tag/indentifier specified
- Note: a header where used should only be used once; all headers apart from @title: are optional; the @structure: or 0~toc header is used to describe document structure, and can be useful to know.
-This is a sample header (#{@cX.fuschia}Dublin Core in fuschia,#{@cX.off} #{@cX.cyan}other information headers in cyan,#{@cX.off} #{@cX.ruby}markup instructions in red#{@cX.off}):
-
-#{@cX.fuschia}@title:#{@cX.off} My Title - This is now the Title of the Document and used as such
- #{@cX.cyan}:subtitle:#{@cX.off} The Subtitle if any
-
-#{@cX.fuschia}@creator:#{@cX.off}
- #{@cX.fuschia}:author:#{@cX.off} Surname, Other names (if more than one author separate author names with a semi colon, if name is of an institution just write name or the name contains a comma enclose in quotation marks)
-
-#{@cX.fuschia}@classify:#{@cX.off}
- #{@cX.fuschia}:topic_register:#{@cX.off} [e.g.:] text markup language; application:text processing;output:html|xml|latex|pdf|sql
-
-#{@cX.fuschia}@subject:#{@cX.off} (whatever your subject)
-
-#{@cX.fuschia}@description:#{@cX.off}
-
-#{@cX.fuschia}@publisher:#{@cX.off}
-
-#{@cX.fuschia}@contributor:#{@cX.off}
-
-#{@cX.fuschia}@translator:#{@cX.off} [or @translated_by:]
-
-#{@cX.fuschia}@illustrator:#{@cX.off} [or @illustrated_by:]
-
-#{@cX.fuschia}@prepared_by:#{@cX.off} [or @digitized_by:]
-
-#{@cX.fuschia}@date:#{@cX.off} 2000-08-27
-\t[ also #{@cX.fuschia}@date.created:#{@cX.off} #{@cX.fuschia}@date.issued:#{@cX.off} #{@cX.fuschia}@date.available:#{@cX.off} #{@cX.fuschia}@date.valid:#{@cX.off} #{@cX.fuschia}@date.modified:#{@cX.off} ]
-
-#{@cX.fuschia}@type:#{@cX.off} article
-
-#{@cX.fuschia}@format:#{@cX.off}
-
-#{@cX.fuschia}@identifier:#{@cX.off}
-
-#{@cX.fuschia}@source:#{@cX.off}
-
-#{@cX.fuschia}@language:#{@cX.off} [or @language.document:] [country code for language if available, or language, English, en is the default setting] (en - English, fr - French, de - German, it - Italian, es - Spanish, pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, hr - Croatian, cs - Czech, bg - Bulgarian ) [however, encodings are not available for all of the languages listed.]
-
-#{@cX.fuschia}@language.original:#{@cX.off}
+ Note: a header where used should only be used once; all headers apart from #{@cX.ruby}@title:#{@cX.off} are optional.
+
+#{@cX.ruby}@title:#{@cX.off} My Title - This is now the Title of the Document and used as such
+ #{@cX.cyan}:subtitle:#{@cX.off} The Subtitle if any
+
+#{@cX.ruby}@creator:#{@cX.off}
+ #{@cX.cyan}:author:#{@cX.off} Surname, Other names (if more than one author separate author names with a semi colon, if name is of an institution just write name or the name contains a comma enclose in quotation marks)
+ #{@cX.cyan}:contributor:#{@cX.off}
+ #{@cX.cyan}:translator:#{@cX.off} [or :translated_by:]
+ #{@cX.cyan}:illustrator:#{@cX.off} [or :illustrated_by:]
+ #{@cX.cyan}:prepared_by:#{@cX.off} [or :digitized_by:]
+
+#{@cX.ruby}@date:#{@cX.off}
+ #{@cX.cyan}:published:#{@cX.off}
+ #{@cX.cyan}:created:#{@cX.off}
+ #{@cX.cyan}:issued:#{@cX.off}
+ #{@cX.cyan}:available:#{@cX.off}
+ #{@cX.cyan}:valid:#{@cX.off}
+ #{@cX.cyan}:modified:#{@cX.off}
+
+#{@cX.ruby}@rights:#{@cX.off}
+ #{@cX.cyan}:copyright:#{@cX.off} Author's name, all rights reserved
+ #{@cX.cyan}:license:#{@cX.off} public domain, copyleft, creative commons variant, etc.
+
+#{@cX.ruby}@classify:#{@cX.off}
+ #{@cX.cyan}:topic_register:#{@cX.off} [e.g.:] text markup language; application:text processing;output:html|xml|latex|pdf|sql
+ #{@cX.cyan}:subject:#{@cX.off} (whatever your subject)
+ #{@cX.cyan}:keywords:#{@cX.off}
+ #{@cX.cyan}:coverage:#{@cX.off}
+ #{@cX.cyan}:relation:#{@cX.off}
+ #{@cX.cyan}:type:#{@cX.off}
+ #{@cX.cyan}:identifier:#{@cX.off}
+ #{@cX.cyan}:loc:#{@cX.off} [Library of Congress classification]
+ #{@cX.cyan}:dewey:#{@cX.off} [Dewey classification]
+ #{@cX.cyan}:isbn:#{@cX.off}
+ #{@cX.cyan}:oclc:#{@cX.off}
+
+#{@cX.ruby}@notes:#{@cX.off}
+ #{@cX.cyan}:description:#{@cX.off}
+ #{@cX.cyan}:abstract:#{@cX.off}
+ #{@cX.cyan}:comment:#{@cX.off}
+ #{@cX.cyan}:history:#{@cX.off}
+ #{@cX.cyan}:prefix:#{@cX.off}
+ #{@cX.cyan}:suffix:#{@cX.off}
+
+#{@cX.ruby}@publisher:#{@cX.off}
+
+#{@cX.ruby}@language:#{@cX.off} [or @language.document:] [country code for language if available, or language, English, en is the default setting] (en - English, fr - French, de - German, it - Italian, es - Spanish, pt - Portuguese, sv - Swedish, da - Danish, fi - Finnish, no - Norwegian, is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, hr - Croatian, cs - Czech, bg - Bulgarian ) [however, encodings are not available for all of the languages listed.]
+
+#{@cX.ruby}@language.original:#{@cX.off}
original language in which the work was published
-#{@cX.fuschia}@papersize:#{@cX.off}
-(A4|US_letter|book_B5|book_A5|US_legal)
+#{@cX.ruby}@links:#{@cX.off}
+ { SiSU }http://www.jus.uio.no/sisu/
+ { FSF }http://www.fsf.org
-#{@cX.fuschia}@relation:#{@cX.off}
-
-#{@cX.fuschia}@coverage:#{@cX.off}
-
-#{@cX.fuschia}@rights:#{@cX.off} copyright, all rights reserved, public domain, copyleft, creative commons variant, etc.
-
-#{@cX.cyan}@owner:#{@cX.off}
-
-#{@cX.cyan}@keywords:#{@cX.off} text document generation processing management latex pdf structured xml citation [your keywords here, used for example by rss feeds, and in sql searches]
-
-#{@cX.cyan}@abstract:#{@cX.off} [paper abstract, placed after table of contents]
-
-#{@cX.cyan}@comment:#{@cX.off} [...]
-
-#{@cX.cyan}@catalogue:#{@cX.off} #{@cX.green}loc=#{@cX.off}[Library of Congress classification]; #{@cX.green}dewey=#{@cX.off}[Dewey classification]; #{@cX.green}isbn=#{@cX.off}[ISBN]; #{@cX.green}pg=#{@cX.off}[Project Gutenberg text number]
-
-#{@cX.cyan}@classify_loc:#{@cX.off} [Library of Congress classification]
-
-#{@cX.cyan}@classify_dewey:#{@cX.off} [Dewey classification]
-
-#{@cX.cyan}@classify_isbn:#{@cX.off} [ISBN]
-
-#{@cX.cyan}@classify_pg:#{@cX.off} [Project Gutenberg text number]
-
-#{@cX.cyan}@prefix_a:#{@cX.off} [prefix is placed just before table of contents - not implemented]
-
-#{@cX.cyan}@prefix_b:#{@cX.off} or #{@cX.cyan}@prefix:#{@cX.off} [prefix is placed just after table of contents]
-
-#{@cX.cyan}@rcs:#{@cX.off} $Id$ [used by rcs or cvs to embed version (revision control) information into document, rcs or cvs can usefully provide a history of updates to a document ]
-
-#{@cX.ruby}@structure:#{@cX.off} PART; CHAPTER; SECTION; ARTICLE; none; none;
-optional, document structure can be defined by words to match or regular expression (the regular expression is assumed to start at the beginning of a line of text i.e. ^) default markers :A~ to :C~ and 1~ to 6~ can be used within text instead, without this header tag, and may be used to supplement the instructions provided in this header tag if provided (@structure: is a synonym for @toc:)
-
-#{@cX.ruby}@level:#{@cX.off} newpage=3; breakpage=4 [paragraph level, used by latex to breakpages, the page is optional eg. in newpage]
-
-#{@cX.ruby}@markup:#{@cX.off} num_top=4 [various markup instructions, eg: num_top=4 headings tobe numbered, starting at heading level 4... the default is to provide 3 levels, as in 1 level 4, 1.1 level 5, 1.1.1 level 6, markup to be merged within level]
-
-#{@cX.ruby}@bold:#{@cX.off} [regular expression of words/phrases to be made bold]
-
-#{@cX.ruby}@italics:#{@cX.off} [regular expression of words/phrases to italize]
-
-#{@cX.ruby}@vocabulary:#{@cX.off} name of taxonomy/vocabulary/wordlist to use against document
-
-#{@cX.ruby}@skin:#{@cX.off} skin_doc_[name_of_desired_document_skin]
-
-#{@cX.ruby}@links:#{@cX.off} { SiSU }http://www.jus.uio.no/sisu/; { FSF }http://www.fsf.org
-
-#{@cX.ruby}@@promo:#{@cX.off} sisu, ruby, search_libre_docs, open_society [places content in right pane in html, makes use of list.yml and promo.yml, commented out sample in document sample: free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst]
+#{@cX.ruby}@make:#{@cX.off}
+ #{@cX.cyan}:breaks:#{@cX.off} new=:B; break=1
+ #{@cX.cyan}:bold:#{@cX.off} [regular expression of words/phrases to be made bold]
+ #{@cX.cyan}:italics:#{@cX.off} [regular expression of words/phrases to italize]
+ #{@cX.cyan}:headings:#{@cX.off} PART; CHAPTER; Section; Article;
+ #{@cX.grey}% optional, document structure can be defined by words to match or regular expression (the regular expression is assumed to start at the beginning of a line of text i.e. ^) default markers A~ to C~ and 1~ to 6~ can be used within text instead, without this header tag, and may be used to supplement the instructions provided in this header tag if provided#{@cX.off}
+ #{@cX.cyan}:papersize:#{@cX.off} (A4|US_letter|book_B5|book_A5|US_legal)
+ #{@cX.cyan}:markup:#{@cX.off} num_top=4 [various markup instructions, eg: num_top=4 headings tobe numbered, starting at heading level 4... the default is to provide 3 levels, as in 1 level 4, 1.1 level 5, 1.1.1 level 6, markup to be merged within level]
+ #{@cX.cyan}:promo:#{@cX.off} sisu, ruby, search_libre_docs, open_society [places content in right pane in html, makes use of list.yml and promo.yml, commented out sample in document sample: free_as_in_freedom.richard_stallman_crusade_for_free_software.sam_williams.sst]
#{@cX.grey}% header ends here, NB only @title: is mandatory [this would be a comment]#{@cX.off}
-#{@cX.grey}% NOTE: headings/levels below refer to 0.38 expermental markup
- (a conversion script provided in sisu-examples, modify.rb makes conversion between 0.37 and 0.38 markup simple)#{@cX.off}
-#{@cX.blue}:A~#{@cX.off} Top level heading [this is usually the same as the title @title: ]
+#{@cX.blue}A~#{@cX.off} Top level heading [this is usually the same as the title @title: ]
-#{@cX.blue}:B~#{@cX.off} Second level heading [this is a heading level divider]
+#{@cX.blue}B~#{@cX.off} Second level heading [this is a heading level divider]
-#{@cX.blue}:C~#{@cX.off} Third level heading [this is a heading level divider]
+#{@cX.blue}C~#{@cX.off} Third level heading [this is a heading level divider]
#{@cX.blue}1~#{@cX.off} Top level heading preceding substantive text of document or sub-heading 5, the heading level that would normally be marked 1. or 2. or 3. etc. in a document
@@ -901,7 +891,7 @@ WOK
SiSU_Env::InfoSettings.new.program?(program)
else ''
end
- if program =='rmagick'; program='identify' #rmagick is ruby lib uses imagemagick's identify
+ if program =='rmagick' then program='identify' #rmagick is ruby lib uses imagemagick's identify
end
bin=if SiSU_Env::SystemCall.new.program_found?(program)
SiSU_Env::SystemCall.new.program_found?(program)
@@ -909,9 +899,9 @@ WOK
end
else bin,rc='false','false'
end
- if program; "#{@cX.blue}#{program}#{@cX.off} bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}"
- else "bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}"
- end
+ (program) \
+ ? ("#{@cX.blue}#{program}#{@cX.off} bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}")
+ : ("bin: #{@cX.brown}#{bin}#{@cX.off} rc: #{@cX.brown}#{rc}#{@cX.off}")
end
def sisu_version
version=SiSU_Env::InfoVersion.instance.get_version
@@ -925,40 +915,40 @@ WOK
@ls=leading_spaces=' '*49
@rhost=SiSU_Env::InfoRemoteHost.new.rhost
def r1
- if @rhost.r1; @rhost.r1 + "\n"
- else ''
- end
+ (@rhost.r1) \
+ ? @rhost.r1 + "\n"
+ : ''
end
def r2
- if @rhost.r2; @ls + @rhost.r2 + "\n"
- else ''
- end
+ (@rhost.r2) \
+ ? @ls + @rhost.r2 + "\n"
+ : ''
end
def r3
- if @rhost.r3; @ls + @rhost.r3 + "\n"
- else ''
- end
+ (@rhost.r3) \
+ ? @ls + @rhost.r3 + "\n"
+ : ''
end
def r4
- if @rhost.r4; @ls + @rhost.r4 + "\n"
- else ''
- end
+ (@rhost.r4) \
+ ? @ls + @rhost.r4 + "\n"
+ : ''
end
def r5
- if @rhost.r5; @ls + @rhost.r5 + "\n"
- else ''
- end
+ (@rhost.r5) \
+ ? @ls + @rhost.r5 + "\n"
+ : ''
end
def r6
- if @rhost.r6; @ls + @rhost.r6 + "\n"
- else ''
- end
+ (@rhost.r6) \
+ ? @ls + @rhost.r6 + "\n"
+ : ''
end
def note
msg='(remote settings user and host set in sisurc.yml under remote:)'
- if @rhost.r1; @ls + msg
- else msg
- end
+ (@rhost.r1) \
+ ? @ls + msg
+ : msg
end
self
end
@@ -1082,7 +1072,7 @@ The following heading or level (structuring) defaults are available (for use ins
or, [0.38]
- :A~ :B~ :C~ 1~ 2~ 3~
+ A~ B~ C~ 1~ 2~ 3~
Heading tags take either of the forms above, ranging from 1-6
@@ -1114,11 +1104,11 @@ in the 0.38 notation this maps to:
% SiSU 0.38
-:A~ Document Title
+A~ Document Title
-:B~ Document Subtitle whatever it is
+B~ Document Subtitle whatever it is
-:C~ Part
+C~ Part
1~ Chapter
@@ -1291,8 +1281,7 @@ WOK
WOK
end
- def install
- #% system configuration
+ def install #% system configuration
print <<WOK
#{@cX.green}Install SiSU#{@cX.off}
diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb
index 100916ff..132394d6 100644
--- a/lib/sisu/v3/html.rb
+++ b/lib/sisu/v3/html.rb
@@ -90,9 +90,9 @@ module SiSU_HTML
@env=@particulars.env
loc=@env.url.output_tell
unless @opt.cmd =~/q/
- tool=if @opt.cmd =~/[MVvz]/; "#{@env.program.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}"
- else "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
- end
+ tool=(@opt.cmd =~/[MVvz]/) \
+ ? ("#{@env.program.web_browser} file://#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_segtoc}")
+ : ("[#{@opt.f_pth[:lng_is]}] #{@opt.fno}")
@opt.cmd=~/[MVvz]/ \
? SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_hi_blue
: SiSU_Screen::Ansi.new(@opt.cmd,'HTML',tool).green_title_hi
@@ -167,9 +167,9 @@ module SiSU_HTML
and @md.lnk
@md.lnk.each do |l|
if defined? l[:say]
- target=if l[:url] !~/^\.(\.)?\//; 'external'
- else '_top'
- end
+ target=(l[:url] !~/^\.(\.)?\//) \
+ ? 'external'
+ : '_top'
s_lnk_url,s_lnk_lnk=l[:url],l[:say]
txt_obj={ lnk_url: s_lnk_url, lnk_txt: s_lnk_lnk, target: target }
lev_dob_ocn=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
@@ -321,7 +321,7 @@ WOK
and link !~/#/ #% keep eye on link
p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,link)
end
- title=if dob.obj !~/Metadata/; linkname
+ title=if dob.obj !~/Metadata/ then linkname
else
link='metadata'
%{<b><a href="#{link}#{@md.lang_code_insert}#{Sfx[:html]}">#{linkname}</a></b>}
@@ -350,9 +350,9 @@ WOK
end
else
@@toc[:scr] << '<br />'
- link=if dob.ln; dob.ln
- else ''
- end
+ link=(dob.ln) \
+ ? dob.ln
+ : ''
%{<b><a href="##{link}">#{linkname}</a></b>}
end
txt_obj={ txt: title }
@@ -528,8 +528,6 @@ WOK
ads=SiSU_HTML_Promo::Ad.new(@md)
toc_shared << dochead << ads.div.major
@segtoc << format_head_toc.head << ads.div.major
- toc_shared << format_head_toc.toc_head_escript if SiSU_HTML_Format::HeadToc.method_defined? :toc_head_escript
- @segtoc << format_head_toc.toc_head_escript if SiSU_HTML_Format::HeadToc.method_defined? :toc_head_escript
if @make.build.html_top_band?
toc_shared << format_head_toc.scroll_head_navigation_band
end
@@ -609,8 +607,7 @@ WOK
end
def publish
scroll=[]
- hr='<center><hr width=90% /></center>'
- scroll << @scr_toc << '<div class="scroll">' << hr << @scr_body << @scr_endnotes << hr << @scr_owner_details << '</div>' << @scr_tails
+ scroll << @scr_toc << '<div class="scroll">' << @scr_body << @scr_endnotes << @scr_owner_details << '</div>' << @scr_tails
scroll=scroll.flatten.compact #watch
end
end
diff --git a/lib/sisu/v3/html_format.rb b/lib/sisu/v3/html_format.rb
index 85e47e0b..fa9ac462 100644
--- a/lib/sisu/v3/html_format.rb
+++ b/lib/sisu/v3/html_format.rb
@@ -135,7 +135,7 @@ module SiSU_HTML_Format
end
def png_nav
def toc
- %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.up}" alt="TOC" />}
+ %{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.up}" alt="toc" />}
end
def pre
%{<img border="0" width="22" height="22" src="#{url_path_image_sys}/#{icon.previous}" alt="&lt;&lt;&nbsp;previous" />}
@@ -184,7 +184,7 @@ module SiSU_HTML_Format
end
def copyat
%{#{@vz.paragraph_font_tiny}copy @
- <a href="#{@vz.url_home}" #{@vz.js_home}>
+ <a href="#{@vz.url_home}">
#{@vz.txt_home}
</a></h1>}
end
@@ -213,7 +213,7 @@ module SiSU_HTML_Format
def scroll(text)
if @md.fns =~ /\.(?:-|ssm\.)?sst$/
scroll=%{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{Xx[:html_relative1]}html/#{@file.base_filename.html_scroll}" target="_top" #{@vz.js_doc}>
+ <a href="#{Xx[:html_relative1]}html/#{@file.base_filename.html_scroll}" target="_top">
#{text}
</a>
</td>
@@ -222,7 +222,7 @@ module SiSU_HTML_Format
end
def seg(text)
%{<td align="center" bgcolor="#99CC66">
- <a href="#{@md.file.base_filename.html_segtoc}" target="_top" #{@vz.js_doc}>
+ <a href="#{@md.file.base_filename.html_segtoc}" target="_top">
#{text}
</a>
</td>
@@ -244,7 +244,7 @@ module SiSU_HTML_Format
else @file.base_filename.manifest
end
%{<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{manifest_lnk}" target="_top" #{@vz.js_manifest}>
+ <a href="#{manifest_lnk}" target="_top">
#{@vz.nav_txt_manifest}
</a>
</td>}
@@ -256,12 +256,12 @@ module SiSU_HTML_Format
and @cf_defaults.cf_0 =~/p/
%{
<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{Xx[:html_relative1]}pdf/#{@file.base_filename.pdf_p}" target="_top" #{@vz.js_portrait}>
+ <a href="#{Xx[:html_relative1]}pdf/#{@file.base_filename.pdf_p}" target="_top">
#{@vz.nav_txt_pdf_portrait}
</a>
</td>
<td align="center" bgcolor=#{@vz.color_band2}>
- <a href="#{Xx[:html_relative1]}pdf/#{@file.base_filename.pdf_l}" target="_top" #{@vz.js_portrait}>
+ <a href="#{Xx[:html_relative1]}pdf/#{@file.base_filename.pdf_l}" target="_top">
#{@vz.nav_txt_pdf_landscape}
</a>
</td>
@@ -331,13 +331,13 @@ WOK
def manifest_link(text)
# @file=SiSU_Env::FileOp.new(@md) if @md
%{<font size=2>
- <a href="#{@md.file.base_filename.manifest}" target="_top" #{@vz.js_manifest}>#{text}</a>
+ <a href="#{@md.file.base_filename.manifest}" target="_top">#{text}</a>
</font>}
end
def concordance_link(text)
if @md.concord_make
%{<font size=2>
- <a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}>
+ <a href="#{@md.file.base_filename.html_concordance}" target="_top">
#{text}
</a>
</font>}
@@ -394,14 +394,13 @@ WOK
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
+<a name="start" id="start"></a>}
end
def concordance
if @md.concord_make
%{#{@vz.margin_css}
<h4 class="toc">
- <a href="./#{@md.file.base_filename.html_concordance}" #{@vz.js_concordance}>
+ <a href="./#{@md.file.base_filename.html_concordance}">
<i>Concordance</i>
</a>
</h4>
@@ -418,7 +417,7 @@ WOK
<div id="vertical_links">
<ul id="vertical">
<li class="refbold">
- <a href="#{url}" #{@vz.js_home}>
+ <a href="#{url}">
#{@vz.txt_hp}
</a>
</li>
@@ -439,7 +438,7 @@ WOK
<div id="horizontal_links">
<ul id="horizontal">
<li class="refbold">
- <a href="#{url}" #{@vz.js_home}>
+ <a href="#{url}">
#{@vz.txt_hp}
</a>
</li>
@@ -454,9 +453,9 @@ WOK
<!- quick ref -!>}
end
def links_guide_open(type='horizontal')
- if type=='vertical'; links_guide_vertical_open
- else links_guide_horizontal_open
- end
+ (type=='vertical') \
+ ? links_guide_vertical_open
+ : links_guide_horizontal_open
end
def links_guide_close
insert=''
@@ -545,7 +544,7 @@ WOK
def metadata
%{#{@vz.margin_css}
<h4 class="toc">
- <a href="#{@metalink}" #{@vz.js_metalink}>
+ <a href="#{@metalink}">
<i>MetaData</i>
</a>
</h4>
@@ -634,17 +633,17 @@ WOK
end
%{<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="#{pre}" target="_top" #{@vz.js_prev}>
+ <a href="#{pre}" target="_top">
#{png_nav.dot_pre}
</a>
</td>
<td align="center">
- <a href="#{up}" target="_top" #{@vz.js_toc}>
+ <a href="#{up}" target="_top">
#{png_nav.dot_toc}
</a>
</td>
<td align="right">
- <a href="#{nxt}" target="_top" #{@vz.js_next}>
+ <a href="#{nxt}" target="_top">
#{png_nav.dot_nxt}
</a>
#{@vz.table_close}}
@@ -655,17 +654,17 @@ WOK
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">
<tr><td align="left">
- <a href="#{pre}" target="_top" #{@vz.js_prev}>
+ <a href="#{pre}" target="_top">
#{png_nav.dot_pre}
</a>
</td>
<td align="center">
- <a href="#{up}" target="_top" #{@vz.js_toc}>
+ <a href="#{up}" target="_top">
#{png_nav.dot_toc}
</a>
</td>
<td align="right">
- <a href="#{nxt}" target="_top" #{@vz.js_next}>
+ <a href="#{nxt}" target="_top">
#{png_nav.dot_nxt}
</a>
#{@vz.table_close}}
@@ -673,17 +672,17 @@ WOK
def toc_nav(f_pre=false,f_nxt=false,use=1)
pre=nxt=''
toc=%{<td align="center" bgcolor=#{@vz.color_band1}>
- <a href="#{@toc}" target="_top" #{@vz.js_toc}>
+ <a href="#{@toc}" target="_top">
#{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[:html]}" target="_top" #{@vz.js_prev}>
+ <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}>
- <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top" #{@vz.js_next}>
+ <a href="#{@seg_name_html[@seg_name_html_tracker+1]}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
#{png_nav.nxt}
</a>
</td>} if f_nxt==true
@@ -714,7 +713,7 @@ WOK
end
def manifest_link(text)
%{<font size=2>
- <a href="#{@md.file.base_filename.manifest}" target="_top" #{@vz.js_manifest}>
+ <a href="#{@md.file.base_filename.manifest}" target="_top">
#{text}
</a>
</font>}
@@ -722,7 +721,7 @@ WOK
def concordance_link(text)
if @md.concord_make
%{<font size=2>
- <a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}>
+ <a href="#{@md.file.base_filename.html_concordance}" target="_top">
#{text}
</a>
</font>}
@@ -746,42 +745,6 @@ WOK
<tr><td valign="top">
<font size="2">}
end
- def heading_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[:html]}" 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 heading_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[:html]}" 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 heading_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[:html]}" 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">
@@ -856,8 +819,7 @@ WOK
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
+<a name="start" id="start"></a>}
end
def title_banner(title,subtitle,creator)
%{
@@ -903,7 +865,7 @@ WOK
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
- if t_o.class==Hash
+ if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
@ocn =t_o[:ocn] || nil
@ocn_display =t_o[:ocn_display] || nil
@@ -957,9 +919,9 @@ WOK
def headname #check whether used
hn=if @t_o.is ==:heading \
and not @t_o.name.empty? #determine use
- hn=if @t_o.is ==:heading; %{<a name="h#{@t_o.name}" id="h#{@t_o.name}"></a>}
- else %{<a name="#{@t_o.name}" id="#{@t_o.name}"></a>}
- end
+ hn=(@t_o.is ==:heading) \
+ ? (%{<a name="h#{@t_o.name}" id="h#{@t_o.name}"></a>})
+ : (%{<a name="#{@t_o.name}" id="#{@t_o.name}"></a>})
else nil
end
hn
@@ -1035,16 +997,14 @@ WOK
end
para_form_css('p','norm')
end
- def break
- @txt=@txt.gsub(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />').
- gsub(/#{Mx[:br_obj]}/,'<hr style="width:30%" /><br />')
- para_form_css('p','norm')
- end
def format(tag,attrib)
para_form_css(tag,attrib)
end
def heading_normal(tag,attrib)
- %{
+ section_break=(tag=~/h[1-4]/) \
+ ? '<p><hr width=90% /></p>'
+ : ''
+ %{#{section_break}
<div class="substance">
#{@p_num.ocn_display}
<#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name}
diff --git a/lib/sisu/v3/html_promo.rb b/lib/sisu/v3/html_promo.rb
index a2edea47..387da244 100644
--- a/lib/sisu/v3/html_promo.rb
+++ b/lib/sisu/v3/html_promo.rb
@@ -98,7 +98,7 @@ module SiSU_HTML_Promo
elsif @flag[:sk] #promo set in associated skin
promo_array=@vz.widget_promo
elsif @flag[:rc] #promo set in rc file
- promo_array=if @rc['html']['promo'].class==String
+ promo_array=if @rc['html']['promo'].is_a?(String)
@rc['html']['promo'].split(/[,;]\s*/)
else @rc['html']['promo']
end
@@ -406,7 +406,7 @@ WOK
adverts << output_form_select(type,id)
else
if defined? @ad[:promo][category][type][id] \
- and @ad[:promo][category][type][id].class==Array \
+ and @ad[:promo][category][type][id].is_a?(Array) \
and @ad[:promo][category][type][id].length > 0
adverts << @ad[:promo][category][type][id].join("\n")
end
diff --git a/lib/sisu/v3/html_scroll.rb b/lib/sisu/v3/html_scroll.rb
index 8e9b6e11..170285cf 100644
--- a/lib/sisu/v3/html_scroll.rb
+++ b/lib/sisu/v3/html_scroll.rb
@@ -125,14 +125,22 @@ module SiSU_HTML_Scroll
end
elsif dob.is==:heading_insert
x=if dob.ln==1
- sto.heading_body1
+ unless dob.obj.empty?
+ sto.heading_body1
+ end
elsif dob.ln==2
- sto.heading_body2
+ unless dob.obj.empty?
+ sto.heading_body2
+ end
elsif dob.ln==3
- sto.heading_body3
+ unless dob.obj.empty?
+ sto.heading_body3
+ end
elsif dob.ln==4 \
and dob.obj !~/^(?:Endnotes|Index|Metadata|Manifest)$/
- sto.heading_body4
+ unless dob.obj.empty?
+ sto.heading_body4
+ end
elsif dob.ln==4 \
and dob.obj=='Endnotes'
sto.heading_body4
@@ -141,19 +149,18 @@ module SiSU_HTML_Scroll
and dob.obj=='Index'
sto.heading_body4
book_idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_html(@md.opt).html_idx
- book_idx.each do |x| #takes book index prepared for segments and strips segment identifying info
+ book_idx.each do |x| #takes book index prepared for segments & strips segment identifying info
x=x.gsub(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/,'<a href="#\1">\2</a>')
end
book_idx.join("\n")
- #elsif dob.ln==4 \
- #and dob.obj=~/Meta/
- #p __LINE__
- ##and dob.obj=='Metadata'
- #metadata=SiSU_Metadata::Summary.new(@md).xhtml.metadata
elsif dob.ln==5
- sto.heading_body5
+ unless dob.obj.empty?
+ sto.heading_body5
+ end
elsif dob.ln==6
- sto.heading_body6
+ unless dob.obj.empty?
+ sto.heading_body6
+ end
end
elsif dob.is==:para
if dob.indent \
@@ -187,14 +194,13 @@ module SiSU_HTML_Scroll
elsif dob.is==:table
sto.table
elsif dob.is==:break
- sto.break
end
if dob =~/<a name="n\d+">/ \
and dob =~/^(?:\^~\d+\s|<!e[:_]\d+!>)/ # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though
dob=''
end
- unless @rcdc; @scr[:body] << para_html unless para_html =~/\A\s*\Z/
- else #@scr[:metadata] << dob.obj
+ unless @rcdc
+ @scr[:body] << para_html unless para_html =~/\A\s*\Z/
end
end
end
diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v3/html_segments.rb
index b527eaba..81bb08d4 100644
--- a/lib/sisu/v3/html_segments.rb
+++ b/lib/sisu/v3/html_segments.rb
@@ -312,9 +312,9 @@ module SiSU_HTML_Seg
@@get_hash_to=dob.name
@@get_hash_fn=dob.name
end
- if dob.obj.class==String
+ if dob.obj.is_a?(String)
markup(dob)
- elsif dob.obj.class==Array
+ elsif dob.obj.is_a?(Array)
dob.obj.each do |pg|
markup(pg)
end
@@ -370,13 +370,12 @@ module SiSU_HTML_Seg
else ''
end
@@seg[:tocband_bannerless] << '<br />' << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav])
- @@seg[:headings] << format_head_seg.seg_head_escript if SiSU_HTML_Format::HeadSeg.method_defined? :seg_head_escript #debug PHP move up in text #bug
if @title_banner_
@@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'')
end
- ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
+ ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
@p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display }
format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
@@ -385,9 +384,9 @@ module SiSU_HTML_Seg
end
if @@is2==1
heading2=@@heading2
- ocn=if heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
+ ocn=(heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
@p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display }
format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
@@ -396,9 +395,9 @@ module SiSU_HTML_Seg
end
if @@is3==1
heading3=@@heading3
- ocn=if heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
+ ocn=(heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
@p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display }
format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
@@ -407,9 +406,9 @@ module SiSU_HTML_Seg
end
if @@is4==1
heading4=@@heading4
- ocn=if heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix
- else ''
- end
+ ocn=(heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \
+ ? $1
+ : ''
@p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)
txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display }
format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)
@@ -472,7 +471,6 @@ module SiSU_HTML_Seg
elsif dob.is==:table
sto.table
elsif dob.is==:break
- sto.break
end
if @md.flag_separate_endnotes
dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type
diff --git a/lib/sisu/v3/html_tune.rb b/lib/sisu/v3/html_tune.rb
index a1c9a8dc..05126ede 100644
--- a/lib/sisu/v3/html_tune.rb
+++ b/lib/sisu/v3/html_tune.rb
@@ -101,7 +101,7 @@ module SiSU_HTML_Tune
end
def clean
html=@html
- str=if html.class==String
+ str=if html.is_a?(String)
html
else html.obj
end
@@ -354,7 +354,7 @@ module SiSU_HTML_Tune
gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
- gsub(/^#{Mx[:gl_bullet]}/m,'●&nbsp;&nbsp;').
+ gsub(/#{Mx[:gl_bullet]}/m,'●&nbsp;&nbsp;').
gsub(/#{Mx[:nbsp]}/,'&nbsp;').
gsub(/<(p|br)>/,'<\1 />')
dob=SiSU_HTML_Tune::CleanHTML.new(dob).clean
diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb
index c4eed640..2e0fb92c 100644
--- a/lib/sisu/v3/hub.rb
+++ b/lib/sisu/v3/hub.rb
@@ -59,8 +59,33 @@
module SiSU
require_relative 'constants' # constants.rb
require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
include SiSU_Screen
- @@pwd_the=Dir.pwd
+ require_relative 'options' # options.rb
+ require_relative 'param' # param.rb
+ include SiSU_Param
+ require_relative 'defaults' # defaults.rb
+ include SiSU_Viz
+ require_relative 'help' # help.rb
+ include SiSU_Help
+ require 'uri'
+ class HubMaster
+ def initialize(argv)
+ pwd_the=Dir.pwd
+ begin #% select what to do
+ home=ENV['HOME']
+ opt=SiSU_Commandline::Options.new(argv)
+ SiSU::Processing.new(opt).actions
+ rescue
+ cmd=(opt ? opt.cmd : '')
+ SiSU_Screen::Ansi.new(cmd,$!,$@).rescue do
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ Dir.chdir(pwd_the)
+ end
+ end
+ end
class OptionLoopFiles
def initialize(opt)
@opt=opt
@@ -116,7 +141,7 @@ module SiSU
number_of_files={}
@opt.files.each_with_index do |fns,i|
fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'')
- if number_of_files[fn].class == Array
+ if number_of_files[fn].is_a?(Array)
number_of_files[fn] << i
else
number_of_files.store(fn,[i])
@@ -184,23 +209,16 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
require_relative 'cgi' # cgi.rb
SiSU_CGI::SearchSQL.new(@opt).read
end
- def encoding # -K build character encoding db (uses KirbyBase)
- require_relative 'character_encoding' # character_encoding.rb
- SiSU_CharacterEncode::Create.new.db
- end
def termsheet # -t
system("sisu_termsheet #{@opt.cmd} #{@opt.fns}\n")
@@n_do=@@n_do+1
SiSU_Screen::Ansi.new(@opt.cmd,@@n_do,'Termsheet(s) processed').term_sheet_title unless @opt.act[:quiet][:set] ==:on
end
def webrick # -W
- port=prt=@fns
- prt=if prt !~/\d+/
- 'webrick default (sysenv)'
- else "webrick port set to #{prt}"
- end
+ prt=SiSU_Env::InfoEnv.new(@fns).port.webrick_port
puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} }
- system("sisu_webrick #{port}&\n")
+ require_relative 'webrick'
+ SiSU_Webserv::WebrickStart.new
end
def not_found
puts "\n#{@cX.fuschia}FILE NOT FOUND:#{@cX.off} << #{@opt.fns} >> - requested #{@opt.cmd} processing skipped\n"
@@ -229,10 +247,11 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
class Processing
require 'fileutils'
include FileUtils
- @@env=SiSU_Env::InfoEnv.new
+ @@env=nil
attr_accessor :op
def initialize(opt)
@opt=opt
+ @@env=SiSU_Env::InfoEnv.new
@msg,@msgs='',nil
@tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }
end
@@ -501,10 +520,8 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
def do_initialization
@cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
flag=SiSU_Env::InfoProcessingFlag.new
- if @opt.cmd =~/[vVM]/ #% version information
- unless @opt.files.empty?
- SiSU_Help::Help.new('env',@opt).sisu_version
- end
+ if @opt.act[:version_info][:set]==:on #% version information
+ SiSU_Help::Help.new('env',@opt).sisu_version
end
if @opt.act[:license][:set]==:on #% license information
SiSU_Help::Help.new('license',@opt).help_request
@@ -692,33 +709,5 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on
end
end
end
- begin #% select what to do
- if RUBY_VERSION < '1.9'
- require 'jcode'
- $KCODE='UTF8'
- end
- require_relative 'constants' # constants.rb
- require_relative 'options' # options.rb
- require_relative 'sysenv' # sysenv.rb
- include SiSU_Env; include SiSU_Screen
- require_relative 'param' # param.rb
- include SiSU_Param
- require_relative 'defaults' # defaults.rb
- include SiSU_Viz
- require_relative 'help' # help.rb
- include SiSU_Help
- require 'uri'
- home=ENV['HOME']
- argv=$*
- @opt=SiSU_Commandline::Options.new(argv)
- SiSU::Processing.new(@opt).actions
- rescue
- cmd=(@opt ? @opt.cmd : '')
- SiSU_Screen::Ansi.new(cmd,$!,$@).rescue do
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- Dir.chdir(@@pwd_the)
- end
end
__END__
diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb
index 20983d7f..58f2d8eb 100644
--- a/lib/sisu/v3/manifest.rb
+++ b/lib/sisu/v3/manifest.rb
@@ -87,7 +87,7 @@ module SiSU_Manifest
url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}"
@opt.cmd=~/[MVvz]/ \
? SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"#{xbrowser} #{url_html}").green_hi_blue
- : SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").grey_title_hi
+ : SiSU_Screen::Ansi.new(@opt.cmd,'Manifest',"[#{@opt.f_pth[:lng_is]}]", "#{url_html}").grey_title_grey_blue
SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i
end
data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions
@@ -111,7 +111,7 @@ module SiSU_Manifest
@base_url="#{@env.url.root}/#{@fnb}"
@o_str=SiSU_Env::FileOp.new(md).output_dir_structure
@image_path=if @o_str.dump_or_redirect?
- %{./image}
+ './image'
else
%{#{@f.path_rel_links.html_scroll_2}_sisu/image_sys}
end
@@ -155,9 +155,9 @@ module SiSU_Manifest
end
def summarize_sources(id,file,pth,rel,url)
sys=SiSU_Env::SystemCall.new
- dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{pth}/#{file}")
- else sys.md5("#{pth}/#{file}")
- end
+ dgst=(@dg =~/^sha(?:2|256)$/) \
+ ? sys.sha256("#{pth}/#{file}")
+ : sys.md5("#{pth}/#{file}")
SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/
size=(File.size("#{pth}/#{file}")/1024.00).to_s
kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
@@ -225,13 +225,13 @@ module SiSU_Manifest
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)
- static=if url =~/^\.\//; url.gsub(/^\.(\.)?/,@base_url)
- elsif url =~/^\.\.\//; url.gsub(/^\.(\.)?/,@env.url.root)
- else url
+ static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url)
+ 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">&nbsp;&nbsp;#{@brace_url.xml_open}<a href="#{static}">#{static}</a>#{@brace_url.xml_close}</p></td></tr>\n}
end
@@ -406,11 +406,11 @@ module SiSU_Manifest
summarize(id,file,pth,rel,url)
end
if FileTest.file?(@f.place_file.txt.dir)==true
- if @md.opt.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)'
- elsif @md.opt.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)'
- elsif @md.opt.cmd =~/A/; id='Plaintext (dos (UTF-8) with footnotes)'
- elsif @md.opt.cmd =~/E/; id='Plaintext (dos (UTF-8) with endnotes)'
- else id='Plaintext (UTF-8)'
+ id=if @md.opt.cmd =~/a/ then 'Plaintext (Unix (UTF-8) with footnotes)'
+ elsif @md.opt.cmd =~/e/ then 'Plaintext (Unix (UTF-8) with endnotes)'
+ elsif @md.opt.cmd =~/A/ then 'Plaintext (dos (UTF-8) with footnotes)'
+ elsif @md.opt.cmd =~/E/ then 'Plaintext (dos (UTF-8) with endnotes)'
+ else 'Plaintext (UTF-8)'
end
pth=@f.output_path.txt.dir
rel=@f.output_path.txt.rel_sm
@@ -697,9 +697,15 @@ WOK
@manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{@translate.topic_register}:</p></th><td>\n}
@md.topic_register_array.each do |t|
t.each_with_index do |st,i|
- if st.class==Array
+ if st.is_a?(Array)
st.each do |v|
- @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n}
+ if v.is_a?(Array)
+ v.each do |w,i|
+ @manifest[:html] << %{<p class="it#{i}">#{w}</p>\n}
+ end
+ else
+ @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n}
+ end
end
else @manifest[:html] << %{<p class="it#{i}">#{st}</p>\n}
end
@@ -749,9 +755,9 @@ WOK
and @md.lnk
@md.lnk.each do |l|
if defined? l[:say]
- target=if l[:url] !~/^\.(\.)?\//; 'external'
- else '_top'
- end
+ target=(l[:url] !~/^\.(\.)?\//) \
+ ? 'external'
+ : '_top'
url,lnk=l[:url],l[:say]
unless url.nil? \
or url.empty?
diff --git a/lib/sisu/v3/manpage.rb b/lib/sisu/v3/manpage.rb
index d292900c..81f2ed2c 100644
--- a/lib/sisu/v3/manpage.rb
+++ b/lib/sisu/v3/manpage.rb
@@ -136,9 +136,9 @@ module SiSU_Manpage
end
notes=@n.flatten
notes.each do |e|
- util=if e.to_s =~/^\[[\d*+]+\]:/; SiSU_TextUtils::Wrap.new(e.to_s,78,4,1)
- else SiSU_TextUtils::Wrap.new(e.to_s,78,0,1)
- end
+ util=(e.to_s =~/^\[[\d*+]+\]:/) \
+ ? (SiSU_TextUtils::Wrap.new(e.to_s,78,4,1))
+ : (SiSU_TextUtils::Wrap.new(e.to_s,78,0,1))
wrap=util.line_wrap
wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
wrap.gsub(/(^|&nbsp;|#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*'). #man page requires
@@ -415,7 +415,7 @@ WOK
filename_manpage=SiSU_Env::FileOp.new(@md).write_file.manpage
@sisu=[]
@content.each do |para| # this is a hack
- if para.class==Array \
+ if para.is_a?(Array) \
and para.length > 0
para.each do |line|
line=line.gsub(/\s+$/m,'')
diff --git a/lib/sisu/v3/manpage_format.rb b/lib/sisu/v3/manpage_format.rb
index 8698ee40..a102b094 100644
--- a/lib/sisu/v3/manpage_format.rb
+++ b/lib/sisu/v3/manpage_format.rb
@@ -76,11 +76,6 @@ module SiSU_ManpageFormat
class FormatTextObject
def initialize(md,dob)
@md,@dob=md,dob
-if @dob.class==Hash
- puts __FILE__ + ' ' + __LINE__.to_s #+ "-->\n" + caller.inspect
-elsif @dob.class==String
- puts __FILE__ + ' ' + __LINE__.to_s #+ "-->\n" + caller.inspect
-end
rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:en_a_c]}/
@dob.obj.gsub!(rgx,'\1') if @dob.obj =~rgx
@vz=SiSU_Env::GetInit.instance.skin
diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb
index 4985b3dd..807d2832 100644
--- a/lib/sisu/v3/odf.rb
+++ b/lib/sisu/v3/odf.rb
@@ -101,7 +101,7 @@ module SiSU_ODF
require_relative 'defaults' # defaults.rb
require_relative 'shared_txt' # shared_txt.rb
@@img_count=0
- @@odf={ body: [], open: [], close: [], head: [], metadata: [], tail: [], endnotes: [] }
+ @@odf={ body: [], head: [], toc: [], metadata: [], tail: [], book_idx: [], endnotes: [] }
@@docstart=true
@@fns=nil
def initialize(particulars)
@@ -137,13 +137,26 @@ module SiSU_ODF
if n =~/#{Mx[:br_line]}/
fix=n.split(/#{Mx[:br_line]}/) #watch #added
fix.each do |x|
- if x =~/\S+/; @n << x
+ if x =~/\S+/ then @n << x
end
end
else @n << n
end
end
end
+ def odf_book_idx
+ if @md.book_idx
+ idx_arr,idx_raw=[],SiSU_Particulars::CombinedSingleton.instance.get_idx_raw(@md.opt).raw_idx
+ idx_raw.each do |x|
+ x=if x.is_a?(String)
+ SiSU_ODF_Format::FormatBookIndex.new(x).book_idx_bookmark
+ else nil
+ end
+ idx_arr << x.strip if x.is_a?(String)
+ end
+ @@odf[:book_idx]=idx_arr.join
+ end
+ end
def odf_metadata
@@odf[:metadata]=SiSU_Metadata::Summary.new(@md).odf.metadata
end
@@ -162,8 +175,10 @@ module SiSU_ODF
@@odf[:tail] << %{\n<text:p text:style-name="P_normal">SiSU: &lt;<text:a xlink:type="simple" xlink:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>&gt; and &lt;<text:a xlink:type="simple" xlink:href="http://www.sisudoc.org">www.sisudoc.org</text:a>&gt;</text:p>}
@@odf[:tail] << "\n</office:text></office:body></office:document-content>"
end
- def heading(dob,p_num='')
- dob.obj=dob.obj.gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check
+ def set_bookmark_tag(dob)
+ tags=SiSU_ODF_Format::Tags.new.set_bookmark_tag(dob)
+ end
+ def heading(dob,p_num)
m=/#{$1}/
breakpage=''
if @md.fns \
@@ -180,7 +195,19 @@ module SiSU_ODF
end
end
@@docstart=false
- dob.obj=%{#{breakpage}<text:h text:style-name="H_#{dob.ln}" text:outline-level="#{dob.ln}">#{dob.obj}#{p_num}</text:h>}
+ dob.tmp=dob.obj
+ dob.obj=%{#{breakpage}<text:h text:style-name="H_#{dob.ln}" text:outline-level="#{dob.ln}">#{p_num[:set_ref]}#{set_bookmark_tag(dob)}#{dob.obj}#{p_num[:display]}</text:h>}
+ dob
+ end
+ def toc(dob,p_num)
+ m=/#{$1}/
+ hardspace=(dob.lv =~/[A-C]/i) \
+ ? '<text:p text:style-name="Standard"/>'
+ : ''
+ toc_heading=dob.ocn \
+ ? %{<text:bookmark-ref text:reference-format="text" text:ref-name="#{dob.ocn}">#{dob.tmp}</text:bookmark-ref>}
+ : dob.tmp
+ dob.obj=%{<text:h text:style-name="H_#{dob.ln}" text:outline-level="#{dob.ln}">#{toc_heading}</text:h>#{hardspace}}
dob
end
def image_src(i)
@@ -244,7 +271,7 @@ module SiSU_ODF
dob.obj.scan(/(#{Mx[:lnk_o]}[ ]*(.+?)[ ]*#{Mx[:lnk_c]}(image))/)
else nil
end
- if m; m.each do |i|
+ if m then m.each do |i|
cont,url=i[1],i[2]
cont=cont.gsub(/([)(\]\[])/,"\\\\\\1").
gsub(/([+?])/,"\\\\\\1") # incorrect handling of +
@@ -282,6 +309,10 @@ module SiSU_ODF
end
t
end
+ def text_link_odf_bookmark(txt,url,trail)
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map
+ %{<text:bookmark-ref text:reference-format="text" text:ref-name="#{url}">#{txt.strip}</text:bookmark-ref>#{trail}}
+ end
def text_link(dob)
m=dob.obj.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]})/) #sort
if m
@@ -305,6 +336,19 @@ module SiSU_ODF
txt=txt.gsub(/([)(\]\[])/,"\\\\\\1").
gsub(/([+?*])/,"\\\\\\1") # problems with +
url=url.gsub(/([+?])/,"\\\\\\1") # problems with +
+ dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{url}#{Mx[:rel_c]}/m,text_link_odf_bookmark(txt,url,trail)). #make sure trailing ']' are not caught in url
+ gsub(/\\([)(\]\[?])/,'\1') #clumsy fix
+ end
+ m=nil
+ end
+ dob
+ end
+ def text_link_relative_(dob)
+ m=dob.obj.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]})/) #sort
+ if m
+ m.each do |i|
+ txt,url,trail=i[1],i[2]
+ txt=txt.gsub(/([)(\]\[])/,"\\\\\\1")
dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{url}#{Mx[:rel_c]}/m,text_link_odf(txt,url,trail)). #make sure trailing ']' are not caught in url
gsub(/\\([)(\]\[?])/,'\1') #clumsy fix
end
@@ -312,7 +356,7 @@ module SiSU_ODF
end
dob
end
- def normal(dob,p_num='') #P1 - P3
+ def normal(dob,p_num) #P1 - P3
dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
'<text:a xlink:type="simple" xlink: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]}/,
@@ -322,12 +366,12 @@ module SiSU_ODF
dob.obj= if dob.is==:para \
and dob.indent.to_s =~/[0-9]/ \
and dob.indent == dob.hang
- %{<text:p text:style-name="P_indent_#{dob.indent}">#{dob.obj}#{p_num}</text:p>}
+ %{<text:p text:style-name="P_indent_#{dob.indent}">#{p_num[:set_ref]}#{set_bookmark_tag(dob)}#{dob.obj}#{p_num[:display]}</text:p>}
elsif dob.is==:para \
and dob.hang.to_s =~/[0-9]/ \
and dob.indent != dob.hang
- %{<text:p text:style-name="P_h#{dob.hang}_i#{dob.indent}">#{dob.obj}#{p_num}</text:p>}
- else %{<text:p text:style-name="P_normal">#{dob.obj}#{p_num}</text:p>}
+ %{<text:p text:style-name="P_h#{dob.hang}_i#{dob.indent}">#{p_num[:set_ref]}#{set_bookmark_tag(dob)}#{dob.obj}#{p_num[:display]}</text:p>}
+ else %{<text:p text:style-name="P_normal">#{p_num[:set_ref]}#{set_bookmark_tag(dob)}#{dob.obj}#{p_num[:display]}</text:p>}
end
dob
end
@@ -341,8 +385,8 @@ module SiSU_ODF
str
end
def footnote(t_o)
- str=if defined? t_o.obj; t_o.obj
- elsif t_o.class==String; t_o
+ str=if defined? t_o.obj then t_o.obj
+ elsif t_o.is_a?(String) then t_o
end
if str
@astx||=10000
@@ -376,8 +420,8 @@ module SiSU_ODF
end
end
end
- if defined? t_o.obj; t_o.obj=str
- elsif t_o.class==String; t_o=str
+ if defined? t_o.obj then t_o.obj=str
+ elsif t_o.is_a?(String) then t_o=str
end
t_o
end
@@ -390,12 +434,13 @@ module SiSU_ODF
end
def poem(dob,p_num) #P4 #same as group
parray=[]
- dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
+ 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)
- parray << %{<text:p text:style-name="P_group">#{parablock}</text:p>} if parablock =~/\S+/
+ parray << %{<text:p text:style-name="P_group">#{set_ref}#{parablock}</text:p>} if parablock =~/\S+/
end
dob.obj=parray.join \
- + %{<text:p text:style-name="P_group">#{p_num}</text:p>} \
+ + %{<text:p text:style-name="P_group">#{p_num[:display]}</text:p>} \
+ '<text:p text:style-name="Standard"/>'
dob
end
@@ -407,7 +452,8 @@ module SiSU_ODF
%{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}).
gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
%{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
+ 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)
parablock=parablock.gsub(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">').
gsub(/&lt;(\/text:a)&gt;/,'<\1>').
@@ -415,10 +461,10 @@ module SiSU_ODF
gsub(/&lt;(text:p text:style-name="Footnote")&gt;/,'<\1>').
gsub(/&lt;(\/?text:(?:note-citation|note-body|note|p))&gt;/,'<\1>')
parablock=footnote(parablock)
- parray << %{<text:p text:style-name="P_group">#{parablock}</text:p>} if parablock =~/\S+/
+ parray << %{<text:p text:style-name="P_group">#{set_ref}#{parablock}</text:p>} if parablock =~/\S+/
end
dob.obj=parray.join \
- + %{<text:p text:style-name="P_group">#{p_num}</text:p>} \
+ + %{<text:p text:style-name="P_group">#{p_num[:display]}</text:p>} \
+ '<text:p text:style-name="Standard"/>'
dob
end
@@ -430,7 +476,8 @@ module SiSU_ODF
%{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}).
gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
%{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
+ 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)
parablock=parablock.gsub(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">').
gsub(/&lt;(\/text:a)&gt;/,'<\1>').
@@ -438,10 +485,10 @@ module SiSU_ODF
gsub(/&lt;(text:p text:style-name="Footnote")&gt;/,'<\1>').
gsub(/&lt;(\/?text:(?:note-citation|note-body|note|p))&gt;/,'<\1>')
parablock=footnote(parablock)
- parray << %{<text:p text:style-name="P_group">#{parablock}</text:p>} if parablock =~/\S+/
+ parray << %{<text:p text:style-name="P_group">#{set_ref}#{parablock}</text:p>} if parablock =~/\S+/
end
dob.obj=parray.join \
- + %{<text:p text:style-name="P_group">#{p_num}</text:p>} \
+ + %{<text:p text:style-name="P_group">#{p_num[:display]}</text:p>} \
+ '<text:p text:style-name="Standard"/>'
dob
end
@@ -449,15 +496,16 @@ module SiSU_ODF
if dob.is==:code
dob.obj=dob.obj.gsub(/\s\s/,'&#160;&#160;')
parray=[]
- dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
+ 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)
parablock=parablock.gsub(/^\s*$/,'<br />').
gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
'<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
- parray << %{<text:p text:style-name="P_code">#{parablock}</text:p>} if parablock =~/\S+/
+ parray << %{<text:p text:style-name="P_code">#{set_ref}#{parablock}</text:p>} if parablock =~/\S+/
end
dob.obj=parray.join \
- + %{<text:p text:style-name="P_group">#{p_num}</text:p>} \
+ + %{<text:p text:style-name="P_group">#{p_num[:display]}</text:p>} \
+ '<text:p text:style-name="Standard"/>'
end
dob
@@ -490,18 +538,22 @@ module SiSU_ODF
dob
else dob
end
- p_num=''
- if @env.odt_ocn?
- if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
- if defined? dob.ocn \
- and not dob.ocn.nil?
- p_num=SiSU_ODF_Format::ParagraphNumber.new(dob.ocn).display
- end
+ p_num={ display: '', set_ref: '' }
+ if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
+ if defined? dob.ocn \
+ and dob.ocn.is_a?(Fixnum)
+ p_num=SiSU_ODF_Format::ParagraphNumber.new(dob.ocn).set_bookmark_and_display
+ #p_num=SiSU_ODF_Format::ParagraphNumber.new(dob.ocn).set_ref_and_display
end
end
dob=footnote(dob)
if dob.is==:heading
@@odf[:body] << heading(dob,p_num).obj << @br*2
+ if SiSU_Env::ProcessingSettings.new(md).build.toc?
+ if dob.lv =~/[A-C1]/i
+ @@odf[:toc] << toc(dob,p_num).obj
+ end
+ end
elsif dob.is ==:verse
@@odf[:body] << poem(dob,p_num).obj << @br*2
elsif dob.is==:group
@@ -539,6 +591,7 @@ module SiSU_ODF
else STDERR.puts %{\t*WARN* did not find image - "#{bullet}/bullet_09.png" [#{__FILE__}:#{__LINE__}]}
end
end
+ odf_book_idx
odf_metadata
data.each do |dob|
#p dob.obj if dob.obj =~safe_characters and @md.opt.cmd =~/V/ #KEEP
@@ -573,7 +626,7 @@ module SiSU_ODF
dob.obj=dob.obj.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
- gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,''). #check
+ gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'<text:bookmark-start text:name="\1"/><text:bookmark-end text:name="\1"/>'). #check
gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;').
gsub(/#{Mx[:mk_o]}[~-]##{Mx[:mk_c]}/,'')
@@ -693,14 +746,19 @@ WOK
def publish
divider='='
content=[]
+ br_pg='<text:p text:style-name="P_normal_page_new"> </text:p>'
data=@data
- content << @@odf[:open]
- content << @@odf[:head]
- content << @@odf[:body]
- content << @@odf[:metadata]
- content << @@odf[:tail]
+ content <<
+ @@odf[:head] <<
+ @@odf[:toc] <<
+ br_pg <<
+ @@odf[:body] <<
+ @@odf[:book_idx] <<
+ br_pg <<
+ @@odf[:metadata] <<
+ @@odf[:tail]
SiSU_ODF::Source::Output.new(content,@md,@env).odf
- @@odf[:head],@@odf[:body],@@odf[:tail],@@odf[:metadata]=[],[],[],[]
+ @@odf={ head: [], toc: [], body: [], tail: [], book_idx: [], metadata: [] }
end
end
class Output <Source
@@ -739,7 +797,7 @@ WOK
env.make_path(@md.file.output_path.odt.dir)
filename="#{@env.processing_path.odt}/content.xml"
od=File.new(filename,'w+')
- @content.each do |para| # this is a hack
+ @content.compact.each do |para| # this is a hack
od.puts para unless para =~/\A\s*\Z/
end
od.close
@@ -759,45 +817,3 @@ WOK
end
end
__END__
-todo:
-* table of contents
-* page header/footer?
-
-done:
-headings *
-footnotes *
-bold underscore italics strikethrough *
-superscript subscript *
-extended ascii set *
-indents *
- [autonomy_markup0.sst] *
-groups
- poem *
- code *
- tables
-images
-bullet
-line break
-page break
-
-notes?? [you could add a note number for every object/paragraph!]
-
- FileUtils::cd(@env.processing_path.odt)
- structure=[]
- Find.find(@env.processing_path.odt) do |f|
- structure << puts f
- end
- open(opendoc,'wb') do |f|
- zip=Zlib::ZipWriter.new(f)
- structure.each |z| do
- zip << z
- end
- zip.close
- end
- #zip -qr #{opendoc} *
- FileUtils::mv(opendoc,"#{@env.path.output}/#{@md.fnb}/.")
- FileUtils::cd(Dir.pwd)
-●
-<text:span text:style-name="T6">●</text:span> #bullet
-dob.obj.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})\s*#{Mx[:gl_bullet]}/,'\1 <text:span text:style-name="T6">·</text:span> ') #bullet
-dob.obj.gsub!(/^#{Mx[:gl_bullet]}/,'<text:span text:style-name="T6">·</text:span> ') #bullet
diff --git a/lib/sisu/v3/odf_format.rb b/lib/sisu/v3/odf_format.rb
index ae5c4aec..adfcf684 100644
--- a/lib/sisu/v3/odf_format.rb
+++ b/lib/sisu/v3/odf_format.rb
@@ -63,8 +63,15 @@ module SiSU_ODF_Format
def initialize(paranum)
@paranum=/(\d+)/m.match(paranum.to_s)[1]
end
- def display
- @paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript">[\1]</text:span>')
+ def set_ref_and_display
+ set_ref=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript"><text:reference-mark-start text:name="\1"/><text:reference-mark-end text:name="\1"/></text:span>')
+ disp=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript">[\1]</text:span>')
+ ocn={ display: disp, set_ref: set_ref }
+ end
+ def set_bookmark_and_display
+ set_ref=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript"><text:bookmark-start text:name="\1"/><text:bookmark-end text:name="\1"/></text:span>')
+ disp=@paranum.gsub(/(\d+)/,' <text:span text:style-name="Span_subscript">[\1]</text:span>')
+ ocn={ display: disp, set_ref: set_ref }
end
def name
@paranum.gsub(/(\d+)/,'<a name="\1"></a>')
@@ -73,10 +80,54 @@ module SiSU_ODF_Format
@paranum.gsub(/(\d+)/,'<a href="#\1">')
end
end
+ class FormatBookIndex
+ def initialize(idx_str)
+ @idx_str=idx_str
+ end
+ def book_idx_bookmark
+ map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags
+ rgx_bookmark=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}#?\S+?#{Mx[:rel_c]}/m
+ while @idx_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
+ link,url=link.strip,url.strip
+ @idx_str=@idx_str.gsub(/&/m,"&amp;")
+ ocn_lnk=if map_nametags[url] \
+ and map_nametags[url][:ocn]
+ map_nametags[url][:ocn]
+ else nil
+ end
+ ocn_lnk=(url=~/^\d+$/ ? url : ocn_lnk)
+ if ocn_lnk and not ocn_lnk.empty?
+ @idx_str=@idx_str.sub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
+ '<text:span text:style-name="Span_bold">\1</text:span>').
+ sub(rgx_bookmark,
+ %{<text:bookmark-ref text:reference-format="text" text:ref-name="#{url}">#{link.strip}</text:bookmark-ref>})
+ else
+ puts %{name tag: "#{url}" not found}
+ @idx_str.sub!(rgx_bookmark,"#{link}")
+ end
+ end
+ @idx_str=@idx_str.gsub(/#{Xx[:protect]}/m,'').
+ sub(/,\s*$/m,'').
+ gsub(/\n/,'')
+ @idx_str='<text:p text:style-name="P_normal">' + @idx_str + '</text:p>'
+ end
+ end
+ class Tags
+ def set_bookmark_tag(dob)
+ tags=''
+ if dob.tags.length > 0
+ dob.tags.each do |tag|
+ tags +=%{ <text:span text:style-name="Span_subscript"><text:bookmark-start text:name="#{tag}"/><text:bookmark-end text:name="#{tag}"/></text:span>}
+ end
+ end
+ tags
+ end
+ end
class FormatTextObject
def initialize(md,t_o)
@md,@t_o=md,t_o
- if t_o.class==Hash
+ if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
else
p t_o.class
@@ -116,9 +167,9 @@ module SiSU_ODF_Format
end
end
def table_head_open(count)
- type=if @dob.head_; 1
- else 2
- end
+ type=(@dob.head_) \
+ ? 1
+ : 2
alpha=case @dob.cols
when 1; 'A'
when 2; 'B'
@@ -136,12 +187,13 @@ module SiSU_ODF_Format
when 14; 'N'
else 'D'
end
- %{<table:table table:name="Table#{count}" table:style-name="Table#{type}">#{@br}} +
+ tag=SiSU_ODF_Format::Tags.new.set_bookmark_tag(@dob)
+ %{<table:table table:name="Table#{count}" table:style-name="Table#{type}">#{@p_num[:set_ref]}#{tag}#{@br}} +
%{<table:table-column table:style-name="Table#{type}.#{alpha}" table:number-columns-repeated="#{@dob.cols}"/>#{@br}}
end
def table_close(tablefoot='')
'</table:table>' \
- + %{<text:p text:style-name="P_group">#{@p_num}</text:p>}
+ + %{<text:p text:style-name="P_group">#{@p_num[:display]}</text:p>}
end
def table_tag_cell(str,i)
txt_name_cell=if i==0 \
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb
index 7aa3622d..39c392a9 100644
--- a/lib/sisu/v3/options.rb
+++ b/lib/sisu/v3/options.rb
@@ -57,11 +57,12 @@
=end
module SiSU_Commandline
- require "pathname"
+ require 'pathname'
require_relative 'sysenv' # sysenv.rb
@@base_path=nil
class Options
attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what
+ @@act=nil
def initialize(a)
@cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','','',''
@f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]}
@@ -185,10 +186,13 @@ module SiSU_Commandline
@mod=['--v3']
@cmd=shortcut.cf_0 + 'm'
end
- SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/
+ if @cmd =~/[vVM]/ \
+ && @cmd !~/-vu?$/
+ SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown
+ end
end
# @files=@files.uniq
- @act=opt_act
+ @@act ? @act=@@act : @@act=@act=opt_act
@files
self
end
@@ -212,7 +216,7 @@ module SiSU_Commandline
if x =~/^(?:https?|file):\/\/\S+/ #\
end
pwd=Dir.pwd
- fn_pod=x.gsub(/.+?([^\/]+)\.txz$/,'\1')
+ fn_pod=x.gsub(/([^\/]+)\.txz$/,'\1')
fullname=@env.processing_path.processing + '/sisupod/' + fn_pod
pt=Pathname.new(fullname)
FileUtils::mkdir_p(pt.to_s)
@@ -220,7 +224,7 @@ module SiSU_Commandline
options=s.gsub(/(\s+--?\S+)+.+/,'\1')
system("
chdir #{fullname}
- tar xaf #{x}
+ tar xaf #{pwd}/#{x}
chdir #{pwd}
")
Dir.chdir(pt.realpath.to_s + '/sisupod/doc')
@@ -315,9 +319,9 @@ module SiSU_Commandline
else puts "file not found: #{x}"
end
elsif x =~ /\.termsheet\.rb$/
- if FileTest.file?(x); f << x
- else puts "file not found: #{x}"
- end
+ (FileTest.file?(x)) \
+ ? (f << x)
+ : (puts "file not found: #{x}")
else w=x
puts "#{x} in #{a.join(' ')}?"
end
@@ -456,334 +460,342 @@ module SiSU_Commandline
end
def opt_act #note mod line commands have already been converted to command characters, cmd
cmd,mod=@cmd,@mod
- act={}
- act[:license]=(cmd =~/L/ \
- || mod.inspect =~/"--license/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:site_init]=(cmd =~/C/ \
- || mod.inspect =~/"--init-site"|"--configure"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:rc]=if mod.inspect =~/"--rc=/
- x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'')
- { bool: true, set: :on, inst: x }
- else
- { bool: false, set: :na, inst: '' }
- end
- act[:processing_path]=if mod.inspect =~/"--processing-path=/
- base_pth=mod.join(';').gsub(/^.*--processing-path=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
- { bool: true, set: :on, inst: base_pth }
- elsif mod.inspect =~/"--processing-path/
- { bool: true, set: :on, inst: @base_path }
- else
- { bool: false, set: :na, inst: nil }
- end
- act[:dump]=if mod.inspect =~/"--dump=/
- base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
- { bool: true, set: :on, inst: base_pth }
- elsif mod.inspect =~/"--dump/
- { bool: true, set: :on, inst: @base_path }
+ @@act=if @@act
+ @act=@@act
else
- { bool: false, set: :na, inst: nil }
- end
- act[:redirect]=if mod.inspect =~/"--redirect=/
- base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
- { bool: true, set: :on, inst: base_pth }
- elsif mod.inspect =~/"--redirect/
- { bool: true, set: :on, inst: @base_path }
- else
- { bool: false, set: :na, inst: nil }
- end
- act[:verbose]=(cmd =~/v/ \
- || mod.inspect =~/"--verbose"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:quiet]=(cmd =~/q/ \
- || mod.inspect =~/"--quiet"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--color-off"/
- { bool: false, set: :off }
- else { bool: true, set: :na } #fix default color
- end
-# act[:color_toggle]=if cmd =~/c/ \
-# or mod.inspect =~/"--color-toggle"/
-# true
-# else false
-# end
- act[:maintenance]=(cmd =~/M/ \
- || mod.inspect =~/"--maintenance|--keep-processing-files"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:profile]=(cmd =~/E/ \
- || mod.inspect =~/"--profile"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:switch]=if mod.inspect =~/"--switch-off=/
- off_list=mod.join(';').gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1')
- off_list=off_list.scan(/[^,;\s]+/)
- { bool: false, set: :off, off: off_list}
- else { bool: true, set: :na, off: [] }
- end
- act[:output_by]=if mod.inspect =~/"--(?:output-)?by-language"/
- { set: :language }
- elsif mod.inspect =~/"--(?:output-)?by-filename"/
- { set: :filename }
- elsif mod.inspect =~/"--(?:output-)?by-filetype"/
- { set: :filetype }
- else { set: :na }
- end
- act[:ocn]=if mod.inspect =~/"--inc-ocn"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-ocn"/ \
- || act[:switch][:off].inspect =~/"ocn"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:toc]=if mod.inspect =~/"--inc-toc"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-toc"/ \
- || act[:switch][:off].inspect =~/"toc"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:minitoc]=if mod.inspect =~/"--inc-minitoc"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-minitoc"/ \
- || act[:switch][:off].inspect =~/"minitoc"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:manifest]=if mod.inspect =~/"--inc-manifest"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \
- || act[:switch][:off].inspect =~/"manifest"/
- { bool: false, set: :off }
- elsif act[:manifest]=(cmd =~/y/ \
- || mod.inspect =~/"--manifest"/)
- { bool: true, set: :on }
- else { bool: true, set: :na }
- end
- act[:links_to_manifest]=if mod.inspect =~/"--inc-links-to-manifest"|"--inc-manifest-links"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \
- || act[:switch][:off].inspect =~/"links_to_manifest"|"manifest_links"|"--(?:exc|no)-manifest"/ \
- || mod.inspect =~/"--(?:redirect|dump)/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:manifest_minitoc]=if mod.inspect =~/"--inc-manifest-minitoc"|"--inc-minitoc"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-manifest-minitoc"|"--(?:exc|no)-minitoc"/ \
- || act[:switch][:off].inspect =~/"manifest_minitoc"|"minitoc"/
- #|| mod.inspect =~/"--(?:redirect|dump)/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:metadata]=if mod.inspect =~/"--inc-metadata"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-metadata"/ \
- || act[:switch][:off].inspect =~/"metadata"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:html_minitoc]=if mod.inspect =~/"--inc-html-minitoc"|"--inc-minitoc"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-html-minitoc"|"--(?:exc|no)-minitoc"/ \
- || act[:switch][:off].inspect =~/"html_minitoc"|"minitoc"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:html_navigation]=if mod.inspect =~/"--inc-html-navigation"|"--inc-navigation"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-html-navigation"|"--(?:exc|no)-navigation"/ \
- || act[:switch][:off].inspect =~/"html_navigation"|"nav"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:html_navigation_bar]=if mod.inspect =~/"--inc-html-navigation-bar"|"--inc-navigation-bar"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \
- || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:segsubtoc]=if mod.inspect =~/"--inc-segsubtoc"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-segsubtoc"/ \
- || act[:switch][:off].inspect =~/"segsubtoc"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:search_form]=if mod.inspect =~/"--inc-search-form"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-search-form"/ \
- || act[:switch][:off].inspect =~/"search_form"|"search"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:html_search_form]=if mod.inspect =~/"--inc-html-search-form"|"--inc-search-form"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-html-search-form"|"--(?:exc|no)-search-form"/ \
- || act[:switch][:off].inspect =~/"html_search_form"|"search_form"|"search"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:html_right_pane]=if mod.inspect =~/"--inc-html-right-pane"|"--inc-right-pane"|"--inc-html-right-column"|"--inc-right-column"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-html-right-pane"|"--(?:exc|no)-right-pane"|"--(?:exc|no)-html-right-column"|"--(?:exc|no)-right-column"/ \
- || act[:switch][:off].inspect =~/"html_right_pane"|"html_right_column"|"promo"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
- end
- act[:html_top_band]=if mod.inspect =~/"--inc-html-top-band"|"--inc-top-band"/
- { bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-html-top-band"|"--(?:exc|no)-top-band"/ \
- || act[:switch][:off].inspect =~/"html-top-band"|"top-band"/
- { bool: false, set: :off }
- else { bool: true, set: :na }
+ act={}
+ act[:license]=(cmd =~/L/ \
+ || mod.inspect =~/"--license/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:site_init]=(cmd =~/C/ \
+ || mod.inspect =~/"--init-site"|"--configure"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:rc]=if mod.inspect =~/"--rc=/
+ x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'')
+ { bool: true, set: :on, inst: x }
+ else
+ { bool: false, set: :na, inst: '' }
+ end
+ act[:processing_path]=if mod.inspect =~/"--processing-path=/
+ base_pth=mod.join(';').gsub(/^.*--processing-path=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
+ { bool: true, set: :on, inst: base_pth }
+ elsif mod.inspect =~/"--processing-path/
+ { bool: true, set: :on, inst: @base_path }
+ else
+ { bool: false, set: :na, inst: nil }
+ end
+ act[:dump]=if mod.inspect =~/"--dump=/
+ base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
+ { bool: true, set: :on, inst: base_pth }
+ elsif mod.inspect =~/"--dump/
+ { bool: true, set: :on, inst: @base_path }
+ else
+ { bool: false, set: :na, inst: nil }
+ end
+ act[:redirect]=if mod.inspect =~/"--redirect=/
+ base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
+ { bool: true, set: :on, inst: base_pth }
+ elsif mod.inspect =~/"--redirect/
+ { bool: true, set: :on, inst: @base_path }
+ else
+ { bool: false, set: :na, inst: nil }
+ end
+ act[:verbose]=(cmd =~/v/ \
+ || mod.inspect =~/"--verbose"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:version_info]=(cmd =~/[vVM]/ \
+ || mod.inspect =~/"--verbose"|"--maintenance"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:quiet]=(cmd =~/q/ \
+ || mod.inspect =~/"--quiet"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--color-off"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na } #fix default color
+ end
+# act[:color_toggle]=if cmd =~/c/ \
+# or mod.inspect =~/"--color-toggle"/
+# true
+# else false
+# end
+ act[:maintenance]=(cmd =~/M/ \
+ || mod.inspect =~/"--maintenance|--keep-processing-files"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:profile]=(cmd =~/E/ \
+ || mod.inspect =~/"--profile"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:switch]=if mod.inspect =~/"--switch-off=/
+ off_list=mod.join(';').gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1')
+ off_list=off_list.scan(/[^,;\s]+/)
+ { bool: false, set: :off, off: off_list}
+ else { bool: true, set: :na, off: [] }
+ end
+ act[:output_by]=if mod.inspect =~/"--(?:output-)?by-language"/
+ { set: :language }
+ elsif mod.inspect =~/"--(?:output-)?by-filename"/
+ { set: :filename }
+ elsif mod.inspect =~/"--(?:output-)?by-filetype"/
+ { set: :filetype }
+ else { set: :na }
+ end
+ act[:ocn]=if mod.inspect =~/"--inc-ocn"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-ocn"/ \
+ || act[:switch][:off].inspect =~/"ocn"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:toc]=if mod.inspect =~/"--inc-toc"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-toc"/ \
+ || act[:switch][:off].inspect =~/"toc"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:minitoc]=if mod.inspect =~/"--inc-minitoc"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-minitoc"/ \
+ || act[:switch][:off].inspect =~/"minitoc"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:manifest]=if mod.inspect =~/"--inc-manifest"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \
+ || act[:switch][:off].inspect =~/"manifest"/
+ { bool: false, set: :off }
+ elsif act[:manifest]=(cmd =~/y/ \
+ || mod.inspect =~/"--manifest"/)
+ { bool: true, set: :on }
+ else { bool: true, set: :na }
+ end
+ act[:links_to_manifest]=if mod.inspect =~/"--inc-links-to-manifest"|"--inc-manifest-links"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \
+ || act[:switch][:off].inspect =~/"links_to_manifest"|"manifest_links"|"--(?:exc|no)-manifest"/ \
+ || mod.inspect =~/"--(?:redirect|dump)/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:manifest_minitoc]=if mod.inspect =~/"--inc-manifest-minitoc"|"--inc-minitoc"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-manifest-minitoc"|"--(?:exc|no)-minitoc"/ \
+ || act[:switch][:off].inspect =~/"manifest_minitoc"|"minitoc"/
+ #|| mod.inspect =~/"--(?:redirect|dump)/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:metadata]=if mod.inspect =~/"--inc-metadata"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-metadata"/ \
+ || act[:switch][:off].inspect =~/"metadata"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_minitoc]=if mod.inspect =~/"--inc-html-minitoc"|"--inc-minitoc"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-minitoc"|"--(?:exc|no)-minitoc"/ \
+ || act[:switch][:off].inspect =~/"html_minitoc"|"minitoc"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_navigation]=if mod.inspect =~/"--inc-html-navigation"|"--inc-navigation"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-navigation"|"--(?:exc|no)-navigation"/ \
+ || act[:switch][:off].inspect =~/"html_navigation"|"nav"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_navigation_bar]=if mod.inspect =~/"--inc-html-navigation-bar"|"--inc-navigation-bar"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \
+ || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:segsubtoc]=if mod.inspect =~/"--inc-segsubtoc"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-segsubtoc"/ \
+ || act[:switch][:off].inspect =~/"segsubtoc"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:search_form]=if mod.inspect =~/"--inc-search-form"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-search-form"/ \
+ || act[:switch][:off].inspect =~/"search_form"|"search"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_search_form]=if mod.inspect =~/"--inc-html-search-form"|"--inc-search-form"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-search-form"|"--(?:exc|no)-search-form"/ \
+ || act[:switch][:off].inspect =~/"html_search_form"|"search_form"|"search"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_right_pane]=if mod.inspect =~/"--inc-html-right-pane"|"--inc-right-pane"|"--inc-html-right-column"|"--inc-right-column"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-right-pane"|"--(?:exc|no)-right-pane"|"--(?:exc|no)-html-right-column"|"--(?:exc|no)-right-column"/ \
+ || act[:switch][:off].inspect =~/"html_right_pane"|"html_right_column"|"promo"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:html_top_band]=if mod.inspect =~/"--inc-html-top-band"|"--inc-top-band"/
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--(?:exc|no)-html-top-band"|"--(?:exc|no)-top-band"/ \
+ || act[:switch][:off].inspect =~/"html-top-band"|"top-band"/
+ { bool: false, set: :off }
+ else { bool: true, set: :na }
+ end
+ act[:dal]=(cmd =~/m/ \
+ || mod.inspect =~/"--dal"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:html]=(cmd =~/h/ \
+ || mod.inspect =~/"--html"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:concordance]=(cmd =~/w/ \
+ || mod.inspect =~/"--concordance"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:images]=(cmd =~/j/ \
+ || mod.inspect =~/"--images"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:pdf]=(cmd =~/p/ \
+ || mod.inspect =~/"--pdf"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:epub]=(cmd =~/e/ \
+ || mod.inspect =~/"--epub"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:odt]=(cmd =~/o/ \
+ || mod.inspect =~/"--odt"|"--odf"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:xml_sax]=(cmd =~/x/ \
+ || mod.inspect =~/"--xml-sax"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:xml_dom]=(cmd =~/X/ \
+ || mod.inspect =~/"--xml-dom"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:xhtml]=(cmd =~/b/ \
+ || mod.inspect =~/"--xhtml"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:txt]=(cmd =~/[at]/ \
+ || mod.inspect =~/"--txt"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:manpage]=(cmd =~/i/ \
+ || mod.inspect =~/"--manpage"|"--man"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:texinfo]=(cmd =~/I/ \
+ || mod.inspect =~/"--texinfo"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:fictionbook]=(cmd =~/f/ \
+ || mod.inspect =~/"--fictionbook"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:psql]=(cmd =~/D/ \
+ || mod.inspect =~/"--pg"|"--pgsql"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:sqlite]=(cmd =~/d/ \
+ || mod.inspect =~/"--sqlite"/) \
+ && (mod.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:sqlite_discreet]=(cmd =~/d/ \
+ || mod.inspect =~/"--sql"|"--sqlite"/) \
+ && (mod.inspect =~/"--both"/ \
+ || mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:harvest]=(mod.inspect =~/"--harvest"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:po4a]=(cmd =~/P/ \
+ || mod.inspect =~/"--po4a"|"--pot?"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:git]=(cmd =~/g/ \
+ || mod.inspect =~/"--git"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:zap]=(cmd =~/Z/ \
+ || mod.inspect =~/"--zap"|"--delete"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:hash_digests]=(cmd =~/N/ \
+ || mod.inspect =~/"--hash-digests"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:sample_search_form]=(cmd =~/F/ \
+ || mod.inspect =~/"--sample-search-form"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:webrick]=(cmd =~/W/ \
+ || mod.inspect =~/"--webrick"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:share_source]=(cmd =~/s/ \
+ || mod.inspect =~/"--source"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:sisupod]=(cmd =~/S/ \
+ || mod.inspect =~/"--sisupod"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:scp]=(cmd =~/r/ \
+ || mod.inspect =~/"--scp"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:rsync]=(cmd =~/R/ \
+ || mod.inspect =~/"--rsync"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:delete_output]=(cmd =~/z/ \
+ || mod.inspect =~/"--delete"|"--zap"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:urls_all]=(cmd =~/U/ \
+ || mod.inspect =~/"--urls-all"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:urls_selected]=(cmd =~/u/ \
+ || mod.inspect =~/"--urls"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:sitemap]=(cmd =~/Y/ \
+ || mod.inspect =~/"--sitemap"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:qrcode]=(cmd =~/Q/ \
+ || mod.inspect =~/"--qrcode"/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ act[:help]=(mod.inspect =~/"--help/) \
+ ? { bool: true, set: :on }
+ : { bool: false, set: :na }
+ @act=act
end
- act[:dal]=(cmd =~/m/ \
- || mod.inspect =~/"--dal"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:html]=(cmd =~/h/ \
- || mod.inspect =~/"--html"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:concordance]=(cmd =~/w/ \
- || mod.inspect =~/"--concordance"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:images]=(cmd =~/j/ \
- || mod.inspect =~/"--images"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:pdf]=(cmd =~/p/ \
- || mod.inspect =~/"--pdf"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:epub]=(cmd =~/e/ \
- || mod.inspect =~/"--epub"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:odt]=(cmd =~/o/ \
- || mod.inspect =~/"--odt"|"--odf"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:xml_sax]=(cmd =~/x/ \
- || mod.inspect =~/"--xml-sax"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:xml_dom]=(cmd =~/X/ \
- || mod.inspect =~/"--xml-dom"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:xhtml]=(cmd =~/b/ \
- || mod.inspect =~/"--xhtml"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:txt]=(cmd =~/[at]/ \
- || mod.inspect =~/"--txt"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:manpage]=(cmd =~/i/ \
- || mod.inspect =~/"--manpage"|"--man"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:texinfo]=(cmd =~/I/ \
- || mod.inspect =~/"--texinfo"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:fictionbook]=(cmd =~/f/ \
- || mod.inspect =~/"--fictionbook"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:psql]=(cmd =~/D/ \
- || mod.inspect =~/"--pg"|"--pgsql"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:sqlite]=(cmd =~/d/ \
- || mod.inspect =~/"--sqlite"/) \
- && (mod.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:sqlite_discreet]=(cmd =~/d/ \
- || mod.inspect =~/"--sql"|"--sqlite"/) \
- && (mod.inspect =~/"--both"/ \
- || mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:harvest]=(mod.inspect =~/"--harvest"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:po4a]=(cmd =~/P/ \
- || mod.inspect =~/"--po4a"|"--pot?"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:git]=(cmd =~/g/ \
- || mod.inspect =~/"--git"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:zap]=(cmd =~/Z/ \
- || mod.inspect =~/"--zap"|"--delete"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:hash_digests]=(cmd =~/N/ \
- || mod.inspect =~/"--hash-digests"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:sample_search_form]=(cmd =~/F/ \
- || mod.inspect =~/"--sample-search-form"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:webrick]=(cmd =~/W/ \
- || mod.inspect =~/"--webrick"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:share_source]=(cmd =~/s/ \
- || mod.inspect =~/"--source"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:sisupod]=(cmd =~/S/ \
- || mod.inspect =~/"--sisupod"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:scp]=(cmd =~/r/ \
- || mod.inspect =~/"--scp"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:rsync]=(cmd =~/R/ \
- || mod.inspect =~/"--rsync"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:delete_output]=(cmd =~/z/ \
- || mod.inspect =~/"--delete"|"--zap"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:urls_all]=(cmd =~/U/ \
- || mod.inspect =~/"--urls-all"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:urls_selected]=(cmd =~/u/ \
- || mod.inspect =~/"--urls"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:sitemap]=(cmd =~/Y/ \
- || mod.inspect =~/"--sitemap"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:qrcode]=(cmd =~/Q/ \
- || mod.inspect =~/"--qrcode"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- act[:help]=(mod.inspect =~/"--help/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
- @act=act
end
def cmd
@cmd
@@ -792,7 +804,7 @@ module SiSU_Commandline
@mod
end
def act
- @act
+ @@act
end
def files_mod
files_mod=files
diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb
index f6084aab..bffba529 100644
--- a/lib/sisu/v3/param.rb
+++ b/lib/sisu/v3/param.rb
@@ -165,10 +165,11 @@ module SiSU_Param
end
def validate_length(s,l,n)
#s=(s.length <= l) ? s : nil
- s=if s.class==String \
+ s=if s.is_a?(String) \
and s.length <= l
s
- elsif s.class==NilClass; nil
+ elsif s.is_a?(NilClass)
+ nil
elsif s.class !=String
STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}"
s
@@ -226,6 +227,13 @@ module SiSU_Param
if x =~/^%\s/ #ignore comment
elsif x =~/:(\S+?):\s+(.+)/
a,b=/:(\S+?):\s+(.+)\Z/m.match(x)[1,2]
+ b=if b =~/\n/m
+ (b =~/;\n/m) \
+ ? (b.split(/;\s*\n\s*/).join(';'))
+ : (b.split(/\s*\n\s*/).join(' '))
+ else
+ b
+ end
elsif i == 0
a='main'
b=x
@@ -307,7 +315,7 @@ module SiSU_Param
names=@h['editor'] \
? name_format(@h['editor'])
: nil
- s=(names.class==Hash) \
+ s=(names.is_a?(Hash)) \
? names[:name_str]
: nil
s=if s
@@ -320,7 +328,7 @@ module SiSU_Param
names=@h['editor'] \
? name_format(@h['editor'])
: nil
- (names.class==Hash) \
+ (names.is_a?(Hash)) \
? names[:name_a_h]
: nil
end
@@ -328,7 +336,7 @@ module SiSU_Param
names=@h['contributor'] \
? name_format(@h['contributor'])
: nil
- s=(names.class==Hash) \
+ s=(names.is_a?(Hash)) \
? names[:name_str]
: nil
s=if s
@@ -341,7 +349,7 @@ module SiSU_Param
names=@h['contributor'] \
? name_format(@h['contributor'])
: nil
- (names.class==Hash) \
+ (names.is_a?(Hash)) \
? names[:name_a_h]
: nil
end
@@ -349,7 +357,7 @@ module SiSU_Param
names=@h['illustrator'] \
? name_format(@h['illustrator'])
: nil
- s=(names.class==Hash) \
+ s=(names.is_a?(Hash)) \
? names[:name_str]
: nil
s=if s
@@ -362,7 +370,7 @@ module SiSU_Param
names=@h['illustrator'] \
? name_format(@h['illustrator'])
: nil
- (names.class==Hash) \
+ (names.is_a?(Hash)) \
? names[:name_a_h]
: nil
end
@@ -370,7 +378,7 @@ module SiSU_Param
names=@h['photographer'] \
? name_format(@h['photographer'])
: nil
- s=(names.class==Hash) \
+ s=(names.is_a?(Hash)) \
? names[:name_str]
: nil
s=if s
@@ -383,7 +391,7 @@ module SiSU_Param
names=@h['photographer'] \
? name_format(@h['photographer'])
: nil
- (names.class==Hash) \
+ (names.is_a?(Hash)) \
? names[:name_a_h]
: nil
end
@@ -391,7 +399,7 @@ module SiSU_Param
names=@h['translator'] \
? name_format(@h['translator'])
: nil
- s=(names.class==Hash) \
+ s=(names.is_a?(Hash)) \
? names[:name_str]
: nil
s=if s
@@ -404,7 +412,7 @@ module SiSU_Param
names=@h['translator'] \
? name_format(@h['translator'])
: nil
- (names.class==Hash) \
+ (names.is_a?(Hash)) \
? names[:name_a_h]
: nil
end
@@ -412,7 +420,7 @@ module SiSU_Param
names=@h['audio'] \
? name_format(@h['audio'])
: nil
- s=(names.class==Hash) \
+ s=(names.is_a?(Hash)) \
? names[:name_str]
: nil
s=if s
@@ -425,7 +433,7 @@ module SiSU_Param
names=@h['audio'] \
? name_format(@h['audio'])
: nil
- (names.class==Hash) \
+ (names.is_a?(Hash)) \
? names[:name_a_h]
: nil
end
@@ -433,7 +441,7 @@ module SiSU_Param
names=@h['digitized_by'] \
? name_format(@h['digitized_by'])
: nil
- s=(names.class==Hash) \
+ s=(names.is_a?(Hash)) \
? names[:name_str]
: nil
s=if s
@@ -446,7 +454,7 @@ module SiSU_Param
names=@h['digitized_by'] \
? name_format(@h['digitized_by'])
: nil
- (names.class==Hash) \
+ (names.is_a?(Hash)) \
? names[:name_a_h]
: nil
end
@@ -454,7 +462,7 @@ module SiSU_Param
names=@h['prepared_by'] \
? name_format(@h['prepared_by'])
: nil
- s=(names.class==Hash) \
+ s=(names.is_a?(Hash)) \
? names[:name_str]
: nil
s=if s
@@ -468,7 +476,7 @@ module SiSU_Param
? name_format(@h['prepared_by'])
: nil
names=name_format(@h['prepared_by'])
- (names.class==Hash) \
+ (names.is_a?(Hash)) \
? names[:name_a_h]
: nil
end
@@ -540,7 +548,7 @@ module SiSU_Param
(str =~/https?:\/\/\S+$/) ? ' ;' : ';'
end
def all
- s=if @h['all']; @h['all']
+ s=if @h['all'] then @h['all']
else
s=''
if defined? copyright.text \
@@ -553,36 +561,36 @@ module SiSU_Param
and copyright.translation \
and not copyright.translation.empty?
v=sep(copyright.translation)
- s +='<br> translation ' + copyright.translation + v
+ s +='\\\\ translation ' + copyright.translation + v
end
if defined? copyright.illustrations \
and copyright.illustrations \
and not copyright.illustrations.empty?
v=sep(copyright.illustrations)
- s +='<br> illustrations ' + copyright.illustrations + v
+ s +='\\\\ illustrations ' + copyright.illustrations + v
end
if defined? copyright.photographs \
and copyright.photographs \
and not copyright.photographs.empty?
v=sep(copyright.photographs)
- s +='<br> photographs ' + copyright.photographs + v
+ s +='\\\\ photographs ' + copyright.photographs + v
end
if defined? copyright.digitization \
and copyright.digitization \
and not copyright.digitization.empty?
v=sep(copyright.digitization)
- s +='<br> digitization ' + copyright.digitization + v
+ s +='\\\\ digitization ' + copyright.digitization + v
end
if defined? copyright.audio \
and copyright.audio \
and not copyright.audio.empty?
v=sep(copyright.audio)
- s +='<br> audio ' + copyright.audio + v
+ s +='\\\\ audio ' + copyright.audio + v
end
if defined? copyright.license \
and copyright.license \
and not copyright.license.empty?
- s +='<br> License: ' + copyright.license
+ s +='\\\\ License: ' + copyright.license
end
if s.empty?
SiSU_Screen::Ansi.new(@opt.cmd,'WARNING Document Rights information missing; provide @rights: :copyright:').warn unless @opt.cmd =~/q/
@@ -597,7 +605,7 @@ module SiSU_Param
self
end
def classify
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
+ a=@s.split(/(\n%\s.+?$|[ ]*)(?:\n[ ]*(?=:)|\Z)/m)
@h=build_hash(a)
def coverage
s=@h['coverage']
@@ -797,9 +805,9 @@ module SiSU_Param
end
end
def emphasis
- if @h['emphasis'] =~/bold/; 'bold'
- elsif @h['emphasis'] =~/italics?/; 'italics'
- elsif @h['emphasis'] =~/under(?:line|score)/; 'underscore'
+ if @h['emphasis'] =~/bold/ then 'bold'
+ elsif @h['emphasis'] =~/italics?/ then 'italics'
+ elsif @h['emphasis'] =~/under(?:line|score)/ then 'underscore'
else nil
end
end
@@ -811,8 +819,8 @@ module SiSU_Param
matches=''
w.each do |x|
c=(x[1] =~/[i],/) ? :i : :s
- matches=matches + x[0].gsub(/([${}])/,'\\\\\1') + '|'
- arr_hash << {
+ matches=matches + x[0].gsub(/([${}])/,'\\\\\1') + '|'
+ arr_hash << {
match: x[0].gsub(/([${}])/,'\\\\\1'),
replace: x[2],
case_s: c
@@ -1024,7 +1032,6 @@ module SiSU_Param
end
def links
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
- a
end
def notes
a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
@@ -1185,7 +1192,7 @@ module SiSU_Param
SiSU_Screen::Ansi.new(@opt.cmd,'No SiSU markup version provided').warn if @opt.cmd =~/[VM]/
end
else
- mv=if defined? @markup_version.determined and not @markup_version.determined.nil?
+ mv=if @markup_version.determined.is_a?(Float)
x=@markup_version.determined
"markup version determined #{x}"
else ''
@@ -1229,13 +1236,13 @@ module SiSU_Param
@notes=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).notes
when /^@links:\s+(.+?)\Z/m #% * header metadata - links
doc_links=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).links
- count=1
+ a_idx=0
@links=[]
doc_links.each do |doc_link|
if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/
- @links[count]={}
- @links[count][:say],@links[count][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2]
- count +=1
+ @links[a_idx]={}
+ @links[a_idx][:say],@links[a_idx][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2]
+ a_idx +=1
end
end
@lnk=@links
@@ -1330,7 +1337,7 @@ module SiSU_Param
if @markup.nil? \
or @markup.empty?
@markup=@markup_version.determined.to_s
- elsif @markup !~/0\.38/; @markup=@markup.strip + "; #{@markup_version.determined}"
+ elsif @markup !~/0\.38/ then @markup=@markup.strip + "; #{@markup_version.determined}"
end
if not defined? @title.full.nil?
tf=para[/^:A~\S*(.+)$/m,1]
@@ -1358,7 +1365,8 @@ module SiSU_Param
if para =~/~\{|\^~ |~\^|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m
@flag_auto_endnotes,@flag_endnotes=true,true
end
- if para =~/^(?:table\{|\{table)/i; @flag_tables=true
+ if para =~/^(?:table\{|\{table)/i
+ @flag_tables=true
end
end
if para =~/^:?A~/
@@ -1395,6 +1403,12 @@ module SiSU_Param
@sem_tag=true if para=~/[:;]\{.+?\}[:;][a-z+]/ #refix later
end
end #% here endeth the document loop
+ unless @make
+ if @opt.cmd =~/[VM]/
+ SiSU_Screen::Ansi.new(@opt.cmd,'@make:','header absent').warn
+ end
+ @make=SiSU_Param::Parameters::Md.new('@make: ',@opt,@env).make
+ end
if @ec[:image].length > 0
@ec[:image]=@ec[:image].flatten.uniq
@ec[:image].delete_if {|x| x =~/https?:\/\// }
@@ -1404,29 +1418,29 @@ module SiSU_Param
@ec[:multimedia]=@ec[:multimedia].uniq.flatten.sort
unless @rights
if defined? @creator.author \
- and @creator.author \
+ and @creator.author.is_a?(String) \
and defined? @date.published \
- and @date.published
+ and @date.published.is_a?(String)
@rights=SiSU_Param::Parameters::MdDefault.new.rights(@creator.author,@date.published)
elsif defined? @creator.author \
- and @creator.author
+ and @creator.author.is_a?(String)
@rights=SiSU_Param::Parameters::MdDefault.new.rights("[#{@creator.author}]",'')
end
end
if defined? @classify.topic_register \
- and not @classify.topic_register.nil? \
+ and @classify.topic_register.is_a?(String) \
and @classify.topic_register.length >3
topic_register=@classify.topic_register
- u=topic_register.scan(/[^;]+/)
+ u=topic_register.scan(/[^;]+/m).sort
v=[]
u.each do |l|
- v << l.scan(/[^:]+/)
+ v << l.scan(/[^:]+/m)
end
v.each do |m|
- m[-1]=m[-1].scan(/[^|]+/) if m[-1] =~/[|]/
+ m[-1]=m[-1].scan(/[^|]+/m) if m[-1] =~/[|]/m
@topic_register_array << m
end
- @topic_register_array=@topic_register_array.sort
+ @topic_register_array
end
if @i18n
@i18n=@i18n.uniq
@@ -1453,9 +1467,9 @@ module SiSU_Param
# gsub(/:?C/,'3').
# gsub(/:?B/,'2').
# gsub(/:?A/,'1')
- translate=if translate =~/^\d+$/; translate.to_i
- else translate
- end
+ translate=(translate =~/^\d+$/) \
+ ? translate.to_i
+ : translate
else nil
end
end
@@ -1489,7 +1503,7 @@ module SiSU_Param
@dgst_skin=skin ? (@sys.md5(skin)) : nil
end
end
- @publisher ||= "#@@publisher (this copy)"
+ @publisher ||= "#{@@publisher} (this copy)"
fn_set_lang=SiSU_Env::StandardiseLanguage.new(@opt.lng).language
unless @language[:code] \
and @language[:name]
@@ -1506,9 +1520,9 @@ module SiSU_Param
# @flv.each do |l|
# lang=SiSU_Env::StandardiseLanguage.new.file_to_language(l)
# c={ a: '', b: '', c: '' }
-# if @fnl[:pre] =~/\S/; c[:a]="#{lang[:c]}."
-# elsif @fnl[:mid] =~/\S/; c[:b]=".#{lang[:c]}"
-# elsif @fnl[:post] =~/\S/; c[:c]=".#{lang[:c]}"
+# if @fnl[:pre] =~/\S/ then c[:a]="#{lang[:c]}."
+# elsif @fnl[:mid] =~/\S/ then c[:b]=".#{lang[:c]}"
+# elsif @fnl[:post] =~/\S/ then c[:c]=".#{lang[:c]}"
# end
# @lang << [lang[:n],"#{c[:a]}sisu_manifest#{c[:b]}.html#{c[:c]}"]
# end if @flv
diff --git a/lib/sisu/v3/particulars.rb b/lib/sisu/v3/particulars.rb
index b95ba52a..97a3da3e 100644
--- a/lib/sisu/v3/particulars.rb
+++ b/lib/sisu/v3/particulars.rb
@@ -97,9 +97,9 @@ module SiSU_Particulars
@opt=opt
set_sst_idx
end
- def get_idx_tex(opt)
+ def get_idx_raw(opt)
@opt=opt
- set_tex_idx
+ set_raw_idx
end
def get_idx_html(opt)
@opt=opt
@@ -126,7 +126,7 @@ module SiSU_Particulars
@opt=opt
set_ocn_htmlseg_map
end
- attr_accessor :opt,:md,:sst_idx,:tex_idx,:html_idx,:xhtml_idx
+ attr_accessor :opt,:md,:sst_idx,:raw_idx,:html_idx,:xhtml_idx
def set_md
begin
@md=SiSU_Param::Parameters.new(@opt).get
@@ -180,9 +180,9 @@ module SiSU_Particulars
end
end
end
- def set_tex_idx
+ def set_raw_idx
begin
- @tex_idx=SiSU_DAL::Source.new(@opt).get_idx_tex
+ @raw_idx=SiSU_DAL::Source.new(@opt).get_idx_raw
self
rescue
SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
diff --git a/lib/sisu/v3/plaintext.rb b/lib/sisu/v3/plaintext.rb
index 2fa98883..c86fddb9 100644
--- a/lib/sisu/v3/plaintext.rb
+++ b/lib/sisu/v3/plaintext.rb
@@ -350,7 +350,7 @@ WOK
p_num=''
if @env.plaintext_ocn?
if defined? dob.ocn \
- and not dob.ocn.nil?
+ and dob.ocn.is_a?(Fixnum)
p_num=SiSU_PlaintextFormat::ParagraphNumber.new(dob.ocn).display
end
end
@@ -409,7 +409,7 @@ WOK
@sisu=[]
emptyline=0
@content.each do |para| # this is a hack
- if para.class==Array \
+ if para.is_a?(Array) \
and para.length > 0
para.each do |line|
if line
diff --git a/lib/sisu/v3/plaintext_format.rb b/lib/sisu/v3/plaintext_format.rb
index 445d8c66..fe24112d 100644
--- a/lib/sisu/v3/plaintext_format.rb
+++ b/lib/sisu/v3/plaintext_format.rb
@@ -76,7 +76,7 @@ module SiSU_PlaintextFormat
class FormatTextObject
def initialize(md,t_o)
@md,@t_o=md,t_o
- if t_o.class==Hash
+ if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
@lnk_url =t_o[:lnk_url] || nil
@lnk_txt =t_o[:lnk_txt] || nil
diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v3/po4a.rb
index 7ce825ee..53bab960 100644
--- a/lib/sisu/v3/po4a.rb
+++ b/lib/sisu/v3/po4a.rb
@@ -214,7 +214,7 @@ module SiSU_Po4a
end
desc="#{d}#{s_mark}#{instruct}"
orig=(orig_notes[i].to_s =~/^\^~[\d*+]+/) ? (orig_notes[i].to_s.gsub(/^\^~[\d*+]+/,'^~')) : orig_notes[i].to_s
- trans=if trn_notes.class==Array \
+ trans=if trn_notes.is_a?(Array) \
and trn_notes.length==orig_notes.length
(trn_notes[i].to_s =~/^\^~[\d*+]+/) ? (trn_notes[i].to_s.gsub(/^\^~[\d*+]+/,'^~')) : trn_notes[i].to_s
else ''
@@ -749,12 +749,12 @@ GSUB
#next if data_trn[t].is == :comment
end
end
- if (defined? data_src[s].ocn and data_src[s].ocn.class == Fixnum) \
- and (defined? data_trn[t].ocn and data_trn[t].ocn.class == Fixnum) \
+ if (defined? data_src[s].ocn and data_src[s].ocn.is_a?(Fixnum)) \
+ and (defined? data_trn[t].ocn and data_trn[t].ocn.is_a?(Fixnum)) \
and (data_src[s].ocn == data_trn[t].ocn)
@m_s,@m_t=s,t
- elsif (defined? data_src[s].ocn and data_src[s].ocn.class == Fixnum) \
- and (defined? data_trn[t].ocn and data_trn[t].ocn.class == Fixnum) \
+ elsif (defined? data_src[s].ocn and data_src[s].ocn.is_a?(Fixnum)) \
+ and (defined? data_trn[t].ocn and data_trn[t].ocn.is_a?(Fixnum)) \
and (data_src[s].ocn != data_trn[t].ocn)
p '--- OCN ---'
p 'mis-match'
@@ -934,7 +934,7 @@ GSUB
@sisu=[]
emptyline=0
@content.each do |para| # this is a hack
- if para.class==Array \
+ if para.is_a?(Array) \
and para.length > 0
para.each do |line|
if line
diff --git a/lib/sisu/v3/po4a_set.rb b/lib/sisu/v3/po4a_set.rb
index af6fba88..0dcc25a9 100644
--- a/lib/sisu/v3/po4a_set.rb
+++ b/lib/sisu/v3/po4a_set.rb
@@ -162,7 +162,7 @@ WOK
line_wrap
end
def array_wrap
- if @orig.class==Array
+ if @orig.is_a?(Array)
@arr=[]
@orig.each do |line|
@arr << SiSU_TextUtils::Wrap.new(line,@n_char_max,@n_indent,@n_hang).line_wrap
diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb
index d05bf442..0d126266 100644
--- a/lib/sisu/v3/qrcode.rb
+++ b/lib/sisu/v3/qrcode.rb
@@ -117,16 +117,18 @@ module SiSU_QRcode
def output_metadata
fn=@f.base_filename.manifest_txt
mn=''
- if @md.opt =~/M/
+ if @md.opt.cmd =~/M/
pt=@f.output_path.manifest.dir
fn=@f.base_filename.manifest_txt
manifest=@f.write_file.manifest_txt
end
@manifest[:txt].each do |x|
- manifest << x if @md.opt =~/M/
+ x=x.gsub(/\\\\/m,"\n")
+ puts x if @md.opt.cmd =~/V/
+ manifest << x if @md.opt.cmd =~/M/
mn += x
end
- manifest.close if @md.opt =~/M/
+ manifest.close if @md.opt.cmd =~/M/
#system(%{
# cat #{pt}/#{fn} | qrencode -s 3 -o qrcm.autonomy_markup0.png
#})
@@ -166,9 +168,9 @@ WOK
end
def summarize_sources(id,file,pth,rel,url)
sys=SiSU_Env::SystemCall.new
- dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{pth}/#{file}")
- else sys.md5("#{pth}/#{file}")
- end
+ dgst=(@dg =~/^sha(?:2|256)$/) \
+ ? (sys.sha256("#{pth}/#{file}"))
+ : (sys.md5("#{pth}/#{file}"))
SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/
size=(File.size("#{pth}/#{file}")/1024.00).to_s
kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
@@ -242,9 +244,9 @@ WOK
@manifest[:txt_title] << %{#{info}\n}
end
def links(url,lnk,target)
- static=if url =~/^\.\//; url.gsub(/^\.(\.)?/,@base_url)
- elsif url =~/^\.\.\//; url.gsub(/^\.(\.)?/,@env.url.root)
- else url
+ static=if url =~/^\.\// then url.gsub(/^\.(\.)?/,@base_url)
+ 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}
end
@@ -384,12 +386,12 @@ WOK
summarize(id,file,pth,rel,url)
end
if FileTest.file?(@f.place_file.txt.dir)==true
- if @md.opt.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)'
- elsif @md.opt.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)'
- elsif @md.opt.cmd =~/A/; id='Plaintext (dos (UTF-8) with footnotes)'
- elsif @md.opt.cmd =~/E/; id='Plaintext (dos (UTF-8) with endnotes)'
- else id='Plaintext (UTF-8)'
- end
+ id=if @md.opt.cmd =~/a/ then 'Plaintext (Unix (UTF-8) with footnotes)'
+ elsif @md.opt.cmd =~/e/ then 'Plaintext (Unix (UTF-8) with endnotes)'
+ elsif @md.opt.cmd =~/A/ then 'Plaintext (dos (UTF-8) with footnotes)'
+ elsif @md.opt.cmd =~/E/ then 'Plaintext (dos (UTF-8) with endnotes)'
+ else 'Plaintext (UTF-8)'
+ end
pth=@f.output_path.txt.dir
rel=@f.output_path.txt.rel_sm
url=@f.output_path.txt.url
@@ -668,7 +670,7 @@ WOK
@sp=' '
@md.topic_register_array.each do |t|
t.each_with_index do |st,i|
- if st.class==Array
+ if st.is_a?(Array)
st.each do |v|
@manifest[:txt] << %{#{@sp*i}#{v}\n}
end
diff --git a/lib/sisu/v3/response.rb b/lib/sisu/v3/response.rb
index 675b249e..d660d398 100644
--- a/lib/sisu/v3/response.rb
+++ b/lib/sisu/v3/response.rb
@@ -61,9 +61,9 @@ module SiSU_Response
response='redo'
print ask + " ['yes', 'no' or 'quit']: "
response=File.new('/dev/tty').gets.strip
- ans=if response=='yes'; true
- elsif response=='no'; false
- elsif response =~/^quit|exit$/; exit
+ ans=if response=='yes' then true
+ elsif response=='no' then false
+ elsif response =~/^quit|exit$/ then exit
else puts "[please type: 'yes', 'no' or 'quit']"
response?(ask)
end
diff --git a/lib/sisu/v3/screen_text_color.rb b/lib/sisu/v3/screen_text_color.rb
index 67022087..a9c0b367 100644
--- a/lib/sisu/v3/screen_text_color.rb
+++ b/lib/sisu/v3/screen_text_color.rb
@@ -69,16 +69,11 @@ module SiSU_Screen
@color_instruct=txt[0]
flag=SiSU_Env::InfoProcessingFlag.new
if @cmd
- if flag.color #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off
- @use_color=if @cmd =~/c/; false
- else true
- end
- else
- @use_color=if @cmd =~/c/; true
- else false
- end
- end
- if @cmd =~/k/; @use_color=false
+ #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off
+ @use_color=(flag.color) \
+ ? ((@cmd =~/c/) ? false : true)
+ : ((@cmd =~/c/) ? true : false)
+ if @cmd =~/k/ then @use_color=false # useful color off switch, however, k may be used for something else in future
end
else @use_color=false
end
@@ -254,13 +249,6 @@ module SiSU_Screen
%{#{@cX.off} } +
%{#{@cX.cyan}nav only: #{@txt[4]}#{@cX.off}.}
end
- def php_numbers
- puts %{ #{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}files processed#{@cX.off}. } +
- %{php_scr only: #{@txt[1]}, } +
- %{#{@cX.cyan}php_seg only: #{@txt[2]}#{@cX.off}, } +
- %{joint php scroll & seg: #{@txt[3]}, } +
- %{php_nav only: #{@txt[4]}}
- end
def txt_white
puts "\t#{@cX.white}#{@txt[0]}#{@cX.off} #{@cX.white}#{@txt[1]}#{@cX.off}"
end
@@ -348,6 +336,9 @@ module SiSU_Screen
def grey_title_hi
puts %{#{@cX.grey_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}}
end
+ def grey_title_grey_blue
+ puts %{#{@cX.grey_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.grey}#{@txt[1]}#{@cX.off} #{@cX.blue}#{@txt[2]}#{@cX.off}}
+ end
def dark_grey_title_hi
puts %{#{@cX.darkgrey_hi}#{@cX.black}#{@txt[0]}#{@cX.off*2} #{@cX.blue}#{@txt[1]}#{@cX.off}}
end
@@ -403,9 +394,6 @@ module SiSU_Screen
def html_output
puts %{\t#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.ruby}->#{@cX.off}\n\t #{@cX.blue}#{@txt[1]}#{@cX.off}}
end
- def php_title
- puts %{\n#{@cX.green_hi}#{@cX.black}PHP#{@cX.off*2}}
- end
def segmented
puts "\t#{@cX.grey}Seg#{@cX.off} #{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.grey}segments#{@cX.off}"
end
diff --git a/lib/sisu/v3/shared_images.rb b/lib/sisu/v3/shared_images.rb
index c92719f6..e55f03ad 100644
--- a/lib/sisu/v3/shared_images.rb
+++ b/lib/sisu/v3/shared_images.rb
@@ -78,7 +78,7 @@ module SiSU_Images
end
end
def images_set
- @pwd=ENV['PWD']
+ @pwd=(/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1]
def copy(src_path,dest_path,images=nil)
if FileTest.directory?(src_path)
FileUtils::cd(src_path)
diff --git a/lib/sisu/v3/shared_markup_alt.rb b/lib/sisu/v3/shared_markup_alt.rb
index 98c55e66..4efedff1 100644
--- a/lib/sisu/v3/shared_markup_alt.rb
+++ b/lib/sisu/v3/shared_markup_alt.rb
@@ -58,7 +58,7 @@
module SiSU_TextRepresentation
class Alter
def initialize(x)
- if x.class==String
+ if x.is_a?(String)
@t_o,@s=nil,x
else
@t_o,@s=x,x.obj.dup
@@ -196,7 +196,7 @@ module SiSU_TextRepresentation
class ModifiedTextPlusHashDigest
def initialize(md,x)
@md=md
- if x.class==String
+ if x.is_a?(String)
@t_o,@s=nil,x
else
@t_o,@s=x,x.obj.dup
diff --git a/lib/sisu/v3/shared_metadata.rb b/lib/sisu/v3/shared_metadata.rb
index a8698fd7..cd1e97db 100644
--- a/lib/sisu/v3/shared_metadata.rb
+++ b/lib/sisu/v3/shared_metadata.rb
@@ -259,12 +259,12 @@ module SiSU_Metadata
meta << self.meta_para
end
if defined? @md.dgst \
- and @md.dgst.class==Array
+ and @md.dgst.is_a?(Array)
@tag,@inf,@class='Source Digest',"#{@md.dgst[0]} #{@md.dgst[1]}",'src'
meta << self.meta_para
end
if defined? @md.dgst_skin \
- and @md.dgst_skin.class==Array
+ and @md.dgst_skin.is_a?(Array)
@tag,@inf,@class='Skin Digest',"#{@md.dgst_skin[0]} #{@md.dgst_skin[1]}",'src'
meta << self.meta_para
end
@@ -288,7 +288,7 @@ module SiSU_Metadata
meta << self.meta_para
end
if defined? @md.generated \
- and @md.generated.class==Time
+ and @md.generated.is_a?(Time)
@tag,@inf,@class=tr.last_generated,@md.generated,'date'
meta << self.meta_para
end
@@ -734,7 +734,7 @@ module SiSU_Metadata
@s=str
def utf8
if @s \
- and @s.class==String
+ and @s.is_a?(String)
@s=@s.gsub(/<br(?: \/)?>/u,Mx[:br_paragraph]).
gsub(/</um,'&#60;'). # '&lt;' # &#060;
gsub(/</um,'&#60;'). # '&lt;' # &#060;
@@ -908,7 +908,7 @@ WOK
def odf
def meta_para
url_brace=SiSU_Viz::Skin.new.url_decoration
- if @inf.class==String
+ if @inf.is_a?(String)
@inf=@inf.gsub(/</,'&lt;').gsub(/>/,'&gt;').
gsub(/&lt;br(?: \/)?&gt;/,'<br />')
if @inf =~/&/
@@ -979,7 +979,7 @@ WOK
@br="\\\\\n"
end
def meta_para(tag,inf,sc=true)
- inf=((inf.class==String && sc) ? spec_char(inf) : inf)
+ inf=((inf.is_a?(String) && sc) ? spec_char(inf) : inf)
%{\\begin\{bfseries\}#{tag}:\\end\{bfseries\} #{inf}
}
end
@@ -1193,7 +1193,7 @@ WOK
meta << meta_para(tag,inf)
end
if defined? @md.dgst \
- and @md.dgst.class==Array
+ and @md.dgst.is_a?(Array)
hash_of=spec_char(@md.dgst[0])
hash_of=word_break_points(hash_of)
dgst=number_break_points(@md.dgst[1])
@@ -1201,7 +1201,7 @@ WOK
meta << meta_para(tag,inf,false)
end
if defined? @md.dgst_skin \
- and @md.dgst_skin.class==Array
+ and @md.dgst_skin.is_a?(Array)
hash_of=spec_char(@md.dgst_skin[0])
hash_of=word_break_points(hash_of)
dgst=number_break_points(@md.dgst_skin[1])
@@ -1210,7 +1210,7 @@ WOK
end
meta << %{#{@br}\\begin\{bfseries\}Generated \\end\{bfseries\}}
if defined? @md.generated \
- and @md.generated.class==Time
+ and @md.generated.is_a?(Time)
tag,inf=tr.last_generated,@md.generated
meta << meta_para(tag,inf)
end
diff --git a/lib/sisu/v3/shared_sem.rb b/lib/sisu/v3/shared_sem.rb
index bd906efc..1fa919c2 100644
--- a/lib/sisu/v3/shared_sem.rb
+++ b/lib/sisu/v3/shared_sem.rb
@@ -104,11 +104,13 @@ module SiSU_Sem
puts matched[0] unless matched[0].nil?
end
def if_pair_c
- if @para=~/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m; puts "#{$1}:{ #{$2} }:#{$1}"
+ if @para=~/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m
+ puts "#{$1}:{ #{$2} }:#{$1}"
end
end
def if_pair_sc
- if @para=~/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/; puts ";{ #{$1} };#{$2}"
+ if @para=~/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/
+ puts ";{ #{$1} };#{$2}"
end
end
def match_pair_c
diff --git a/lib/sisu/v3/shared_sisupod_source.rb b/lib/sisu/v3/shared_sisupod_source.rb
index 2aff984c..18821e37 100644
--- a/lib/sisu/v3/shared_sisupod_source.rb
+++ b/lib/sisu/v3/shared_sisupod_source.rb
@@ -86,7 +86,6 @@ module SiSU_Source
image: path_pod + '/' + Gt[:image],
audio: path_pod + '/' + Gt[:audio],
video: path_pod + '/' + Gt[:video],
- conf: path_pod + '/' + Gt[:conf]
}
end
def read
@@ -107,7 +106,7 @@ module SiSU_Source
load "#{SiSU_lib}/defaults.rb"
@skin={}
skin_path = [
- "#{@env.path.pwd}/_sisu/skin",
+ "#{@opt.base_path}/_sisu/skin",
"#{@env.path.home}/.sisu/skin",
'/etc/sisu/skin',
"#{@path_pod[:pod]}/external_document/skin" #CHECK
@@ -214,7 +213,7 @@ module SiSU_Source
FileUtils::mkdir_p(@path_pod[:image])
#unattractive hard coding ... !
image_path='_sisu/image'
- images_pwd="#{@env.path.pwd}/#{image_path}"
+ images_pwd="#{@opt.base_path}/#{image_path}"
##sequence copies base images, defaults used in all html outputs
#image_source_base='/usr/share/sisu/image'
#dir_pwd=Dir.pwd
@@ -238,9 +237,9 @@ module SiSU_Source
if doc_import.length > 0 \
and @opt.fno =~/\.ssm$/
doc_import.each do |f|
- if FileTest.file?("#{@env.path.pwd}#{doc_import_dir}/#{f}")
- FileUtils::cp("#{@env.path.pwd}#{doc_import_dir}/#{f}","#{@path_pod[:doc]}/#{f}")
- else STDERR.puts %{\t*WARN* did not find image - "#{@env.path.pwd}#{doc_import_dir}/#{f}" [#{__FILE__}:#{__LINE__}]}
+ if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f}")
+ FileUtils::cp("#{@opt.base_path}#{doc_import_dir}/#{f}","#{@path_pod[:doc]}/#{f}")
+ else STDERR.puts %{\t*WARN* did not find image - "#{@opt.base_path}#{doc_import_dir}/#{f}" [#{__FILE__}:#{__LINE__}]}
end
end
end
@@ -253,57 +252,57 @@ module SiSU_Source
lng_f=$1
if @opt.lng == lng_f
if @opt.fno =~/\.ssm$/
- if FileTest.file?("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}")
- FileUtils::cp("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}",
+ if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}")
+ FileUtils::cp("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}",
"#{@path_pod[:doc]}/#{f[:n]}")
- else STDERR.puts %{\t*WARN* did not find - "#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
+ else STDERR.puts %{\t*WARN* did not find - "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
end
else
- if FileTest.file?("#{@env.path.pwd}/#{f[:f]}")
+ if FileTest.file?("#{@opt.base_path}/#{f[:f]}")
cpy= :no
cpy=if f[:f] =~ /^#{@opt.f_pth[:lng_is]}\// \
or f[:f] =~ /~#{@opt.f_pth[:lng_is]}\.sst/
- p "#{@env.path.pwd}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}"
+ p "#{@opt.base_path}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}"
:yes
elsif f[:f] !~ /^(?:#{Px[:lng_lst_rgx]})\/|~(?:#{Px[:lng_lst_rgx]})\.sst/ \
and @opt.f_pth[:lng_is] == 'en'
- p "#{@env.path.pwd}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}"
+ p "#{@opt.base_path}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}"
:yes
else :no
end
if cpy == :yes
- FileUtils::cp("#{@env.path.pwd}/#{f[:f]}",
+ FileUtils::cp("#{@opt.base_path}/#{f[:f]}",
"#{@path_pod[:doc]}/#{f[:n]}")
end
- else STDERR.puts %{\t*WARN* did not find - "#{@env.path.pwd}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
+ else STDERR.puts %{\t*WARN* did not find - "#{@opt.base_path}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
end
end
end
else
if @opt.fno =~/\.ssm$/
- if FileTest.file?("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}")
- FileUtils::cp_r("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}",
+ if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}")
+ FileUtils::cp_r("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}",
"#{@path_pod[:doc]}/#{f[:n]}")
- else STDERR.puts %{\t*WARN* did not find - "#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
+ else STDERR.puts %{\t*WARN* did not find - "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
end
else
- if FileTest.file?("#{@env.path.pwd}/#{f[:f]}")
+ if FileTest.file?("#{@opt.base_path}/#{f[:f]}")
cpy= :no
cpy=if f[:f] =~ /^#{@opt.f_pth[:lng_is]}\// \
or f[:f] =~ /~#{@opt.f_pth[:lng_is]}\.sst/
- p "#{@env.path.pwd}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}"
+ p "#{@opt.base_path}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}"
:yes
elsif f[:f] !~ /^(?:#{Px[:lng_lst_rgx]})\/|~(?:#{Px[:lng_lst_rgx]})\.sst/ \
and @opt.f_pth[:lng_is] == 'en'
- p "#{@env.path.pwd}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}"
+ p "#{@opt.base_path}/#{f[:f]} --> #{@path_pod[:doc]}/#{f[:n]}"
:yes
else :no
end
if cpy == :yes
- FileUtils::cp("#{@env.path.pwd}/#{f[:f]}",
+ FileUtils::cp("#{@opt.base_path}/#{f[:f]}",
"#{@path_pod[:doc]}/#{f[:n]}")
end
- else STDERR.puts %{\t*WARN* did not find - "#{@env.path.pwd}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
+ else STDERR.puts %{\t*WARN* did not find - "#{@opt.base_path}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]}
end
end
end
diff --git a/lib/sisu/v3/shared_txt.rb b/lib/sisu/v3/shared_txt.rb
index 39363fcf..228109c1 100644
--- a/lib/sisu/v3/shared_txt.rb
+++ b/lib/sisu/v3/shared_txt.rb
@@ -114,7 +114,7 @@ module SiSU_TextUtils
line_wrap
end
def array_wrap
- if @para.class==Array
+ if @para.is_a?(Array)
@arr=[]
@para.each do |line|
@arr << SiSU_TextUtils::Wrap.new(line,@n_char_max,@n_indent,@n_hang).line_wrap
diff --git a/lib/sisu/v3/shared_xml.rb b/lib/sisu/v3/shared_xml.rb
index cff58007..6860d80c 100644
--- a/lib/sisu/v3/shared_xml.rb
+++ b/lib/sisu/v3/shared_xml.rb
@@ -109,8 +109,8 @@ module SiSU_XML_Munge
def char_enc #character encode
def utf8(dob='')
if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn
- str=if defined? dob.obj; dob.obj
- elsif dob.class==String; dob
+ str=if defined? dob.obj then dob.obj
+ elsif dob.is_a?(String) then dob
end
if str
#¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûü
@@ -217,7 +217,7 @@ module SiSU_XML_Munge
dob=if defined? dob.obj
dob.obj=str
dob
- elsif dob.class==String
+ elsif dob.is_a?(String)
str
end
dob
diff --git a/lib/sisu/v3/sitemaps.rb b/lib/sisu/v3/sitemaps.rb
index 86a8e2fb..d45af899 100644
--- a/lib/sisu/v3/sitemaps.rb
+++ b/lib/sisu/v3/sitemaps.rb
@@ -97,10 +97,9 @@ module SiSU_Sitemaps
end
end
def make_file(path,filename)
- if File.writable?("#{path}/."); File.new("#{path}/#{filename}",'w+')
- else
- SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn
- end
+ (File.writable?("#{path}/.")) \
+ ? (File.new("#{path}/#{filename}",'w+'))
+ : (SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn)
end
def output_map(sitemap)
path=@md.file.output_path.sitemaps.dir
diff --git a/lib/sisu/v3/sst_convert_markup.rb b/lib/sisu/v3/sst_convert_markup.rb
index 6b224ddb..20b6d775 100644
--- a/lib/sisu/v3/sst_convert_markup.rb
+++ b/lib/sisu/v3/sst_convert_markup.rb
@@ -196,7 +196,7 @@ WOK
and @opt.files.length > 0
mr=nil
#%% changes to make m match, r replace -------------------------->
- if @opt.mod.inspect =~/--help/; help
+ if @opt.mod.inspect =~/--help/ then help
elsif @opt.mod.inspect =~/(?:convert|to)[=-](?:xml |sxs|sax|sxd|dom|sxn|node)/
ext=case @opt.mod.inspect
when /(?:convert|to)[=-](?:xml|sxs|sax)/; '.sxs.xml'
@@ -272,13 +272,13 @@ WOK
end
end
end
- if y=~/^\s*$/; @empty1=true
- else @empty1=false
- end
+ @empty1=(y=~/^\s*$/) \
+ ? true
+ : false
@file.puts y unless (@empty1==true and @empty2==true)
- if y=~/^\s*$/; @empty2=true
- else @empty2=false
- end
+ @empty2=(y=~/^\s*$/) \
+ ? true
+ : false
end
@file.close
else puts "NO conversion match in #{i}" unless @opt.cmd=~/q/
diff --git a/lib/sisu/v3/sst_do_inline_footnotes.rb b/lib/sisu/v3/sst_do_inline_footnotes.rb
index 4ceb54fa..b30fa8d2 100644
--- a/lib/sisu/v3/sst_do_inline_footnotes.rb
+++ b/lib/sisu/v3/sst_do_inline_footnotes.rb
@@ -107,9 +107,9 @@ module SiSU_ConvertFootnotes
@@fns=@opt.fns
@@dal_array=[]
end
- dal=if @@dal_array.empty?; read_fnm
- else @@dal_array.dup #check
- end
+ dal=(@@dal_array.empty?) \
+ ? read_fnm
+ : @@dal_array.dup #check
rescue
SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error do
__LINE__.to_s + ':' + __FILE__
@@ -124,7 +124,7 @@ module SiSU_ConvertFootnotes
SiSU_Screen::Ansi.new(@opt.cmd,'convert footnotes').green_title_hi unless @opt.cmd =~/q/
file_array=IO.readlines(@opt.fns,'')
file_array.each do |l|
- if l =~/\r\n/; l.gsub!(/\r\n/,"\n")
+ if l =~/\r\n/ then l.gsub!(/\r\n/,"\n")
end
end
meta=file_array.dup
@@ -145,9 +145,9 @@ module SiSU_ConvertFootnotes
end
def read_fnm
dal=[]
- dal=if FileTest.file?(@fnm); File.open(@fnm){ |f| dal=Marshal.load(f)}
- else SiSU_ConvertFootnotes::Source.new(@opt).create_dal #watch
- end
+ dal=(FileTest.file?(@fnm)) \
+ ? (File.open(@fnm){ |f| dal=Marshal.load(f)})
+ : (SiSU_ConvertFootnotes::Source.new(@opt).create_dal) #watch
end
end
class Output
@@ -192,9 +192,9 @@ module SiSU_ConvertFootnotes
data=data.join.split("\n\n")
data_new=[]
data.each do |x|
- data_new << if x =~ /\n\n/m; x.split(/\n\n+/)
- else x
- end
+ data_new << (x =~ /\n\n/m) \
+ ? (x.split(/\n\n+/))
+ : x
end
data=data_new.flatten
data=SiSU_ConvertFootnotes::Make.new(@md,data).substitutions_and_insertions?
@@ -360,9 +360,9 @@ module SiSU_ConvertFootnotes
if para !~/^(?:@\S+:|0~\S+)\s/m \
and para !~/\A\s*\Z/m
@md.set_heading_top=true
- head=if @md.title.full ; ":A~ #{@md.title.full}"
- else ':A~ [no title provided]'
- end
+ head=(@md.title.full) \
+ ? (":A~ #{@md.title.full}")
+ : (':A~ [no title provided]')
@tuned_file << head
end
end
@@ -382,9 +382,9 @@ module SiSU_ConvertFootnotes
and para !~/\A\s*\Z/m \
and para !~/<:p[bn]>/
@md.set_heading_seg=true
- head=if @md.title.full ; "1~seg [#{@md.title.full}]"
- else '1~seg [segment]'
- end
+ head=(@md.title.full) \
+ ? ("1~seg [#{@md.title.full}]")
+ : ('1~seg [segment]')
@tuned_file << head
end
end
diff --git a/lib/sisu/v3/sst_identify_markup.rb b/lib/sisu/v3/sst_identify_markup.rb
index 60c28bf5..012475be 100644
--- a/lib/sisu/v3/sst_identify_markup.rb
+++ b/lib/sisu/v3/sst_identify_markup.rb
@@ -236,9 +236,9 @@ WOK
end
else puts 'file not found: ' + @opt.fns
end
- if defined? markup.version; markup.version
- else 'markup type/version not determined'
- end
+ (defined? markup.version) \
+ ? markup.version
+ : 'markup type/version not determined'
end
def markup_version?
if @opt.fns.empty?
diff --git a/lib/sisu/v3/sst_to_s_xml_sax.rb b/lib/sisu/v3/sst_to_s_xml_sax.rb
index 20f68aca..cc08be70 100644
--- a/lib/sisu/v3/sst_to_s_xml_sax.rb
+++ b/lib/sisu/v3/sst_to_s_xml_sax.rb
@@ -427,7 +427,7 @@ WOK
@sisu=new_file_data.scan(/.+/)
SiSU_Env::FileOp.new(@md).mkdir
filename_sxm=SiSU_Env::FileOp.new(@md,@md.fn[:sxs]).mkfile_pwd
- if filename_sxm.class==File
+ if filename_sxm.is_a?(File)
@sisu.each {|para| filename_sxm.puts para}
filename_sxm.close
else puts 'file not created, is directory writable?'
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 23326b40..c4b364ad 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -87,7 +87,7 @@ module SiSU_Env
@t.month
end
def year_static
- '2012'
+ YEAR
end
end
class InfoSystem
@@ -224,10 +224,6 @@ module SiSU_Env
"#{@@home}/.sisu",
"#{@@sisu_etc}/#{SiSU_version_dir}",
]
- @@yamlrc_path=@@rc_path
- #@@yamlrc_path=(stub_pwd !~/^sisupod$/) \
- #? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"])
- #: ["#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] #security policy: prevent reading of sisurc.yml in sisupod
@@ad_path=(stub_pwd !~/^sisupod$/) \
? ([
"#{@@pwd}/.sisu/skin/yml",
@@ -236,10 +232,10 @@ module SiSU_Env
"#{@@sisu_etc}/skin/yml",
])
: ["#{@@home}/.sisu",@@sisu_etc]
- attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:yamlrc_path,:ad_path
+ attr_accessor :user,:home,:hostname,:pwd,:host,:arch,:rbver,:dir_arch,:dir_sitearch,:dir_bin,:locale,:webserv_path,:webserv_host_cgi,:webserv_port_cgi,:default_dir,:rc_path,:ad_path
def initialize
- @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir,@rc_path,@yamlrc_path,@ad_path=\
- @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir,@@rc_path,@@yamlrc_path,@@ad_path
+ @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir,@rc_path,@ad_path=\
+ @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir,@@rc_path,@@ad_path
#note rbver is duplicated in InfoVersion
end
end
@@ -297,7 +293,7 @@ module SiSU_Env
def sisu_yaml
def rc
unless @@rc
- @yamlrc_path.each do |v|
+ @rc_path.each do |v|
if @@noyaml \
or FileTest.exist?("#{v}/noyaml")
STDERR.puts "WARNING - YAML loading switched off, to enable delete the file:\n\t#{v}/noyaml\n\n" unless @@noyaml
@@ -467,8 +463,8 @@ module SiSU_Env
filename=(@fns =~/\.ssm\.sst$/) \
? @fns.gsub(/\.ssm\.sst$/,'.ssm')
: @fns
- unless (filename.nil? \
- or filename.empty?)
+ if filename.is_a?(String) \
+ and not filename.empty?
if output_dir_structure.by_language_code?
m=/((.+?)(?:\~\w{2,3})?)\.(sst|ssm)$/
@fn[:b],@fn[:m],@fn[:t]=filename[m,1],filename[m,2],filename[m,3]
@@ -781,7 +777,7 @@ module SiSU_Env
@texpdf
end
def latex2pdf(md,papersize='a4') #convert from latex to pdf
- tell=if @cmd =~/[MV]/
+ tell=if @cmd =~/[MV]/
''
elsif @cmd =~/[v]/
%q{2>&1 | grep -v ' WARNING '}
@@ -790,18 +786,16 @@ module SiSU_Env
mode='batchmode' #mode='nonstopmode'
program_ref="\n\t\tSee http://www.tug.org/applications/pdftex/\n\t\tOn Debian this is is included in tetex-extra"
texpdf=tex2pdf_engine
- if @pdfetex_flag;
+ if @pdfetex_flag
texpdf_cmd=case texpdf
when /xetex/
- @input =~/landscape\.tex$/ \
- ? %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize} -l" #{@input} #{tell}\n}
- : %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n}
+ %{#{texpdf} -interaction=#{mode} -fmt=xelatex -papersize="#{papersize}" #{@input} #{tell}\n}
when /xelatex/
- @input =~/landscape\.tex$/ \
- ? %{#{texpdf} -interaction=#{mode} -papersize="#{papersize} -l" #{@input} #{tell}\n}
- : %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n}
- when /pdftex/; "#{texpdf} -interaction=#{mode} -fmt=pdflatex #{@input} #{tell}\n"
- when /pdflatex/; "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n"
+ %{#{texpdf} -interaction=#{mode} -papersize="#{papersize}" #{@input} #{tell}\n}
+ when /pdftex/
+ "#{texpdf} -interaction=#{mode} -fmt=pdflatex #{@input} #{tell}\n"
+ when /pdflatex/
+ "#{texpdf} -interaction=#{mode} #{@input} #{tell}\n"
end
system(texpdf_cmd)
else STDERR.puts "\t*WARN* none of the following programs are installed: #{program[0]}, #{program[1]}, #{program[2]} is installed. #{program_ref}"
@@ -979,7 +973,7 @@ module SiSU_Env
include FileUtils
attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:processing_git,:etc,:yamlrc_dir
@@image_flag,@@local_image=true,true #warning on @@image_flag
- @@fb=@@man_path=nil,nil
+ @@fb,@@man_path=nil,nil
def initialize(fns='',md=nil)
super() #you may not want to re-execute this static info so frequently!
@fns,@md=fns,md
@@ -990,7 +984,7 @@ module SiSU_Env
elsif defined? @env.fnb \
and @env.fnb
@env.fnb
- elsif not @fns.nil? \
+ elsif @fns.is_a?(String) \
and not @fns.empty?
m=/(.+)?\.(?:(?:-|ssm\.)?sst|ssm)$/m
@fns[m,1] if not @fns.empty?
@@ -1193,25 +1187,25 @@ module SiSU_Env
end
def html_minitoc?
flag=if defined? @rc['html']['minitoc'] \
- and not @rc['html']['minitoc'].nil?
+ and @rc['html']['minitoc'].is_a?(String)
@rc['html']['minitoc']
else false
end
end
def manifest_minitoc?
- flag=if (defined? @rc['manifest']['minitoc'] \
- and not @rc['manifest']['minitoc'].nil?)
+ flag=if defined? @rc['manifest']['minitoc'] \
+ and @rc['manifest']['minitoc'].is_a?(String)
@rc['manifest']['minitoc']
else false
end
end
def build
def omit_list
- @off_list ||=if (defined? @rc['omit_list'] \
- and not @rc['omit_list'].nil?)
+ @off_list ||=if defined? @rc['omit_list'] \
+ and @rc['omit_list'].is_a?(String)
@rc['omit_list']
- elsif (defined? @rc['omit']['list'] \
- and not @rc['omit']['list'].nil?)
+ elsif defined? @rc['omit']['list'] \
+ and @rc['omit']['list'].is_a?(String)
@rc['omit']['list']
else
nil
@@ -1390,7 +1384,7 @@ module SiSU_Env
true
elsif defined? @vz.widget_promo \
and not @vz.widget_promo.nil? \
- and @vz.widget_promo.class==Array \
+ and @vz.widget_promo.is_a?(Array) \
and @vz.widget_promo.length > 0
@flag[:sk]=true
true
@@ -1745,18 +1739,15 @@ WOK
self
end
def read_source_file(fns)
- fns_array=if RUBY_VERSION < '1.9'
- x=unless fns =~/\.ssm.sst$/
- IO.readlines(fns,'')
- else IO.readlines("#{processing_path.composite_file}/#{fns}",'')
- end
- else #ruby version >= '1.9'
- x=unless fns =~/\.ssm.sst$/
- IO.readlines(fns,'r:utf-8')
- else IO.readlines("#{processing_path.composite_file}/#{fns}",'r:utf-8')
- end
+ fns_array=unless fns =~/\.ssm.sst$/
+ IO.readlines(fns, mode: 'r:utf-8', cr_newline: true)
+ else
+ IO.readlines("#{processing_path.composite_file}/#{fns}", mode: 'r:utf-8', cr_newline: true)
end
end
+ def source_file_processing_array(fns)
+ sf=read_source_file(fns).join.split(/\s*\n\s*\n/m)
+ end
def path #dir
def home
@sys.home
@@ -2077,8 +2068,7 @@ WOK
end
def dal
pth=if defined? @rc['processing']['dal'] \
- and not @rc['processing']['dal'].nil? \
- and not @rc['processing']['dal'].empty?
+ and @rc['processing']['dal'].is_a?(String)
"#{processing}/#{@rc['processing']['dal']}"
else "#{processing}/#{defaults[:processing_dal]}"
end
@@ -2087,8 +2077,7 @@ WOK
end
def tune
pth=if defined? @rc['processing']['tune'] \
- and not @rc['processing']['tune'].nil? \
- and not @rc['processing']['tune'].empty?
+ and @rc['processing']['tune'].is_a?(String)
"#{processing}/#{@rc['processing']['tune']}"
else "#{processing}/#{defaults[:processing_tune]}"
end
@@ -2102,8 +2091,7 @@ WOK
end
def git
pth=if defined? @rc['git']['dir'] \
- and not @rc['git']['dir'].nil? \
- and not @rc['git']['dir'].empty?
+ and @rc['git']['dir'].is_a?(String)
x=(@rc['git']['dir'] =~/^(?:~|home)$/) \
? home + '/' + Gt[:git]
: @rc['git']['dir'] + '/' + Gt[:git]
@@ -2168,8 +2156,7 @@ WOK
end
def tex
pth=if defined? @rc['processing']['latex'] \
- and not @rc['processing']['latex'].nil? \
- and not @rc['processing']['latex'].empty?
+ and @rc['processing']['latex'].is_a?(String)
"#{processing}/#{@rc['processing']['latex']}"
else "#{processing}/#{defaults[:processing_latex]}"
end
@@ -2178,8 +2165,7 @@ WOK
end
def texi
pth=if defined? @rc['processing']['texinfo'] \
- and not @rc['processing']['texinfo'].nil? \
- and not @rc['processing']['texinfo'].empty?
+ and @rc['processing']['texinfo'].is_a?(String)
"#{processing}/#{@rc['processing']['texinfo']}"
else "#{processing}/#{defaults[:processing_texinfo]}"
end
@@ -2194,8 +2180,7 @@ WOK
end
def lout
pth=if defined? @rc['processing']['lout'] \
- and not @rc['processing']['lout'].nil? \
- and not @rc['processing']['lout'].empty?
+ and @rc['processing']['lout'].is_a?(String)
"#{processing}/#{@rc['processing']['lout']}"
else "#{processing}/#{defaults[:processing_lout]}"
end
@@ -2209,8 +2194,7 @@ WOK
end
def sqlite
pth=if defined? @rc['processing']['sqlite'] \
- and not @rc['processing']['sqlite'].nil? \
- and not @rc['processing']['sqlite'].empty?
+ and @rc['processing']['sqlite'].is_a?(String)
"#{processing}/#{@rc['processing']['sqlite']}"
else "#{processing}/#{defaults[:processing_sqlite]}"
end
@@ -2219,8 +2203,7 @@ WOK
end
def postgresql
pth=if defined? @rc['processing']['postgresql'] \
- and not @rc['processing']['postgresql'].nil? \
- and not @rc['processing']['postgresql'].empty?
+ and @rc['processing']['postgresql'].is_a?(String)
"#{processing}/#{@rc['processing']['postgresql']}"
else "#{processing}/#{defaults[:processing_postgresql]}"
end
@@ -2292,82 +2275,41 @@ WOK
else defaults[:webserv_host_cgi]
end
end
- def webrick_port
- if @md \
- and @md.opt.cmd.inspect=~/-F/ \
- and @md.opt.mod.inspect=~/port=(\d+)/
- $1
- else
- if defined? @rc['webserv_cgi']['port']
- if @rc['webserv_cgi']['port'].nil? \
- and (defined? @md.opt.mod \
- and not @md.opt.mod.nil? \
- and @md.opt.mod.inspect=~/webrick/)
- defaults[:webserv_port_cgi]
- elsif not @rc['webserv_cgi']['port'].nil?
- @rc['webserv_cgi']['port']
- else defaults[:webserv_port_cgi]
- end
- else defaults[:webserv_port_cgi]
- end
- end
- end
- def webserv_port_cgi
- if @md \
- and defined? @md.opt \
- and @md.opt.cmd.inspect=~/-F/ \
- and @md.opt.mod.inspect=~/port=(\d+)/
- $1
- else
- if defined? @rc['webserv_cgi']['port']
- if @rc['webserv_cgi']['port'].nil? \
- and (defined? @md.opt.mod \
- and not @md.opt.mod.nil? \
- and @md.opt.mod.inspect=~/webrick/)
- defaults[:webserv_port_cgi]
- elsif not @rc['webserv_cgi']['port'].nil?
- @rc['webserv_cgi']['port']
- else nil
- end
- else nil
- end
- end
- end
def webserv_cgi #web url for local webserv (localhost, or hostname)
if defined? @rc['webserv_cgi']['host'] \
- and not @rc['webserv_cgi']['host'].nil?
+ and @rc['webserv_cgi']['host'].is_a?(String)
http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') #check https? missing
- if webserv_port_cgi
- "#{http}#{@rc['webserv_cgi']['host']}:#{webserv_port_cgi}/#{@stub_pwd}"
+ if port.webserv_port_cgi
+ "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}/#{@stub_pwd}"
else "#{http}#{@rc['webserv_cgi']['host']}/#{@stub_pwd}"
end
else
http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://')
- if webserv_port_cgi
- "#{http}#{webserv_host_base}:#{webserv_port_cgi}/#{@stub_pwd}"
+ if port.webserv_port_cgi
+ "#{http}#{webserv_host_base}:#{port.webserv_port_cgi}/#{@stub_pwd}"
else "#{http}#{webserv_host_base}/#{@stub_pwd}"
end
end
end
def webserv_base_cgi #web url for local webserv (localhost, or hostname)
if defined? @rc['webserv_cgi']['host'] \
- and not @rc['webserv_cgi']['host'].nil?
+ and @rc['webserv_cgi']['host'].is_a?(String)
http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://')
- if webserv_port_cgi
- "#{http}#{@rc['webserv_cgi']['host']}:#{webserv_port_cgi}"
+ if port.webserv_port_cgi
+ "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}"
else "#{http}#{@rc['webserv_cgi']['host']}"
end
else
http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://')
- if webserv_port_cgi
- "#{http}#{webserv_host_base}:#{webserv_port_cgi}"
+ if port.webserv_port_cgi
+ "#{http}#{webserv_host_base}:#{port.webserv_port_cgi}"
else "#{http}#{webserv_host_base}"
end
end
end
def webrick #must have a port #REMOVE
if defined? @rc['webserv_cgi']['host'] \
- and not @rc['webserv_cgi']['host'].nil?
+ and @rc['webserv_cgi']['host'].is_a?(String)
http=if @rc['webserv_cgi']['host'] =~/http:\/\//
'http://'
elsif @rc['webserv_cgi']['host'] =~/https:\/\//
@@ -2376,7 +2318,7 @@ WOK
end
"#{http}#{@rc['webserv_cgi']['host']}"
elsif webserv_host_base \
- and not webserv_host_base.nil?
+ and webserv_host_base.is_a?(String)
"#{http}#{webserv_host_base}"
else "#{http}localhost" end
end
@@ -2391,8 +2333,8 @@ WOK
elsif defined? @rc['webserv']['webrick_url'] \
and @rc['webserv']['webrick_url']==false
"file://#{path.webserv}"
- elsif webserv_port_cgi =~/\S+/
- "#{url.hostname}:#{webserv_port_cgi}"
+ elsif port.webserv_port_cgi =~/\S+/
+ "#{url.hostname}:#{port.webserv_port_cgi}"
else
url.hostname
end
@@ -2485,6 +2427,50 @@ WOK
end
self
end
+ def port
+ def webrick_port
+ if @md \
+ and @md.opt.cmd.inspect=~/-F/ \
+ and @md.opt.mod.inspect=~/port=(\d+)/
+ $1
+ else
+ if defined? @rc['webserv_cgi']['port']
+ if @rc['webserv_cgi']['port'].nil? \
+ and (defined? @md.opt.mod \
+ and not @md.opt.mod.nil? \
+ and @md.opt.mod.inspect=~/webrick/)
+ defaults[:webserv_port_cgi]
+ elsif not @rc['webserv_cgi']['port'].nil?
+ @rc['webserv_cgi']['port']
+ else defaults[:webserv_port_cgi]
+ end
+ else defaults[:webserv_port_cgi]
+ end
+ end
+ end
+ def webserv_port_cgi
+ if @md \
+ and defined? @md.opt \
+ and @md.opt.cmd.inspect=~/-F/ \
+ and @md.opt.mod.inspect=~/port=(\d+)/
+ $1
+ else
+ if defined? @rc['webserv_cgi']['port']
+ if @rc['webserv_cgi']['port'].nil? \
+ and (defined? @md.opt.mod \
+ and not @md.opt.mod.nil? \
+ and @md.opt.mod.inspect=~/webrick/)
+ defaults[:webserv_port_cgi]
+ elsif not @rc['webserv_cgi']['port'].nil?
+ @rc['webserv_cgi']['port']
+ else nil
+ end
+ else nil
+ end
+ end
+ end
+ self
+ end
def digest
def type
if defined? @rc['default']['digest'] \
@@ -2745,48 +2731,42 @@ WOK
end
def cf_0 #processing flag shortcuts
if defined? @rc['flag']['default'] \
- and not (@rc['flag']['default'].nil? \
- or @rc['flag']['default'].empty?)
+ and @rc['flag']['default'].is_a?(String)
@rc['flag']['default']
else '-NQhewpotbxXdyYv'
end
end
def cf_1 #processing flag shortcuts
if defined? @rc['flag']['i'] \
- and not (@rc['flag']['i'].nil? \
- or @rc['flag']['i'].empty?)
+ and @rc['flag']['i'].is_a?(String)
@rc['flag']['i']
else '-Qhewpoty'
end
end
def cf_2 #processing flag shortcuts
if defined? @rc['flag']['ii'] \
- and not (@rc['flag']['ii'].nil? \
- or @rc['flag']['ii'].empty?)
+ and @rc['flag']['ii'].is_a?(String)
@rc['flag']['ii']
else '-NQhewpotbxXdy'
end
end
def cf_3 #processing flag shortcuts
if defined? @rc['flag']['iii'] \
- and not (@rc['flag']['iii'].nil? \
- or @rc['flag']['iii'].empty?)
+ and @rc['flag']['iii'].is_a?(String)
@rc['flag']['iii']
else '-NQhewpotbxXdyY'
end
end
def cf_4 #processing flag shortcuts
if defined? @rc['flag']['iv'] \
- and not (@rc['flag']['iv'].nil? \
- or @rc['flag']['iv'].empty?)
+ and @rc['flag']['iv'].is_a?(String)
@rc['flag']['iv']
else '-NQhewpotbxXdDyY --update'
end
end
def cf_5 #processing flag shortcuts
if defined? @rc['flag']['v'] \
- and not (@rc['flag']['v'].nil? \
- or @rc['flag']['v'].empty?)
+ and @rc['flag']['v'].is_a?(String)
@rc['flag']['v']
else '-NQhewpotbxXdDyYv --update'
end
@@ -2984,7 +2964,7 @@ WOK
def remote_host #see InfoRemote remote_host_base_general
r=[]
r=if (defined? @rc['remote'] \
- and @rc['remote'].class==Array)
+ and @rc['remote'].is_a?(Array))
r_array=@rc['remote']
r_array.each_with_index do |renv,i|
r[i]={}
@@ -3001,7 +2981,7 @@ WOK
end
r
elsif (defined? @rc['remote'] \
- and @rc['remote'].class==Hash \
+ and @rc['remote'].is_a?(Hash) \
and defined? @rc['remote']['user'] \
and defined? @rc['remote']['host'])
r[0]={}
@@ -3467,8 +3447,8 @@ WOK
def dal_idx_sst_rel_html_seg
"#{@env.processing_path.dal}/#{@fns}.idx_sst.rbm"
end
- def dal_idx_sst_rel
- "#{@env.processing_path.dal}/#{@fns}.idx_tex.rbm"
+ def dal_idx_sst_rel #used by tex & odf
+ "#{@env.processing_path.dal}/#{@fns}.idx_raw.rbm"
end
def dal_idx_html
"#{@env.processing_path.dal}/#{@fns}.idx_html.rbm"
@@ -3879,7 +3859,7 @@ WOK
def port #PGPORT
((defined? @rc['db']['postgresql']['port']) \
&& ( @rc['db']['postgresql']['port'] =~/\d+/ \
- || @rc['db']['postgresql']['port'].class==Fixnum)) \
+ || @rc['db']['postgresql']['port'].is_a?(Fixnum))) \
? @rc['db']['postgresql']['port']
: (@defaults[:postgresql_port])
end
@@ -5630,7 +5610,7 @@ WOK
@env=SiSU_Env::InfoEnv.new
end
def webrick
- @env.url.webrick_port
+ @env.port.webrick_port
end
end
class InfoProgram < InfoEnv #revisit
@@ -5643,7 +5623,8 @@ WOK
class InfoSkin
def initialize(md=nil,skin=nil)
@md=md
- @d_sk=if skin.class==String ; skin
+ @d_sk=if skin.is_a?(String)
+ skin
elsif defined? md.doc_skin \
and md.doc_skin
md.doc_skin
@@ -6032,15 +6013,3 @@ module SiSU_Errors
end
__END__
https? intro check 2007-09-22
-
-fns_array=unless fns =~/\.ssm.sst$/
- if RUBY_VERSION < '1.9'
- IO.readlines(fns,'')
- else IO.readlines(fns,'r:utf-8')
- end
-else
- if RUBY_VERSION < '1.9'
- IO.readlines("#{processing_path.composite_file}/#{fns}",'')
- else IO.readlines("#{processing_path.composite_file}/#{fns}",'r:utf-8')
- end
-end
diff --git a/lib/sisu/v3/texinfo_format.rb b/lib/sisu/v3/texinfo_format.rb
index 7374d01e..78f2a188 100644
--- a/lib/sisu/v3/texinfo_format.rb
+++ b/lib/sisu/v3/texinfo_format.rb
@@ -66,10 +66,10 @@ module SiSU_TexInfoFormat
@@tex_pattern_margin_number="\\\\marginpar.+?\s+"
def initialize(md,dob=nil)
@md,@dob=md,dob
- if dob.class==Hash
+ if dob.is_a?(Hash)
p dob.class
p caller
- elsif dob.class==String
+ elsif dob.is_a?(String)
p dob.class
p caller
end
diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb
index 4c224b22..0665c9b4 100644
--- a/lib/sisu/v3/texpdf.rb
+++ b/lib/sisu/v3/texpdf.rb
@@ -401,8 +401,9 @@ module SiSU_TeX
def tables(data)
@tex_file=[]
data.each do |dob|
- @tex_file << if dob.class==String \
- or dob.class==Hash; dob
+ @tex_file << if dob.is_a?(String) \
+ or dob.is_a?(Hash)
+ dob
elsif dob.is==:table
tables_hash(@md,dob) #Hash result
else dob
@@ -468,13 +469,14 @@ module SiSU_TeX
|| dob.is==:group \
|| dob.is==:alt \
|| dob.is==:verse
- dob.tmp=dob.tmp.gsub(/#{Mx[:nbsp]}/m,'{~}').
- gsub(/#{Mx[:gl_bullet]}/m,'$\txtbullet$\hspace{\enspace}'). #Bullet environment not used for grouped text, ∴ no hanging indent here
+ dob.tmp=dob.tmp.gsub(/#{Mx[:nbsp]}/m,' \hardspace ').
+ gsub(/#{Mx[:gl_bullet]}/m,'\txtbullet \hardspace '). #Bullet environment not used for grouped text, no hanging indent here
gsub(/#{Mx[:br_nl]}+/m,"\n\n") #match not ideal, but currently not inserting extra newlines anyway
ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob)
dob.tmp=if dob.is==:group \
|| dob.is==:block \
|| dob.is==:alt
+ dob.tmp=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters_safe
ocn \
+ @tex_ml.paraskip_small \
+ "\n" \
@@ -485,6 +487,9 @@ module SiSU_TeX
+ "\n" \
+ @tex_ml.paraskip_normal
elsif dob.is==:verse
+ dob.tmp=dob.tmp.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'\begin{bfseries}\1 \end{bfseries}').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'\emph{\1}').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/m,'\uline{\1}')
ocn \
+ @tex_ml.paraskip_tiny \
+ "\n" \
@@ -531,14 +536,14 @@ module SiSU_TeX
h=tst.heading_major
heading="\\clearpage\n" + h.tmp
idx_arr=[]
- idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_tex(@md.opt).tex_idx
+ idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_raw(@md.opt).raw_idx
idx.each do |x|
- x=if x.class==String
+ x=if x.is_a?(String)
x=SiSU_TeX_Pdf::SpecialCharacters.new(@md,x).special_characters
x=SiSU_TeX_Pdf::FormatTextObject.new(@md,x).url_str_internal(x,true)
else x=nil
end
- idx_arr << x.sub(/,$/,'') if x.class==String
+ idx_arr << x.sub(/,$/,'') if x.is_a?(String)
end
idx_str=idx_arr.join(br)
l=heading + br + idx_str
@@ -577,7 +582,7 @@ module SiSU_TeX
dob.tmp=dob.tmp.strip unless dob.is==:code
dob=enclose(dob) unless dob.tmp =~/^$/
end
- if dob.class==String
+ if dob.is_a?(String)
dob.tmp=dob.tmp.gsub(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \newline '). #% tread with care
gsub(/(\.#{Tex[:tilde]}\S*\s*|<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #% tread with care
end
@@ -705,8 +710,8 @@ WOK
% \\sloppy
\\begin{document}
WOK
- sisu_rc_footnote=if @md.sc_info; @tex_ml.doc_sc_info_footnote_full
- else @tex_ml.doc_sc_info_footnote_brief
+ sisu_rc_footnote=if @md.sc_info then @tex_ml.doc_sc_info_footnote_full
+ else @tex_ml.doc_sc_info_footnote_brief
end
@copymark='' #check and remove as now is superflous
x={}
@@ -771,7 +776,7 @@ WOK
@tex_file << x
x=nil
data.each do |dob| #% case follows with levels 1-6 indents & graphics
- if dob.class==Hash
+ if dob.is_a?(Hash)
elsif dob.of==:para \
|| dob.of==:block #GATEWAY FIX FIX stuff
dob=markup_common(dob)
@@ -792,7 +797,7 @@ WOK
end
end
end
- elsif dob.tmp.class==Hash \
+ elsif dob.tmp.is_a?(Hash) \
and (dob.tmp[:p] and dob.tmp[:l])
dob = {
p: markup_common(dob.tmp[:p]),
@@ -839,7 +844,7 @@ WOK
def number_paras(data)
tex_file=[]
data.each do |dob|
- dob=if dob.class==Hash
+ dob=if dob.is_a?(Hash)
if ( dob['a4'] \
or dob['a5'] \
or dob['b5'] \
@@ -927,7 +932,7 @@ WOK
file[:portrait] << @@tex_head[ps][:p]
file[:landscape] << @@tex_head[ps][:l]
array.each do |morph|
- if morph.class==String
+ if morph.is_a?(String)
#morph.gsub!(/^\s+/,'')
if morph !~/\A\s*\Z/
file[:portrait].puts morph,"\n"
@@ -935,7 +940,7 @@ WOK
end
elsif morph.class.inspect =~ /SiSU_DAL_DocumentStructure/ \
and morph.tmp \
- and morph.tmp.class==String
+ and morph.tmp.is_a?(String)
if morph.is !=:code \
&& morph.of !=:block
morph.tmp=morph.tmp.gsub(/^\s+/,'')
@@ -946,10 +951,10 @@ WOK
file[:portrait].puts morph.tmp,"\n"
file[:landscape].puts morph.tmp,"\n"
end
- elsif morph.class==Hash #inserted headers and the like, only
+ elsif morph.is_a?(Hash) #inserted headers and the like, only
h={ ps: ps, h: morph, filename: file }
output_morph_hash(h)
- elsif morph.tmp.class==Hash #tables & images?
+ elsif morph.tmp.is_a?(Hash) #tables & images?
h={ ps: ps, h: morph.tmp, filename: file }
output_morph_hash(h)
end
diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb
index 43763157..2bd558bc 100644
--- a/lib/sisu/v3/texpdf_format.rb
+++ b/lib/sisu/v3/texpdf_format.rb
@@ -719,7 +719,7 @@ module SiSU_TeX_Pdf
def initialize(md,t_o)
@md,@t_o=md,t_o
@env=SiSU_Env::InfoEnv.new(@md.fns)
- if t_o.class==Hash
+ if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
@subtitle=t_o[:subtitle] || nil
@ps=t_o[:paper_size] || nil
@@ -1284,8 +1284,7 @@ WOK
"\\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
end
str=str.gsub(/<:ee>/,'').
- gsub(/<!>/,' ').
- #proposed change, insert, but may be redundant
+ gsub(/<!>/,' '). #proposed change, insert, but may be redundant
gsub(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} "). # Work Area
gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}').
gsub(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}').
diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb
index 1dcf988f..0aba1d89 100644
--- a/lib/sisu/v3/urls.rb
+++ b/lib/sisu/v3/urls.rb
@@ -278,10 +278,11 @@ module SiSU_Urls
end
def urls_select
unless @opt.cmd =~/q/
- i="(output manifest) [#{@opt.f_pth[:lng_is]}] #{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}"
+ i1="[#{@opt.f_pth[:lng_is]}]"
+ i2="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}"
@opt.cmd=~/[MVvz]/ \
? SiSU_Screen::Ansi.new(@opt.cmd,'URLs').green_title_hi
- : SiSU_Screen::Ansi.new(@opt.cmd,'URL',i).grey_title_hi
+ : SiSU_Screen::Ansi.new(@opt.cmd,'URL (output manifest)',i1, i2).grey_title_grey_blue
SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").flow if @opt.cmd =~/[MVv]/
end
m=/.+\/(?:src\/)?(\S+)/im # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
diff --git a/lib/sisu/v3/webrick.rb b/lib/sisu/v3/webrick.rb
index f8189bba..96280d0c 100644
--- a/lib/sisu/v3/webrick.rb
+++ b/lib/sisu/v3/webrick.rb
@@ -56,77 +56,54 @@
suffixes, see man pages for options
=end
-def brick(port,get='')
- cgidir=if get=~/pwd/; Dir.pwd
- else '/usr/lib/cgi-bin' # @env.path.cgi
- end
- port=SiSU_Env::InfoPort.new.webrick
- begin
- s=HTTPServer.new(
- Port: port,
- DocumentRoot: Dir::pwd + '/htdocs',
- CGIPathEnv: ENV['PATH']
- )
- cgi_dir=File.expand_path(cgidir)
- @mount.each { |x,y| # mount subdirectories
- s.mount(x, HTTPServlet::FileHandler, y, true)
- }
- s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, { FancyIndexing: true })
- trap("INT"){ s.shutdown }
- s.start
- rescue
- SiSU_Errors::InfoError.new($!,$@,'-W',nil).error do #fix
- __LINE__.to_s + ':' + __FILE__
- end
- ensure
- end
-end
-begin #%
- require 'webrick'
- include WEBrick
- require 'time'
- require_relative 'sysenv' # sysenv.rb
- include SiSU_Env; include SiSU_Screen
- @cX=SiSU_Screen::Ansi.new('yes').cX
- @env=SiSU_Env::InfoEnv.new
- port=SiSU_Env::InfoPort.new
- @argv=$*
- @host=@env.url.webrick
- host='localhost'
- @port="#{@argv[0].to_i}"
- @port="#{port.webrick}" if @port =~ /^0$/
- @serve=[]
- Dir.foreach(@env.path.webserv) do |x|
- if x !~/^\./ \
- and FileTest.directory?("#{@env.path.webserv}/#{x}")
- @serve << x
- end
- end
- @mount=[]
- @serve.each {|x| @mount << ["/#{x}", "#{@env.path.webserv}/#{x}"]}
- @pwd=Dir.pwd
- @week=Time.now.strftime(%{%Yw%W})
- puts "\n"
- @mount.each { |x,y|
- puts " #{@cX.cyan}#{x}#{@cX.off}\t#{@cX.grey}see#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/wb.cgi#{@cX.off} #{@cX.ruby}@#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/#{@cX.off}"
- }
- puts "#{@cX.grey}"
- wb_s2=[]
- #% writes file wb.cgi to shared directories ...
- #% wb_top
- wb_top=%q(#!/usr/bin/env ruby
- # * arch-tag: webrick info on environment, mounted directories, and contents of pwd
- require 'time'
- require 'cgi'
- require 'fcgi'
- ls=Dir.entries('./')
- dir_contents=[]
- ls.each { |x| dir_contents << "<a href=\"./#{x}/\">#{x}</a><br>" unless x =~/^(\.)+$/ }
- dir_contents=dir_contents.sort.join(' ')
- #host=ENV['HOSTNAME']
- #host=%x{echo $HOSTNAME}
- )
- wb_s1=<<WOK
+module SiSU_Webserv
+ class WebrickStart
+ require 'webrick'
+ include WEBrick
+ require 'time'
+ require_relative 'sysenv' # sysenv.rb
+ include SiSU_Env
+ include SiSU_Screen
+ def initialize
+ begin #%
+ @cX=SiSU_Screen::Ansi.new('yes').cX
+ @env=SiSU_Env::InfoEnv.new
+ port=SiSU_Env::InfoPort.new
+ @host=@env.url.webrick
+ host='localhost'
+ @port=port.webrick
+ @serve=[]
+ Dir.foreach(@env.path.webserv) do |x|
+ if x !~/^\./ \
+ and FileTest.directory?("#{@env.path.webserv}/#{x}")
+ @serve << x
+ end
+ end
+ @mount=[]
+ @serve.each {|x| @mount << ["/#{x}", "#{@env.path.webserv}/#{x}"]}
+ @pwd=Dir.pwd
+ @week=Time.now.strftime(%{%Yw%W})
+ puts "\n"
+ @mount.each { |x,y|
+ puts " #{@cX.cyan}#{x}#{@cX.off}\t#{@cX.grey}see#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/wb.cgi#{@cX.off} #{@cX.ruby}@#{@cX.off} #{@cX.blue}#{@host}:#{@port}#{x}/#{@cX.off}"
+ }
+ puts "#{@cX.grey}"
+ wb_s2=[]
+ #% writes file wb.cgi to shared directories ...
+ #% wb_top
+ wb_top=%q(#!/usr/bin/env ruby
+ # * arch-tag: webrick info on environment, mounted directories, and contents of pwd
+ require 'time'
+ require 'cgi'
+ require 'fcgi'
+ ls=Dir.entries('./')
+ dir_contents=[]
+ ls.each { |x| dir_contents << "<a href=\"./#{x}/\">#{x}</a><br>" unless x =~/^(\.)+$/ }
+ dir_contents=dir_contents.sort.join(' ')
+ #host=ENV['HOSTNAME']
+ #host=%x{echo $HOSTNAME}
+ )
+ wb_s1=<<WOK
page=CGI.new "html3"
page.out {
@@ -142,36 +119,66 @@ begin #
page.p {''} +
page.p {page.b{"Webrick Served Directories: "}} +
WOK
- #% wb_s2 (mounts)
- @mount.each do |x,y| wb_s2 <<<<WOK
- page.p {page.b{'<a href="#{@host}:#{@port}#{x}/">#{x}</a> '} + '<a href="#{@host}:#{@port}#{x}/">#{@host}:#{@port}#{x}</a> (mounts: #{y}/) <a href="#{@host}:#{@port}#{x}/wb.cgi">info (wb.cgi)</a>'} +
+ #% wb_s2 (mounts)
+ @mount.each do |x,y| wb_s2 <<<<WOK
+ page.p {page.b{'<a href="#{@host}:#{@port}#{x}/">#{x}</a> '} + '<a href="#{@host}:#{@port}#{x}/">#{@host}:#{@port}#{x}</a> (mounts: #{y}/) <a href="#{@host}:#{@port}#{x}/wb.cgi">info (wb.cgi)</a>'} +
WOK
-end
- #% wb_end
- wb_end=<<WOK
+ end
+ #% wb_end
+ wb_end=<<WOK
page.p {page.b{"Contents of PWD (see URL): "}} +
page.p {"#\{dir_contents}"}
}
}
}
WOK
- @mount.each { |x,y| #% wb puts
- puts y
- filename=File.new("#{y}/wb.cgi",'w')
- filename << wb_top
- filename << wb_s1
- filename << wb_s2
- filename << wb_end
- filename.close
- FileUtils::chmod(0755,"#{y}/wb.cgi &") if FileTest.file?("#{y}/wb.cgi &")
- }
- puts " #{@cX.off}"
- get=@argv.shift if @argv[0] =~/pwd/ #% argv
- brick(@port,get)
-rescue;
- require_relative 'sysenv' # sysenv.rb
- SiSU_Errors::InfoError.new($!,$@,'-W',nil).error do #fix
- __LINE__.to_s + ':' + __FILE__
+ @mount.each { |x,y| #% wb puts
+ puts y
+ filename=File.new("#{y}/wb.cgi",'w')
+ filename << wb_top
+ filename << wb_s1
+ filename << wb_s2
+ filename << wb_end
+ filename.close
+ FileUtils::chmod(0755,"#{y}/wb.cgi &") if FileTest.file?("#{y}/wb.cgi &")
+ }
+ puts " #{@cX.off}"
+ #get=@argv.shift if @argv[0] =~/pwd/ #% argv
+ get=Dir.pwd
+ brick(@port,get)
+ rescue
+ require_relative 'sysenv' # sysenv.rb
+ SiSU_Errors::InfoError.new($!,$@,'-W',nil).error do #fix
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
+ def brick(port,get='')
+ cgidir=if get=~/pwd/; Dir.pwd
+ else '/usr/lib/cgi-bin' # @env.path.cgi
+ end
+ port=SiSU_Env::InfoPort.new.webrick
+ begin
+ s=HTTPServer.new(
+ Port: port,
+ DocumentRoot: Dir::pwd + '/htdocs',
+ CGIPathEnv: ENV['PATH']
+ )
+ cgi_dir=File.expand_path(cgidir)
+ @mount.each { |x,y| # mount subdirectories
+ s.mount(x, HTTPServlet::FileHandler, y, true)
+ }
+ s.mount('/cgi-bin', HTTPServlet::FileHandler, cgi_dir, { FancyIndexing: true })
+ trap("INT"){ s.shutdown }
+ s.start
+ rescue
+ SiSU_Errors::InfoError.new($!,$@,'-W',nil).error do #fix
+ __LINE__.to_s + ':' + __FILE__
+ end
+ ensure
+ end
+ end
end
ensure
end
diff --git a/lib/sisu/v3/xhtml_table.rb b/lib/sisu/v3/xhtml_table.rb
index 753b0242..30701433 100644
--- a/lib/sisu/v3/xhtml_table.rb
+++ b/lib/sisu/v3/xhtml_table.rb
@@ -84,7 +84,7 @@ module SiSU_XHTML_Table
end
nc+=1
end
- trc=trc.class==Array ? trc.flatten.join : trc
+ trc=(trc.is_a?(Array)) ? trc.flatten.join : trc
trc=" <tr>#{trc}</tr>\n"
nr+=1
table_rows << trc
diff --git a/lib/sisu/v3/xml_format.rb b/lib/sisu/v3/xml_format.rb
index a9f6fb01..52874eb1 100644
--- a/lib/sisu/v3/xml_format.rb
+++ b/lib/sisu/v3/xml_format.rb
@@ -195,17 +195,9 @@ module SiSU_XML_Format
@vz=SiSU_Env::GetInit.instance.skin #margin,paragraph,table,banner,url,png,txt,color,font,nav_txt,nav_png,credits,js,php
@index='index'
end
- def toc_head_escript #embedded script in this case PHP
- end
def table_close
'</font> </td></tr></table>'
end
- def buttons_home
- %{\n#{@banner.home_and_index_buttons}\n}
- end
- def copyat
- %{copy @ <a href="#{@url.home}" #{@js.home}>#{@txt.home}</a>}
- end
def toc_head
<<WOK
<html>
@@ -382,17 +374,6 @@ WOK
%{ </font>
#{@vz.table_close}}
end
- def buttons_home
- %{<!- home and index buttons -!>
- #{@vz.banner_home_and_index_buttons}
-<!- home and index buttons -!>}
- end
- def copyat
- %{#{@vz.paragraph_font_tiny}copy @
- <a href="#{@vz.url_home}" #{@vz.js_home}>
- #{@vz.txt_home}
- </a></font>}
- end
def html_close #moved
%{</body>
</html>}
@@ -541,8 +522,7 @@ WOK
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
+<a name="start" id="start"></a>}
end
def links_guide_open(type='horizontal')
if type=='vertical'; links_guide_vertical_open
@@ -629,7 +609,7 @@ WOK
def metadata
%{#{@vz.margin_css}
<h4 class="toc">
- <a href="#{@metalink}" #{@vz.js_metalink}>
+ <a href="#{@metalink}">
<i>MetaData</i>
</a>
</h4>
@@ -719,25 +699,24 @@ WOK
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
+<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.js_prev}>
+ <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.js_toc}>
+ <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.js_next}>
+ <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}}
@@ -745,17 +724,17 @@ WOK
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.js_toc}>
+ <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.js_prev}>
+ <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.js_next}>
+ <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
@@ -935,8 +914,7 @@ WOK
#{@vz.color_body}
<a name="top" id="top"></a>
<a name="up" id="up"></a>
-<a name="start" id="start"></a>
-#{@vz.js_top}}
+<a name="start" id="start"></a>}
end
def title_banner(title,subtitle,creator)
%{
@@ -999,7 +977,7 @@ WOK
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
- if t_o.class==Hash
+ if t_o.is_a?(Hash)
@txt =t_o[:txt] || nil
@ocn =t_o[:ocn] || nil
@ocn_display =t_o[:ocn_display] || nil
diff --git a/lib/sisu/v3/xml_tables.rb b/lib/sisu/v3/xml_tables.rb
index 98dc0140..ba89e791 100644
--- a/lib/sisu/v3/xml_tables.rb
+++ b/lib/sisu/v3/xml_tables.rb
@@ -97,11 +97,9 @@ module SiSU_Tables
if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u
@parablock=@parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
%{<tr>
- <td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}<b>}).
+ <td width="\\1%" valign="top"><b>}).
gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
- %{</b></td><td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}<b>}).
+ %{</b></td><td width="\\1%" valign="top"><b>}).
gsub(/#{Mx[:tc_c]}/,"</b>\n</td>\n</tr>")
@@tablehead=0
end
@@ -109,13 +107,11 @@ module SiSU_Tables
else
@parablock=@parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
%{<tr>
- <td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}}).
+ <td width="\\1%" valign="top">}).
gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,
%{
</td>
- <td width="\\1%" valign="top">
- #{@vz.paragraph_table_xml}}).
+ <td width="\\1%" valign="top">}).
gsub(/#{Mx[:tc_c]}/,"\n</td>\n</tr>\n")
end
@parablock