aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/dal.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/dal.rb')
-rw-r--r--lib/sisu/v3/dal.rb71
1 files changed, 24 insertions, 47 deletions
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