aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v5/ao.rb18
-rw-r--r--lib/sisu/v5/ao_doc_str.rb131
-rw-r--r--lib/sisu/v5/ao_expand_insertions.rb63
-rw-r--r--lib/sisu/v5/ao_idx.rb11
-rw-r--r--lib/sisu/v5/ao_images.rb11
-rw-r--r--lib/sisu/v5/ao_misc_arrange.rb4
-rw-r--r--lib/sisu/v5/db_create.rb30
-rw-r--r--lib/sisu/v5/db_indexes.rb20
-rw-r--r--lib/sisu/v5/dbi.rb24
-rw-r--r--lib/sisu/v5/dbi_discrete.rb3
-rw-r--r--lib/sisu/v5/defaults.rb3
-rw-r--r--lib/sisu/v5/dp.rb28
-rw-r--r--lib/sisu/v5/html.rb21
-rw-r--r--lib/sisu/v5/html_segments.rb4
-rw-r--r--lib/sisu/v5/hub_options.rb9
-rw-r--r--lib/sisu/v5/remote.rb6
-rw-r--r--lib/sisu/v5/rexml.rb12
-rw-r--r--lib/sisu/v5/se_db.rb7
-rw-r--r--lib/sisu/v5/se_hub_particulars.rb3
-rw-r--r--lib/sisu/v5/se_info_env.rb3
-rw-r--r--lib/sisu/v5/se_info_system.rb3
-rw-r--r--lib/sisu/v5/src_kdissert_share.rb3
-rw-r--r--lib/sisu/v5/sst_from_xml.rb3
-rw-r--r--lib/sisu/v5/texpdf.rb46
-rw-r--r--lib/sisu/v5/texpdf_format.rb12
-rw-r--r--lib/sisu/v5/utils.rb13
-rw-r--r--lib/sisu/v5/webrick.rb3
-rw-r--r--lib/sisu/v5/xhtml_epub2.rb3
-rw-r--r--lib/sisu/v5/xml_fictionbook2.rb3
-rw-r--r--lib/sisu/v5/xml_odf_odt.rb3
-rw-r--r--lib/sisu/v6/ao.rb18
-rw-r--r--lib/sisu/v6/ao_doc_str.rb131
-rw-r--r--lib/sisu/v6/ao_expand_insertions.rb63
-rw-r--r--lib/sisu/v6/ao_idx.rb11
-rw-r--r--lib/sisu/v6/ao_images.rb11
-rw-r--r--lib/sisu/v6/ao_misc_arrange.rb4
-rw-r--r--lib/sisu/v6/db_create.rb30
-rw-r--r--lib/sisu/v6/db_indexes.rb20
-rw-r--r--lib/sisu/v6/dbi.rb24
-rw-r--r--lib/sisu/v6/dbi_discrete.rb3
-rw-r--r--lib/sisu/v6/defaults.rb3
-rw-r--r--lib/sisu/v6/dp.rb28
-rw-r--r--lib/sisu/v6/html.rb21
-rw-r--r--lib/sisu/v6/html_segments.rb4
-rw-r--r--lib/sisu/v6/hub_options.rb9
-rw-r--r--lib/sisu/v6/remote.rb6
-rw-r--r--lib/sisu/v6/rexml.rb12
-rw-r--r--lib/sisu/v6/se_db.rb7
-rw-r--r--lib/sisu/v6/se_hub_particulars.rb3
-rw-r--r--lib/sisu/v6/se_info_env.rb3
-rw-r--r--lib/sisu/v6/se_info_system.rb3
-rw-r--r--lib/sisu/v6/src_kdissert_share.rb3
-rw-r--r--lib/sisu/v6/sst_from_xml.rb3
-rw-r--r--lib/sisu/v6/texpdf.rb46
-rw-r--r--lib/sisu/v6/texpdf_format.rb12
-rw-r--r--lib/sisu/v6/utils.rb13
-rw-r--r--lib/sisu/v6/webrick.rb3
-rw-r--r--lib/sisu/v6/xhtml_epub2.rb3
-rw-r--r--lib/sisu/v6/xml_fictionbook2.rb3
-rw-r--r--lib/sisu/v6/xml_odf_odt.rb3
60 files changed, 754 insertions, 252 deletions
diff --git a/lib/sisu/v5/ao.rb b/lib/sisu/v5/ao.rb
index 0a494184..e06259d6 100644
--- a/lib/sisu/v5/ao.rb
+++ b/lib/sisu/v5/ao.rb
@@ -497,27 +497,33 @@ module SiSU_AO
end
def make_marshal_idx_sst_html_seg
marshal_ao=@make.marshal.ao_idx_sst_rel_html_seg
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Array)
end
def make_marshal_idx_sst_rel
marshal_ao=@make.marshal.ao_idx_sst_rel
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Array)
end
def make_marshal_idx_html
marshal_ao=@make.marshal.ao_idx_html
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Array)
end
def make_marshal_idx_xhtml
marshal_ao=@make.marshal.ao_idx_xhtml
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Array)
end
def make_marshal_map_nametags
marshal_ao=@make.marshal.ao_map_nametags
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Hash)
end
def make_marshal_map_name_ocn_htmlseg
marshal_ao=@make.marshal.ao_map_ocn_htmlseg
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Hash)
end
end
class Make
diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb
index 11990abf..e10cc4ef 100644
--- a/lib/sisu/v5/ao_doc_str.rb
+++ b/lib/sisu/v5/ao_doc_str.rb
@@ -230,8 +230,11 @@ module SiSU_AO_DocumentStructureExtract
term_nodes << term_node
use,plus=rgx_idx_ocn_seg.match(term_node)[1,2]
@use=use.strip
- idx_hash[@use]=
- { sub: [], plus: plus } unless idx_hash[@use] and defined? idx_hash[@use]
+ unless idx_hash[@use] \
+ and defined? idx_hash[@use]
+ idx_hash[@use]=
+ { sub: [], plus: plus }
+ end
when Array
subterm_nodes=[]
term_node.each do |subterm_node|
@@ -240,8 +243,11 @@ module SiSU_AO_DocumentStructureExtract
: (subterm_node + '+0')
subterm_nodes << subterm_node
sub,sub_plus=rgx_idx_ocn_seg.match(subterm_node)[1,2]
- idx_hash[@use]=
- { sub: [], plus: 0 } unless idx_hash[@use] and defined? idx_hash[@use]
+ unless idx_hash[@use] \
+ and defined? idx_hash[@use]
+ idx_hash[@use]=
+ { sub: [], plus: 0 }
+ end
idx_hash[@use][:sub] <<
{ sub.strip => { plus: sub_plus } }
end
@@ -299,6 +305,18 @@ module SiSU_AO_DocumentStructureExtract
next
end
t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") if @@flag[:code]==:off
+ unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
+ idx=if t_o=~/^=\{\s*(.+)\s*\}\s*$\Z/m
+ m=$1
+ m=m.split(/[ ]*\n/).join(' ').
+ gsub(/\s+([|:;])\s+/,'\1').
+ gsub(/\s+([+]\d+)\s+/,'\1')
+ t_o=t_o.gsub(/\n=\{.+?\}\s*$/m,'')
+ idx_array_and_hash=construct_idx_array_and_hash(m)
+ idx_array_and_hash[:hash]
+ else nil
+ end
+ end
if t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \
and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$|^`:quote_(?:open|close)`/ \
and @@flag[:code]==:off \
@@ -308,17 +326,6 @@ module SiSU_AO_DocumentStructureExtract
and @@flag[:alt]==:off \
and @@flag[:box]==:off \
and @@flag[:table]==:off
- unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
- idx=if t_o=~/^=\{\s*(.+)\s*\}\s*$\Z/m; m=$1
- m=m.split(/[ ]*\n/).join(' ').
- gsub(/\s+([|:;])\s+/,'\1').
- gsub(/\s+([+]\d+)\s+/,'\1')
- t_o=t_o.gsub(/\n=\{.+?\}\s*$/m,'')
- idx_array_and_hash=construct_idx_array_and_hash(m)
- idx_array_and_hash[:hash]
- else nil
- end
- end
t_o=case t_o
when /^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ #metadata, header
if t_o=~/^#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*(.+)/m
@@ -707,7 +714,8 @@ module SiSU_AO_DocumentStructureExtract
tags: tags,
num: @num_id[:table],
}
- t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) \
+ unless h.nil?
tuned_file << t_o
h={
is_for: :table,
@@ -743,7 +751,8 @@ module SiSU_AO_DocumentStructureExtract
tags: tags,
num: @num_id[:table],
}
- t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) \
+ unless h.nil?
tuned_file << t_o
h={
is_for: :table,
@@ -779,7 +788,8 @@ module SiSU_AO_DocumentStructureExtract
tags: tags,
num: @num_id[:table],
}
- t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) \
+ unless h.nil?
tuned_file << t_o
h={
is_for: :table,
@@ -828,15 +838,22 @@ module SiSU_AO_DocumentStructureExtract
t_o=nil
end
end
- if @@flag[:code]==:curls or @@flag[:code]==:tics
- if (@@flag[:code]==:curls and t_o =~/^\}code/) \
- or (@@flag[:code]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ if @@flag[:code]==:curls \
+ or @@flag[:code]==:tics
+ if (@@flag[:code]==:curls \
+ && t_o =~/^\}code/) \
+ or (@@flag[:code]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/m)
@@flag[:code]=:off
- @tuned_code[-1].gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'')
+ if @tuned_code[-1]
+ @tuned_code[-1].
+ gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'')
+ end
obj=@tuned_code.join("\n")
tags=[]
h={
obj: obj,
+ idx: idx,
syntax: @@flag[:lngsyn],
tags: tags,
num: @num_id[:code_block],
@@ -854,7 +871,8 @@ module SiSU_AO_DocumentStructureExtract
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
end
- if (@@flag[:code]==:curls or @@flag[:code]==:tics) \
+ if (@@flag[:code]==:curls \
+ || @@flag[:code]==:tics) \
and t_o.is_a?(String)
sub_array=t_o.dup + "#{Mx[:br_nl]}"
@line_mode=[]
@@ -863,28 +881,40 @@ module SiSU_AO_DocumentStructureExtract
@tuned_code << t_o
t_o=nil
end
- elsif (@@flag[:poem]==:curls or @@flag[:poem]==:tics) \
- or (@@flag[:box]==:curls or @@flag[:box]==:tics) \
- or (@@flag[:group]==:curls or @@flag[:group]==:tics) \
- or (@@flag[:block]==:curls or @@flag[:block]==:tics) \
- or (@@flag[:alt]==:curls or @@flag[:alt]==:tics) \
- or (@@flag[:quote]==:open and t_o =~/`:quote_close`/m) #not
- if (@@flag[:poem]==:curls and t_o =~/^\}poem/) \
- or (@@flag[:poem]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ elsif (@@flag[:poem]==:curls \
+ || @@flag[:poem]==:tics) \
+ or (@@flag[:box]==:curls \
+ || @@flag[:box]==:tics) \
+ or (@@flag[:group]==:curls \
+ || @@flag[:group]==:tics) \
+ or (@@flag[:block]==:curls \
+ || @@flag[:block]==:tics) \
+ or (@@flag[:alt]==:curls \
+ || @@flag[:alt]==:tics) \
+ or (@@flag[:quote]==:open \
+ && t_o =~/`:quote_close`/m) #not
+ if (@@flag[:poem]==:curls \
+ && t_o =~/^\}poem$/m) \
+ or (@@flag[:poem]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:poem]=:off
h={
is_for: :poem,
obj: '',
+ idx: idx,
sym: :poem_close,
num: @num_id[:poem],
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
- elsif (@@flag[:box]==:curls and t_o =~/^\}box/) \
- or (@@flag[:box]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ elsif (@@flag[:box]==:curls \
+ && t_o =~/^\}box/) \
+ or (@@flag[:box]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:box]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:box],
}
@@ -894,16 +924,20 @@ module SiSU_AO_DocumentStructureExtract
h={
is_for: :box,
obj: '',
+ idx: idx,
sym: :box_close,
num: @num_id[:box],
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
- elsif (@@flag[:group]==:curls and t_o =~/^\}group/) \
- or (@@flag[:group]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ elsif (@@flag[:group]==:curls \
+ && t_o =~/^\}group/) \
+ or (@@flag[:group]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:group]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:group],
}
@@ -917,12 +951,15 @@ module SiSU_AO_DocumentStructureExtract
num: @num_id[:group],
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
- elsif (@@flag[:block]==:curls and t_o =~/^\}block/) \
- or (@@flag[:block]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ elsif (@@flag[:block]==:curls \
+ && t_o =~/^\}block/) \
+ or (@@flag[:block]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:block]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:block],
}
@@ -936,12 +973,15 @@ module SiSU_AO_DocumentStructureExtract
num: @num_id[:block],
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
- elsif (@@flag[:alt]==:curls and t_o =~/^\}alt/) \
- or (@@flag[:alt]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ elsif (@@flag[:alt]==:curls \
+ && t_o =~/^\}alt/) \
+ or (@@flag[:alt]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:alt]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:alt],
}
@@ -955,10 +995,12 @@ module SiSU_AO_DocumentStructureExtract
num: @num_id[:alt],
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
- elsif @@flag[:quote]==:open and t_o =~/`:quote_close`/m
+ elsif @@flag[:quote]==:open \
+ and t_o =~/`:quote_close`/m
@@flag[:quote]=:off
h={
is_for: :quote,
+ idx: idx,
obj: '',
sym: :quote_close,
num: @num_id[:quote],
@@ -977,9 +1019,12 @@ module SiSU_AO_DocumentStructureExtract
}
SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
- if (@@flag[:poem]==:curls or @@flag[:poem]==:tics \
- or @@flag[:group]==:curls or @@flag[:group]==:tics \
- or @@flag[:alt]==:curls or @@flag[:alt]==:tics) \
+ if (@@flag[:poem]==:curls \
+ || @@flag[:poem]==:tics) \
+ or (@@flag[:group]==:curls \
+ || @@flag[:group]==:tics) \
+ or (@@flag[:alt]==:curls \
+ || @@flag[:alt]==:tics) \
and t_o =~/\S/ \
and t_o !~/^(?:\}(?:verse|code|box|alt|group|block)|(?:verse|code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|alt|group|block)\{)/ \
and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic
diff --git a/lib/sisu/v5/ao_expand_insertions.rb b/lib/sisu/v5/ao_expand_insertions.rb
index 47ac9887..483e9fdb 100644
--- a/lib/sisu/v5/ao_expand_insertions.rb
+++ b/lib/sisu/v5/ao_expand_insertions.rb
@@ -142,7 +142,7 @@ module SiSU_AO_Insertions
}
end
def path_and_file(fn,pth)
- "#{@base_path}/#{pth}/#{fn}"
+ @base_path + '/' + pth + '/' + fn
end
def manifest
fn=@md.file.base_filename.manifest(fnh)
@@ -150,7 +150,7 @@ module SiSU_AO_Insertions
end
def html_toc
fn=@md.file.base_filename.html_segtoc(fnh)
- "#{@base_path}/html/#{@linked_doc}/#{fn}"
+ @base_path + '/html/' + @linked_doc + '/' + fn
end
def html_doc
fn=@md.file.base_filename.html_scroll(fnh)
@@ -158,7 +158,7 @@ module SiSU_AO_Insertions
end
def html_concordance
fn=@md.file.base_filename.html_concordance
- "#{@base_path}/html/#{@linked_doc}/#{fn}"
+ @base_path + '/html/' + @linked_doc + '/' + fn
end
def epub
fn=@md.file.base_filename.epub(fnh)
@@ -197,16 +197,17 @@ module SiSU_AO_Insertions
path_and_file(fn,'digest')
end
def source
- "#{@base_path}/src/#{@src}"
+ @base_path + '/src/' + @src
end
def sisupod
- "#{@base_path}/src/#{@src}.zip"
+ @base_path + '/src/' + @src + '.zip'
end
self
end
def by_filetype(linked_doc,lng,src=nil)
@linked_doc,@lng,@src=linked_doc,lng,src
- @lc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lng).language_code_insert
+ @lc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lng).
+ language_code_insert
@base_path="#{@md.file.output_path.base.url}"
def fnh
{
@@ -215,7 +216,7 @@ module SiSU_AO_Insertions
}
end
def path_and_file(fn,pth)
- "#{@base_path}/#{pth}/#{fn}"
+ @base_path + '/' + pth + '/' + fn
end
def manifest
fn=@md.file.base_filename.manifest(fnh)
@@ -270,10 +271,10 @@ module SiSU_AO_Insertions
path_and_file(fn,'digest')
end
def source
- "#{@base_path}/src/#{@src}"
+ @base_path + '/src/' + @src
end
def sisupod
- "#{@base_path}/src/#{@src}.zip"
+ @base_path + '/src/' + @src + '.zip'
end
self
end
@@ -289,8 +290,8 @@ module SiSU_AO_Insertions
end
def path_and_file(fn,pth=nil)
(pth.nil?) \
- ? "#{@base_path}/#{fn}"
- : "#{@base_path}/#{pth}/#{fn}"
+ ? @base_path + '/' + fn
+ : @base_path + '/' + pth + '/' + fn
end
def manifest
fn=@md.file.base_filename.manifest(fnh)
@@ -345,28 +346,50 @@ module SiSU_AO_Insertions
path_and_file(fn)
end
def source
- "#{@base_path}/#{@src}"
+ @base_path + '/' + @src
end
def sisupod
- "#{@base_path}/#{@src}.zip"
+ @base_path + '/' + @src + '.zip'
end
self
end
def expand_insertions?
data=@data
tuned_file,tuned_file_tmp=[],[]
- codeblock_=false
+ codeblock_={
+ status: :false,
+ type: :na,
+ }
data.each do |para|
- codeblock_=if para =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?)/
- true
- elsif para =~/^(?:\}code|```(?:\s|$))/m
- false
+ codeblock_=if para =~/^code(?:\.[a-z][0-9a-z_]+)?\{/ \
+ and codeblock_[:status]==:false
+ {
+ status: :true,
+ type: :curl,
+ }
+ elsif para =~/^```[ ]+code(?:\.[a-z][0-9a-z_]+)?/ \
+ and codeblock_[:status]==:false
+ {
+ status: :true,
+ type: :tics,
+ }
+ elsif codeblock_[:type]==:curl \
+ and para =~/^\}code/m
+ {
+ status: :false,
+ type: :na,
+ }
+ elsif codeblock_[:type]==:tics \
+ and para =~/^```(?:\s|$)/m
+ {
+ status: :false,
+ type: :na,
+ }
else codeblock_
end
if para !~/^%+\s/ \
- and not codeblock_ \
+ and codeblock_[:status] != :true \
and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/
- manifest=nil
@u=SiSU_Env::InfoEnv.new.url
m_cmd=''
if defined? @u.remote
diff --git a/lib/sisu/v5/ao_idx.rb b/lib/sisu/v5/ao_idx.rb
index c0dba12a..19f58082 100644
--- a/lib/sisu/v5/ao_idx.rb
+++ b/lib/sisu/v5/ao_idx.rb
@@ -79,7 +79,10 @@ module SiSU_AO_BookIndex
html_idx,xhtml_idx=
extract_book_index(data)
data=
- clean_and_insert_index(data,sisu_markup_idx_rel_html_seg)
+ clean_and_insert_index(
+ data,
+ sisu_markup_idx_rel_html_seg
+ )
[
data,
sisu_markup_idx_rel,
@@ -99,7 +102,11 @@ module SiSU_AO_BookIndex
end
if defined? dob.idx \
and dob.idx.is_a?(Hash)
- idx_array << {idx: dob.idx, ocn: dob.ocn, seg: @seg }
+ idx_array << {
+ idx: dob.idx,
+ ocn: dob.ocn,
+ seg: @seg
+ }
end
tuned_file << dob if dob
end
diff --git a/lib/sisu/v5/ao_images.rb b/lib/sisu/v5/ao_images.rb
index dce92fc5..dd33833d 100644
--- a/lib/sisu/v5/ao_images.rb
+++ b/lib/sisu/v5/ao_images.rb
@@ -134,6 +134,17 @@ module SiSU_AO_Images
end
img_col,img_row=/(\d+)x(\d+)/m.match(imgsys)[1,2]
img_col,img_row=img_col.to_i,img_row.to_i
+ else
+ errmsg='imagemagick or graphicksmagick are required to process images'
+ if @md.opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding (as requested) without image processing")
+ break
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
end
end
row=((img && defined? img.rows) ? img.rows : img_row)
diff --git a/lib/sisu/v5/ao_misc_arrange.rb b/lib/sisu/v5/ao_misc_arrange.rb
index 09842fcc..ab61671c 100644
--- a/lib/sisu/v5/ao_misc_arrange.rb
+++ b/lib/sisu/v5/ao_misc_arrange.rb
@@ -98,11 +98,11 @@ module SiSU_AO_MiscArrangeText
else
para << block_open
end
- elsif para =~/\A.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m \
+ elsif para =~/\A.+?\n```(?:\s+\~\{.+?\}\~)?(?:\s+[~-][#])?(\s*=\{.+?\})?\s*\Z/m \
and @flag==:open
@flag=:close
text,block_close=
- /\A(.+?)\n(```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2]
+ /\A(.+?)\n(```(?:\s+\~\{.+?\}\~)?(?:\s+[~-][#])?(?:\s+=\{.+?\})?)\s*\Z/m.match(para)[1,2]
para=[]
if not text.to_s.empty?
para << text.to_s << block_close
diff --git a/lib/sisu/v5/db_create.rb b/lib/sisu/v5/db_create.rb
index 956a470a..19e81998 100644
--- a/lib/sisu/v5/db_create.rb
+++ b/lib/sisu/v5/db_create.rb
@@ -117,10 +117,38 @@ module SiSU_DbCreate
end
end
def conn_exec_pg(sql)
- @conn.exec_params(sql)
+ begin
+ @conn.exec_params(sql)
+ rescue
+ if @conn.is_a?(NilClass)
+ errmsg="No pg connection (check pg dependencies)"
+ if @opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without pg output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
+ end
+ end
end
def conn_exec_sqlite(sql)
+ begin
@conn.execute(sql)
+ rescue
+ if @conn.is_a?(NilClass)
+ errmsg="No sqlite3 connection (check sqlite3 dependencies)"
+ if @opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without sqlite output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
+ end
+ end
end
def metadata_and_text
if (@opt.act[:verbose_plus][:set]==:on \
diff --git a/lib/sisu/v5/db_indexes.rb b/lib/sisu/v5/db_indexes.rb
index b76e4b26..a27deb67 100644
--- a/lib/sisu/v5/db_indexes.rb
+++ b/lib/sisu/v5/db_indexes.rb
@@ -82,9 +82,23 @@ module SiSU_DbIndex
end
end
def conn_execute_array(sql_arr)
- @conn.transaction do |conn|
- sql_arr.each do |sql|
- conn_execute_sql(conn,sql)
+ begin
+ @conn.transaction do |conn|
+ sql_arr.each do |sql|
+ conn_execute_sql(conn,sql)
+ end
+ end
+ rescue
+ if @conn.is_a?(NilClass)
+ errmsg="No sqlite3 connection (check sqlite3 dependencies)"
+ if @opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without sqlite output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
end
end
end
diff --git a/lib/sisu/v5/dbi.rb b/lib/sisu/v5/dbi.rb
index a7bbd822..df4b3180 100644
--- a/lib/sisu/v5/dbi.rb
+++ b/lib/sisu/v5/dbi.rb
@@ -102,7 +102,12 @@ module SiSU_DBI
end
def read_psql
begin
- require 'pg'
+ begin
+ require 'pg'
+ rescue LoadError
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pg NOT FOUND (LoadError)')
+ end
@conn=@db.psql.conn_pg
rescue
if @opt.act[:psql_create][:set]==:on
@@ -119,10 +124,23 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet
def read_sqlite
begin
begin
- require 'sqlite3'
+ begin
+ require 'sqlite3'
+ rescue LoadError
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('sqlite3 NOT FOUND (LoadError)')
+ end
@conn=@db.sqlite.conn_sqlite3
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('sqlite3 NOT FOUND (LoadError)')
+ errmsg='sqlite3 NOT FOUND (LoadError)'
+ if @opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error(errmsg + ', ' + 'attempt to proceed without sqlite output (as requested)')
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error(errmsg + ', ' + 'STOPPING')
+ exit
+ end
end
end
end
diff --git a/lib/sisu/v5/dbi_discrete.rb b/lib/sisu/v5/dbi_discrete.rb
index b9c3eebe..51755469 100644
--- a/lib/sisu/v5/dbi_discrete.rb
+++ b/lib/sisu/v5/dbi_discrete.rb
@@ -73,7 +73,8 @@ module SiSU_DBI_Discrete #% database building
require 'fileutils'
include FileUtils::Verbose
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('fileutils NOT FOUND (LoadError)')
end
class SQL
def initialize(opt)
diff --git a/lib/sisu/v5/defaults.rb b/lib/sisu/v5/defaults.rb
index c2f0f19c..2da6c73d 100644
--- a/lib/sisu/v5/defaults.rb
+++ b/lib/sisu/v5/defaults.rb
@@ -65,7 +65,8 @@ module SiSU_Viz
begin
require 'uri'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('uri NOT FOUND (LoadError)')
end
require_relative 'se' # se.rb
include SiSU_Env
diff --git a/lib/sisu/v5/dp.rb b/lib/sisu/v5/dp.rb
index ef61f6b4..33c6c565 100644
--- a/lib/sisu/v5/dp.rb
+++ b/lib/sisu/v5/dp.rb
@@ -583,6 +583,34 @@ module SiSU_Param
def sep(str)
' \\\\ '
end
+ def copyright_and_license
+ s=if @h['all'] then @h['all']
+ else
+ s=''
+ if defined? copyright.text \
+ and copyright.text \
+ and not copyright.text.empty?
+ v=sep(copyright.text)
+ s +=copyright.text + v
+ end
+ if defined? copyright.license \
+ and copyright.license \
+ and not copyright.license.empty?
+ s +=copyright.license
+ end
+ if s.empty?
+ SiSU_Screen::Ansi.new(
+ @opt.act[:color_state][:set],
+ 'WARNING Document Rights information missing; provide @rights: :copyright:'
+ ).warn unless @opt.act[:quiet][:set]==:on
+ else
+ l,n=Db[:col_info_note],'rights.all'
+ validate_length(s,l,n)
+ end
+ s=s.gsub(/ [\\]+\s+$/,'')
+ end
+ s
+ end
def all
s=if @h['all'] then @h['all']
else
diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb
index 683eba96..33253c78 100644
--- a/lib/sisu/v5/html.rb
+++ b/lib/sisu/v5/html.rb
@@ -64,7 +64,8 @@ module SiSU_HTML
begin
require 'pstore'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pstore NOT FOUND (LoadError)')
end
require_relative 'se_hub_particulars' # se_hub_particulars.rb
include SiSU_Particulars
@@ -146,7 +147,14 @@ module SiSU_HTML
data=tuned_file_array
if @opt.act[:html_scroll][:set]==:on
scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet
- scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish
+ scroll=SiSU_HTML::Source::ScrollOutput.new(
+ scr_toc,
+ scr[:body],
+ scr[:metadata],
+ scr[:owner_details],
+ scr[:tails],
+ @md
+ ).publish
SiSU_HTML::Source::Output.new(scroll,@md).scroll
end
rescue
@@ -206,7 +214,11 @@ module SiSU_HTML
? '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 }
+ 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)
@links_guide_toc << lev_dob_ocn.links_guide if s_lnk_lnk
end
@@ -259,7 +271,8 @@ module SiSU_HTML
def initialize(md=nil,data='')
@data,@md=data,md
@vz=SiSU_Viz::Defaults.new
- @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
+ @ocn_html_identifier=
+ SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
@tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md
end
def songsheet #extracts toc for scroll & seg
diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb
index 9b0cc1c7..dab3159f 100644
--- a/lib/sisu/v5/html_segments.rb
+++ b/lib/sisu/v5/html_segments.rb
@@ -243,7 +243,9 @@ module SiSU_HTML_Seg
#my_make_source_file=SiSU_Env::CreateFile.new(@md.fns)
idx_html=SiSU_Particulars::CombinedSingleton.
instance.get_idx_html(@md.opt).html_idx
- idx_html.each {|x| @@seg[:idx] << x }
+ idx_html.each do |x|
+ @@seg[:idx] << x
+ end
@@seg[:heading_idx]=''
end
data.each do |dob|
diff --git a/lib/sisu/v5/hub_options.rb b/lib/sisu/v5/hub_options.rb
index 849be52f..bc96b878 100644
--- a/lib/sisu/v5/hub_options.rb
+++ b/lib/sisu/v5/hub_options.rb
@@ -65,7 +65,8 @@ module SiSU_Commandline
begin
require 'pathname'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pathname NOT FOUND (LoadError)')
end
require_relative 'se' # se.rb
require_relative 'dp_make' # dp_make.rb
@@ -780,6 +781,12 @@ module SiSU_Commandline
@act=@@act
else
act={}
+ act[:no_stop]=if select_arr.inspect \
+ =~/"--no-stop"|"--errors-as-warnings"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
act[:license]=(select_arr.inspect \
=~/"--license/) \
? { bool: true, set: :on }
diff --git a/lib/sisu/v5/remote.rb b/lib/sisu/v5/remote.rb
index 1a1a9f0a..81c0ed91 100644
--- a/lib/sisu/v5/remote.rb
+++ b/lib/sisu/v5/remote.rb
@@ -152,7 +152,8 @@ module SiSU_Remote
require 'open-uri'
require 'pp'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('open-uri or pp NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('open-uri or pp NOT FOUND (LoadError)')
end
require_relative 'ao_composite' # ao_composite.rb
@rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
@@ -201,7 +202,8 @@ module SiSU_Remote
begin
require 'net/http'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('net/http NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('net/http NOT FOUND (LoadError)')
end
for requested_pod in get_p
pod_info=RemoteDownload.new(requested_pod)
diff --git a/lib/sisu/v5/rexml.rb b/lib/sisu/v5/rexml.rb
index 98263899..93018be9 100644
--- a/lib/sisu/v5/rexml.rb
+++ b/lib/sisu/v5/rexml.rb
@@ -63,9 +63,11 @@
module SiSU_Rexml
# load XML file for REXML parsing
begin
- require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
+ require 'rexml/document' \
+ if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('rexml/document NOT FOUND (LoadError)')
end
require_relative 'dp' # dp.rb
include SiSU_Param
@@ -74,9 +76,11 @@ module SiSU_Rexml
include SiSU_Viz
class Rexml
begin
- require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
+ require 'rexml/document' \
+ if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('rexml/document NOT FOUND (LoadError)')
end
def initialize(md,fno)
@md,@fno=md,fno
diff --git a/lib/sisu/v5/se_db.rb b/lib/sisu/v5/se_db.rb
index fcb5fc0d..84fd6ba6 100644
--- a/lib/sisu/v5/se_db.rb
+++ b/lib/sisu/v5/se_db.rb
@@ -140,7 +140,12 @@ module SiSU_Info_Db
DBI.connect(psql.dbi,psql.user,psql.db)
end
def conn_pg
- require 'pg'
+ begin
+ require 'pg'
+ rescue LoadError
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pg NOT FOUND (LoadError)')
+ end
PG::Connection.new(dbname: psql.db, port: psql.port)
end
self
diff --git a/lib/sisu/v5/se_hub_particulars.rb b/lib/sisu/v5/se_hub_particulars.rb
index 17942a71..89744476 100644
--- a/lib/sisu/v5/se_hub_particulars.rb
+++ b/lib/sisu/v5/se_hub_particulars.rb
@@ -65,7 +65,8 @@ module SiSU_Particulars
begin
require 'singleton'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('singleton NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('singleton NOT FOUND (LoadError)')
end
require_relative 'se' # se.rb
include SiSU_Env
diff --git a/lib/sisu/v5/se_info_env.rb b/lib/sisu/v5/se_info_env.rb
index 6e3dc2ef..777644d7 100644
--- a/lib/sisu/v5/se_info_env.rb
+++ b/lib/sisu/v5/se_info_env.rb
@@ -77,7 +77,8 @@ module SiSU_Info_Env
require 'fileutils'
include FileUtils
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname or fileutils NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pathname or fileutils NOT FOUND (LoadError)')
end
attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:base_markup_dir_stub,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:processing_git,:etc,:yamlrc_dir
@@image_flag,@@local_image=true,true #warning on @@image_flag
diff --git a/lib/sisu/v5/se_info_system.rb b/lib/sisu/v5/se_info_system.rb
index 7f0e7a00..9bf61c4c 100644
--- a/lib/sisu/v5/se_info_system.rb
+++ b/lib/sisu/v5/se_info_system.rb
@@ -67,7 +67,8 @@ module SiSU_Info_Sys_Gen
begin
require 'rbconfig'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('rbconfig NOT FOUND (LoadError)')
end
@@user, @@home, @@hostname, @@pwd, @@sisu_etc, @@host, @@arch, @@rbver, @@dir_arch, @@dir_sitearch, @@dir_bin, @@locale, @@rc,@@sisurc_path,@@ad=
ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil, nil, {} # %x{ruby -v}.strip # Config::CONFIG['rb_ver']
diff --git a/lib/sisu/v5/src_kdissert_share.rb b/lib/sisu/v5/src_kdissert_share.rb
index e67d4249..0938ad26 100644
--- a/lib/sisu/v5/src_kdissert_share.rb
+++ b/lib/sisu/v5/src_kdissert_share.rb
@@ -68,7 +68,8 @@ module SiSU_KdiSource
require 'fileutils'
include FileUtils
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('fileutils NOT FOUND (LoadError)')
end
def initialize(opt)
@opt=opt
diff --git a/lib/sisu/v5/sst_from_xml.rb b/lib/sisu/v5/sst_from_xml.rb
index b6fccd92..ea1f3d11 100644
--- a/lib/sisu/v5/sst_from_xml.rb
+++ b/lib/sisu/v5/sst_from_xml.rb
@@ -68,7 +68,8 @@ module SiSU_sstFromXML
require 'rexml/document'
include REXML
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('rexml/document NOT FOUND (LoadError)')
end
def initialize(opt)
@opt=opt
diff --git a/lib/sisu/v5/texpdf.rb b/lib/sisu/v5/texpdf.rb
index fe7ec47e..c2c9dc70 100644
--- a/lib/sisu/v5/texpdf.rb
+++ b/lib/sisu/v5/texpdf.rb
@@ -64,7 +64,8 @@ module SiSU_TeX
begin
require 'pstore'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pstore NOT FOUND (LoadError)')
end
require_relative 'defaults' # defaults.rb
include SiSU_Viz
@@ -85,7 +86,8 @@ module SiSU_TeX
begin
require 'pstore'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pstore NOT FOUND (LoadError)')
end
require_relative 'se' # se.rb
include SiSU_Env
@@ -267,8 +269,16 @@ module SiSU_TeX
FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}")
FileUtils::rm(portrait_pdf)
else
- STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{portrait_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)"
STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.act[:maintenance][:set]==:on
+ errmsg="pdf file not generated #{portrait_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')} (check texlive dependencies)"
+ if @md.opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without pdf output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
end
end
if @md.opt.act[:pdf_l][:set]==:on
@@ -276,8 +286,16 @@ module SiSU_TeX
FileUtils::cp(landscape_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_l}")
FileUtils::rm(landscape_pdf)
else
- STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{landscape_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)"
STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.act[:maintenance][:set]==:on
+ errmsg="pdf file not generated #{landscape_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')} (check texlive dependencies)"
+ if @md.opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without pdf output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
end
end
if (@md.opt.act[:verbose][:set]==:on \
@@ -312,7 +330,15 @@ module SiSU_TeX
and File.size(texfile) > 0
#@tex_f_no+=1
else
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error("\tzero file size #{@env.processing_path.tex}/#{texfile}")
+ errmsg="zero file size #{@env.processing_path.tex}/#{texfile}"
+ if @md.opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without pdf output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
end
end
end
@@ -423,12 +449,10 @@ module SiSU_TeX
if defined? @md.rights.all \
and not @md.rights.all.empty?
rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed
- sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,rght.copyright.all)
- copymark=@md.author_copymark \
- ? '{\begin{small}\copyright\end{small}} '
- : ''
- copymark='Copyright {\begin{small}\copyright\end{small}} '
- copyright=sp_char.special_characters_safe.gsub(/^\s*Copyright \(C\)/, copymark)
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,rght.copyright.copyright_and_license)
+ copymark='Copyright {\begin{small}{\copyright\end{small}} '
+ #copymark='Copyright {\begin{small}^{\copyright\end{small}} '
+ copyright=sp_char.special_characters_safe.gsub(/\s*Copyright \(C\)/, copymark)
@@rights||="\n #{Tex[:backslash]*2}[3]\\ \\linebreak #{copyright}"
end
if defined? @md.notes.prefix_b \
diff --git a/lib/sisu/v5/texpdf_format.rb b/lib/sisu/v5/texpdf_format.rb
index 9957ab48..d0c2ca5d 100644
--- a/lib/sisu/v5/texpdf_format.rb
+++ b/lib/sisu/v5/texpdf_format.rb
@@ -184,7 +184,7 @@ module SiSU_TeX_Pdf
when /legal/i then @tx.legal.portrait.w #U.S. alternative
when /book|b5/i then @tx.b5.portrait.w #book default - larger
when /a5/i then @tx.a5.portrait.w
- else @tx.a4.portrait.w #default currently A4
+ else @tx.a4.portrait.w #default currently A4
end
textwidth=tw.to_i - 20
colW=[]
@@ -1445,7 +1445,7 @@ module SiSU_TeX_Pdf
str=str.gsub(/\\textbackslash (copyright|clearpage|newpage)/,"\\\\\\1") #kludge bad solution, find out where tail is sent through specChar !
str
end
- def special_characters #special characters - some substitutions are sequence sensitive, rearrange with care.
+ def special_characters # special characters - some substitutions are sequence sensitive, rearrange with care
str,is=@txt,@is
str=xetex_special_characters_1(str,is) unless str.nil?
str=special_characters_unsafe_1(str) unless str.nil? #xetex_special_characters_unsafe_1(@txt)
@@ -1464,10 +1464,10 @@ module SiSU_TeX_Pdf
str=str.gsub(/([0-9a-f]{8})/i,'\1\-')
@txt=str
end
- def special_characters_safe #special characters - some substitutions are sequence sensitive, rearrange with care.
+ def special_characters_safe # special characters - some substitutions are sequence sensitive, rearrange with care
str,is=@txt,@is
str=xetex_special_characters_1(str,is) unless str.nil?
- str=xetex_special_characters_2(str,is) unless str.nil? # remove this to start with, causes issues
+ str=xetex_special_characters_2(str,is) unless str.nil? # remove this to start with, causes issues
str=special_characters_safe_close(str) unless str.nil?
@txt=str
end
@@ -1478,7 +1478,7 @@ module SiSU_TeX_Pdf
str=special_characters_safe_close(str) unless str.nil?
@txt=str
end
- def characters_code_listings #special characters - some substitutions are sequence sensitive, rearrange with care.
+ def characters_code_listings # special characters - some substitutions are sequence sensitive, rearrange with care
str,is=@txt,@is
str=xetex_code_listings(str,is) unless str.nil?
@txt=str
@@ -1541,7 +1541,7 @@ module SiSU_TeX_Pdf
else ''
end
end
- def sitename #owners site, eg freeculture, free.for.all, gutenberg etc.
+ def sitename # owners site, eg freeculture, free.for.all, gutenberg etc.
"\\href{#{@vz.url_home}}{#{@vz.txt_home}}"
end
def owner_chapter
diff --git a/lib/sisu/v5/utils.rb b/lib/sisu/v5/utils.rb
index c5a312d2..1f4e6f05 100644
--- a/lib/sisu/v5/utils.rb
+++ b/lib/sisu/v5/utils.rb
@@ -130,7 +130,10 @@ module SiSU_Utils
def set(v=nil,x=nil)
v=var(v,x)
file,path=File.basename(@file),File.dirname(@file)
- v[:c][:on] + @line + v[:c][:off] + ' ' + path + '/' "#{v[:c][:on]}#{file}#{v[:c][:off]}" + v[:m]
+ v[:c][:on] + @line + v[:c][:off] + ' ' \
+ + path + '/' \
+ + "#{v[:c][:on]}#{file}#{v[:c][:off]}" \
+ + v[:m]
end
def mark(v=nil,x=nil)
puts set(v,x)
@@ -150,9 +153,9 @@ module SiSU_Utils
def warn(v=nil,x=nil)
if (v.is_a?(Symbol) \
and x.is_a?(String))
- x= '*WARN* ' + x
+ x="\n " + '*WARN* ' + x
elsif v.is_a?(String)
- v='*WARN* ' + v
+ v="\n " + '*WARN* ' + v
x=nil
else
v,x='*WARN*',nil
@@ -162,9 +165,9 @@ module SiSU_Utils
def error(v=nil,x=nil)
if (v.is_a?(Symbol) \
and x.is_a?(String))
- x= '*ERROR* ' + x
+ x="\n " + '*ERROR* ' + x
elsif v.is_a?(String)
- v='*ERROR* ' + v
+ v="\n " + '*ERROR* ' + v
x=nil
else
v,x='*ERROR*',nil
diff --git a/lib/sisu/v5/webrick.rb b/lib/sisu/v5/webrick.rb
index 5a8a3223..b36c1c8e 100644
--- a/lib/sisu/v5/webrick.rb
+++ b/lib/sisu/v5/webrick.rb
@@ -68,7 +68,8 @@ module SiSU_Webserv
require 'webrick'
include WEBrick
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('time or webrick NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('time or webrick NOT FOUND (LoadError)')
end
require_relative 'se' # se.rb
include SiSU_Env
diff --git a/lib/sisu/v5/xhtml_epub2.rb b/lib/sisu/v5/xhtml_epub2.rb
index ae83214e..e0aa70cb 100644
--- a/lib/sisu/v5/xhtml_epub2.rb
+++ b/lib/sisu/v5/xhtml_epub2.rb
@@ -64,7 +64,8 @@ module SiSU_XHTML_EPUB2
begin
require 'pstore'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pstore NOT FOUND (LoadError)')
end
require_relative 'se_hub_particulars' # se_hub_particulars.rb
include SiSU_Particulars
diff --git a/lib/sisu/v5/xml_fictionbook2.rb b/lib/sisu/v5/xml_fictionbook2.rb
index c7c54b30..80ebf371 100644
--- a/lib/sisu/v5/xml_fictionbook2.rb
+++ b/lib/sisu/v5/xml_fictionbook2.rb
@@ -243,7 +243,8 @@ module SiSU_XML_Fictionbook
begin
require 'base64'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('base64 NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('base64 NOT FOUND (LoadError)')
end
images_raw,images_base64_fb2=[],[]
images_base64={}
diff --git a/lib/sisu/v5/xml_odf_odt.rb b/lib/sisu/v5/xml_odf_odt.rb
index 9598e189..4e540fde 100644
--- a/lib/sisu/v5/xml_odf_odt.rb
+++ b/lib/sisu/v5/xml_odf_odt.rb
@@ -77,7 +77,8 @@ module SiSU_XML_ODF_ODT
require 'zlib'
require 'find'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('zlib or find NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('zlib or find NOT FOUND (LoadError)')
end
def initialize(opt)
@opt=opt
diff --git a/lib/sisu/v6/ao.rb b/lib/sisu/v6/ao.rb
index 56334b05..81dfc9bd 100644
--- a/lib/sisu/v6/ao.rb
+++ b/lib/sisu/v6/ao.rb
@@ -497,27 +497,33 @@ module SiSU_AO
end
def make_marshal_idx_sst_html_seg
marshal_ao=@make.marshal.ao_idx_sst_rel_html_seg
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Array)
end
def make_marshal_idx_sst_rel
marshal_ao=@make.marshal.ao_idx_sst_rel
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Array)
end
def make_marshal_idx_html
marshal_ao=@make.marshal.ao_idx_html
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Array)
end
def make_marshal_idx_xhtml
marshal_ao=@make.marshal.ao_idx_xhtml
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Array)
end
def make_marshal_map_nametags
marshal_ao=@make.marshal.ao_map_nametags
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Hash)
end
def make_marshal_map_name_ocn_htmlseg
marshal_ao=@make.marshal.ao_map_ocn_htmlseg
- File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Hash)
+ File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \
+ if @data.is_a?(Hash)
end
end
class Make
diff --git a/lib/sisu/v6/ao_doc_str.rb b/lib/sisu/v6/ao_doc_str.rb
index 67670a55..6e7a103f 100644
--- a/lib/sisu/v6/ao_doc_str.rb
+++ b/lib/sisu/v6/ao_doc_str.rb
@@ -230,8 +230,11 @@ module SiSU_AO_DocumentStructureExtract
term_nodes << term_node
use,plus=rgx_idx_ocn_seg.match(term_node)[1,2]
@use=use.strip
- idx_hash[@use]=
- { sub: [], plus: plus } unless idx_hash[@use] and defined? idx_hash[@use]
+ unless idx_hash[@use] \
+ and defined? idx_hash[@use]
+ idx_hash[@use]=
+ { sub: [], plus: plus }
+ end
when Array
subterm_nodes=[]
term_node.each do |subterm_node|
@@ -240,8 +243,11 @@ module SiSU_AO_DocumentStructureExtract
: (subterm_node + '+0')
subterm_nodes << subterm_node
sub,sub_plus=rgx_idx_ocn_seg.match(subterm_node)[1,2]
- idx_hash[@use]=
- { sub: [], plus: 0 } unless idx_hash[@use] and defined? idx_hash[@use]
+ unless idx_hash[@use] \
+ and defined? idx_hash[@use]
+ idx_hash[@use]=
+ { sub: [], plus: 0 }
+ end
idx_hash[@use][:sub] <<
{ sub.strip => { plus: sub_plus } }
end
@@ -299,6 +305,18 @@ module SiSU_AO_DocumentStructureExtract
next
end
t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") if @@flag[:code]==:off
+ unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
+ idx=if t_o=~/^=\{\s*(.+)\s*\}\s*$\Z/m
+ m=$1
+ m=m.split(/[ ]*\n/).join(' ').
+ gsub(/\s+([|:;])\s+/,'\1').
+ gsub(/\s+([+]\d+)\s+/,'\1')
+ t_o=t_o.gsub(/\n=\{.+?\}\s*$/m,'')
+ idx_array_and_hash=construct_idx_array_and_hash(m)
+ idx_array_and_hash[:hash]
+ else nil
+ end
+ end
if t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \
and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$|^`:quote_(?:open|close)`/ \
and @@flag[:code]==:off \
@@ -308,17 +326,6 @@ module SiSU_AO_DocumentStructureExtract
and @@flag[:alt]==:off \
and @@flag[:box]==:off \
and @@flag[:table]==:off
- unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
- idx=if t_o=~/^=\{\s*(.+)\s*\}\s*$\Z/m; m=$1
- m=m.split(/[ ]*\n/).join(' ').
- gsub(/\s+([|:;])\s+/,'\1').
- gsub(/\s+([+]\d+)\s+/,'\1')
- t_o=t_o.gsub(/\n=\{.+?\}\s*$/m,'')
- idx_array_and_hash=construct_idx_array_and_hash(m)
- idx_array_and_hash[:hash]
- else nil
- end
- end
t_o=case t_o
when /^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/ #metadata, header
if t_o=~/^#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*(.+)/m
@@ -707,7 +714,8 @@ module SiSU_AO_DocumentStructureExtract
tags: tags,
num: @num_id[:table],
}
- t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) \
+ unless h.nil?
tuned_file << t_o
h={
is_for: :table,
@@ -743,7 +751,8 @@ module SiSU_AO_DocumentStructureExtract
tags: tags,
num: @num_id[:table],
}
- t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) \
+ unless h.nil?
tuned_file << t_o
h={
is_for: :table,
@@ -779,7 +788,8 @@ module SiSU_AO_DocumentStructureExtract
tags: tags,
num: @num_id[:table],
}
- t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) \
+ unless h.nil?
tuned_file << t_o
h={
is_for: :table,
@@ -828,15 +838,22 @@ module SiSU_AO_DocumentStructureExtract
t_o=nil
end
end
- if @@flag[:code]==:curls or @@flag[:code]==:tics
- if (@@flag[:code]==:curls and t_o =~/^\}code/) \
- or (@@flag[:code]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ if @@flag[:code]==:curls \
+ or @@flag[:code]==:tics
+ if (@@flag[:code]==:curls \
+ && t_o =~/^\}code/) \
+ or (@@flag[:code]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/m)
@@flag[:code]=:off
- @tuned_code[-1].gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'')
+ if @tuned_code[-1]
+ @tuned_code[-1].
+ gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'')
+ end
obj=@tuned_code.join("\n")
tags=[]
h={
obj: obj,
+ idx: idx,
syntax: @@flag[:lngsyn],
tags: tags,
num: @num_id[:code_block],
@@ -854,7 +871,8 @@ module SiSU_AO_DocumentStructureExtract
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
end
- if (@@flag[:code]==:curls or @@flag[:code]==:tics) \
+ if (@@flag[:code]==:curls \
+ || @@flag[:code]==:tics) \
and t_o.is_a?(String)
sub_array=t_o.dup + "#{Mx[:br_nl]}"
@line_mode=[]
@@ -863,28 +881,40 @@ module SiSU_AO_DocumentStructureExtract
@tuned_code << t_o
t_o=nil
end
- elsif (@@flag[:poem]==:curls or @@flag[:poem]==:tics) \
- or (@@flag[:box]==:curls or @@flag[:box]==:tics) \
- or (@@flag[:group]==:curls or @@flag[:group]==:tics) \
- or (@@flag[:block]==:curls or @@flag[:block]==:tics) \
- or (@@flag[:alt]==:curls or @@flag[:alt]==:tics) \
- or (@@flag[:quote]==:open and t_o =~/`:quote_close`/m) #not
- if (@@flag[:poem]==:curls and t_o =~/^\}poem/) \
- or (@@flag[:poem]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ elsif (@@flag[:poem]==:curls \
+ || @@flag[:poem]==:tics) \
+ or (@@flag[:box]==:curls \
+ || @@flag[:box]==:tics) \
+ or (@@flag[:group]==:curls \
+ || @@flag[:group]==:tics) \
+ or (@@flag[:block]==:curls \
+ || @@flag[:block]==:tics) \
+ or (@@flag[:alt]==:curls \
+ || @@flag[:alt]==:tics) \
+ or (@@flag[:quote]==:open \
+ && t_o =~/`:quote_close`/m) #not
+ if (@@flag[:poem]==:curls \
+ && t_o =~/^\}poem$/m) \
+ or (@@flag[:poem]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:poem]=:off
h={
is_for: :poem,
obj: '',
+ idx: idx,
sym: :poem_close,
num: @num_id[:poem],
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
- elsif (@@flag[:box]==:curls and t_o =~/^\}box/) \
- or (@@flag[:box]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ elsif (@@flag[:box]==:curls \
+ && t_o =~/^\}box/) \
+ or (@@flag[:box]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:box]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:box],
}
@@ -894,16 +924,20 @@ module SiSU_AO_DocumentStructureExtract
h={
is_for: :box,
obj: '',
+ idx: idx,
sym: :box_close,
num: @num_id[:box],
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
- elsif (@@flag[:group]==:curls and t_o =~/^\}group/) \
- or (@@flag[:group]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ elsif (@@flag[:group]==:curls \
+ && t_o =~/^\}group/) \
+ or (@@flag[:group]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:group]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:group],
}
@@ -917,12 +951,15 @@ module SiSU_AO_DocumentStructureExtract
num: @num_id[:group],
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
- elsif (@@flag[:block]==:curls and t_o =~/^\}block/) \
- or (@@flag[:block]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ elsif (@@flag[:block]==:curls \
+ && t_o =~/^\}block/) \
+ or (@@flag[:block]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:block]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:block],
}
@@ -936,12 +973,15 @@ module SiSU_AO_DocumentStructureExtract
num: @num_id[:block],
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
- elsif (@@flag[:alt]==:curls and t_o =~/^\}alt/) \
- or (@@flag[:alt]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ elsif (@@flag[:alt]==:curls \
+ && t_o =~/^\}alt/) \
+ or (@@flag[:alt]==:tics \
+ && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:alt]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
h={
obj: obj,
+ idx: idx,
tags: tags,
num: @num_id[:alt],
}
@@ -955,10 +995,12 @@ module SiSU_AO_DocumentStructureExtract
num: @num_id[:alt],
}
t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
- elsif @@flag[:quote]==:open and t_o =~/`:quote_close`/m
+ elsif @@flag[:quote]==:open \
+ and t_o =~/`:quote_close`/m
@@flag[:quote]=:off
h={
is_for: :quote,
+ idx: idx,
obj: '',
sym: :quote_close,
num: @num_id[:quote],
@@ -977,9 +1019,12 @@ module SiSU_AO_DocumentStructureExtract
}
SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
- if (@@flag[:poem]==:curls or @@flag[:poem]==:tics \
- or @@flag[:group]==:curls or @@flag[:group]==:tics \
- or @@flag[:alt]==:curls or @@flag[:alt]==:tics) \
+ if (@@flag[:poem]==:curls \
+ || @@flag[:poem]==:tics) \
+ or (@@flag[:group]==:curls \
+ || @@flag[:group]==:tics) \
+ or (@@flag[:alt]==:curls \
+ || @@flag[:alt]==:tics) \
and t_o =~/\S/ \
and t_o !~/^(?:\}(?:verse|code|box|alt|group|block)|(?:verse|code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|alt|group|block)\{)/ \
and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic
diff --git a/lib/sisu/v6/ao_expand_insertions.rb b/lib/sisu/v6/ao_expand_insertions.rb
index 45a3a4ab..8eb0e5c4 100644
--- a/lib/sisu/v6/ao_expand_insertions.rb
+++ b/lib/sisu/v6/ao_expand_insertions.rb
@@ -142,7 +142,7 @@ module SiSU_AO_Insertions
}
end
def path_and_file(fn,pth)
- "#{@base_path}/#{pth}/#{fn}"
+ @base_path + '/' + pth + '/' + fn
end
def manifest
fn=@md.file.base_filename.manifest(fnh)
@@ -150,7 +150,7 @@ module SiSU_AO_Insertions
end
def html_toc
fn=@md.file.base_filename.html_segtoc(fnh)
- "#{@base_path}/html/#{@linked_doc}/#{fn}"
+ @base_path + '/html/' + @linked_doc + '/' + fn
end
def html_doc
fn=@md.file.base_filename.html_scroll(fnh)
@@ -158,7 +158,7 @@ module SiSU_AO_Insertions
end
def html_concordance
fn=@md.file.base_filename.html_concordance
- "#{@base_path}/html/#{@linked_doc}/#{fn}"
+ @base_path + '/html/' + @linked_doc + '/' + fn
end
def epub
fn=@md.file.base_filename.epub(fnh)
@@ -197,16 +197,17 @@ module SiSU_AO_Insertions
path_and_file(fn,'digest')
end
def source
- "#{@base_path}/src/#{@src}"
+ @base_path + '/src/' + @src
end
def sisupod
- "#{@base_path}/src/#{@src}.zip"
+ @base_path + '/src/' + @src + '.zip'
end
self
end
def by_filetype(linked_doc,lng,src=nil)
@linked_doc,@lng,@src=linked_doc,lng,src
- @lc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lng).language_code_insert
+ @lc=SiSU_Env::FilenameLanguageCodeInsert.new(@md.opt,lng).
+ language_code_insert
@base_path="#{@md.file.output_path.base.url}"
def fnh
{
@@ -215,7 +216,7 @@ module SiSU_AO_Insertions
}
end
def path_and_file(fn,pth)
- "#{@base_path}/#{pth}/#{fn}"
+ @base_path + '/' + pth + '/' + fn
end
def manifest
fn=@md.file.base_filename.manifest(fnh)
@@ -270,10 +271,10 @@ module SiSU_AO_Insertions
path_and_file(fn,'digest')
end
def source
- "#{@base_path}/src/#{@src}"
+ @base_path + '/src/' + @src
end
def sisupod
- "#{@base_path}/src/#{@src}.zip"
+ @base_path + '/src/' + @src + '.zip'
end
self
end
@@ -289,8 +290,8 @@ module SiSU_AO_Insertions
end
def path_and_file(fn,pth=nil)
(pth.nil?) \
- ? "#{@base_path}/#{fn}"
- : "#{@base_path}/#{pth}/#{fn}"
+ ? @base_path + '/' + fn
+ : @base_path + '/' + pth + '/' + fn
end
def manifest
fn=@md.file.base_filename.manifest(fnh)
@@ -345,28 +346,50 @@ module SiSU_AO_Insertions
path_and_file(fn)
end
def source
- "#{@base_path}/#{@src}"
+ @base_path + '/' + @src
end
def sisupod
- "#{@base_path}/#{@src}.zip"
+ @base_path + '/' + @src + '.zip'
end
self
end
def expand_insertions?
data=@data
tuned_file,tuned_file_tmp=[],[]
- codeblock_=false
+ codeblock_={
+ status: :false,
+ type: :na,
+ }
data.each do |para|
- codeblock_=if para =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?)/
- true
- elsif para =~/^(?:\}code|```(?:\s|$))/m
- false
+ codeblock_=if para =~/^code(?:\.[a-z][0-9a-z_]+)?\{/ \
+ and codeblock_[:status]==:false
+ {
+ status: :true,
+ type: :curl,
+ }
+ elsif para =~/^```[ ]+code(?:\.[a-z][0-9a-z_]+)?/ \
+ and codeblock_[:status]==:false
+ {
+ status: :true,
+ type: :tics,
+ }
+ elsif codeblock_[:type]==:curl \
+ and para =~/^\}code/m
+ {
+ status: :false,
+ type: :na,
+ }
+ elsif codeblock_[:type]==:tics \
+ and para =~/^```(?:\s|$)/m
+ {
+ status: :false,
+ type: :na,
+ }
else codeblock_
end
if para !~/^%+\s/ \
- and not codeblock_ \
+ and codeblock_[:status] != :true \
and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/
- manifest=nil
@u=SiSU_Env::InfoEnv.new.url
m_cmd=''
if defined? @u.remote
diff --git a/lib/sisu/v6/ao_idx.rb b/lib/sisu/v6/ao_idx.rb
index 7a4b1f03..048a4457 100644
--- a/lib/sisu/v6/ao_idx.rb
+++ b/lib/sisu/v6/ao_idx.rb
@@ -79,7 +79,10 @@ module SiSU_AO_BookIndex
html_idx,xhtml_idx=
extract_book_index(data)
data=
- clean_and_insert_index(data,sisu_markup_idx_rel_html_seg)
+ clean_and_insert_index(
+ data,
+ sisu_markup_idx_rel_html_seg
+ )
[
data,
sisu_markup_idx_rel,
@@ -99,7 +102,11 @@ module SiSU_AO_BookIndex
end
if defined? dob.idx \
and dob.idx.is_a?(Hash)
- idx_array << {idx: dob.idx, ocn: dob.ocn, seg: @seg }
+ idx_array << {
+ idx: dob.idx,
+ ocn: dob.ocn,
+ seg: @seg
+ }
end
tuned_file << dob if dob
end
diff --git a/lib/sisu/v6/ao_images.rb b/lib/sisu/v6/ao_images.rb
index 93ed4d84..e934ec1a 100644
--- a/lib/sisu/v6/ao_images.rb
+++ b/lib/sisu/v6/ao_images.rb
@@ -134,6 +134,17 @@ module SiSU_AO_Images
end
img_col,img_row=/(\d+)x(\d+)/m.match(imgsys)[1,2]
img_col,img_row=img_col.to_i,img_row.to_i
+ else
+ errmsg='imagemagick or graphicksmagick are required to process images'
+ if @md.opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding (as requested) without image processing")
+ break
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
end
end
row=((img && defined? img.rows) ? img.rows : img_row)
diff --git a/lib/sisu/v6/ao_misc_arrange.rb b/lib/sisu/v6/ao_misc_arrange.rb
index 8adebfd5..f1aa1e02 100644
--- a/lib/sisu/v6/ao_misc_arrange.rb
+++ b/lib/sisu/v6/ao_misc_arrange.rb
@@ -98,11 +98,11 @@ module SiSU_AO_MiscArrangeText
else
para << block_open
end
- elsif para =~/\A.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m \
+ elsif para =~/\A.+?\n```(?:\s+\~\{.+?\}\~)?(?:\s+[~-][#])?(\s*=\{.+?\})?\s*\Z/m \
and @flag==:open
@flag=:close
text,block_close=
- /\A(.+?)\n(```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2]
+ /\A(.+?)\n(```(?:\s+\~\{.+?\}\~)?(?:\s+[~-][#])?(?:\s+=\{.+?\})?)\s*\Z/m.match(para)[1,2]
para=[]
if not text.to_s.empty?
para << text.to_s << block_close
diff --git a/lib/sisu/v6/db_create.rb b/lib/sisu/v6/db_create.rb
index 55eab144..a9083b61 100644
--- a/lib/sisu/v6/db_create.rb
+++ b/lib/sisu/v6/db_create.rb
@@ -117,10 +117,38 @@ module SiSU_DbCreate
end
end
def conn_exec_pg(sql)
- @conn.exec_params(sql)
+ begin
+ @conn.exec_params(sql)
+ rescue
+ if @conn.is_a?(NilClass)
+ errmsg="No pg connection (check pg dependencies)"
+ if @opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without pg output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
+ end
+ end
end
def conn_exec_sqlite(sql)
+ begin
@conn.execute(sql)
+ rescue
+ if @conn.is_a?(NilClass)
+ errmsg="No sqlite3 connection (check sqlite3 dependencies)"
+ if @opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without sqlite output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
+ end
+ end
end
def metadata_and_text
if (@opt.act[:verbose_plus][:set]==:on \
diff --git a/lib/sisu/v6/db_indexes.rb b/lib/sisu/v6/db_indexes.rb
index 876fd856..12c427dd 100644
--- a/lib/sisu/v6/db_indexes.rb
+++ b/lib/sisu/v6/db_indexes.rb
@@ -82,9 +82,23 @@ module SiSU_DbIndex
end
end
def conn_execute_array(sql_arr)
- @conn.transaction do |conn|
- sql_arr.each do |sql|
- conn_execute_sql(conn,sql)
+ begin
+ @conn.transaction do |conn|
+ sql_arr.each do |sql|
+ conn_execute_sql(conn,sql)
+ end
+ end
+ rescue
+ if @conn.is_a?(NilClass)
+ errmsg="No sqlite3 connection (check sqlite3 dependencies)"
+ if @opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without sqlite output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
end
end
end
diff --git a/lib/sisu/v6/dbi.rb b/lib/sisu/v6/dbi.rb
index 3ee6bf0a..47173d4f 100644
--- a/lib/sisu/v6/dbi.rb
+++ b/lib/sisu/v6/dbi.rb
@@ -102,7 +102,12 @@ module SiSU_DBI
end
def read_psql
begin
- require 'pg'
+ begin
+ require 'pg'
+ rescue LoadError
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pg NOT FOUND (LoadError)')
+ end
@conn=@db.psql.conn_pg
rescue
if @opt.act[:psql_create][:set]==:on
@@ -119,10 +124,23 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet
def read_sqlite
begin
begin
- require 'sqlite3'
+ begin
+ require 'sqlite3'
+ rescue LoadError
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('sqlite3 NOT FOUND (LoadError)')
+ end
@conn=@db.sqlite.conn_sqlite3
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('sqlite3 NOT FOUND (LoadError)')
+ errmsg='sqlite3 NOT FOUND (LoadError)'
+ if @opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error(errmsg + ', ' + 'attempt to proceed without sqlite output (as requested)')
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error(errmsg + ', ' + 'STOPPING')
+ exit
+ end
end
end
end
diff --git a/lib/sisu/v6/dbi_discrete.rb b/lib/sisu/v6/dbi_discrete.rb
index 99c8a7b3..5149614a 100644
--- a/lib/sisu/v6/dbi_discrete.rb
+++ b/lib/sisu/v6/dbi_discrete.rb
@@ -73,7 +73,8 @@ module SiSU_DBI_Discrete #% database building
require 'fileutils'
include FileUtils::Verbose
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('fileutils NOT FOUND (LoadError)')
end
class SQL
def initialize(opt)
diff --git a/lib/sisu/v6/defaults.rb b/lib/sisu/v6/defaults.rb
index c725b11d..de8ae429 100644
--- a/lib/sisu/v6/defaults.rb
+++ b/lib/sisu/v6/defaults.rb
@@ -65,7 +65,8 @@ module SiSU_Viz
begin
require 'uri'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('uri NOT FOUND (LoadError)')
end
require_relative 'se' # se.rb
include SiSU_Env
diff --git a/lib/sisu/v6/dp.rb b/lib/sisu/v6/dp.rb
index 50317108..111896d7 100644
--- a/lib/sisu/v6/dp.rb
+++ b/lib/sisu/v6/dp.rb
@@ -583,6 +583,34 @@ module SiSU_Param
def sep(str)
' \\\\ '
end
+ def copyright_and_license
+ s=if @h['all'] then @h['all']
+ else
+ s=''
+ if defined? copyright.text \
+ and copyright.text \
+ and not copyright.text.empty?
+ v=sep(copyright.text)
+ s +=copyright.text + v
+ end
+ if defined? copyright.license \
+ and copyright.license \
+ and not copyright.license.empty?
+ s +=copyright.license
+ end
+ if s.empty?
+ SiSU_Screen::Ansi.new(
+ @opt.act[:color_state][:set],
+ 'WARNING Document Rights information missing; provide @rights: :copyright:'
+ ).warn unless @opt.act[:quiet][:set]==:on
+ else
+ l,n=Db[:col_info_note],'rights.all'
+ validate_length(s,l,n)
+ end
+ s=s.gsub(/ [\\]+\s+$/,'')
+ end
+ s
+ end
def all
s=if @h['all'] then @h['all']
else
diff --git a/lib/sisu/v6/html.rb b/lib/sisu/v6/html.rb
index afd69118..bd1c4d6b 100644
--- a/lib/sisu/v6/html.rb
+++ b/lib/sisu/v6/html.rb
@@ -64,7 +64,8 @@ module SiSU_HTML
begin
require 'pstore'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pstore NOT FOUND (LoadError)')
end
require_relative 'se_hub_particulars' # se_hub_particulars.rb
include SiSU_Particulars
@@ -146,7 +147,14 @@ module SiSU_HTML
data=tuned_file_array
if @opt.act[:html_scroll][:set]==:on
scr=SiSU_HTML::Source::Scroll.new(@md,data,scr_endnotes).songsheet
- scroll=SiSU_HTML::Source::ScrollOutput.new(scr_toc,scr[:body],scr[:metadata],scr[:owner_details],scr[:tails],@md).publish
+ scroll=SiSU_HTML::Source::ScrollOutput.new(
+ scr_toc,
+ scr[:body],
+ scr[:metadata],
+ scr[:owner_details],
+ scr[:tails],
+ @md
+ ).publish
SiSU_HTML::Source::Output.new(scroll,@md).scroll
end
rescue
@@ -206,7 +214,11 @@ module SiSU_HTML
? '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 }
+ 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)
@links_guide_toc << lev_dob_ocn.links_guide if s_lnk_lnk
end
@@ -259,7 +271,8 @@ module SiSU_HTML
def initialize(md=nil,data='')
@data,@md=data,md
@vz=SiSU_Viz::Defaults.new
- @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
+ @ocn_html_identifier=
+ SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier
@tell=SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set]) if @md
end
def songsheet #extracts toc for scroll & seg
diff --git a/lib/sisu/v6/html_segments.rb b/lib/sisu/v6/html_segments.rb
index b410d0b0..3240d6a4 100644
--- a/lib/sisu/v6/html_segments.rb
+++ b/lib/sisu/v6/html_segments.rb
@@ -243,7 +243,9 @@ module SiSU_HTML_Seg
#my_make_source_file=SiSU_Env::CreateFile.new(@md.fns)
idx_html=SiSU_Particulars::CombinedSingleton.
instance.get_idx_html(@md.opt).html_idx
- idx_html.each {|x| @@seg[:idx] << x }
+ idx_html.each do |x|
+ @@seg[:idx] << x
+ end
@@seg[:heading_idx]=''
end
data.each do |dob|
diff --git a/lib/sisu/v6/hub_options.rb b/lib/sisu/v6/hub_options.rb
index cedcdcfe..5625963b 100644
--- a/lib/sisu/v6/hub_options.rb
+++ b/lib/sisu/v6/hub_options.rb
@@ -65,7 +65,8 @@ module SiSU_Commandline
begin
require 'pathname'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pathname NOT FOUND (LoadError)')
end
require_relative 'se' # se.rb
require_relative 'dp_make' # dp_make.rb
@@ -780,6 +781,12 @@ module SiSU_Commandline
@act=@@act
else
act={}
+ act[:no_stop]=if select_arr.inspect \
+ =~/"--no-stop"|"--errors-as-warnings"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
act[:license]=(select_arr.inspect \
=~/"--license/) \
? { bool: true, set: :on }
diff --git a/lib/sisu/v6/remote.rb b/lib/sisu/v6/remote.rb
index 3a8b58d0..895c1737 100644
--- a/lib/sisu/v6/remote.rb
+++ b/lib/sisu/v6/remote.rb
@@ -152,7 +152,8 @@ module SiSU_Remote
require 'open-uri'
require 'pp'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('open-uri or pp NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('open-uri or pp NOT FOUND (LoadError)')
end
require_relative 'ao_composite' # ao_composite.rb
@rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
@@ -201,7 +202,8 @@ module SiSU_Remote
begin
require 'net/http'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('net/http NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('net/http NOT FOUND (LoadError)')
end
for requested_pod in get_p
pod_info=RemoteDownload.new(requested_pod)
diff --git a/lib/sisu/v6/rexml.rb b/lib/sisu/v6/rexml.rb
index 7960a3ec..0d87defc 100644
--- a/lib/sisu/v6/rexml.rb
+++ b/lib/sisu/v6/rexml.rb
@@ -63,9 +63,11 @@
module SiSU_Rexml
# load XML file for REXML parsing
begin
- require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
+ require 'rexml/document' \
+ if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('rexml/document NOT FOUND (LoadError)')
end
require_relative 'dp' # dp.rb
include SiSU_Param
@@ -74,9 +76,11 @@ module SiSU_Rexml
include SiSU_Viz
class Rexml
begin
- require 'rexml/document' if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
+ require 'rexml/document' \
+ if FileTest.directory?("#{Config::CONFIG['rubylibdir']}/rexml") #Config::CONFIG['sitedir']
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('rexml/document NOT FOUND (LoadError)')
end
def initialize(md,fno)
@md,@fno=md,fno
diff --git a/lib/sisu/v6/se_db.rb b/lib/sisu/v6/se_db.rb
index ac226675..abf80b32 100644
--- a/lib/sisu/v6/se_db.rb
+++ b/lib/sisu/v6/se_db.rb
@@ -140,7 +140,12 @@ module SiSU_Info_Db
DBI.connect(psql.dbi,psql.user,psql.db)
end
def conn_pg
- require 'pg'
+ begin
+ require 'pg'
+ rescue LoadError
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pg NOT FOUND (LoadError)')
+ end
PG::Connection.new(dbname: psql.db, port: psql.port)
end
self
diff --git a/lib/sisu/v6/se_hub_particulars.rb b/lib/sisu/v6/se_hub_particulars.rb
index 99bdf9f6..320bb769 100644
--- a/lib/sisu/v6/se_hub_particulars.rb
+++ b/lib/sisu/v6/se_hub_particulars.rb
@@ -65,7 +65,8 @@ module SiSU_Particulars
begin
require 'singleton'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('singleton NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('singleton NOT FOUND (LoadError)')
end
require_relative 'se' # se.rb
include SiSU_Env
diff --git a/lib/sisu/v6/se_info_env.rb b/lib/sisu/v6/se_info_env.rb
index 0ce6f63a..abd46542 100644
--- a/lib/sisu/v6/se_info_env.rb
+++ b/lib/sisu/v6/se_info_env.rb
@@ -77,7 +77,8 @@ module SiSU_Info_Env
require 'fileutils'
include FileUtils
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname or fileutils NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pathname or fileutils NOT FOUND (LoadError)')
end
attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:base_markup_dir_stub,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:processing_git,:etc,:yamlrc_dir
@@image_flag,@@local_image=true,true #warning on @@image_flag
diff --git a/lib/sisu/v6/se_info_system.rb b/lib/sisu/v6/se_info_system.rb
index 6f290a4e..cc85f28d 100644
--- a/lib/sisu/v6/se_info_system.rb
+++ b/lib/sisu/v6/se_info_system.rb
@@ -67,7 +67,8 @@ module SiSU_Info_Sys_Gen
begin
require 'rbconfig'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rbconfig NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('rbconfig NOT FOUND (LoadError)')
end
@@user, @@home, @@hostname, @@pwd, @@sisu_etc, @@host, @@arch, @@rbver, @@dir_arch, @@dir_sitearch, @@dir_bin, @@locale, @@rc,@@sisurc_path,@@ad=
ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil, nil, {} # %x{ruby -v}.strip # Config::CONFIG['rb_ver']
diff --git a/lib/sisu/v6/src_kdissert_share.rb b/lib/sisu/v6/src_kdissert_share.rb
index ebe761f0..7cf421aa 100644
--- a/lib/sisu/v6/src_kdissert_share.rb
+++ b/lib/sisu/v6/src_kdissert_share.rb
@@ -68,7 +68,8 @@ module SiSU_KdiSource
require 'fileutils'
include FileUtils
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('fileutils NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('fileutils NOT FOUND (LoadError)')
end
def initialize(opt)
@opt=opt
diff --git a/lib/sisu/v6/sst_from_xml.rb b/lib/sisu/v6/sst_from_xml.rb
index 56083ff9..62a293fd 100644
--- a/lib/sisu/v6/sst_from_xml.rb
+++ b/lib/sisu/v6/sst_from_xml.rb
@@ -68,7 +68,8 @@ module SiSU_sstFromXML
require 'rexml/document'
include REXML
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('rexml/document NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('rexml/document NOT FOUND (LoadError)')
end
def initialize(opt)
@opt=opt
diff --git a/lib/sisu/v6/texpdf.rb b/lib/sisu/v6/texpdf.rb
index 9861a5b5..10bfa961 100644
--- a/lib/sisu/v6/texpdf.rb
+++ b/lib/sisu/v6/texpdf.rb
@@ -64,7 +64,8 @@ module SiSU_TeX
begin
require 'pstore'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pstore NOT FOUND (LoadError)')
end
require_relative 'defaults' # defaults.rb
include SiSU_Viz
@@ -85,7 +86,8 @@ module SiSU_TeX
begin
require 'pstore'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pstore NOT FOUND (LoadError)')
end
require_relative 'se' # se.rb
include SiSU_Env
@@ -267,8 +269,16 @@ module SiSU_TeX
FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}")
FileUtils::rm(portrait_pdf)
else
- STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{portrait_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)"
STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.act[:maintenance][:set]==:on
+ errmsg="pdf file not generated #{portrait_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')} (check texlive dependencies)"
+ if @md.opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without pdf output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
end
end
if @md.opt.act[:pdf_l][:set]==:on
@@ -276,8 +286,16 @@ module SiSU_TeX
FileUtils::cp(landscape_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_l}")
FileUtils::rm(landscape_pdf)
else
- STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{landscape_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)"
STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.act[:maintenance][:set]==:on
+ errmsg="pdf file not generated #{landscape_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')} (check texlive dependencies)"
+ if @md.opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without pdf output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
end
end
if (@md.opt.act[:verbose][:set]==:on \
@@ -312,7 +330,15 @@ module SiSU_TeX
and File.size(texfile) > 0
#@tex_f_no+=1
else
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error("\tzero file size #{@env.processing_path.tex}/#{texfile}")
+ errmsg="zero file size #{@env.processing_path.tex}/#{texfile}"
+ if @md.opt.act[:no_stop][:set]==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, proceeding without pdf output (as requested)")
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error("#{errmsg}, STOPPING")
+ exit
+ end
end
end
end
@@ -423,12 +449,10 @@ module SiSU_TeX
if defined? @md.rights.all \
and not @md.rights.all.empty?
rght=@md.rights #.author.dup #dup is necessary, else contents of :rights changed
- sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,rght.copyright.all)
- copymark=@md.author_copymark \
- ? '{\begin{small}\copyright\end{small}} '
- : ''
- copymark='Copyright {\begin{small}\copyright\end{small}} '
- copyright=sp_char.special_characters_safe.gsub(/^\s*Copyright \(C\)/, copymark)
+ sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,rght.copyright.copyright_and_license)
+ copymark='Copyright {\begin{small}{\copyright\end{small}} '
+ #copymark='Copyright {\begin{small}^{\copyright\end{small}} '
+ copyright=sp_char.special_characters_safe.gsub(/\s*Copyright \(C\)/, copymark)
@@rights||="\n #{Tex[:backslash]*2}[3]\\ \\linebreak #{copyright}"
end
if defined? @md.notes.prefix_b \
diff --git a/lib/sisu/v6/texpdf_format.rb b/lib/sisu/v6/texpdf_format.rb
index 95764b60..12b88fac 100644
--- a/lib/sisu/v6/texpdf_format.rb
+++ b/lib/sisu/v6/texpdf_format.rb
@@ -184,7 +184,7 @@ module SiSU_TeX_Pdf
when /legal/i then @tx.legal.portrait.w #U.S. alternative
when /book|b5/i then @tx.b5.portrait.w #book default - larger
when /a5/i then @tx.a5.portrait.w
- else @tx.a4.portrait.w #default currently A4
+ else @tx.a4.portrait.w #default currently A4
end
textwidth=tw.to_i - 20
colW=[]
@@ -1445,7 +1445,7 @@ module SiSU_TeX_Pdf
str=str.gsub(/\\textbackslash (copyright|clearpage|newpage)/,"\\\\\\1") #kludge bad solution, find out where tail is sent through specChar !
str
end
- def special_characters #special characters - some substitutions are sequence sensitive, rearrange with care.
+ def special_characters # special characters - some substitutions are sequence sensitive, rearrange with care
str,is=@txt,@is
str=xetex_special_characters_1(str,is) unless str.nil?
str=special_characters_unsafe_1(str) unless str.nil? #xetex_special_characters_unsafe_1(@txt)
@@ -1464,10 +1464,10 @@ module SiSU_TeX_Pdf
str=str.gsub(/([0-9a-f]{8})/i,'\1\-')
@txt=str
end
- def special_characters_safe #special characters - some substitutions are sequence sensitive, rearrange with care.
+ def special_characters_safe # special characters - some substitutions are sequence sensitive, rearrange with care
str,is=@txt,@is
str=xetex_special_characters_1(str,is) unless str.nil?
- str=xetex_special_characters_2(str,is) unless str.nil? # remove this to start with, causes issues
+ str=xetex_special_characters_2(str,is) unless str.nil? # remove this to start with, causes issues
str=special_characters_safe_close(str) unless str.nil?
@txt=str
end
@@ -1478,7 +1478,7 @@ module SiSU_TeX_Pdf
str=special_characters_safe_close(str) unless str.nil?
@txt=str
end
- def characters_code_listings #special characters - some substitutions are sequence sensitive, rearrange with care.
+ def characters_code_listings # special characters - some substitutions are sequence sensitive, rearrange with care
str,is=@txt,@is
str=xetex_code_listings(str,is) unless str.nil?
@txt=str
@@ -1541,7 +1541,7 @@ module SiSU_TeX_Pdf
else ''
end
end
- def sitename #owners site, eg freeculture, free.for.all, gutenberg etc.
+ def sitename # owners site, eg freeculture, free.for.all, gutenberg etc.
"\\href{#{@vz.url_home}}{#{@vz.txt_home}}"
end
def owner_chapter
diff --git a/lib/sisu/v6/utils.rb b/lib/sisu/v6/utils.rb
index 7e915429..af464572 100644
--- a/lib/sisu/v6/utils.rb
+++ b/lib/sisu/v6/utils.rb
@@ -130,7 +130,10 @@ module SiSU_Utils
def set(v=nil,x=nil)
v=var(v,x)
file,path=File.basename(@file),File.dirname(@file)
- v[:c][:on] + @line + v[:c][:off] + ' ' + path + '/' "#{v[:c][:on]}#{file}#{v[:c][:off]}" + v[:m]
+ v[:c][:on] + @line + v[:c][:off] + ' ' \
+ + path + '/' \
+ + "#{v[:c][:on]}#{file}#{v[:c][:off]}" \
+ + v[:m]
end
def mark(v=nil,x=nil)
puts set(v,x)
@@ -150,9 +153,9 @@ module SiSU_Utils
def warn(v=nil,x=nil)
if (v.is_a?(Symbol) \
and x.is_a?(String))
- x= '*WARN* ' + x
+ x="\n " + '*WARN* ' + x
elsif v.is_a?(String)
- v='*WARN* ' + v
+ v="\n " + '*WARN* ' + v
x=nil
else
v,x='*WARN*',nil
@@ -162,9 +165,9 @@ module SiSU_Utils
def error(v=nil,x=nil)
if (v.is_a?(Symbol) \
and x.is_a?(String))
- x= '*ERROR* ' + x
+ x="\n " + '*ERROR* ' + x
elsif v.is_a?(String)
- v='*ERROR* ' + v
+ v="\n " + '*ERROR* ' + v
x=nil
else
v,x='*ERROR*',nil
diff --git a/lib/sisu/v6/webrick.rb b/lib/sisu/v6/webrick.rb
index feb28c7d..000eab57 100644
--- a/lib/sisu/v6/webrick.rb
+++ b/lib/sisu/v6/webrick.rb
@@ -68,7 +68,8 @@ module SiSU_Webserv
require 'webrick'
include WEBrick
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('time or webrick NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('time or webrick NOT FOUND (LoadError)')
end
require_relative 'se' # se.rb
include SiSU_Env
diff --git a/lib/sisu/v6/xhtml_epub2.rb b/lib/sisu/v6/xhtml_epub2.rb
index 9ab7c6ec..26399ef7 100644
--- a/lib/sisu/v6/xhtml_epub2.rb
+++ b/lib/sisu/v6/xhtml_epub2.rb
@@ -64,7 +64,8 @@ module SiSU_XHTML_EPUB2
begin
require 'pstore'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pstore NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('pstore NOT FOUND (LoadError)')
end
require_relative 'se_hub_particulars' # se_hub_particulars.rb
include SiSU_Particulars
diff --git a/lib/sisu/v6/xml_fictionbook2.rb b/lib/sisu/v6/xml_fictionbook2.rb
index 36b42f8f..3e43dbec 100644
--- a/lib/sisu/v6/xml_fictionbook2.rb
+++ b/lib/sisu/v6/xml_fictionbook2.rb
@@ -243,7 +243,8 @@ module SiSU_XML_Fictionbook
begin
require 'base64'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('base64 NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('base64 NOT FOUND (LoadError)')
end
images_raw,images_base64_fb2=[],[]
images_base64={}
diff --git a/lib/sisu/v6/xml_odf_odt.rb b/lib/sisu/v6/xml_odf_odt.rb
index c5e06109..967812db 100644
--- a/lib/sisu/v6/xml_odf_odt.rb
+++ b/lib/sisu/v6/xml_odf_odt.rb
@@ -77,7 +77,8 @@ module SiSU_XML_ODF_ODT
require 'zlib'
require 'find'
rescue LoadError
- SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('zlib or find NOT FOUND (LoadError)')
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ error('zlib or find NOT FOUND (LoadError)')
end
def initialize(opt)
@opt=opt