Class: SiSU_AO::Source

Inherits:
Instantiate show all
Defined in:
lib/sisu/ao.rb

Instance Attribute Summary

Attributes inherited from SiSU_Param::Parameters::Instructions

#abstract, #ad_alt, #ad_began, #ad_home, #ad_png, #ad_url, #audio, #author, #author_copymark, #author_home, #author_nationality, #author_title, #authors, #authorship, #base_program, #bold_match_list, #book_idx, #classify, #cls_dewey, #cls_isbn, #cls_loc, #cls_pg, #comments, #concord_make, #contact, #contributor, #cover_image, #coverage, #creator, #current_publisher, #daisy, #date, #date_added_to_site, #date_available, #date_available_scheme, #date_created, #date_created_scheme, #date_issued, #date_issued_scheme, #date_modified, #date_modified_scheme, #date_scheme, #date_translated, #date_valid, #date_valid_scheme, #description, #dgst, #digitized_by, #dir_lout, #dir_out, #dir_tex, #doc_css, #ec, #email, #emphasis_set_to, #en, #env, #file, #file_encoding, #file_type, #filesize, #firstseg, #flag_auto_biblio, #flag_auto_endnotes, #flag_biblio, #flag_endnotes, #flag_glossary, #flag_promo, #flag_separate_endnotes, #flag_separate_endnotes_make, #flag_tables, #flv, #fn, #fnb, #fnl, #fnn, #fno, #fns, #fnstex, #fnt, #fnz, #footer_links, #format, #full_title, #generated, #heading_seg_first, #heading_seg_first_flag, #home, #home_button_image, #home_button_links, #hostname, #html_title, #i18n, #icon, #identifier, #illustrator, #image, #information, #italics_match_list, #keywords, #lang, #lang_code_insert, #language, #language_original, #links, #lnk, #locale, #lv0, #lv1, #lv2, #lv3, #lv4, #lv5, #lv6, #lvs, #make, #man_section, #markup, #markup_instruction, #notes, #num_top, #ocn, #opt, #original, #pagebreak, #pageline, #pagenew, #papersize, #papersize_array, #path, #pdf, #prefix_a, #prefix_b, #prepared_by, #programs, #project_details, #promo, #publisher, #pwd, #relation, #rights, #ruby_version, #sc_date, #sc_filename, #sc_info, #sc_number, #sc_time, #seg_autoname_safe, #seg_names, #sem_tag, #set_header_title, #set_heading_seg, #set_heading_top, #sfx_src, #sisu, #source, #stmp, #stmpd, #subject, #substitution_match_list, #subtitle, #subtitle_tex, #suffix, #tag_array, #tags, #title, #toc, #toc_lev_limit, #topic_register, #topic_register_array, #translator, #txt_path, #type, #user, #vocabulary, #wc_bytes, #wc_lines, #wc_words, #writing_focus, #yaml, #yamladdr

Instance Method Summary collapse

Methods inherited from SiSU_Param::Parameters::Instructions

#extract

Constructor Details

#initialize(opt, fnx = nil, process = :complete) ⇒ Source

Returns a new instance of Source.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/sisu/ao.rb', line 85

def initialize(opt,fnx=nil,process=:complete)
  @opt,@fnx,@process=opt,fnx,process
  @per ||=SiSU_AO_Persist::Persist.new.persist_init
  @per.fns ||=opt.fns
  fn_use=if fnx \
  and fnx =~/\.ss[tmi]$/
    fnx
  elsif opt.fns =~/\.ssm$/
    opt.fns + '.sst'
  else
    opt.fns
  end
  @make_fns=SiSU_Env::InfoFile.new(fn_use)
  @fnm=@make_fns.marshal.
  @fnc=@make_fns.marshal.ao_content
  @idx_sst=@make_fns.marshal.ao_idx_sst_rel_html_seg
  @idx_raw=@make_fns.marshal.ao_idx_sst_rel
  @idx_html=@make_fns.marshal.ao_idx_html
  @idx_xhtml=@make_fns.marshal.ao_idx_xhtml
  @map_nametags=@make_fns.marshal.ao_map_nametags
  @map_ocn_htmlseg=@make_fns.marshal.ao_map_ocn_htmlseg
  @env=SiSU_Env::InfoEnv.new
end

Instance Method Details

#getObject

reads ao, unless does not exist then creates first



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/sisu/ao.rb', line 125

def get                                                                    #reads ao, unless does not exist then creates first
  begin
    ao=[]
    unless @per.fns==@opt.fns \
    or @per.fns==@fnx
      @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
      ? @fnx
      : @opt.fns
      @per.ao_arr=[]
    end
    ao=(@per.ao_arr.empty?) \
    ? read_fnc
    : @per.ao_arr.dup
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
    SiSU_AO::Instantiate.new
  end
end

#get_idx_htmlObject

reads ao idx.html, #unless does not exist then creates first



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/sisu/ao.rb', line 188

def get_idx_html                                                           #reads ao idx.html, #unless does not exist then creates first
  begin
    ao=[]
    unless @per.fns==@opt.fns \
    or @per.fns==@fnx
      @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
      ? @fnx
      : @opt.fns
      @per.idx_arr_html=[]
    end
    ao=(@per.idx_arr_html.empty?) \
    ? read_idx_html
    : @per.idx_arr_html.dup
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
    SiSU_AO::Instantiate.new
  end
end

#get_idx_rawObject



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/sisu/ao.rb', line 167

def get_idx_raw
  begin
    ao=[]
    unless @per.fns==@opt.fns \
    or @per.fns==@fnx
      @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
      ? @fnx
      : @opt.fns
      @per.idx_arr_tex=[]
    end
    ao=(@per.idx_arr_tex.empty?) \
    ? read_idx_raw
    : @per.idx_arr_tex.dup #check
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
    SiSU_AO::Instantiate.new
  end
end

#get_idx_sstObject

reads ao idx.sst, #unless does not exist then creates first



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/sisu/ao.rb', line 146

def get_idx_sst                                                            #reads ao idx.sst, #unless does not exist then creates first
  begin
    ao=[]
    unless @per.fns==@opt.fns \
    or @per.fns==@fnx
      @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
      ? @fnx
      : @opt.fns
      @per.idx_arr_sst=[]
    end
    ao=(@per.idx_arr_sst.empty?) \
    ? read_idx_sst
    : @per.idx_arr_sst.dup #check
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
    SiSU_AO::Instantiate.new
  end
end

#get_idx_xhtmlObject

reads ao idx.xhtml, #unless does not exist then creates first



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/sisu/ao.rb', line 209

def get_idx_xhtml                                                          #reads ao idx.xhtml, #unless does not exist then creates first
  begin
    ao=[]
    unless @per.fns==@opt.fns \
    or @per.fns==@fnx
      @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
      ? @fnx
      : @opt.fns
      @per.idx_arr_xhtml=[] #...
    end
    ao=(@per.idx_arr_xhtml.empty?) \
    ? read_idx_xhtml
    : @per.idx_arr_xhtml.dup
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
    SiSU_AO::Instantiate.new
  end
end

#get_map_nametagsObject

reads ao map.nametags, #unless does not exist then creates first



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/sisu/ao.rb', line 230

def get_map_nametags                                                       #reads ao map.nametags, #unless does not exist then creates first
  begin
    ao=[]
    unless @per.fns==@opt.fns \
    or @per.fns==@fnx
      @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
      ? @fnx
      : @opt.fns
      @per.map_arr_nametags=[]
    end
    ao=(@per.map_arr_nametags.empty?) \
    ? read_map_nametags
    : @per.map_arr_nametags.dup
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
    SiSU_AO::Instantiate.new
  end
end

#get_map_ocn_htmlsegObject

reads ao map.ocn_htmlseg, #unless does not exist then creates first



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/sisu/ao.rb', line 251

def get_map_ocn_htmlseg                                                    #reads ao map.ocn_htmlseg, #unless does not exist then creates first
  begin
    ao=[]
    unless @per.fns==@opt.fns \
    or @per.fns==@fnx
      @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
      ? @fnx
      : @opt.fns
      @per.map_arr_ocn_htmlseg=[]
    end
    ao=(@per.map_arr_ocn_htmlseg.empty?) \
    ? read_map_ocn_htmlseg
    : @per.map_arr_ocn_htmlseg.dup
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections,@opt.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
    SiSU_AO::Instantiate.new
  end
end

#readObject

creates ao



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/sisu/ao.rb', line 108

def read                                                                   #creates ao
  begin
    @per=SiSU_AO_Persist::Persist.new
    @per.ao_arr=[]
    @per.fns=(@fnx && @fnx =~/\.ss[tmi]$/) \
    ? @fnx
    : @opt.fns
    create_ao
  rescue
    SiSU_Errors::Rescued.new($!,$@,@opt.selections,@per.fns).location do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
    SiSU_AO_Persist::Persist.new.persist_init
    SiSU_AO::Instantiate.new
  end
end