From 9347018753e818b49980651df3b77352c5f3792f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 1 Jul 2014 00:45:40 -0400 Subject: v5 v6: ao, code cosmetic rearrangement --- data/doc/sisu/CHANGELOG_v5 | 6 + data/doc/sisu/CHANGELOG_v6 | 6 + lib/sisu/v5/ao.rb | 88 +++-- lib/sisu/v5/ao_character_check.rb | 9 +- lib/sisu/v5/ao_composite.rb | 70 ++-- lib/sisu/v5/ao_doc_objects.rb | 435 +++++++++++++------------ lib/sisu/v5/ao_doc_str.rb | 634 +++++++++++++++++++++++++++++------- lib/sisu/v5/ao_endnotes.rb | 34 +- lib/sisu/v5/ao_expand_insertions.rb | 48 ++- lib/sisu/v5/ao_hash_digest.rb | 22 +- lib/sisu/v5/ao_idx.rb | 194 ++++++++--- lib/sisu/v5/ao_images.rb | 26 +- lib/sisu/v5/ao_metadata.rb | 13 +- lib/sisu/v5/ao_misc_arrange.rb | 31 +- lib/sisu/v5/ao_numbering.rb | 43 ++- lib/sisu/v5/ao_syntax.rb | 66 ++-- lib/sisu/v5/hub.rb | 56 +++- lib/sisu/v5/options.rb | 36 +- lib/sisu/v5/param.rb | 154 +++++++-- lib/sisu/v6/ao.rb | 88 +++-- lib/sisu/v6/ao_character_check.rb | 9 +- lib/sisu/v6/ao_composite.rb | 70 ++-- lib/sisu/v6/ao_doc_objects.rb | 435 +++++++++++++------------ lib/sisu/v6/ao_doc_str.rb | 634 +++++++++++++++++++++++++++++------- lib/sisu/v6/ao_endnotes.rb | 34 +- lib/sisu/v6/ao_expand_insertions.rb | 48 ++- lib/sisu/v6/ao_hash_digest.rb | 22 +- lib/sisu/v6/ao_idx.rb | 194 ++++++++--- lib/sisu/v6/ao_images.rb | 26 +- lib/sisu/v6/ao_metadata.rb | 13 +- lib/sisu/v6/ao_misc_arrange.rb | 31 +- lib/sisu/v6/ao_numbering.rb | 43 ++- lib/sisu/v6/ao_syntax.rb | 66 ++-- lib/sisu/v6/hub.rb | 56 +++- lib/sisu/v6/options.rb | 36 +- lib/sisu/v6/param.rb | 154 +++++++-- 36 files changed, 2810 insertions(+), 1120 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 07221ecf..f4c824f5 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -38,6 +38,12 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.4.3.orig.tar.xz sisu_5.4.3.orig.tar.xz sisu_5.4.3-1.dsc +* ao, + * code cosmetic rearrangement + +* code cosmetic rearrangement + * ao*, param, hub, options, composite + * merge what was sisu_6.0.8 into v5 * ao, * syntax, able optionally to indicate the language syntax of a code block diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 794edfdb..81420f21 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -28,6 +28,12 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.9.orig.tar.xz sisu_6.0.9.orig.tar.xz sisu_6.0.9-1.dsc +* ao, + * code cosmetic rearrangement + +* code cosmetic rearrangement + * ao*, param, hub, options, composite + %% 6.0.8.orig.tar.xz (2014-06-19:24/4) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_6.0.8 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_6.0.8-1 diff --git a/lib/sisu/v5/ao.rb b/lib/sisu/v5/ao.rb index c69e3be9..ee99805d 100644 --- a/lib/sisu/v5/ao.rb +++ b/lib/sisu/v5/ao.rb @@ -162,7 +162,9 @@ module SiSU_AO : @opt.fns @@idx_arr[:sst]=[] end - ao=(@@idx_arr[:sst].empty?) ? read_idx_sst : @@idx_arr[:sst].dup #check + ao=(@@idx_arr[:sst].empty?) \ + ? read_idx_sst + : @@idx_arr[:sst].dup #check rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -181,7 +183,9 @@ module SiSU_AO : @opt.fns @@idx_arr[:tex]=[] end - ao=(@@idx_arr[:tex].empty?) ? read_idx_raw : @@idx_arr[:tex].dup #check + ao=(@@idx_arr[:tex].empty?) \ + ? read_idx_raw + : @@idx_arr[:tex].dup #check rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -200,7 +204,9 @@ module SiSU_AO : @opt.fns @@idx_arr[:html]=[] end - ao=(@@idx_arr[:html].empty?) ? read_idx_html : @@idx_arr[:html].dup + ao=(@@idx_arr[:html].empty?) \ + ? read_idx_html + : @@idx_arr[:html].dup rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -219,7 +225,9 @@ module SiSU_AO : @opt.fns @@idx_arr[:xthml]=[] end - ao=(@@idx_arr[:xhtml].empty?) ? read_idx_xhtml : @@idx_arr[:xhtml].dup + ao=(@@idx_arr[:xhtml].empty?) \ + ? read_idx_xhtml + : @@idx_arr[:xhtml].dup rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -238,7 +246,9 @@ module SiSU_AO : @opt.fns @@map_arr[:nametags]=[] end - ao=(@@map_arr[:nametags].empty?) ? read_map_nametags : @@map_arr[:nametags].dup + ao=(@@map_arr[:nametags].empty?) \ + ? read_map_nametags + : @@map_arr[:nametags].dup rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -257,7 +267,9 @@ module SiSU_AO : @opt.fns @@map_arr[:ocn_htmlseg]=[] end - ao=(@@map_arr[:ocn_htmlseg].empty?) ? read_map_ocn_htmlseg : @@map_arr[:ocn_htmlseg].dup + ao=(@@map_arr[:ocn_htmlseg].empty?) \ + ? read_map_ocn_htmlseg + : @@map_arr[:ocn_htmlseg].dup rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -273,8 +285,14 @@ module SiSU_AO tell=(@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) \ - ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Document Abstraction') - : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Document Abstraction',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}") + ? SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Document Abstraction' + ) + : SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Document Abstraction',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" + ) tell.blue_title_hi end fn=(@fnx && @fnx =~/\.ss[tmi]$/) \ @@ -293,9 +311,16 @@ module SiSU_AO cf=SiSU_Env::CreateFile.new(fn) if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on) - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"~meta/#{@opt.fns}.meta").output + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + @opt.fns, + "~meta/#{@opt.fns}.meta" + ).output elsif @opt.act[:maintenance][:set]==:on - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"ao -> #{cf.meta}").txt_grey + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + "ao -> #{cf.meta}" + ).txt_grey end end ao.each {|s| ao_array << s} @@ -435,7 +460,8 @@ module SiSU_AO if defined? o.ocn case o.is when :heading - filename_debug.puts "#{o.is.to_s} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}" + filename_debug.puts + "#{o.is.to_s} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}" end end end @@ -507,23 +533,37 @@ module SiSU_AO reset data_txt=@data data_txt= - SiSU_AO_Insertions::Insertions.new(@md,data_txt).expand_insertions? # ao_expand_insertions.rb + SiSU_AO_Insertions::Insertions.new(@md,data_txt). # ao_expand_insertions.rb + expand_insertions? data_txt= - SiSU_AO_MiscArrangeText::SI.new(@md,data_txt).prepare_text # ao_misc_arrange.rb - data_obj,metadata= - SiSU_AO_DocumentStructureExtract::Build.new(@md,data_txt).identify_parts # ao_doc_str.rb + SiSU_AO_MiscArrangeText::SI.new(@md,data_txt). # ao_misc_arrange.rb + prepare_text + data_obj, + metadata= + SiSU_AO_DocumentStructureExtract::Build.new(@md,data_txt). # ao_doc_str.rb + identify_parts data_obj= - SiSU_AO_Syntax::Markup.new(@md,data_obj).songsheet # ao_syntax.rb - data_obj,endnote_array= - SiSU_AO_CharacterCheck::Check.new(data_obj).character_check_and_oldstyle_endnote_array # ao_character_check.rb + SiSU_AO_Syntax::Markup.new(@md,data_obj).songsheet # ao_syntax.rb + data_obj, + endnote_array= + SiSU_AO_CharacterCheck::Check.new(data_obj). # ao_character_check.rb + character_check_and_oldstyle_endnote_array data_obj= - SiSU_AO_Images::Images.new(@md,data_obj).images # ao_images.rb - data_obj,tags_map,ocn_html_seg_map= - SiSU_AO_Numbering::Numbering.new(@md,data_obj).numbering_song # ao_numbering.rb - data_obj,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx= - SiSU_AO_BookIndex::BookIndex.new(@md,data_obj,@env).indexing_song if @md.book_idx # ao_idx.rb + SiSU_AO_Images::Images.new(@md,data_obj).images # ao_images.rb + data_obj, + tags_map, + ocn_html_seg_map= + SiSU_AO_Numbering::Numbering.new(@md,data_obj). # ao_numbering.rb + numbering_song + data_obj, + book_index_rel, + book_index_rel_html_seg, + html_idx,xhtml_idx= + SiSU_AO_BookIndex::BookIndex.new(@md,data_obj,@env). # ao_idx.rb + indexing_song if @md.book_idx data_obj= - SiSU_AO_Endnotes::Endnotes.new(@md,data_obj,endnote_array).endnotes # ao_endnotes.rb + SiSU_AO_Endnotes::Endnotes.new(@md,data_obj,endnote_array). # ao_endnotes.rb + endnotes outputdata=data_obj if (@md.opt.act[:ao][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on) diff --git a/lib/sisu/v5/ao_character_check.rb b/lib/sisu/v5/ao_character_check.rb index ef45679a..d32b3d4b 100644 --- a/lib/sisu/v5/ao_character_check.rb +++ b/lib/sisu/v5/ao_character_check.rb @@ -80,9 +80,9 @@ module SiSU_AO_CharacterCheck gsub(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '). gsub(/(~\{\s*)\s+/,'\1 '). gsub(/ \/\//,"#{Mx[:br_line]}"). - gsub(/
/,"#{Mx[:br_line]}"). #needed by xml, xhtml etc. + gsub(/
/,"#{Mx[:br_line]}"). #needed by xml, xhtml etc. gsub(/\t/,' '). - gsub(/\342\200\231/u,"'"). #if dob =~/’/ #Avoid #‘ ’ #“ ” + gsub(/\342\200\231/u,"'"). #if dob =~/’/ #Avoid #‘ ’ #“ ” gsub(/\\copy(?:right)?\b/,'©'). gsub(/\\trademark\b|\\tm\b/,'®') dob.obj=dob.obj + "\n" @@ -91,8 +91,9 @@ module SiSU_AO_CharacterCheck when /\^~/ #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+ sub_dob=dob.obj.dup @endnote_array << sub_dob.gsub(/\n/,''). - gsub(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}). - strip + gsub(/\^~\s+(.+)\s*/, + %{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}). + strip endnote_no+=1 dob=nil if dob.obj =~/\^~ .+/ #watch, removes 'binary' endnote now in endnote array for later insertion end diff --git a/lib/sisu/v5/ao_composite.rb b/lib/sisu/v5/ao_composite.rb index 9fd42672..a7d0e48c 100644 --- a/lib/sisu/v5/ao_composite.rb +++ b/lib/sisu/v5/ao_composite.rb @@ -74,7 +74,8 @@ module SiSU_Assemble end def download_images(images_info) path="#{@env.processing_path.processing}/external_document/image" - FileUtils::mkdir_p(path) unless FileTest.directory?(path) + FileUtils::mkdir_p(path) \ + unless FileTest.directory?(path) download_from=images_info.shift images_info.each do |i| image="#{path}/#{i}" @@ -85,7 +86,8 @@ module SiSU_Assemble imagefile.close end output_path="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" - FileUtils::mkdir_p(output_path) unless FileTest.directory?(output_path) + FileUtils::mkdir_p(output_path) \ + unless FileTest.directory?(output_path) SiSU_Env::SystemCall.new("#{path}/*",output_path,'q').rsync end end @@ -99,8 +101,8 @@ module SiSU_Assemble begin pwd=Dir.pwd Dir.chdir(@opt.f_pth[:pth]) - @fns_array=IO.readlines(@opt.fno,'') - assembled=insertions? + fns_array=IO.readlines(@opt.fno,'') + assembled=insertions?(fns_array) write(assembled) Dir.chdir(pwd) rescue @@ -141,7 +143,9 @@ module SiSU_Assemble end if not @code_flag \ and i !~/^%+\s/ - i=i.gsub(/^([123]|:?[ABCD])~\? /,'% [conditional heading:] \1~ ') #off conditional heading (consider syntax) + i=i. + gsub(/^([123]|:?[ABCD])~\? /, + '% [conditional heading:] \1~ ') #off conditional heading (consider syntax) if i =~/^@\S+?:/ i=i.gsub(/\n/m,"\n% "). gsub(/\n%\s+$/m,''). @@ -161,27 +165,36 @@ module SiSU_Assemble end file end - def insertions? - data=@fns_array + def insertions?(fns_array) tuned_file,imagedir=[],[] - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Composite Document',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").grey_title_hi unless @opt.act[:quiet][:set]==:on - data.each do |para| + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Composite Document', + "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}", + ).grey_title_hi unless @opt.act[:quiet][:set]==:on + fns_array.each do |para| if para =~/^<<\s+(\S+?\.ss[it])$/ loadfile=$1.strip - src_ssm=@opt.fns.sub(/\.ssm\.sst/,'.ssm') if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'loading:',loadfile).txt_grey + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'loading:', + loadfile, + ).txt_grey end - tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[ti]$/ # and NetTest - imagedir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.ss[ti]$/.match(loadfile).captures.join + '/_sisu/image' #watch + tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[it]$/ # and NetTest + imagedir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.ss[it]$/. + match(loadfile).captures.join + + '/_sisu/image' #watch begin require 'uri' require 'open-uri' require 'pp' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri, open-uri or pp NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('uri, open-uri or pp NOT FOUND (LoadError)') end image_uri=URI.parse(imagedir) insert=open(loadfile) @@ -191,13 +204,12 @@ module SiSU_Assemble @@imager[image_uri] ||=[] @@imager[image_uri] << file[:images] file[:prepared] - elsif loadfile =~ /\.ss[ti]$/ \ + elsif loadfile =~ /\.ss[it]$/ \ and FileTest.file?(loadfile) insert_array=IO.readlines(loadfile,'') file=insertion(loadfile,insert_array) file[:prepared] else - cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX STDERR.puts %{SKIPPED processing file: [#{@opt.lng}] "#{@opt.fns}" it requires an invalid or non-existent file: "#{loadfile}"} $process_document = :skip; break #remove this line to continue processing documents that have missing include files para @@ -225,8 +237,8 @@ module SiSU_Assemble def read begin @opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm') #FIX earlier, hub - @fns_array=IO.readlines(@opt.fns,'') - insertions? + fns_array=IO.readlines(@opt.fns,'') + insertions?(fns_array) rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -234,26 +246,32 @@ module SiSU_Assemble ensure end end - def insertions? - data=@fns_array + def insertions?(fns_array) tuned_file=[] - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Composite Document',@opt.fno).grey_title_hi unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Composite Document', + @opt.fno + ).grey_title_hi unless @opt.act[:quiet][:set]==:on @ssm=[@opt.fns] - data.each do |para| + fns_array.each do |para| if para =~/^<<\s+(\S+?\.ss[it])$/ loadfile=$1.strip if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'loading:',loadfile).txt_grey + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'loading:', + loadfile, + ).txt_grey end - tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[ti]$/ + tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[it]$/ @ssm << loadfile - elsif loadfile =~ /\.ss[ti]$/ \ + elsif loadfile =~ /\.ss[it]$/ \ and FileTest.file?(loadfile) @ssm << loadfile else - cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX STDERR.puts %{SKIPPED processing file: [#{@opt.lng}] "#{@opt.fns}" it requires an invalid or non-existent file: "#{loadfile}"} $process_document = :skip; break #remove this line to continue processing documents that have missing include files para diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb index dd0a44cd..1357ee90 100644 --- a/lib/sisu/v5/ao_doc_objects.rb +++ b/lib/sisu/v5/ao_doc_objects.rb @@ -74,10 +74,10 @@ module SiSU_AO_DocumentStructure @of=:meta end def metadata(tags) - of= @of #Symbol, classification - group - is= :meta #Symbol, classification - specific type - tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag - obj= nil + of = @of #Symbol, classification - group + is = :meta #Symbol, classification - specific type + tags = tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag + obj = nil @of,@is,@tags,@obj=of,is,tags,obj self end @@ -89,12 +89,12 @@ module SiSU_AO_DocumentStructure @of=:meta end def metadata(h,o=nil) - of= @of #Symbol, classification - group - is= :meta #Symbol, classification - specific type - tag= h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + of = @of #Symbol, classification - group + is = :meta #Symbol, classification - specific type + tag = h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 @of,@is,@tag,@obj,@digest,@tmp=of,is,tag,obj,digest,tmp self end @@ -142,44 +142,47 @@ module SiSU_AO_DocumentStructure and (h[:ln] and h[:ln].to_s=~/[0-9]/) h[:lv]=heading_lv(h[:ln]) end - of= @of #Symbol, classification - group - is= :heading #Symbol, classification - specific type - name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info] - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6 - ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 - lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure) - use_=if lv \ - and lv == '1' - h[:use_] || ((defined? o.use_) ? o.use_ : :ok) - elsif not lv.empty? \ - and lv =~ /[A-D2-3]/ - :ok - else - h[:use_] || ((defined? o.use_) ? o.use_ : :ok) - end - ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] - end - autonum_= if h[:autonum_].nil? then ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses - else h[:autonum_] - end - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@lv,@ln,@lc,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@use_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,lc,name,tags,obj,idx,ocn,odv,osp,node,parent,use_,ocn_,note_,autonum_,digest,tmp + of = @of #Symbol, classification - group + is = :heading #Symbol, classification - specific type + name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + node = h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info] + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + lv = h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6 + ln = h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 + lc = h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure) + use_ = if lv \ + and lv == '1' + h[:use_] || ((defined? o.use_) ? o.use_ : :ok) + elsif not lv.empty? \ + and lv =~ /[A-D2-3]/ + :ok + else + h[:use_] || ((defined? o.use_) ? o.use_ : :ok) + end + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] + end + autonum_ = if h[:autonum_].nil? + ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses + else h[:autonum_] + end + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@lv,@ln,@lc,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@use_,@ocn_,@note_,@autonum_,@digest,@tmp= + of, is, lv, ln, lc, name, tags, obj, idx, ocn, odv, osp, node, parent, use_, ocn_, note_, autonum_, digest, tmp self end def heading_insert(h,o=nil) heading(h,o=nil) - @is= :heading_insert #String, classification - specific type + @is = :heading_insert #String, classification - specific type self end end @@ -191,52 +194,56 @@ module SiSU_AO_DocumentStructure @tags=[] end def paragraph(h,o=nil) - of= @of #Symbol, classification - group - is= :para #Symbol, classification - specific type - name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - indent= h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level - hang= h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level - bullet_=h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted? - quote_= h[:quote_] || ((defined? o.quote_) ? o.quote_ : false) #Bool, quote (blockquote)? - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) - ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group + is = :para #Symbol, classification - specific type + name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + indent = h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level + hang = h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level + bullet_ = h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted? + quote_ = h[:quote_] || ((defined? o.quote_) ? o.quote_ : false) #Bool, quote (blockquote)? + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + image_ = h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@quote_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,quote_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@quote_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp= + of, is, name, tags, obj, indent, hang, bullet_, quote_, idx, ocn, odv, osp, parent, image_, note_, ocn_, digest, tmp self end def docinfo(h,o=nil) - of= @of #String, classification - group - is= :docinfo #String, classification - specific type - name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? - tags= h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= nil #String, book index provided? - ocn= nil #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - indent= nil #Integer, indent level - hang= nil #Integer, indent level - bullet_=false #Bool, bulleted? - note_= false #Bool, endnotes/footnotes? (processing optimization) - image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) - ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #String, classification - group + is = :docinfo #String, classification - specific type + name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? + tags = h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = nil #String, book index provided? + ocn = nil #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + indent = nil #Integer, indent level + hang = nil #Integer, indent level + bullet_ = false #Bool, bulleted? + note_ = false #Bool, endnotes/footnotes? (processing optimization) + image_ = h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp= + of, is, name, tags, obj, indent, hang, bullet_, idx, ocn, odv, osp, parent, image_, note_, ocn_, digest, tmp self end end @@ -248,124 +255,136 @@ module SiSU_AO_DocumentStructure @tags=[] end def code(h,o=nil) - of= @of #Symbol, classification - group #alt 'code' - is= :code #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - lngsyn= h[:lngsyn] || ((defined? o.lngsyn) ? o.lngsyn : :txt) #symbol, code lngsyn - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - number_= h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not? - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group #alt 'code' + is = :code #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + lngsyn = h[:lngsyn] || ((defined? o.lngsyn) ? o.lngsyn : :txt) #symbol, code lngsyn + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + number_ = h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not? + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@lngsyn,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,lngsyn,idx,ocn,odv,osp,parent,number_,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@lngsyn,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, lngsyn, idx, ocn, odv, osp, parent, number_, note_, ocn_, num, digest, tmp self end def box(h,o=nil) - of= @of #Symbol, classification - group - is= :box #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group + is = :box #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp self end def block(h,o=nil) - of= @of #Symbol, classification - group - is= :block #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group + is = :block #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp self end def group(h,o=nil) - of= @of #Symbol, classification - group - is= :group #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group + is = :group #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp self end - def alt(h,o=nil) #see block - of= @of #Symbol, classification - group - is= :alt #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + def alt(h,o=nil) #see block + of = @of #Symbol, classification - group + is = :alt #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp self end - def verse(h,o=nil) #part of poem decide how you deal with this - of= @of #Symbol, classification - group - is= :verse #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + def verse(h,o=nil) #part of poem decide how you deal with this + of = @of #Symbol, classification - group + is = :verse #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp @h=nil self end @@ -378,26 +397,28 @@ module SiSU_AO_DocumentStructure @tags=[] end def table(h,o=nil) - of= @of #Symbol, classification - group - is= :table #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - cols= h[:cols] || ((defined? o.cols) ? o.cols : nil) - widths= h[:widths] || ((defined? o.widths) ? o.widths : nil) - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - head_= h[:head_] || ((defined? o.head_) ? o.head_ : false) - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group + is = :table #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + cols = h[:cols] || ((defined? o.cols) ? o.cols : nil) + widths = h[:widths] || ((defined? o.widths) ? o.widths : nil) + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + head_ = h[:head_] || ((defined? o.head_) ? o.head_ : false) + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,cols,widths,obj,idx,ocn,odv,osp,parent,head_,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, cols, widths, obj, idx, ocn, odv, osp, parent, head_, note_, ocn_, num, digest, tmp self end end @@ -420,8 +441,9 @@ module SiSU_AO_DocumentStructure osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + ocn_=if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @@ -507,7 +529,8 @@ module SiSU_AO_DocumentStructure attr= h[:attr] || ((defined? o.attr) ? o.attr : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use num= h[:num] || ((defined? o.num) ? o.num : nil) - @of,@is,@obj,@sym,@attr,@tmp,@num=of,is,obj,sym,attr,tmp,num + @of,@is,@obj,@sym,@attr,@tmp,@num= + of, is, obj, sym, attr, tmp, num self end end diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb index e5ed0fd0..9743f794 100644 --- a/lib/sisu/v5/ao_doc_str.rb +++ b/lib/sisu/v5/ao_doc_str.rb @@ -154,12 +154,18 @@ module SiSU_AO_DocumentStructureExtract [0,0] end obj=if str2 =~/^(.+?)\s+\\\\(?:\s+|\n)/ - str2.gsub(/^(.+?)(\s+\\\\(?:\s+|\n))/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") + str2.gsub(/^(.+?)(\s+\\\\(?:\s+|\n))/, + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") else - str2.gsub(/^(.+?)\n/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\n") + str2.gsub(/^(.+?)\n/, + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\n") end hang,indent=hang_indent[0],hang_indent[1] - [hang,indent,obj] + [ + hang, + indent, + obj, + ] end def endnote_test?(str) (str=~/~\{.+?\}~|~\[.+?\]~/) \ @@ -182,7 +188,10 @@ module SiSU_AO_DocumentStructureExtract t.gsub!(/[^a-z0-9._-]/,'') end end - [str,tags] + [ + str, + tags, + ] end def rgx_idx_ocn_seg @rgx_idx_ocn_seg=/(.+?)\s*[+](\d+)/ @@ -196,9 +205,13 @@ module SiSU_AO_DocumentStructureExtract idx_couplet_tmp=[] idx_couplet=idx.scan(/\s*[^:]+\s*/) if idx_couplet[1] =~/[|]/ - idx_couplet_tmp << idx_couplet[0] << idx_couplet[1].scan(/\s*[^|]+\s*/) + idx_couplet_tmp << + idx_couplet[0] << + idx_couplet[1].scan(/\s*[^|]+\s*/) else - idx_couplet_tmp << idx_couplet[0] << [idx_couplet[1]] + idx_couplet_tmp << + idx_couplet[0] << + [idx_couplet[1]] end idx_couplet=idx_couplet_tmp else [idx] @@ -207,14 +220,17 @@ module SiSU_AO_DocumentStructureExtract idx_lst.each do |term_node| case term_node when String - term_node=term_node[0].chr.capitalize + term_node[1,term_node.length] + term_node= + term_node[0].chr.capitalize + + term_node[1,term_node.length] term_node=(term_node =~/.+?[+]\d+/) \ ? term_node : (term_node + '+0') 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] + idx_hash[@use]= + { sub: [], plus: plus } unless idx_hash[@use] and defined? idx_hash[@use] when Array subterm_nodes=[] term_node.each do |subterm_node| @@ -223,15 +239,20 @@ 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] - idx_hash[@use][:sub] << {sub.strip => { plus: sub_plus }} + idx_hash[@use]= + { sub: [], plus: 0 } unless idx_hash[@use] and defined? idx_hash[@use] + idx_hash[@use][:sub] << + { sub.strip => { plus: sub_plus } } end term_nodes << subterm_nodes end end idx_array << term_nodes end - { hash: idx_hash, array: idx_array } + { + hash: idx_hash, + array: idx_array, + } end def identify_parts tuned_file=[] @@ -252,16 +273,26 @@ module SiSU_AO_DocumentStructureExtract h=case $1 when /[+]/ @@flag[:ocn]=:on - {flag: :ocn_on} + { + flag: :ocn_on, + } when /[~]/ @@flag[:ocn]=:ocn_off_headings_keep - {flag: :ocn_off, mod: :headings_keep} + { + flag: :ocn_off, + mod: :headings_keep, + } when /[-]/ #of particular relevance with level 1~ which is required to precede substantive text & used e.g. in html segmented text @@flag[:ocn]=:ocn_off_headings_dummy_lev1 - {flag: :ocn_off, mod: :headings_exclude} + { + flag: :ocn_off, + mod: :headings_exclude, + } else @@flag[:ocn]=:on - {flag: :ocn_on} + { + flag: :ocn_on, + } end t_o=SiSU_AO_DocumentStructure::ObjectFlag.new.flag_ocn(h) next @@ -296,7 +327,7 @@ module SiSU_AO_DocumentStructureExtract t_o=nil when /^%+\s/ #comment t_o=if t_o=~/^%+\s+(.+)/ - h={obj: $1} + h={ obj: $1 } SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) else nil end @@ -319,7 +350,13 @@ module SiSU_AO_DocumentStructureExtract end end end - h={ lv: lv, ln: ln, obj: obj, idx: idx, tags: tags } + h={ + lv: lv, + ln: ln, + obj: obj, + idx: idx, + tags: tags, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) elsif t_o=~/^:?[A-D1-6]\~(\S+?)-\s+(.+)/m name,obj=$1,$2 @@ -337,7 +374,14 @@ module SiSU_AO_DocumentStructureExtract end end end - h={ lv: lv, name: name, obj: obj, idx: idx, autonum_: false, tags: tags} + h={ + lv: lv, + name: name, + obj: obj, + idx: idx, + autonum_: false, + tags: tags, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) elsif t_o=~/^:?[A-D1-6]\~(\S+)\s+(.+)/m name,obj=$1,$2 @@ -355,7 +399,13 @@ module SiSU_AO_DocumentStructureExtract end end end - h={ lv: lv, name: name, obj: obj, idx: idx, tags: tags } + h={ + lv: lv, + name: name, + obj: obj, + idx: idx, + tags: tags, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) else nil end @@ -378,7 +428,17 @@ module SiSU_AO_DocumentStructureExtract obj << ' ~#' end end - h={ bullet_: bullet, hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? } + h={ + bullet_: bullet, + hang: hang, + indent: indent, + obj: obj, + idx: idx, + note_: note, + image_: image, + tags: tags, + quote: quotes?, + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end else nil @@ -401,7 +461,16 @@ module SiSU_AO_DocumentStructureExtract obj << ' ~#' end end - h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? } + h={ + hang: hang, + indent: indent, + obj: obj, + idx: idx, + note_: note, + image_: image, + tags: tags, + quote: quotes?, + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end else nil @@ -425,7 +494,17 @@ module SiSU_AO_DocumentStructureExtract end end unless obj=~/\A\s*\Z/m - h={ bullet_: false, indent: 0, hang: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? } + h={ + bullet_: false, + indent: 0, + hang: 0, + obj: obj, + idx: idx, + note_: note, + image_: image, + tags: tags, + quote: quotes?, + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end end @@ -447,9 +526,17 @@ module SiSU_AO_DocumentStructureExtract else :txt end @@counter=1 - @codeblock_numbered=(t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{#|```[ ]+code(?:\.[a-z][0-9a-z_]+)?\s[#])/) ? true : false + @codeblock_numbered= + (t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{#|```[ ]+code(?:\.[a-z][0-9a-z_]+)?\s[#])/) \ + ? true + : false @num_id[:code_block] +=1 - h={ obj: '', sym: :code_block_open, num: @num_id[:code_block], syntax: @@flag[:lngsyn] } + h={ + obj: '', + sym: :code_block_open, + num: @num_id[:code_block], + syntax: @@flag[:lngsyn], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) elsif t_o =~/^(?:poem\{|```[ ]+poem)/ @@flag[:poem]=case t_o @@ -458,58 +545,86 @@ module SiSU_AO_DocumentStructureExtract else @@flag[:poem] #error end @num_id[:poem] +=1 - h={ obj: '', sym: :poem_open, num: @num_id[:poem] } + h={ + obj: '', + sym: :poem_open, + num: @num_id[:poem], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << t_o elsif t_o =~/^(?:box(?:\.[a-z_]+)?\{|```[ ]+box(?:\.[a-z_]+)?)/ @@flag[:box]=case t_o when /^box\{/ then :curls when /^```[ ]+box/ then :tics - else @@flag[:box] #error + else @@flag[:box] #error end @num_id[:box] +=1 - h={ obj: '', sym: :box_open, num: @num_id[:box] } + h={ + obj: '', + sym: :box_open, + num: @num_id[:box], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << t_o elsif t_o =~/^(?:group\{|```[ ]+group)/ @@flag[:group]=case t_o when /^group\{/ then :curls when /^```[ ]+group/ then :tics - else @@flag[:group] #error + else @@flag[:group] #error end @num_id[:group] +=1 - h={ obj: '', sym: :group_open, num: @num_id[:group] } + h={ + obj: '', + sym: :group_open, + num: @num_id[:group], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << t_o elsif t_o =~/^(?:block\{|```[ ]+block)/ @@flag[:block]=case t_o when /^block\{/ then :curls when /^```[ ]+block/ then :tics - else @@flag[:block] #error + else @@flag[:block] #error end @num_id[:block] +=1 - h={ obj: '', sym: :block_open, num: @num_id[:block] } + h={ + obj: '', + sym: :block_open, + num: @num_id[:block], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << t_o elsif t_o =~/^(?:alt\{|```[ ]+alt)/ @@flag[:alt]=case t_o when /^alt\{/ then :curls when /^```[ ]+alt/ then :tics - else @@flag[:alt] #error + else @@flag[:alt] #error end @num_id[:alt] +=1 - h={ obj: '', sym: :alt_open, num: @num_id[:alt] } + h={ + obj: '', + sym: :alt_open, + num: @num_id[:alt], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << t_o elsif t_o =~/^`:quote_open`/ @@flag[:quote]=:open @num_id[:quote] +=1 - h={ obj: '', sym: :quote_open, num: @num_id[:quote] } + h={ + obj: '', + sym: :quote_open, + num: @num_id[:quote], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) #tuned_file << t_o #% find second source, entered twice, should be once so closed off here elsif t_o =~/^(?:table\{|```[ ]+table|\{table)[ ~]/ @num_id[:table] +=1 - h={ obj: '', sym: :table_open, num: @num_id[:table] } + h={ + obj: '', + sym: :table_open, + num: @num_id[:table], + } ins_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << ins_o if t_o=~/^table\{(?:~h)?\s+/ @@ -525,7 +640,12 @@ module SiSU_AO_DocumentStructureExtract col=$2.scan(/\d+/) heading=false end - @h={ head_: heading, cols: cols, widths: col, idx: idx } + @h={ + head_: heading, + cols: cols, + widths: col, + idx: idx, + } elsif t_o=~/^```[ ]+table(?:~h)?\s+c\d+/ @@flag[:table]=:tics @rows='' @@ -539,7 +659,12 @@ module SiSU_AO_DocumentStructureExtract col=$2.scan(/\d+/) heading=false end - @h={ head_: heading, cols: cols, widths: col, idx: idx } + @h={ + head_: heading, + cols: cols, + widths: col, + idx: idx, + } elsif t_o=~/^\{table(?:~h)?(?:\s+\d+;?)?\}\n.+\Z/m m1,m2,hd=nil,nil,nil tbl=/^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1] @@ -550,7 +675,7 @@ module SiSU_AO_DocumentStructureExtract cols=nil rws.each do |r| cols=(cols ? cols : (r.scan('|').length) +1) - r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") + r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") rows += r + Mx[:tc_c] end col=[] @@ -563,18 +688,30 @@ module SiSU_AO_DocumentStructureExtract width=100.00/cols cols.times { col << width } end - h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] } + h={ + head_: hd, + cols: cols, + widths: col, + obj: rows, + idx: idx, + tags: tags, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o - h={ obj: '', sym: :table_close, num: @num_id[:table] } + h={ + obj: '', + sym: :table_close, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) t_o elsif t_o=~/^```[ ]+table(?:~h)?\s+/ m1,m2,hd=nil,nil,nil h=case t_o - when /^```[ ]+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one + when /^```[ ]+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one m1,tbl,hd=$1,$2,true - when /^```[ ]+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one + when /^```[ ]+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one m1,tbl,hd=$1,$2,false else nil end @@ -583,13 +720,25 @@ module SiSU_AO_DocumentStructureExtract rws=tbl.split(/\n/) rows='' rws.each do |r| - r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") + r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") rows += r + Mx[:tc_c] end - h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] } + h={ + head_: hd, + cols: col.length, + widths: col, + obj: rows, + idx: idx, + tags: tags, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o - h={ obj: '', sym: :table_close, num: @num_id[:table] } + h={ + obj: '', + sym: :table_close, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) t_o elsif t_o=~/^\{table(?:~h)?\s+/ @@ -606,13 +755,25 @@ module SiSU_AO_DocumentStructureExtract rws=tbl.split(/\n/) rows='' rws.each do |r| - r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") + r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") rows += r + Mx[:tc_c] end - h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] } + h={ + head_: hd, + cols: col.length, + widths: col, + obj: rows, + idx: idx, + tags: tags, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o - h={ obj: '', sym: :table_close, num: @num_id[:table] } + h={ + obj: '', + sym: :table_close, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) t_o end @@ -626,11 +787,21 @@ module SiSU_AO_DocumentStructureExtract and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) @@flag[:table]=:off headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx] - @h={ head_: headings, cols: columns, widths: widths, idx: idx, obj: @rows } + @h={ + head_: headings, + cols: columns, + widths: widths, + idx: idx, + obj: @rows, + } t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(@h) tuned_file << t_o @h,@rows=nil,'' - h={ obj: '', sym: :table_close, num: @num_id[:table] } + h={ + obj: '', + sym: :table_close, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) t_o else @@ -650,12 +821,22 @@ module SiSU_AO_DocumentStructureExtract @tuned_code[-1].gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'') obj=@tuned_code.join("\n") tags=[] - h={ obj: obj, syntax: @@flag[:lngsyn], tags: tags, num: @num_id[:code_block], number_: @codeblock_numbered } + h={ + obj: obj, + syntax: @@flag[:lngsyn], + tags: tags, + num: @num_id[:code_block], + number_: @codeblock_numbered, + } @@flag[:lngsyn]=:txt t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.code(h) @tuned_code=[] tuned_file << t_o - h={ obj: '', sym: :code_close, num: @num_id[:code_block] } + h={ + obj: '', + sym: :code_close, + num: @num_id[:code_block], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) end if (@@flag[:code]==:curls or @@flag[:code]==:tics) \ @@ -676,55 +857,102 @@ module SiSU_AO_DocumentStructureExtract if (@@flag[:poem]==:curls and t_o =~/^\}poem/) \ or (@@flag[:poem]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) @@flag[:poem]=:off - h={ obj: '', sym: :poem_close, num: @num_id[:poem] } + h={ + obj: '', + 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*$/) @@flag[:box]=:off obj,tags=extract_tags(@tuned_block.join("\n")) - h={ obj: obj, tags: tags, num: @num_id[:box] } + h={ + obj: obj, + tags: tags, + num: @num_id[:box], + } @tuned_block=[] t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.box(h) tuned_file << t_o - h={ obj: '', sym: :box_close, num: @num_id[:box] } + h={ + obj: '', + 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*$/) @@flag[:group]=:off obj,tags=extract_tags(@tuned_block.join("\n")) - h={ obj: obj, tags: tags, num: @num_id[:group] } + h={ + obj: obj, + tags: tags, + num: @num_id[:group], + } @tuned_block=[] t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.group(h) tuned_file << t_o - h={ obj: '', sym: :group_close, num: @num_id[:group] } + h={ + obj: '', + sym: :group_close, + 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*$/) @@flag[:block]=:off obj,tags=extract_tags(@tuned_block.join("\n")) - h={ obj: obj, tags: tags, num: @num_id[:block] } + h={ + obj: obj, + tags: tags, + num: @num_id[:block], + } @tuned_block=[] t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.block(h) tuned_file << t_o - h={ obj: '', sym: :block_close, num: @num_id[:block] } + h={ obj: '', + sym: :block_close, + 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*$/) @@flag[:alt]=:off obj,tags=extract_tags(@tuned_block.join("\n")) - h={ obj: obj, tags: tags, num: @num_id[:alt] } + h={ + obj: obj, + tags: tags, + num: @num_id[:alt], + } t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.alt(h) @tuned_block=[] tuned_file << t_o - h={ obj: '', sym: :alt_close, num: @num_id[:alt] } + h={ + obj: '', + sym: :alt_close, + num: @num_id[:alt], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) elsif @@flag[:quote]==:open and t_o =~/`:quote_close`/m @@flag[:quote]=:off - h={ obj: '', sym: :quote_close, num: @num_id[:quote] } + h={ + obj: '', + sym: :quote_close, + num: @num_id[:quote], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) elsif @@flag[:quote]==:open t_o,tags=extract_tags(t_o) - h={ indent: 1, obj: t_o, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? } + h={ + indent: 1, + obj: t_o, + idx: idx, + note_: note, + image_: image, + tags: tags, + quote: quotes?, + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end if (@@flag[:poem]==:curls or @@flag[:poem]==:tics \ @@ -741,7 +969,11 @@ module SiSU_AO_DocumentStructureExtract poem.each do |v| v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n") obj,tags=extract_tags(v) - h={ obj: obj, tags: tags, num: @num_id[:poem] } + h={ + obj: obj, + tags: tags, + num: @num_id[:poem], + } t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.verse(h) tuned_file << t_o end @@ -779,26 +1011,67 @@ module SiSU_AO_DocumentStructureExtract end if @md.flag_endnotes tuned_file << @pb - h={ ln: 1, lc: 1, obj: 'Endnotes', autonum_: false } + h={ + ln: 1, + lc: 1, + obj: 'Endnotes', + autonum_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, lc: 2, obj: 'Endnotes', name: 'endnotes', autonum_: false } + h={ + ln: 4, + lc: 2, + obj: 'Endnotes', + name: 'endnotes', + autonum_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ obj: 'Endnotes' } + h={ + obj: 'Endnotes' + } end if @md.book_idx tuned_file << @pb - h={ ln: 1, lc: 1, obj: 'Index', autonum_: false } + h={ + ln: 1, + lc: 1, + obj: 'Index', + autonum_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, lc: 2, obj: 'Index', name: 'book_index', autonum_: false } + h={ + ln: 4, + lc: 2, + obj: 'Index', + name: 'book_index', + autonum_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ obj: 'Index' } + h={ + obj: 'Index' + } end tuned_file << @pb - h={ ln: 1, lc: 1, obj: 'Metadata', autonum_: false, ocn_: false } + h={ + ln: 1, + lc: 1, + obj: 'Metadata', + autonum_: false, + ocn_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, lc: 2, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false } + h={ + ln: 4, + lc: 2, + obj: 'SiSU Metadata, document information', + name: 'metadata', + autonum_: false, + ocn_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ obj: 'eof' } + h={ + obj: 'eof', + } meta=SiSU_AO_DocumentStructure::ObjectMetadata.new.metadata(@metadata) [tuned_file,meta] end @@ -811,11 +1084,20 @@ module SiSU_AO_DocumentStructureExtract table end def meta_heading(h) - h={ lv: h[:lv], ln: h[:ln], name: h[:name], obj: h[:obj], ocn: '0' } + h={ + lv: h[:lv], + ln: h[:ln], + name: h[:name], + obj: h[:obj], + ocn: '0', + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) end def meta_para(str) - h={ obj: str, ocn_: false } + h={ + obj: str, + ocn_: false, + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end def build_lines(type=:none) @@ -831,7 +1113,7 @@ module SiSU_AO_DocumentStructureExtract line=line.gsub(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type==:code # REMOVE try sort for texpdf special case line=if line =~/(?:https?|file|ftp):\/\/\S+$/ line.gsub(/\s*$/," #{Mx[:br_nl]}") - else line.gsub(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code' + else line.gsub(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code' end elsif line =~/^\s*$/ line.gsub(/\s*$/,"#{Mx[:br_nl]}") @@ -857,25 +1139,46 @@ module SiSU_AO_DocumentStructureExtract and not @dob.bullet_ @dob=case @dob.obj when /^#{@md.lv0}/ - h={ lv: 'A', ln: 0 } + h={ + lv: 'A', + ln: 0, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv1}/ - h={ lv: 'B', ln: 1 } + h={ + lv: 'B', + ln: 1, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv2}/ - h={ lv: 'C', ln: 2 } + h={ + lv: 'C', + ln: 2, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv3}/ - h={ lv: 'D', ln: 3 } + h={ + lv: 'D', + ln: 3, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv4}/ - h={ lv: '1', ln: 4 } + h={ + lv: '1', + ln: 4, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv5}/ - h={ lv: '2', ln: 5 } + h={ + lv: '2', + ln: 5, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv6}/ - h={ lv: '3', ln: 6 } + h={ + lv: '3', + ln: 6, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) else @dob end @@ -1269,7 +1572,8 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} end if dob.is==:heading if ocn_flag==true - dob.ln,dob.node,dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent,dob.lc=ln,node,ocn,ocn_flag,ocn_dv,ocn_sp,parent,collapsed_level + dob.ln,dob.node,dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent,dob.lc= + ln, node, ocn, ocn_flag, ocn_dv,ocn_sp, parent, collapsed_level else ocnu+=1 heading_use=:ok @@ -1280,19 +1584,22 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_dummy_heading]}/,'') heading_use=:dummy end - dob.ln,dob.node,dob.ocn,dob.ocn_,dob.use_,dob.odv,dob.osp,dob.parent,dob.lc=ln,node,nil,ocn_flag,heading_use,ocn_dv,ocn_sp,parent,collapsed_level + dob.ln,dob.node,dob.ocn,dob.ocn_,dob.use_, dob.odv,dob.osp,dob.parent,dob.lc= + ln, node, nil, ocn_flag,heading_use,ocn_dv, ocn_sp, parent, collapsed_level end else if dob.of !=:meta \ && dob.of !=:comment \ && dob.of !=:layout if ocn_flag == true - dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent=ocn,ocn_flag,ocn_dv,ocn_sp,parent + dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent= + ocn, ocn_flag,ocn_dv, ocn_sp, parent else ocnu+=1 dob.obj=dob.obj.gsub(/#{Mx[:fa_o]}[~-]##{Mx[:fa_c]}/,'') if dob.obj ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}" - dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent=nil,ocn_flag,ocn_dv,ocn_sp,parent + dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent= + nil, ocn_flag,ocn_dv, ocn_sp, parent end end end @@ -1340,7 +1647,10 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} data=@data tuned_file=[] hs=[0,false,false,false] - t={ lv: @s[0], status: :open } + t={ + lv: @s[0], + status: :open, + } tuned_file << tags(t) if @md.opt.act[:verbose_plus][:set]==:on puts "\nXML sisu structure outline --->\n" @@ -1432,7 +1742,13 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} when '5' then 8 when '6' then 9 end - h={ tag: tag, node: o[:node], lv: o[:lv], ln: ln, status: o[:status] } + h={ + tag: tag, + node: o[:node], + lv: o[:lv], + ln: ln, + status: o[:status], + } SiSU_AO_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments end def tag_open(o,tag) @@ -1445,121 +1761,205 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} case hs[0] when 0 if (lev <= 0) and hs[0] - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 1 if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 2 if (lev <= 2) and hs[2] - t={ lv: @s[2], status: :close } + t={ + lv: @s[2], + status: :close, + } ary << tags(t) end if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 3 if (lev <= 3) and hs[3] - t={ lv: @s[3], status: :close } + t={ + lv: @s[3], + status: :close, + } ary << tags(t) end if (lev <= 2) and hs[2] - t={ lv: @s[2], status: :close } + t={ + lv: @s[2], + status: :close, + } ary << tags(t) end if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 4 if (lev <= 4) - t={ lv: @s[4], status: :close } + t={ + lv: @s[4], + status: :close, + } ary << tags(t) end if (lev <= 3) and hs[3] - t={ lv: @s[3], status: :close } + t={ + lv: @s[3], + status: :close, + } ary << tags(t) end if (lev <= 2) and hs[2] - t={ lv: @s[2], status: :close } + t={ + lv: @s[2], + status: :close, + } ary << tags(t) end if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 5 if (lev <= 5) - t={ lv: @s[5], status: :close } + t={ + lv: @s[5], + status: :close, + } ary << tags(t) end if (lev <= 4) - t={ lv: @s[4], status: :close } + t={ + lv: @s[4], + status: :close, + } ary << tags(t) end if (lev <= 3) and hs[3] - t={ lv: @s[3], status: :close } + t={ + lv: @s[3], + status: :close, + } ary << tags(t) end if (lev <= 2) and hs[2] - t={ lv: @s[2], status: :close } + t={ + lv: @s[2], + status: :close, + } ary << tags(t) end if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 6 if (lev <= 6) - t={ lv: @s[6], status: :close } + t={ + lv: @s[6], + status: :close, + } ary << tags(t) end if (lev <= 5) - t={ lv: @s[5], status: :close } + t={ + lv: @s[5], + status: :close, + } ary << tags(t) end if (lev <= 4) - t={ lv: @s[4], status: :close } + t={ + lv: @s[4], + status: :close, + } ary << tags(t) end if (lev <= 3) and hs[3] - t={ lv: @s[3], status: :close } + t={ + lv: @s[3], + status: :close, + } ary << tags(t) end if (lev <= 2) and hs[2] - t={ lv: @s[2], status: :close } + t={ + lv: @s[2], + status: :close, + } ary << tags(t) end if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end end diff --git a/lib/sisu/v5/ao_endnotes.rb b/lib/sisu/v5/ao_endnotes.rb index a662370c..5517cd87 100644 --- a/lib/sisu/v5/ao_endnotes.rb +++ b/lib/sisu/v5/ao_endnotes.rb @@ -63,8 +63,12 @@ module SiSU_AO_Endnotes class Endnotes def initialize(md,data,endnote_array=nil) - @md,@data,@endnote_array=md,data,endnote_array - @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1 + @md,@data,@endnote_array= + md, data, endnote_array + @endnote_counter, + @endnote_counter_asterisk, + @endnote_counter_dag= + 1,1,1 end def endnotes data=@data @@ -73,17 +77,20 @@ module SiSU_AO_Endnotes data.each do |dob| # manually numbered endnotes --> if @md.opt.mod.inspect =~/--no-asterisk|--no-annotate/ - dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') + dob.obj=dob.obj. + gsub(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') end if @md.opt.mod.inspect =~/--no-dagger|--no-annotate/ - dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') + dob.obj=dob.obj. + gsub(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') end if (defined? dob.obj) \ && (defined? dob.is) \ && dob.is !=:code case dob.obj # auto-numbered endnotes --> when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ - dob.obj=dob.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'\1') + dob.obj=dob.obj. + gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'\1') word_mode=dob.obj.scan(/\S+/m) word_mode=endnote_call_number(word_mode) dob.obj=word_mode.join(' ') @@ -97,7 +104,10 @@ module SiSU_AO_Endnotes end @tuned_file << dob end - @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1 + @endnote_counter, + @endnote_counter_asterisk, + @endnote_counter_dag= + 1,1,1 @tuned_file=@tuned_file.flatten end def endnote_call_number(words) @@ -105,20 +115,24 @@ module SiSU_AO_Endnotes case word when /#{Mx[:en_a_o]}/ unless word =~/#{Mx[:en_a_o]}[*+]+/ - word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@endnote_counter} ") + word.gsub!(/#{Mx[:en_a_o]}/, + "#{Mx[:en_a_o]}#{@endnote_counter} ") @endnote_counter+=1 end when /#{Mx[:en_b_o]}/ if word =~/#{Mx[:en_b_o]}[+]/ - word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@endnote_counter_dag} ") + word.gsub!(/#{Mx[:en_b_o]}[+]/, + "#{Mx[:en_b_o]}\+#{@endnote_counter_dag} ") @endnote_counter_dag+=1 else - word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ") + word.gsub!(/#{Mx[:en_b_o]}[*]?/, + "#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ") @endnote_counter_asterisk+=1 end when /~\^|<:e>/ if @endnote_array - word.gsub!(/~\^|<:e>/,"#{@endnote_array[@endnote_counter-1]}") + word.gsub!(/~\^|<:e>/, + "#{@endnote_array[@endnote_counter-1]}") @endnote_counter+=1 end end diff --git a/lib/sisu/v5/ao_expand_insertions.rb b/lib/sisu/v5/ao_expand_insertions.rb index f47823b6..dce14ee4 100644 --- a/lib/sisu/v5/ao_expand_insertions.rb +++ b/lib/sisu/v5/ao_expand_insertions.rb @@ -77,33 +77,53 @@ module SiSU_AO_Insertions end file_type_names={} file_type_names[:gen],file_type_names[:src]=[],[] - file_type_names[:gen] <<= if cmd_list =~ /y/ then "~^ { document manifest }#{lnk[:manifest]}" + file_type_names[:gen] <<= if cmd_list =~ /y/ + "~^ { document manifest }#{lnk[:manifest]}" end - file_type_names[:gen] <<= if cmd_list =~ /h/ then [" { html, segmented text }#{lnk[:html_toc]}"," { html, scroll, document in one }#{lnk[:html_doc]}"] + file_type_names[:gen] <<= if cmd_list =~ /h/ + [ + " { html, segmented text }#{lnk[:html_toc]}", + " { html, scroll, document in one }#{lnk[:html_doc]}", + ] end - file_type_names[:gen] <<= if cmd_list =~ /e/ then [" { epub }#{lnk[:epub]}"] + file_type_names[:gen] <<= if cmd_list =~ /e/ + [" { epub }#{lnk[:epub]}"] end - file_type_names[:gen] <<= if cmd_list =~ /p/ then [" { pdf, landscape }#{lnk[:pdf_landscape]}"," { pdf, portrait }#{lnk[:pdf_portrait]}"] + file_type_names[:gen] <<= if cmd_list =~ /p/ + [ + " { pdf, landscape }#{lnk[:pdf_landscape]}", + " { pdf, portrait }#{lnk[:pdf_portrait]}", + ] end - file_type_names[:gen] <<= if cmd_list =~ /o/ then " { odf:odt, open document text }#{lnk[:odt]}" + file_type_names[:gen] <<= if cmd_list =~ /o/ + " { odf:odt, open document text }#{lnk[:odt]}" end - file_type_names[:gen] <<= if cmd_list =~ /b/ then " { xhtml scroll }#{lnk[:xhtml]}" + file_type_names[:gen] <<= if cmd_list =~ /b/ + " { xhtml scroll }#{lnk[:xhtml]}" end - file_type_names[:gen] <<= if cmd_list =~ /x/ then " { xml, sax }#{lnk[:xml_sax]}" + file_type_names[:gen] <<= if cmd_list =~ /x/ + " { xml, sax }#{lnk[:xml_sax]}" end - file_type_names[:gen] <<= if cmd_list =~ /X/ then " { xml, dom }#{lnk[:xml_dom]}" + file_type_names[:gen] <<= if cmd_list =~ /X/ + " { xml, dom }#{lnk[:xml_dom]}" end - file_type_names[:gen] <<= if cmd_list =~ /a/ then " { plain text utf-8 }#{lnk[:txt]}" + file_type_names[:gen] <<= if cmd_list =~ /a/ + " { plain text utf-8 }#{lnk[:txt]}" end - file_type_names[:gen] <<= if cmd_list =~ /g/ then 'wiki.txt' + file_type_names[:gen] <<= if cmd_list =~ /g/ + 'wiki.txt' end - file_type_names[:gen] <<= if cmd_list =~ /w/ then " { concordance }#{lnk[:html_concordance]}" + file_type_names[:gen] <<= if cmd_list =~ /w/ + " { concordance }#{lnk[:html_concordance]}" end - file_type_names[:gen] <<= if cmd_list =~ /N/ then " { dcc, document content certificate (digests) }#{lnk[:digest]}" + file_type_names[:gen] <<= if cmd_list =~ /N/ + " { dcc, document content certificate (digests) }#{lnk[:digest]}" end - file_type_names[:src] <<= if source and cmd_shortcut =~ /s/ then " { markup source text }#{lnk[:source]}" + file_type_names[:src] <<= if source and cmd_shortcut =~ /s/ + " { markup source text }#{lnk[:source]}" end - file_type_names[:src] <<= if cmd_shortcut =~ /S/ then " { markup source (zipped) pod }#{lnk[:sisupod]}" + file_type_names[:src] <<= if cmd_shortcut =~ /S/ + " { markup source (zipped) pod }#{lnk[:sisupod]}" end file_type_names[:gen]=file_type_names[:gen].flatten file_type_names[:src]=file_type_names[:src].flatten diff --git a/lib/sisu/v5/ao_hash_digest.rb b/lib/sisu/v5/ao_hash_digest.rb index 1c20671f..6675474c 100644 --- a/lib/sisu/v5/ao_hash_digest.rb +++ b/lib/sisu/v5/ao_hash_digest.rb @@ -85,8 +85,8 @@ module SiSU_AO_Hash t_o.obj=t_o.obj.strip end if (t_o.of !=:structure \ - && t_o.of !=:comment \ - && t_o.of !=:layout) \ + && t_o.of !=:comment \ + && t_o.of !=:layout) \ && t_o.ocn.is_a?(Fixnum) case sha_ when :sha512 @@ -114,7 +114,9 @@ module SiSU_AO_Hash t_o_bit <<= case en_plus when /#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ if en_plus =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/ - t_o_txt,en_open,en_txt,en_close=/(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m.match(en_plus)[1..4] + t_o_txt,en_open,en_txt,en_close= + /(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m. + match(en_plus)[1..4] stripped_en=SiSU_TextRepresentation::Alter.new(en_txt).strip_clean_of_markup digest_en_strip=case @env.digest(@md.opt).type when :sha512 @@ -126,7 +128,13 @@ module SiSU_AO_Hash else Digest::SHA256.hexdigest(stripped_en) end - t_o_txt + en_open + en_txt + Mx[:id_o] + digest_en_strip + Mx[:id_c] + en_close + t_o_txt + + en_open + + en_txt + + Mx[:id_o] + + digest_en_strip + + Mx[:id_c] + + en_close else STDERR.puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up end else en_plus @@ -143,8 +151,10 @@ module SiSU_AO_Hash case t_o.obj when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m en_and_t_o_digest=[] - t_o.obj=t_o.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch - t_o_plus_en=t_o.obj.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m) + t_o.obj=t_o.obj. + gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch + t_o_plus_en=t_o.obj. + scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m) t_o_tail=if t_o.obj =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+.*/m.match(t_o.obj)[1] else '' diff --git a/lib/sisu/v5/ao_idx.rb b/lib/sisu/v5/ao_idx.rb index 43d5aeda..c0dba12a 100644 --- a/lib/sisu/v5/ao_idx.rb +++ b/lib/sisu/v5/ao_idx.rb @@ -67,14 +67,26 @@ module SiSU_AO_BookIndex @rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/ @rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/ @rgx_idx_ocn=/(.+?)~(\d+)/ - @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier + @ocn_html_identifier= + SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @env ||=SiSU_Env::InfoEnv.new(@md.fns) end def indexing_song data=@data - data,sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx=extract_book_index(data) - data=clean_and_insert_index(data,sisu_markup_idx_rel_html_seg) - [data,sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx] + data, + sisu_markup_idx_rel, + sisu_markup_idx_rel_html_seg, + html_idx,xhtml_idx= + extract_book_index(data) + data= + clean_and_insert_index(data,sisu_markup_idx_rel_html_seg) + [ + data, + sisu_markup_idx_rel, + sisu_markup_idx_rel_html_seg, + html_idx, + xhtml_idx, + ] end def extract_book_index(data) tuned_file=[] @@ -93,13 +105,25 @@ module SiSU_AO_BookIndex end if idx_array.length > 0 the_idx=construct_book_index(idx_array) - sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx=nil,nil,nil,nil if @md.book_idx idx=index(the_idx) - sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx=idx[:sst_rel],idx[:sst_rel_html_seg],idx[:html],idx[:xhtml] + sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx, xhtml_idx= + idx[:sst_rel], idx[:sst_rel_html_seg], idx[:html],idx[:xhtml] + else + sisu_markup_idx_rel= + sisu_markup_idx_rel_html_seg= + html_idx= + xhtml_idx= + nil end end - [tuned_file,sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx] + [ + tuned_file, + sisu_markup_idx_rel, + sisu_markup_idx_rel_html_seg, + html_idx, + xhtml_idx, + ] end def construct_book_index(idx_array) the_idx={} @@ -108,8 +132,12 @@ module SiSU_AO_BookIndex location=(term_info[:plus].to_i > 0) \ ? (%{#{idx[:ocn]}-#{idx[:ocn].to_i + term_info[:plus].to_i}}) : idx[:ocn].to_s - the_idx[term]={} unless the_idx[term] and defined? the_idx[term] - the_idx[term]['node_0_terms']=[] unless the_idx[term]['node_0_terms'] and defined? the_idx[term]['node_0_terms'] + the_idx[term]={} \ + unless the_idx[term] \ + and defined? the_idx[term] + the_idx[term]['node_0_terms']=[] \ + unless the_idx[term]['node_0_terms'] \ + and defined? the_idx[term]['node_0_terms'] the_idx[term]['node_0_terms'] << { ocn: idx[:ocn], range: location, seg: idx[:seg] } if term_info[:sub].is_a?(Array) \ and term_info[:sub].length > 0 @@ -118,11 +146,20 @@ module SiSU_AO_BookIndex location=(subterm_info[:plus].to_i > 0) \ ? (%{#{idx[:ocn]}-#{idx[:ocn].to_i + subterm_info[:plus].to_i}}) : idx[:ocn].to_s - the_idx[term]={} unless the_idx[term] and defined? the_idx[term] - the_idx[term]['node_0_terms']=[] unless the_idx[term]['node_0_terms'] and defined? the_idx[term]['node_0_terms'] - the_idx[term]['node_1_subterms']={} unless the_idx[term]['node_1_subterms'] and defined? the_idx[term]['node_1_subterms'] - the_idx[term]['node_1_subterms'][subterm]=[] unless the_idx[term]['node_1_subterms'][subterm] and defined? the_idx[term]['node_1_subterms'][subterm] - the_idx[term]['node_1_subterms'][subterm] << { ocn: idx[:ocn], range: location, seg: idx[:seg] } + the_idx[term]={} \ + unless the_idx[term] \ + and defined? the_idx[term] + the_idx[term]['node_0_terms']=[] \ + unless the_idx[term]['node_0_terms']\ + and defined? the_idx[term]['node_0_terms'] + the_idx[term]['node_1_subterms']={} \ + unless the_idx[term]['node_1_subterms'] \ + and defined? the_idx[term]['node_1_subterms'] + the_idx[term]['node_1_subterms'][subterm]=[] \ + unless the_idx[term]['node_1_subterms'][subterm] \ + and defined? the_idx[term]['node_1_subterms'][subterm] + the_idx[term]['node_1_subterms'][subterm] << + { ocn: idx[:ocn], range: location, seg: idx[:seg] } end end end @@ -138,16 +175,27 @@ module SiSU_AO_BookIndex def index(the_idx) @x=1 idx={} - idx[:sst_rel_html_seg],idx[:sst_rel],idx[:html],idx[:xhtml]=[],[],[],[] - h={obj: Mx[:br_page]} + idx[:sst_rel_html_seg],idx[:sst_rel],idx[:html],idx[:xhtml]= + [], [], [], [] + h={ + obj: Mx[:br_page] + } o=SiSU_AO_DocumentStructure::ObjectLayout.new.break(h) idx[:sst_rel_html_seg] << o idx[:sst_rel] << o - h={lv: '1', name: 'index', obj: "Index"} + h={ + lv: '1', + name: 'index', + obj: "Index" + } o=SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) idx[:sst_rel_html_seg] << o idx[:sst_rel] << o - h={lv: '4', name: 'idx', obj: " [Index] #{Mx[:pa_non_object_dummy_heading]}"} + h={ + lv: '4', + name: 'idx', + obj: " [Index] #{Mx[:pa_non_object_dummy_heading]}" + } o=SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) idx[:sst_rel_html_seg] << o idx[:sst_rel] << o @@ -159,15 +207,19 @@ module SiSU_AO_BookIndex idx[:html] << '' idx[:xhtml] << '' else - idx[:html] << %{#{x},#{$ep[:hsp]}} - idx[:xhtml] << %{#{x},#{$ep[:hsp]}} + idx[:html] << + %{#{x},#{$ep[:hsp]}} + idx[:xhtml] << + %{#{x},#{$ep[:hsp]}} end end idx[:html] << '

' idx[:xhtml] << '

' letter=alph.shift - idx[:html] << %{\n

} - idx[:xhtml] << %{\n

0 - 9

} + idx[:html] << + %{\n

} + idx[:xhtml] << + %{\n

0 - 9

} the_idx.each do |i| i.each do |x| if x.is_a?(String) @@ -176,18 +228,24 @@ module SiSU_AO_BookIndex while letter < f if alph.length > 0 letter=alph.shift - idx[:html] << %{\n

#{letter}

} - idx[:xhtml] << %{\n

#{letter}

} + idx[:html] << + %{\n

#{letter}

} + idx[:xhtml] << + %{\n

#{letter}

} else break end end end - idx[:sst_rel_html_seg] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } - idx[:sst_rel] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } + idx[:sst_rel_html_seg] << + %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } + idx[:sst_rel] << + %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } aname=x.gsub(/\s+/,'_') - idx[:html] << %{\n

#{x}, } + idx[:html] << + %{\n

#{x}, } c=clean_xml(x.dup) - idx[:xhtml] << %{\n

#{c}, } + idx[:xhtml] << + %{\n

#{c}, } @o=idx[:sst_rel_html_seg].index(idx[:sst_rel_html_seg].last) @t=idx[:sst_rel].index(idx[:sst_rel].last) @q=idx[:html].index(idx[:html].last) @@ -200,16 +258,32 @@ module SiSU_AO_BookIndex if x['node_0_terms'].is_a?(Array) x['node_0_terms'].each do |a| if a[:range] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{a[:range]}, } - idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:range]}, } + idx[:sst_rel_html_seg][@o]= + idx[:sst_rel_html_seg][@o] + + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel][@t]= + idx[:sst_rel][@t] + + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } + idx[:html][@q]= + idx[:html][@q] + + %{#{a[:range]}, } + idx[:xhtml][@q]= + idx[:xhtml][@q] + + %{#{a[:range]}, } print a[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on elsif a[:ocn] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{a[:ocn]}, } - idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:ocn]}, } + idx[:sst_rel_html_seg][@o]= + idx[:sst_rel_html_seg][@o] + + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel][@t]= + idx[:sst_rel][@t] + + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } + idx[:html][@q]= + idx[:html][@q] + + %{#{a[:ocn]}, } + idx[:xhtml][@q]= + idx[:xhtml][@q] + + %{#{a[:ocn]}, } print a[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on else p 'error' end @@ -220,24 +294,48 @@ module SiSU_AO_BookIndex if x['node_1_subterms'] x['node_1_subterms'].sort.each do |k,y| if k !~/node_0_terms/ - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{k}, } - idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{k}, } - idx[:html][@q]=idx[:html][@q] + %{\n

#{k}, } + idx[:sst_rel_html_seg][@o]= + idx[:sst_rel_html_seg][@o] + + %{#{k}, } + idx[:sst_rel][@t]= + idx[:sst_rel][@t] + + %{#{k}, } + idx[:html][@q]= + idx[:html][@q] + + %{\n

#{k}, } c=clean_xml(k.dup) - idx[:xhtml][@r]=idx[:xhtml][@r] + %{\n

#{c}, } + idx[:xhtml][@r]= + idx[:xhtml][@r] + + %{\n

#{c}, } print "\n\t" + k + ', ' if @md.opt.act[:verbose_plus][:set]==:on y.each do |z| if z[:range] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{z[:range]}, } - idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:range]}, } + idx[:sst_rel_html_seg][@o]= + idx[:sst_rel_html_seg][@o] + + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel][@t]= + idx[:sst_rel][@t] + + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } + idx[:html][@q]= + idx[:html][@q] + + %{#{z[:range]}, } + idx[:xhtml][@q]= + idx[:xhtml][@q] + + %{#{z[:range]}, } print z[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on elsif z[:ocn] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{z[:ocn]}, } - idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:ocn]}, } + idx[:sst_rel_html_seg][@o]= + idx[:sst_rel_html_seg][@o] + + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel][@t]= + idx[:sst_rel][@t] + + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } + idx[:html][@q]= + idx[:html][@q] + + %{#{z[:ocn]}, } + idx[:xhtml][@q]= + idx[:xhtml][@q] + + %{#{z[:ocn]}, } print z[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on else p 'error' end diff --git a/lib/sisu/v5/ao_images.rb b/lib/sisu/v5/ao_images.rb index 8eee4b57..dce92fc5 100644 --- a/lib/sisu/v5/ao_images.rb +++ b/lib/sisu/v5/ao_images.rb @@ -85,7 +85,10 @@ module SiSU_AO_Images else if (@md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* use of RMagick is not enabled in sisurc.yml').warn + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + '*WARN* use of RMagick is not enabled in sisurc.yml' + ).warn end end data.each do |dob| @@ -99,7 +102,11 @@ module SiSU_AO_Images img_col=img_row=nil images=imgs.each do |image| dir=SiSU_Env::InfoEnv.new(@md.fns) - path_image=[dir.path.image_source_include_local,dir.path.image_source_include_remote,dir.path.image_source_include] + path_image=[ + dir.path.image_source_include_local, + dir.path.image_source_include_remote, + dir.path.image_source_include + ] image_path=nil path_image.each do |img_pth| image_path=img_pth @@ -112,7 +119,10 @@ module SiSU_AO_Images else if (@md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* RMagick not present, will attempt to use imagemagick (identify) directly').warn + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + '*WARN* RMagick not present, will attempt to use imagemagick (identify) directly' + ).warn end imgk=SiSU_Env::SystemCall.new.imagemagick gmgk=SiSU_Env::SystemCall.new.graphicksmagick @@ -144,12 +154,18 @@ module SiSU_AO_Images end end dob.obj=dob.obj.gsub(/(#{image})/,"#{image} #{img_col}x#{img_row}") - else dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,'[ \1 (\2 missing) ]') + else + dob.obj=dob.obj. + gsub(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, + '[ \1 (\2 missing) ]') end end else images=dob.obj.scan(m) do |image| - SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image).warn unless @md.opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + '*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image + ).warn unless @md.opt.act[:quiet][:set]==:on end end end diff --git a/lib/sisu/v5/ao_metadata.rb b/lib/sisu/v5/ao_metadata.rb index c51c40dc..a4f8fcc2 100644 --- a/lib/sisu/v5/ao_metadata.rb +++ b/lib/sisu/v5/ao_metadata.rb @@ -69,11 +69,20 @@ module SiSU_AO_Metadata @tr=SiSU_Translate::Source.new(md,language) end def make_para(obj,ocn) - h={ obj: obj, ocn: 0 } + h={ + obj: obj, + ocn: 0 + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end def make_heading(obj,ocn,name,lv,ln) - h={ lv: lv, ln: ln, name: name, obj: obj, ocn: 0 } + h={ + lv: lv, + ln: ln, + name: name, + obj: obj, + ocn: 0 + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) end def metadata diff --git a/lib/sisu/v5/ao_misc_arrange.rb b/lib/sisu/v5/ao_misc_arrange.rb index 48b421c6..a053f37e 100644 --- a/lib/sisu/v5/ao_misc_arrange.rb +++ b/lib/sisu/v5/ao_misc_arrange.rb @@ -67,10 +67,13 @@ module SiSU_AO_MiscArrangeText end def conditional_headings(para) para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author'). #conditional header - gsub(/^((?:[1-9]|:?[A-D])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 + gsub(/^((?:[1-9]|:?[A-D])~\S*)\s*$/, + '\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 if para =~/^@\S+?:/ - para=para.gsub(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2"). - gsub(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3") + para=para.gsub(/^@(\S+?):(\s+|$)/, + "#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2"). + gsub(/^@(\S+?):([+-])(\s+|$)/, + "#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3") end para end @@ -79,7 +82,9 @@ module SiSU_AO_MiscArrangeText block_open,block_close,text=nil,nil,nil if para =~/\A```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?\n.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m @flag=:close - block_open,text,block_close=/\A(```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?)\n(.+?)\n(```([ ]+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1..3] + block_open,text,block_close= + /\A(```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?)\n(.+?)\n(```([ ]+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m. + match(para)[1..3] ((para=~/^```[ ]+table(?:~h)?\s+/) \ and (para !~/^```[ ]+table(?:~h)?\s+c\d+/)) \ ? para @@ -96,7 +101,8 @@ module SiSU_AO_MiscArrangeText elsif para =~/\A.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m \ and @flag==:open @flag=:close - text,block_close=/\A(.+?)\n(```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2] + text,block_close= + /\A(.+?)\n(```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2] para=[] if not text.to_s.empty? para << text.to_s << block_close @@ -109,7 +115,8 @@ module SiSU_AO_MiscArrangeText end def ticks_remove(para) unless @md.opt.act[:quiet][:set] ==:on - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark("ticks not recognized, ticks removed from pargraph\n#{para}") + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + mark("ticks not recognized, ticks removed from pargraph\n#{para}") end para=para.gsub(/```[ ]+\S+[ ]*/m,''). gsub(/```\s*/m,''). @@ -134,11 +141,15 @@ module SiSU_AO_MiscArrangeText def curly_braces(para) block_open,block_close,text=nil,nil,nil para=if para =~/\A(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?\n.+?\n\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m - block_open,text,block_close=/\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1..3] + block_open,text,block_close= + /\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m. + match(para)[1..3] para=[] para << block_open << text << block_close elsif para =~/\A(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?\n.+?\Z/m - block_open,text=/\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\Z/m.match(para)[1,2] + block_open,text= + /\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\Z/m. + match(para)[1,2] para=[] if not text.to_s.empty? para << block_open << text @@ -146,7 +157,9 @@ module SiSU_AO_MiscArrangeText para << block_open end elsif para =~/\A.+?\n\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m - text,block_close=/\A(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1,2] + text,block_close= + /\A(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\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/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb index a143abeb..cd631796 100644 --- a/lib/sisu/v5/ao_numbering.rb +++ b/lib/sisu/v5/ao_numbering.rb @@ -121,7 +121,8 @@ module SiSU_AO_Numbering dob end def heading_tag_clean(heading_tag) - heading_tag=heading_tag.gsub(/[ ]+/,'_'). + heading_tag=heading_tag. + gsub(/[ ]+/,'_'). gsub(/["']/,''). gsub(/[\/]/,'-'). gsub(/#{Mx[:fa_bold_o]}|#{Mx[:fa_bold_c]}/,''). @@ -315,7 +316,8 @@ module SiSU_AO_Numbering if dob.name !~/^\S+/ \ and dob.obj =~/^\s*(?:\S+\s+)?([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name possible_seg_name=$1 - possible_seg_name=possible_seg_name.gsub(/(?:[:,-]|\W)/,'.'). + possible_seg_name=possible_seg_name. + gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') if @md.seg_names.is_a?(Array) \ and not @md.seg_names.include?(possible_seg_name) @@ -363,11 +365,17 @@ module SiSU_AO_Numbering m=dob.ln.to_s dob_tmp=[] if @md.pagenew.inspect =~/#{m}/ - dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) << dob + dob_tmp << + SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) << + dob elsif @md.pagebreak.inspect =~/#{m}/ - dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) << dob + dob_tmp << + SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) << + dob elsif @md.pageline.inspect =~/#{m}/ - dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line]) << dob + dob_tmp << + SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line]) << + dob end unless dob_tmp.length > 0; dob else dob_tmp @@ -381,11 +389,23 @@ module SiSU_AO_Numbering : @segname tags["#{dob.ocn}"]={ segname: @segname } ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert) - if dob.ln =~/[0-3]/ then { seg: nil, level: dob.ln } + if dob.ln =~/[0-3]/ + { + seg: nil, + level: dob.ln, + } #elsif dob.ln =~/[4-6]/ - else { seg: @seg, level: dob.ln } + else + { + seg: @seg, + level: dob.ln, + } end - else { seg: @seg, level: nil } + else + { + seg: @seg, + level: nil, + } end end dob.tags=dob.tags.uniq if defined? dob.tags @@ -434,7 +454,9 @@ module SiSU_AO_Numbering and defined? @md.title.full \ and defined? @md.creator \ and @md.creator - head=@md.title.main ? ([@lv='1',@obj=@md.title.main]) : ([@lv='1',@obj='[no title provided]']) + head=@md.title.main \ + ? ([@lv='1',@obj=@md.title.main]) + : ([@lv='1',@obj='[no title provided]']) @tuned_file << head end end @@ -479,7 +501,8 @@ module SiSU_AO_Numbering unless @md.set_header_title if t_o !~/^%{1,2}\s/m \ and t_o !~/\A\s*\Z/m - @tuned_file << "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}" + @tuned_file << + "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}" @md.title.main=@md.heading_seg_first @md.set_header_title=true end diff --git a/lib/sisu/v5/ao_syntax.rb b/lib/sisu/v5/ao_syntax.rb index 619c5ac0..99cb6ca0 100644 --- a/lib/sisu/v5/ao_syntax.rb +++ b/lib/sisu/v5/ao_syntax.rb @@ -143,7 +143,8 @@ module SiSU_AO_Syntax && dob.is !=:comment \ && dob.is !=:code \ && dob.is !=:table - dob.obj=dob.obj.gsub(/^-\\\\-\s*$/,"#{Mx[:br_page]}"). + dob.obj=dob.obj. + gsub(/^-\\\\-\s*$/,"#{Mx[:br_page]}"). gsub(/^=\\\\=\s*$/,"#{Mx[:br_page_new]}"). gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}"). gsub(/(?:<:?pb>)/,"#{Mx[:br_page]}"). # depreciated @@ -190,7 +191,8 @@ module SiSU_AO_Syntax dob end def embolden(given) - given=given.gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + given=given. + gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2"). gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/, "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}"). @@ -204,7 +206,8 @@ module SiSU_AO_Syntax "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end def italicise(given) - given=given.gsub(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + given=given. + gsub(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2"). gsub(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/, "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2"). @@ -282,11 +285,13 @@ module SiSU_AO_Syntax word.each do |w| unless /#{@manmkp_bold}|#{@http_m}/.match(w) if defined? @md.bold_match_list[:regx] \ - and @md.bold_match_list[:regx] #document header: @bold: [bold word list] - w=w.gsub(@md.bold_match_list[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") + and @md.bold_match_list[:regx] #document header: @bold: [bold word list] + w=w.gsub(@md.bold_match_list[:regx], + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") elsif defined? @vz.markup_make_bold \ and @vz.markup_make_bold #defaults adjusted bold word list - w=w.gsub(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") + w=w.gsub(@vz.markup_make_bold, + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end else w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/ @@ -324,7 +329,9 @@ module SiSU_AO_Syntax else '' end txt="#{lead_break}#{fce}\{" + txt.split(Mx[:br_nl]).join("\}#{fce}#{Mx[:br_nl]}#{fce}\{") + "\}#{fce}" - dob.obj=dob.obj.sub(/(?:^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)([*!\/_#])\{.+?\}\1/m,"#{lead}#{txt}") + dob.obj=dob.obj. + sub(/(?:^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)([*!\/_#])\{.+?\}\1/m, + "#{lead}#{txt}") dob else dob end @@ -336,7 +343,8 @@ module SiSU_AO_Syntax def fontface(dob) leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|[、。「‹«¿¡]|\>/ dob=fontface_lines(dob,leader) - dob.obj=dob.obj.gsub(/(#{leader})\*\{(.+?)\}\*/m, + dob.obj=dob.obj. + gsub(/(#{leader})\*\{(.+?)\}\*/m, "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis gsub(/(#{leader})!\{(.+?)\}!/m, "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold @@ -399,18 +407,20 @@ module SiSU_AO_Syntax word=dob.obj.scan(/\S+|\n/) #unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit if word word.each do |w| # _ - / # | : ! ^ ~ - unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/ # do something earlier about table!! - w=w.gsub(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character + unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/ # do something earlier about table!! + w=w.gsub(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character end - w=w.gsub(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}").gsub(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character + w=w.gsub(/^\<$/, + "#{Mx[:gl_o]}#lt#{Mx[:gl_c]}").gsub(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character line_array << w end dob.obj=line_array.join(' ') dob.obj=dob.obj.strip end - dob.obj=dob.obj.gsub(/^([*#-.]{1,12})$/,'\1 ~#'). #ocn off for these paragraph separators + dob.obj=dob.obj. + gsub(/^([*#-.]{1,12})$/,'\1 ~#'). #ocn off for these paragraph separators gsub(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]). - gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify + gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify gsub(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c]) if dob.is ==:heading \ and dob.ln ==0 @@ -431,12 +441,14 @@ module SiSU_AO_Syntax dob.obj=if dob.lv =~/[23]/ \ and defined? @md.creator.author \ and @md.creator.author - dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.creator.author}") + dob.obj. + gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/, + "\\1#{@md.creator.author}") else dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1') end end end - dob.obj=dob.obj.gsub(/<(https?:\/\/\S+?)>/,'< \1 >'). #catch problem markup + dob.obj=dob.obj.gsub(/<(https?:\/\/\S+?)>/,'< \1 >'). #catch problem markup gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image'). gsub(//,'<:\1>'). #escaped special character gsub(/ /,"#{Mx[:nbsp]}"). #escaped special character @@ -463,15 +475,18 @@ module SiSU_AO_Syntax gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character if dob.obj=~/(?:https?:|ftp:|\{([^{}]+?)\}(?:#|:|[.]{1,2}\/))\S+/m if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m - dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, - "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]}\\3 \\4#{Mx[:en_a_c]}") # watch + dob.obj=dob.obj. + gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]}\\3 \\4#{Mx[:en_a_c]}") # watch end if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m - dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, - "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ") + dob.obj=dob.obj. + gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ") end - dob.obj=dob.obj.gsub(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, - "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3"). #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline) + dob.obj=dob.obj. + gsub(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3"). #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline) gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}). gsub(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, @@ -486,7 +501,8 @@ module SiSU_AO_Syntax %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}) end dob=fontface(dob) - dob.obj=dob.obj.gsub(/<[:e]\s+(.+?)!?>/, + dob.obj=dob.obj. + gsub(/<[:e]\s+(.+?)!?>/, "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}"). #not tested gsub(/(^|#{Mx[:br_nl]})\s*_\*\s*/, "\\1#{Mx[:gl_bullet]}"). #bullets, shortcut @@ -526,7 +542,8 @@ module SiSU_AO_Syntax elsif dob.is==:table dob=fontface(dob) elsif dob.is ==:code - dob.obj=dob.obj.gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: '). + dob.obj=dob.obj. + gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: '). gsub(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert

back, clumsy if dob.number_ codeline=[] @@ -569,7 +586,8 @@ module SiSU_AO_Syntax # +2 puts 'tech' @data.each do |line| - line=line.gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/, + line=line. + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/, "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/, "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index f57274ad..d9359862 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -75,7 +75,8 @@ module SiSU 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 class HubMaster def initialize(argv) @@ -159,7 +160,11 @@ module SiSU end end if files_translated_idx.flatten.length > 1 - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manifest re-run on (currently generated) translated files',"").grey_title_hi unless @opt.act[:quiet][:set] ==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Manifest re-run on (currently generated) translated files', + '' + ).grey_title_hi unless @opt.act[:quiet][:set] ==:on files_translated_idx.flatten.each do |i| @opt.fns=@opt.files[i] @opt.f_pth=@opt.f_pths[i] @@ -191,22 +196,26 @@ module SiSU @@n_do=0 end def remote_put_base_site_rsync # -CR - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) if @opt.act[:maintenance][:set] ==:on + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ + if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base end def remote_put_base_site_rsync_match # -CCRZ - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) if @opt.act[:maintenance][:set] ==:on + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ + if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base_sync end def remote_put_base_site # -Cr - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) if @opt.act[:maintenance][:set] ==:on + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ + if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base end def remote_put_base_site_all # -CCr - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) if @opt.act[:maintenance][:set] ==:on + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ + if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base_all end @@ -217,7 +226,10 @@ module SiSU def termsheet # -t system("sisu_termsheet #{@opt.cmd} #{@opt.fns}\n") @@n_do=@@n_do+1 - SiSU_Screen::Ansi.new(@opt.cmd,@@n_do,'Termsheet(s) processed').term_sheet_title unless @opt.act[:quiet][:set] ==:on + SiSU_Screen::Ansi.new( + @opt.cmd,@@n_do, + 'Termsheet(s) processed' + ).term_sheet_title unless @opt.act[:quiet][:set] ==:on end def webrick # -W prt=SiSU_Env::InfoEnv.new(@fns).port.webrick_port @@ -254,7 +266,8 @@ module SiSU 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 @@env=nil attr_accessor :op @@ -262,7 +275,9 @@ module SiSU @opt=opt @@env=@env=SiSU_Env::InfoEnv.new @msg,@msgs='',nil - @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") } + @tell=lambda { + SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") + } end def remove_skipped_files_if_any_from_processing_files_array if @remove_faulty_markup_files_array.length > 0 @@ -272,7 +287,8 @@ module SiSU def print_error_message_if_files_skipped if @remove_faulty_markup_files_array.length > 0 puts '---' - STDERR.puts 'ERROR with file(s), did not process: ' + @remove_faulty_markup_files_array.join(',') + STDERR.puts 'ERROR with file(s), did not process: ' + + @remove_faulty_markup_files_array.join(',') end end def do_loops @@ -288,7 +304,8 @@ module SiSU def do_each_file_loop_options @opt.files.each_with_index do |fno,i| @opt.fno=fno - @opt.fns=fno.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst'). + @opt.fns=fno. + gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst'). gsub(/\.ssm$/,'.ssm.sst') @opt.f_pth=@opt.f_pths[i] if @opt.fns !~/\.-sst$/ @@ -492,7 +509,8 @@ module SiSU ensure path_pod=@env.processing_path.processing_sisupod(@opt).paths unless @opt.act[:maintenance][:set]==:on - FileUtils::rm_rf("#{path_pod[:sisupod]}/*") if FileTest.directory?(path_pod[:sisupod]) + FileUtils::rm_rf("#{path_pod[:sisupod]}/*") \ + if FileTest.directory?(path_pod[:sisupod]) end end end @@ -518,7 +536,7 @@ module SiSU case @opt.fns when /\.(termsheet.rb)$/ SiSU::Operations.new(@opt).termsheet - else #print "not processed --> ", fns, "\n" + else #print "not processed --> ", fns, "\n" end else SiSU::Operations.new(@opt).not_found end @@ -528,13 +546,13 @@ module SiSU if @opt.act[:psql][:set]==:on #% --pg, -D DB postgresql require_relative 'dbi' OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb end end if @opt.act[:sqlite][:set]==:on #% --sqlite, -d DB sqlite require_relative 'dbi' OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb end end if @opt.act[:manifest][:set]==:on #% --manifest, -y @@ -579,7 +597,10 @@ module SiSU if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],' ' + File.dirname(__FILE__)).grey + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + ' ' + File.dirname(__FILE__) + ).grey end end if @opt.act[:ao][:set]==:on \ @@ -676,7 +697,8 @@ module SiSU begin require 'profile' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('profile NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('profile NOT FOUND (LoadError)') end end action_on_file_ =if @opt.act[:rsync][:set]==:on \ diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index 091f7665..591bb990 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -72,7 +72,22 @@ module SiSU_Commandline @@sisu_call_origin_path=nil class HeaderCommon def sisu_document_make_instructions - @pagenew=@pagebreak=@pageline=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@num_top=@i18n=@man_section=@emphasis_set_to=@bold_match_list=@italics_match_list=@substitution_match_list=@footer_links=@home_button_links=@links=nil + @pagenew= + @pagebreak= + @pageline= + @toc= + @lv1=@lv2=@lv3=@lv4=@lv5=@lv6= + @num_top= + @i18n= + @man_section= + @emphasis_set_to= + @bold_match_list= + @italics_match_list= + @substitution_match_list= + @footer_links= + @home_button_links= + @links= + nil make_instruct_array=SiSU_Env::GetInit.new.sisu_document_make.makefile_read @makeset=false if make_instruct_array @@ -143,7 +158,8 @@ module SiSU_Commandline attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod @@act=nil def initialize(a) - @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','','','' + @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location= + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::InfoEnv.new @lng_base=@env.language_default_set @@ -316,7 +332,8 @@ module SiSU_Commandline FileUtils::mkdir_p(pt.to_s) pod_make_path=fullname + '/sisupod/doc/_sisu' make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path) - @make_instructions_pod=HeaderCommon.new(make_instruct_array).sisu_document_make_instructions + @make_instructions_pod= + HeaderCommon.new(make_instruct_array).sisu_document_make_instructions Dir.chdir(pt.realpath) system(" chdir #{fullname} @@ -410,7 +427,7 @@ module SiSU_Commandline lng: lng_is, lng_is: lng_is, url_base: nil, - url: nil + url: nil, } else puts "file not found: #{x}" end @@ -422,7 +439,16 @@ module SiSU_Commandline puts "#{x} in #{a.join(' ')}?" end end - { cmd: c, mod: m, what: w, paths: pth, files: f, f_pths: f_pths, lng: lng_is, lngs: lngs } + { + cmd: c, + mod: m, + what: w, + paths: pth, + files: f, + f_pths: f_pths, + lng: lng_is, + lngs: lngs, + } end def expand_numeric_shortcuts(a) shortcut=SiSU_Env::InfoProcessingFlag.new diff --git a/lib/sisu/v5/param.rb b/lib/sisu/v5/param.rb index 9dcdfc26..d20a0129 100644 --- a/lib/sisu/v5/param.rb +++ b/lib/sisu/v5/param.rb @@ -65,15 +65,34 @@ module SiSU_Param require 'uri' require 'pstore' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri or pstore NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('uri or pstore NOT FOUND (LoadError)') end require_relative 'sysenv' # sysenv.rb include SiSU_Env require_relative 'param_make' # param_make.rb require_relative 'param_identify_markup' # param_identify_markup.rb @@date=SiSU_Env::InfoDate.new - @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=nil - @doc={ initialise: nil, markup: '', lnks: '', stmp: '', req: {} } + @@proc= + @@filename_txt= + @@filename_texinfo= + @@filename_lout_portrait= + @@filename_lout_landscape= + @@filename_html_scroll= + @@filename_html_index= + @@filename_html_segtoc= + @@filename_semantic= + @@filename_rss= + @@newfile= + @@drr= + nil + @doc={ + initialise: nil, + markup: '', + lnks: '', + stmp: '', + req: {}, + } @@yaml=@@yamladdr=nil @@trigger=nil @@lv,@@flag={},{} @@ -99,7 +118,8 @@ module SiSU_Param # you may need to change Dir.pwd to @opt.f_pth[:pth] where the latter # has a path value that is different, however, f_pth is not always set! Dir.chdir(@opt.f_pth[:pth]) - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('-- bug alert --') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('-- bug alert --') p 'f_pth ' + @opt.f_pth[:pth] p 'pwd ' + Dir.pwd end @@ -186,7 +206,11 @@ module SiSU_Param STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" s else - SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + 'v', + "*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped", + @opt.fns + ).warn unless @opt.act[:quiet][:set]==:on nil end end @@ -504,7 +528,10 @@ module SiSU_Param elsif @h['text'] then @h['text'] elsif @h['main'] then @h['main'] else - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'WARNING Document Copyright missing; provide @rights: :copyright:' + ).warn unless @opt.act[:quiet][:set]==:on '' end l,n=Db[:col_info_note],'rights.copyright.text' @@ -603,7 +630,10 @@ module SiSU_Param s +='License: ' + 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 + 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) @@ -835,8 +865,10 @@ module SiSU_Param attr_accessor :make,:env,:path,:file,:fn,:fns,:fno,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv0,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:pageline,:num_top,:bold_match_list,:italics_match_list,:substitution_match_list,:emphasis_set_to,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:flag_tables,:vocabulary,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:lang_code_insert,:en,:notes,:dgst,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy,:home_button_image,:home_button_links,:footer_links,:cover_image,:man_section def initialize(fns_array,opt) @env=@path,@file=@fn=@fns=@fno=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv0=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@pageline=@num_top=@bold_match_list=@italics_match_list=@substitution_match_list=@emphasis_set_to=@toc_lev_limit=@flag_tables=@vocabulary=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@lang_code_insert=@en=@notes=@dgst=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=@home_button_image=@home_button_links=@cover_image=@man_section=nil - @data,@path,@fns,@fno,@opt=fns_array,opt.pth,opt.fns,opt.fno,opt #@data used as data - @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=false,false,false,false,false,false,false + @data, @path, @fns, @fno, @opt= + fns_array,opt.pth,opt.fns,opt.fno,opt #@data used as data + @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx= + false, false, false, false, false, false, false @seg_autoname_safe=true @daisy,@sem_tag=false,false @authorship,@markup_instruction,@image='','','','' #check which other values should be set to empty rather than nil @@ -1020,37 +1052,48 @@ module SiSU_Param @lv4=(makes[:lv4]) ? (makes[:lv4]) : @lv4 @lv5=(makes[:lv5]) ? (makes[:lv5]) : @lv5 @lv6=(makes[:lv6]) ? (makes[:lv6]) : @lv6 - @num_top=(makes[:num_top]) \ + @num_top= + (makes[:num_top]) \ ? (makes[:num_top]) \ : @num_top - @substitution_match_list=(makes[:substitution_match_list]) \ + @substitution_match_list= + (makes[:substitution_match_list]) \ ? (makes[:substitution_match_list]) \ : @substitution_match_list - @bold_match_list=(makes[:bold_match_list]) \ + @bold_match_list= + (makes[:bold_match_list]) \ ? (makes[:bold_match_list]) \ : @bold_match_list - @italics_match_list=(makes[:italics_match_list]) \ + @italics_match_list= + (makes[:italics_match_list]) \ ? (makes[:italics_match_list]) \ : @italics_match_list - @emphasis_set_to=(makes[:emphasis_set_to]) \ + @emphasis_set_to= + (makes[:emphasis_set_to]) \ ? (makes[:emphasis_set_to]) \ : @emphasis_set_to - @i18n=(makes[:i18n]) \ + @i18n= + (makes[:i18n]) \ ? (makes[:i18n]) \ : @i18n - @man_section=(makes[:man_section]) \ + @man_section= + (makes[:man_section]) \ ? (makes[:man_section]) \ : @man_section - @footer_links=(makes[:footer_links]) \ + @footer_links= + (makes[:footer_links]) \ ? (makes[:footer_links]) \ : @footer_links - @home_button_links=(makes[:home_button_links]) \ + @home_button_links= + (makes[:home_button_links]) \ ? (makes[:home_button_links]) \ : @home_button_links - @home_button_image=(makes[:home_button_image]) \ + @home_button_image= + (makes[:home_button_image]) \ ? (makes[:home_button_image]) \ : @home_button_image - @cover_image=(makes[:cover_image]) \ + @cover_image= + (makes[:cover_image]) \ ? (makes[:cover_image]) \ : @cover_image end @@ -1117,7 +1160,11 @@ module SiSU_Param : '' title=@title.full.gsub(/\s*(?:

|

|
|
)\s*/,' '). gsub(/~\{.+?\}~/,'') - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Parameters',%{#{title}#{creator}}).txt_grey if @opt.act[:verbose][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Parameters', + %{#{title}#{creator}} + ).txt_grey if @opt.act[:verbose][:set]==:on end if not @book_idx \ and para =~/^=\{(.+?)\}\s*$/ @@ -1151,11 +1198,11 @@ module SiSU_Param elsif para =~/^1~\s+(.+)$/ t=$1 end - unless @heading_seg_first_flag # extract first segment name + unless @heading_seg_first_flag # extract first segment name @heading_seg_first=t @heading_seg_first_flag=true end - if m # list all segment names + if m # list all segment names @seg_names << m @set_heading_seg=true if m=~/^\d{1,3}/ \ @@ -1164,7 +1211,7 @@ module SiSU_Param end end end - para=para.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image) + para=para.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image) if para !~/^%+\s/ \ and para =~@rgx_image @ec[:image] << para.scan(@rgx_image).uniq @@ -1178,7 +1225,11 @@ module SiSU_Param unless @make if (@opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'@make:','header absent').warn + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + '@make:', + 'header absent' + ).warn end @make=SiSU_Param::Parameters::MdMake.new('@make: ',@opt,@env).make end @@ -1318,15 +1369,25 @@ module SiSU_Param if @en[:note] > 0 \ and @en[:sum] > 0 if @en[:sum] > 0 - else SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'*WARN* both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn unless @opt.act[:quiet][:set]==:on + else + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + '*WARN* both endnote styles used', + "~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}" + ).warn unless @opt.act[:quiet][:set]==:on end end if @en[:mark] != @en[:note] \ and @en[:note] > 0 @en[:mismatch]=@en[:note] - @en[:mark] - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'*WARN* endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + '*WARN* endnote number mismatch', + "endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})" + ).warn unless @opt.act[:quiet][:set]==:on footnote_conversion_errors=File.new("#{Dir.pwd}/footnote_conversion_errors.txt",'a') - footnote_conversion_errors << "#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})\n" + footnote_conversion_errors << + "#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})\n" end if not @title \ or not defined? @title.main \ @@ -1335,7 +1396,11 @@ module SiSU_Param and @opt.inspect =~/P/ #@title=Md.new('Text Insert',@opt,@env).title else - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING: Document Title missing','please provide @title:').warn unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'WARNING: Document Title missing', + 'please provide @title:' + ).warn unless @opt.act[:quiet][:set]==:on end end if @author !~/[\S]/ @@ -1343,7 +1408,11 @@ module SiSU_Param and @opt.inspect =~/P/ #@creator=SiSU_Param::Md.new('Text Insert',@opt,@env).creator else - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING: Document Author missing','please provide @creator: :author:').warn unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'WARNING: Document Author missing', + 'please provide @creator: :author:' + ).warn unless @opt.act[:quiet][:set]==:on end end @struct={} @@ -1426,7 +1495,10 @@ module SiSU_Param File.unlink(pstorefile) if FileTest.file?(pstorefile) if (@md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"PStore -> #{pstorefile}").txt_grey + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + "PStore -> #{pstorefile}" + ).txt_grey end store=PStore.new(pstorefile) store.transaction do @@ -1447,10 +1519,26 @@ module SiSU_Param class Instantiate def param_instantiate @@date=SiSU_Env::InfoDate.new - @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=nil + @@proc= + @@filename_txt= + @@filename_texinfo= + @@filename_lout_portrait= + @@filename_lout_landscape= + @@filename_html_scroll= + @@filename_html_index= + @@filename_html_segtoc= + @@filename_semantic= + @@filename_rss= + @@newfile= + @@drr= + nil @doc={ initialise: nil, - markup: '', lnks: '', stmp: '', prefix_a: '', prefix_b: '', + markup: '', + lnks: '', + stmp: '', + prefix_a: '', + prefix_b: '', req: {} } @@yaml=@@yamladdr=nil diff --git a/lib/sisu/v6/ao.rb b/lib/sisu/v6/ao.rb index 064436ae..370bb7e1 100644 --- a/lib/sisu/v6/ao.rb +++ b/lib/sisu/v6/ao.rb @@ -162,7 +162,9 @@ module SiSU_AO : @opt.fns @@idx_arr[:sst]=[] end - ao=(@@idx_arr[:sst].empty?) ? read_idx_sst : @@idx_arr[:sst].dup #check + ao=(@@idx_arr[:sst].empty?) \ + ? read_idx_sst + : @@idx_arr[:sst].dup #check rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -181,7 +183,9 @@ module SiSU_AO : @opt.fns @@idx_arr[:tex]=[] end - ao=(@@idx_arr[:tex].empty?) ? read_idx_raw : @@idx_arr[:tex].dup #check + ao=(@@idx_arr[:tex].empty?) \ + ? read_idx_raw + : @@idx_arr[:tex].dup #check rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -200,7 +204,9 @@ module SiSU_AO : @opt.fns @@idx_arr[:html]=[] end - ao=(@@idx_arr[:html].empty?) ? read_idx_html : @@idx_arr[:html].dup + ao=(@@idx_arr[:html].empty?) \ + ? read_idx_html + : @@idx_arr[:html].dup rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -219,7 +225,9 @@ module SiSU_AO : @opt.fns @@idx_arr[:xthml]=[] end - ao=(@@idx_arr[:xhtml].empty?) ? read_idx_xhtml : @@idx_arr[:xhtml].dup + ao=(@@idx_arr[:xhtml].empty?) \ + ? read_idx_xhtml + : @@idx_arr[:xhtml].dup rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -238,7 +246,9 @@ module SiSU_AO : @opt.fns @@map_arr[:nametags]=[] end - ao=(@@map_arr[:nametags].empty?) ? read_map_nametags : @@map_arr[:nametags].dup + ao=(@@map_arr[:nametags].empty?) \ + ? read_map_nametags + : @@map_arr[:nametags].dup rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -257,7 +267,9 @@ module SiSU_AO : @opt.fns @@map_arr[:ocn_htmlseg]=[] end - ao=(@@map_arr[:ocn_htmlseg].empty?) ? read_map_ocn_htmlseg : @@map_arr[:ocn_htmlseg].dup + ao=(@@map_arr[:ocn_htmlseg].empty?) \ + ? read_map_ocn_htmlseg + : @@map_arr[:ocn_htmlseg].dup rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -273,8 +285,14 @@ module SiSU_AO tell=(@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) \ - ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Document Abstraction') - : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Document Abstraction',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}") + ? SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Document Abstraction' + ) + : SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Document Abstraction',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}" + ) tell.blue_title_hi end fn=(@fnx && @fnx =~/\.ss[tmi]$/) \ @@ -293,9 +311,16 @@ module SiSU_AO cf=SiSU_Env::CreateFile.new(fn) if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on) - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"~meta/#{@opt.fns}.meta").output + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + @opt.fns, + "~meta/#{@opt.fns}.meta" + ).output elsif @opt.act[:maintenance][:set]==:on - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"ao -> #{cf.meta}").txt_grey + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + "ao -> #{cf.meta}" + ).txt_grey end end ao.each {|s| ao_array << s} @@ -435,7 +460,8 @@ module SiSU_AO if defined? o.ocn case o.is when :heading - filename_debug.puts "#{o.is.to_s} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}" + filename_debug.puts + "#{o.is.to_s} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}" end end end @@ -507,23 +533,37 @@ module SiSU_AO reset data_txt=@data data_txt= - SiSU_AO_Insertions::Insertions.new(@md,data_txt).expand_insertions? # ao_expand_insertions.rb + SiSU_AO_Insertions::Insertions.new(@md,data_txt). # ao_expand_insertions.rb + expand_insertions? data_txt= - SiSU_AO_MiscArrangeText::SI.new(@md,data_txt).prepare_text # ao_misc_arrange.rb - data_obj,metadata= - SiSU_AO_DocumentStructureExtract::Build.new(@md,data_txt).identify_parts # ao_doc_str.rb + SiSU_AO_MiscArrangeText::SI.new(@md,data_txt). # ao_misc_arrange.rb + prepare_text + data_obj, + metadata= + SiSU_AO_DocumentStructureExtract::Build.new(@md,data_txt). # ao_doc_str.rb + identify_parts data_obj= - SiSU_AO_Syntax::Markup.new(@md,data_obj).songsheet # ao_syntax.rb - data_obj,endnote_array= - SiSU_AO_CharacterCheck::Check.new(data_obj).character_check_and_oldstyle_endnote_array # ao_character_check.rb + SiSU_AO_Syntax::Markup.new(@md,data_obj).songsheet # ao_syntax.rb + data_obj, + endnote_array= + SiSU_AO_CharacterCheck::Check.new(data_obj). # ao_character_check.rb + character_check_and_oldstyle_endnote_array data_obj= - SiSU_AO_Images::Images.new(@md,data_obj).images # ao_images.rb - data_obj,tags_map,ocn_html_seg_map= - SiSU_AO_Numbering::Numbering.new(@md,data_obj).numbering_song # ao_numbering.rb - data_obj,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx= - SiSU_AO_BookIndex::BookIndex.new(@md,data_obj,@env).indexing_song if @md.book_idx # ao_idx.rb + SiSU_AO_Images::Images.new(@md,data_obj).images # ao_images.rb + data_obj, + tags_map, + ocn_html_seg_map= + SiSU_AO_Numbering::Numbering.new(@md,data_obj). # ao_numbering.rb + numbering_song + data_obj, + book_index_rel, + book_index_rel_html_seg, + html_idx,xhtml_idx= + SiSU_AO_BookIndex::BookIndex.new(@md,data_obj,@env). # ao_idx.rb + indexing_song if @md.book_idx data_obj= - SiSU_AO_Endnotes::Endnotes.new(@md,data_obj,endnote_array).endnotes # ao_endnotes.rb + SiSU_AO_Endnotes::Endnotes.new(@md,data_obj,endnote_array). # ao_endnotes.rb + endnotes outputdata=data_obj if (@md.opt.act[:ao][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on) diff --git a/lib/sisu/v6/ao_character_check.rb b/lib/sisu/v6/ao_character_check.rb index 8774d7a8..22655797 100644 --- a/lib/sisu/v6/ao_character_check.rb +++ b/lib/sisu/v6/ao_character_check.rb @@ -80,9 +80,9 @@ module SiSU_AO_CharacterCheck gsub(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '). gsub(/(~\{\s*)\s+/,'\1 '). gsub(/ \/\//,"#{Mx[:br_line]}"). - gsub(/
/,"#{Mx[:br_line]}"). #needed by xml, xhtml etc. + gsub(/
/,"#{Mx[:br_line]}"). #needed by xml, xhtml etc. gsub(/\t/,' '). - gsub(/\342\200\231/u,"'"). #if dob =~/’/ #Avoid #‘ ’ #“ ” + gsub(/\342\200\231/u,"'"). #if dob =~/’/ #Avoid #‘ ’ #“ ” gsub(/\\copy(?:right)?\b/,'©'). gsub(/\\trademark\b|\\tm\b/,'®') dob.obj=dob.obj + "\n" @@ -91,8 +91,9 @@ module SiSU_AO_CharacterCheck when /\^~/ #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+ sub_dob=dob.obj.dup @endnote_array << sub_dob.gsub(/\n/,''). - gsub(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}). - strip + gsub(/\^~\s+(.+)\s*/, + %{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}). + strip endnote_no+=1 dob=nil if dob.obj =~/\^~ .+/ #watch, removes 'binary' endnote now in endnote array for later insertion end diff --git a/lib/sisu/v6/ao_composite.rb b/lib/sisu/v6/ao_composite.rb index f8c4b396..2f864228 100644 --- a/lib/sisu/v6/ao_composite.rb +++ b/lib/sisu/v6/ao_composite.rb @@ -74,7 +74,8 @@ module SiSU_Assemble end def download_images(images_info) path="#{@env.processing_path.processing}/external_document/image" - FileUtils::mkdir_p(path) unless FileTest.directory?(path) + FileUtils::mkdir_p(path) \ + unless FileTest.directory?(path) download_from=images_info.shift images_info.each do |i| image="#{path}/#{i}" @@ -85,7 +86,8 @@ module SiSU_Assemble imagefile.close end output_path="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" - FileUtils::mkdir_p(output_path) unless FileTest.directory?(output_path) + FileUtils::mkdir_p(output_path) \ + unless FileTest.directory?(output_path) SiSU_Env::SystemCall.new("#{path}/*",output_path,'q').rsync end end @@ -99,8 +101,8 @@ module SiSU_Assemble begin pwd=Dir.pwd Dir.chdir(@opt.f_pth[:pth]) - @fns_array=IO.readlines(@opt.fno,'') - assembled=insertions? + fns_array=IO.readlines(@opt.fno,'') + assembled=insertions?(fns_array) write(assembled) Dir.chdir(pwd) rescue @@ -141,7 +143,9 @@ module SiSU_Assemble end if not @code_flag \ and i !~/^%+\s/ - i=i.gsub(/^([123]|:?[ABCD])~\? /,'% [conditional heading:] \1~ ') #off conditional heading (consider syntax) + i=i. + gsub(/^([123]|:?[ABCD])~\? /, + '% [conditional heading:] \1~ ') #off conditional heading (consider syntax) if i =~/^@\S+?:/ i=i.gsub(/\n/m,"\n% "). gsub(/\n%\s+$/m,''). @@ -161,27 +165,36 @@ module SiSU_Assemble end file end - def insertions? - data=@fns_array + def insertions?(fns_array) tuned_file,imagedir=[],[] - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Composite Document',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").grey_title_hi unless @opt.act[:quiet][:set]==:on - data.each do |para| + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Composite Document', + "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}", + ).grey_title_hi unless @opt.act[:quiet][:set]==:on + fns_array.each do |para| if para =~/^<<\s+(\S+?\.ss[it])$/ loadfile=$1.strip - src_ssm=@opt.fns.sub(/\.ssm\.sst/,'.ssm') if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'loading:',loadfile).txt_grey + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'loading:', + loadfile, + ).txt_grey end - tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[ti]$/ # and NetTest - imagedir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.ss[ti]$/.match(loadfile).captures.join + '/_sisu/image' #watch + tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[it]$/ # and NetTest + imagedir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.ss[it]$/. + match(loadfile).captures.join + + '/_sisu/image' #watch begin require 'uri' require 'open-uri' require 'pp' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri, open-uri or pp NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('uri, open-uri or pp NOT FOUND (LoadError)') end image_uri=URI.parse(imagedir) insert=open(loadfile) @@ -191,13 +204,12 @@ module SiSU_Assemble @@imager[image_uri] ||=[] @@imager[image_uri] << file[:images] file[:prepared] - elsif loadfile =~ /\.ss[ti]$/ \ + elsif loadfile =~ /\.ss[it]$/ \ and FileTest.file?(loadfile) insert_array=IO.readlines(loadfile,'') file=insertion(loadfile,insert_array) file[:prepared] else - cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX STDERR.puts %{SKIPPED processing file: [#{@opt.lng}] "#{@opt.fns}" it requires an invalid or non-existent file: "#{loadfile}"} $process_document = :skip; break #remove this line to continue processing documents that have missing include files para @@ -225,8 +237,8 @@ module SiSU_Assemble def read begin @opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm') #FIX earlier, hub - @fns_array=IO.readlines(@opt.fns,'') - insertions? + fns_array=IO.readlines(@opt.fns,'') + insertions?(fns_array) rescue SiSU_Errors::Rescued.new($!,$@,@opt.cmd,@opt.fns).location do __LINE__.to_s + ':' + __FILE__ @@ -234,26 +246,32 @@ module SiSU_Assemble ensure end end - def insertions? - data=@fns_array + def insertions?(fns_array) tuned_file=[] - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Composite Document',@opt.fno).grey_title_hi unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Composite Document', + @opt.fno + ).grey_title_hi unless @opt.act[:quiet][:set]==:on @ssm=[@opt.fns] - data.each do |para| + fns_array.each do |para| if para =~/^<<\s+(\S+?\.ss[it])$/ loadfile=$1.strip if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'loading:',loadfile).txt_grey + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'loading:', + loadfile, + ).txt_grey end - tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[ti]$/ + tuned_file << if loadfile =~ /(?:https?|file):\/\/\S+?\.ss[it]$/ @ssm << loadfile - elsif loadfile =~ /\.ss[ti]$/ \ + elsif loadfile =~ /\.ss[it]$/ \ and FileTest.file?(loadfile) @ssm << loadfile else - cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX STDERR.puts %{SKIPPED processing file: [#{@opt.lng}] "#{@opt.fns}" it requires an invalid or non-existent file: "#{loadfile}"} $process_document = :skip; break #remove this line to continue processing documents that have missing include files para diff --git a/lib/sisu/v6/ao_doc_objects.rb b/lib/sisu/v6/ao_doc_objects.rb index ee229200..909bb600 100644 --- a/lib/sisu/v6/ao_doc_objects.rb +++ b/lib/sisu/v6/ao_doc_objects.rb @@ -74,10 +74,10 @@ module SiSU_AO_DocumentStructure @of=:meta end def metadata(tags) - of= @of #Symbol, classification - group - is= :meta #Symbol, classification - specific type - tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag - obj= nil + of = @of #Symbol, classification - group + is = :meta #Symbol, classification - specific type + tags = tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag + obj = nil @of,@is,@tags,@obj=of,is,tags,obj self end @@ -89,12 +89,12 @@ module SiSU_AO_DocumentStructure @of=:meta end def metadata(h,o=nil) - of= @of #Symbol, classification - group - is= :meta #Symbol, classification - specific type - tag= h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + of = @of #Symbol, classification - group + is = :meta #Symbol, classification - specific type + tag = h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 @of,@is,@tag,@obj,@digest,@tmp=of,is,tag,obj,digest,tmp self end @@ -142,44 +142,47 @@ module SiSU_AO_DocumentStructure and (h[:ln] and h[:ln].to_s=~/[0-9]/) h[:lv]=heading_lv(h[:ln]) end - of= @of #Symbol, classification - group - is= :heading #Symbol, classification - specific type - name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info] - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6 - ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 - lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure) - use_=if lv \ - and lv == '1' - h[:use_] || ((defined? o.use_) ? o.use_ : :ok) - elsif not lv.empty? \ - and lv =~ /[A-D2-3]/ - :ok - else - h[:use_] || ((defined? o.use_) ? o.use_ : :ok) - end - ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] - end - autonum_= if h[:autonum_].nil? then ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses - else h[:autonum_] - end - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@lv,@ln,@lc,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@use_,@ocn_,@note_,@autonum_,@digest,@tmp=of,is,lv,ln,lc,name,tags,obj,idx,ocn,odv,osp,node,parent,use_,ocn_,note_,autonum_,digest,tmp + of = @of #Symbol, classification - group + is = :heading #Symbol, classification - specific type + name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + node = h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info] + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + lv = h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6 + ln = h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 + lc = h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure) + use_ = if lv \ + and lv == '1' + h[:use_] || ((defined? o.use_) ? o.use_ : :ok) + elsif not lv.empty? \ + and lv =~ /[A-D2-3]/ + :ok + else + h[:use_] || ((defined? o.use_) ? o.use_ : :ok) + end + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] + end + autonum_ = if h[:autonum_].nil? + ((defined? o.autonum_) ? o.autonum_ : true) #Bool? auto-numbering if requested default on, false suppresses + else h[:autonum_] + end + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@lv,@ln,@lc,@name,@tags,@obj,@idx,@ocn,@odv,@osp,@node,@parent,@use_,@ocn_,@note_,@autonum_,@digest,@tmp= + of, is, lv, ln, lc, name, tags, obj, idx, ocn, odv, osp, node, parent, use_, ocn_, note_, autonum_, digest, tmp self end def heading_insert(h,o=nil) heading(h,o=nil) - @is= :heading_insert #String, classification - specific type + @is = :heading_insert #String, classification - specific type self end end @@ -191,52 +194,56 @@ module SiSU_AO_DocumentStructure @tags=[] end def paragraph(h,o=nil) - of= @of #Symbol, classification - group - is= :para #Symbol, classification - specific type - name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - indent= h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level - hang= h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level - bullet_=h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted? - quote_= h[:quote_] || ((defined? o.quote_) ? o.quote_ : false) #Bool, quote (blockquote)? - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) - ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group + is = :para #Symbol, classification - specific type + name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + indent = h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level + hang = h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level + bullet_ = h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted? + quote_ = h[:quote_] || ((defined? o.quote_) ? o.quote_ : false) #Bool, quote (blockquote)? + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + image_ = h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@quote_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,quote_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@quote_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp= + of, is, name, tags, obj, indent, hang, bullet_, quote_, idx, ocn, odv, osp, parent, image_, note_, ocn_, digest, tmp self end def docinfo(h,o=nil) - of= @of #String, classification - group - is= :docinfo #String, classification - specific type - name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? - tags= h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= nil #String, book index provided? - ocn= nil #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - indent= nil #Integer, indent level - hang= nil #Integer, indent level - bullet_=false #Bool, bulleted? - note_= false #Bool, endnotes/footnotes? (processing optimization) - image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) - ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #String, classification - group + is = :docinfo #String, classification - specific type + name = h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? + tags = h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = nil #String, book index provided? + ocn = nil #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + indent = nil #Integer, indent level + hang = nil #Integer, indent level + bullet_ = false #Bool, bulleted? + note_ = false #Bool, endnotes/footnotes? (processing optimization) + image_ = h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp= + of, is, name, tags, obj, indent, hang, bullet_, idx, ocn, odv, osp, parent, image_, note_, ocn_, digest, tmp self end end @@ -248,124 +255,136 @@ module SiSU_AO_DocumentStructure @tags=[] end def code(h,o=nil) - of= @of #Symbol, classification - group #alt 'code' - is= :code #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - lngsyn= h[:lngsyn] || ((defined? o.lngsyn) ? o.lngsyn : :txt) #symbol, code lngsyn - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - number_= h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not? - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group #alt 'code' + is = :code #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + lngsyn = h[:lngsyn] || ((defined? o.lngsyn) ? o.lngsyn : :txt) #symbol, code lngsyn + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + number_ = h[:number_] || ((defined? o.number_) ? o.number_ : false) #Bool, numbered or not? + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@lngsyn,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,lngsyn,idx,ocn,odv,osp,parent,number_,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@lngsyn,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, lngsyn, idx, ocn, odv, osp, parent, number_, note_, ocn_, num, digest, tmp self end def box(h,o=nil) - of= @of #Symbol, classification - group - is= :box #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group + is = :box #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp self end def block(h,o=nil) - of= @of #Symbol, classification - group - is= :block #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group + is = :block #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp self end def group(h,o=nil) - of= @of #Symbol, classification - group - is= :group #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group + is = :group #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp self end - def alt(h,o=nil) #see block - of= @of #Symbol, classification - group - is= :alt #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + def alt(h,o=nil) #see block + of = @of #Symbol, classification - group + is = :alt #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp self end - def verse(h,o=nil) #part of poem decide how you deal with this - of= @of #Symbol, classification - group - is= :verse #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + def verse(h,o=nil) #part of poem decide how you deal with this + of = @of #Symbol, classification - group + is = :verse #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, obj, idx, ocn, odv, osp, parent, note_, ocn_, num, digest, tmp @h=nil self end @@ -378,26 +397,28 @@ module SiSU_AO_DocumentStructure @tags=[] end def table(h,o=nil) - of= @of #Symbol, classification - group - is= :table #Symbol, classification - specific type - tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any - cols= h[:cols] || ((defined? o.cols) ? o.cols : nil) - widths= h[:widths] || ((defined? o.widths) ? o.widths : nil) - obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content - idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? - ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects - odv= h[:odv] || ((defined? o.odv) ? o.odv : nil) - osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) - parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] - head_= h[:head_] || ((defined? o.head_) ? o.head_ : false) - note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + of = @of #Symbol, classification - group + is = :table #Symbol, classification - specific type + tags = h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any + cols = h[:cols] || ((defined? o.cols) ? o.cols : nil) + widths = h[:widths] || ((defined? o.widths) ? o.widths : nil) + obj = h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content + idx = h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? + ocn = h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects + odv = h[:odv] || ((defined? o.odv) ? o.odv : nil) + osp = h[:osp] || ((defined? o.osp) ? o.osp : nil) + parent = h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] + head_ = h[:head_] || ((defined? o.head_) ? o.head_ : false) + note_ = h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) + ocn_ = if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end - num= h[:num] || ((defined? o.num) ? o.num : nil) - digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 - tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,cols,widths,obj,idx,ocn,odv,osp,parent,head_,note_,ocn_,num,digest,tmp + num = h[:num] || ((defined? o.num) ? o.num : nil) + digest = h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 + tmp = h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use + @of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@num,@digest,@tmp= + of, is, tags, cols, widths, obj, idx, ocn, odv, osp, parent, head_, note_, ocn_, num, digest, tmp self end end @@ -420,8 +441,9 @@ module SiSU_AO_DocumentStructure osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) - ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider - else h[:ocn_] + ocn_=if h[:ocn_].nil? + ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider + else h[:ocn_] end digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5 tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @@ -507,7 +529,8 @@ module SiSU_AO_DocumentStructure attr= h[:attr] || ((defined? o.attr) ? o.attr : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use num= h[:num] || ((defined? o.num) ? o.num : nil) - @of,@is,@obj,@sym,@attr,@tmp,@num=of,is,obj,sym,attr,tmp,num + @of,@is,@obj,@sym,@attr,@tmp,@num= + of, is, obj, sym, attr, tmp, num self end end diff --git a/lib/sisu/v6/ao_doc_str.rb b/lib/sisu/v6/ao_doc_str.rb index 7f2815d8..675bfc90 100644 --- a/lib/sisu/v6/ao_doc_str.rb +++ b/lib/sisu/v6/ao_doc_str.rb @@ -154,12 +154,18 @@ module SiSU_AO_DocumentStructureExtract [0,0] end obj=if str2 =~/^(.+?)\s+\\\\(?:\s+|\n)/ - str2.gsub(/^(.+?)(\s+\\\\(?:\s+|\n))/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") + str2.gsub(/^(.+?)(\s+\\\\(?:\s+|\n))/, + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") else - str2.gsub(/^(.+?)\n/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\n") + str2.gsub(/^(.+?)\n/, + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\n") end hang,indent=hang_indent[0],hang_indent[1] - [hang,indent,obj] + [ + hang, + indent, + obj, + ] end def endnote_test?(str) (str=~/~\{.+?\}~|~\[.+?\]~/) \ @@ -182,7 +188,10 @@ module SiSU_AO_DocumentStructureExtract t.gsub!(/[^a-z0-9._-]/,'') end end - [str,tags] + [ + str, + tags, + ] end def rgx_idx_ocn_seg @rgx_idx_ocn_seg=/(.+?)\s*[+](\d+)/ @@ -196,9 +205,13 @@ module SiSU_AO_DocumentStructureExtract idx_couplet_tmp=[] idx_couplet=idx.scan(/\s*[^:]+\s*/) if idx_couplet[1] =~/[|]/ - idx_couplet_tmp << idx_couplet[0] << idx_couplet[1].scan(/\s*[^|]+\s*/) + idx_couplet_tmp << + idx_couplet[0] << + idx_couplet[1].scan(/\s*[^|]+\s*/) else - idx_couplet_tmp << idx_couplet[0] << [idx_couplet[1]] + idx_couplet_tmp << + idx_couplet[0] << + [idx_couplet[1]] end idx_couplet=idx_couplet_tmp else [idx] @@ -207,14 +220,17 @@ module SiSU_AO_DocumentStructureExtract idx_lst.each do |term_node| case term_node when String - term_node=term_node[0].chr.capitalize + term_node[1,term_node.length] + term_node= + term_node[0].chr.capitalize + + term_node[1,term_node.length] term_node=(term_node =~/.+?[+]\d+/) \ ? term_node : (term_node + '+0') 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] + idx_hash[@use]= + { sub: [], plus: plus } unless idx_hash[@use] and defined? idx_hash[@use] when Array subterm_nodes=[] term_node.each do |subterm_node| @@ -223,15 +239,20 @@ 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] - idx_hash[@use][:sub] << {sub.strip => { plus: sub_plus }} + idx_hash[@use]= + { sub: [], plus: 0 } unless idx_hash[@use] and defined? idx_hash[@use] + idx_hash[@use][:sub] << + { sub.strip => { plus: sub_plus } } end term_nodes << subterm_nodes end end idx_array << term_nodes end - { hash: idx_hash, array: idx_array } + { + hash: idx_hash, + array: idx_array, + } end def identify_parts tuned_file=[] @@ -252,16 +273,26 @@ module SiSU_AO_DocumentStructureExtract h=case $1 when /[+]/ @@flag[:ocn]=:on - {flag: :ocn_on} + { + flag: :ocn_on, + } when /[~]/ @@flag[:ocn]=:ocn_off_headings_keep - {flag: :ocn_off, mod: :headings_keep} + { + flag: :ocn_off, + mod: :headings_keep, + } when /[-]/ #of particular relevance with level 1~ which is required to precede substantive text & used e.g. in html segmented text @@flag[:ocn]=:ocn_off_headings_dummy_lev1 - {flag: :ocn_off, mod: :headings_exclude} + { + flag: :ocn_off, + mod: :headings_exclude, + } else @@flag[:ocn]=:on - {flag: :ocn_on} + { + flag: :ocn_on, + } end t_o=SiSU_AO_DocumentStructure::ObjectFlag.new.flag_ocn(h) next @@ -296,7 +327,7 @@ module SiSU_AO_DocumentStructureExtract t_o=nil when /^%+\s/ #comment t_o=if t_o=~/^%+\s+(.+)/ - h={obj: $1} + h={ obj: $1 } SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) else nil end @@ -319,7 +350,13 @@ module SiSU_AO_DocumentStructureExtract end end end - h={ lv: lv, ln: ln, obj: obj, idx: idx, tags: tags } + h={ + lv: lv, + ln: ln, + obj: obj, + idx: idx, + tags: tags, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) elsif t_o=~/^:?[A-D1-6]\~(\S+?)-\s+(.+)/m name,obj=$1,$2 @@ -337,7 +374,14 @@ module SiSU_AO_DocumentStructureExtract end end end - h={ lv: lv, name: name, obj: obj, idx: idx, autonum_: false, tags: tags} + h={ + lv: lv, + name: name, + obj: obj, + idx: idx, + autonum_: false, + tags: tags, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) elsif t_o=~/^:?[A-D1-6]\~(\S+)\s+(.+)/m name,obj=$1,$2 @@ -355,7 +399,13 @@ module SiSU_AO_DocumentStructureExtract end end end - h={ lv: lv, name: name, obj: obj, idx: idx, tags: tags } + h={ + lv: lv, + name: name, + obj: obj, + idx: idx, + tags: tags, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) else nil end @@ -378,7 +428,17 @@ module SiSU_AO_DocumentStructureExtract obj << ' ~#' end end - h={ bullet_: bullet, hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? } + h={ + bullet_: bullet, + hang: hang, + indent: indent, + obj: obj, + idx: idx, + note_: note, + image_: image, + tags: tags, + quote: quotes?, + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end else nil @@ -401,7 +461,16 @@ module SiSU_AO_DocumentStructureExtract obj << ' ~#' end end - h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? } + h={ + hang: hang, + indent: indent, + obj: obj, + idx: idx, + note_: note, + image_: image, + tags: tags, + quote: quotes?, + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end else nil @@ -425,7 +494,17 @@ module SiSU_AO_DocumentStructureExtract end end unless obj=~/\A\s*\Z/m - h={ bullet_: false, indent: 0, hang: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? } + h={ + bullet_: false, + indent: 0, + hang: 0, + obj: obj, + idx: idx, + note_: note, + image_: image, + tags: tags, + quote: quotes?, + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end end @@ -447,9 +526,17 @@ module SiSU_AO_DocumentStructureExtract else :txt end @@counter=1 - @codeblock_numbered=(t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{#|```[ ]+code(?:\.[a-z][0-9a-z_]+)?\s[#])/) ? true : false + @codeblock_numbered= + (t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{#|```[ ]+code(?:\.[a-z][0-9a-z_]+)?\s[#])/) \ + ? true + : false @num_id[:code_block] +=1 - h={ obj: '', sym: :code_block_open, num: @num_id[:code_block], syntax: @@flag[:lngsyn] } + h={ + obj: '', + sym: :code_block_open, + num: @num_id[:code_block], + syntax: @@flag[:lngsyn], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) elsif t_o =~/^(?:poem\{|```[ ]+poem)/ @@flag[:poem]=case t_o @@ -458,58 +545,86 @@ module SiSU_AO_DocumentStructureExtract else @@flag[:poem] #error end @num_id[:poem] +=1 - h={ obj: '', sym: :poem_open, num: @num_id[:poem] } + h={ + obj: '', + sym: :poem_open, + num: @num_id[:poem], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << t_o elsif t_o =~/^(?:box(?:\.[a-z_]+)?\{|```[ ]+box(?:\.[a-z_]+)?)/ @@flag[:box]=case t_o when /^box\{/ then :curls when /^```[ ]+box/ then :tics - else @@flag[:box] #error + else @@flag[:box] #error end @num_id[:box] +=1 - h={ obj: '', sym: :box_open, num: @num_id[:box] } + h={ + obj: '', + sym: :box_open, + num: @num_id[:box], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << t_o elsif t_o =~/^(?:group\{|```[ ]+group)/ @@flag[:group]=case t_o when /^group\{/ then :curls when /^```[ ]+group/ then :tics - else @@flag[:group] #error + else @@flag[:group] #error end @num_id[:group] +=1 - h={ obj: '', sym: :group_open, num: @num_id[:group] } + h={ + obj: '', + sym: :group_open, + num: @num_id[:group], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << t_o elsif t_o =~/^(?:block\{|```[ ]+block)/ @@flag[:block]=case t_o when /^block\{/ then :curls when /^```[ ]+block/ then :tics - else @@flag[:block] #error + else @@flag[:block] #error end @num_id[:block] +=1 - h={ obj: '', sym: :block_open, num: @num_id[:block] } + h={ + obj: '', + sym: :block_open, + num: @num_id[:block], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << t_o elsif t_o =~/^(?:alt\{|```[ ]+alt)/ @@flag[:alt]=case t_o when /^alt\{/ then :curls when /^```[ ]+alt/ then :tics - else @@flag[:alt] #error + else @@flag[:alt] #error end @num_id[:alt] +=1 - h={ obj: '', sym: :alt_open, num: @num_id[:alt] } + h={ + obj: '', + sym: :alt_open, + num: @num_id[:alt], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << t_o elsif t_o =~/^`:quote_open`/ @@flag[:quote]=:open @num_id[:quote] +=1 - h={ obj: '', sym: :quote_open, num: @num_id[:quote] } + h={ + obj: '', + sym: :quote_open, + num: @num_id[:quote], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) #tuned_file << t_o #% find second source, entered twice, should be once so closed off here elsif t_o =~/^(?:table\{|```[ ]+table|\{table)[ ~]/ @num_id[:table] +=1 - h={ obj: '', sym: :table_open, num: @num_id[:table] } + h={ + obj: '', + sym: :table_open, + num: @num_id[:table], + } ins_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) tuned_file << ins_o if t_o=~/^table\{(?:~h)?\s+/ @@ -525,7 +640,12 @@ module SiSU_AO_DocumentStructureExtract col=$2.scan(/\d+/) heading=false end - @h={ head_: heading, cols: cols, widths: col, idx: idx } + @h={ + head_: heading, + cols: cols, + widths: col, + idx: idx, + } elsif t_o=~/^```[ ]+table(?:~h)?\s+c\d+/ @@flag[:table]=:tics @rows='' @@ -539,7 +659,12 @@ module SiSU_AO_DocumentStructureExtract col=$2.scan(/\d+/) heading=false end - @h={ head_: heading, cols: cols, widths: col, idx: idx } + @h={ + head_: heading, + cols: cols, + widths: col, + idx: idx, + } elsif t_o=~/^\{table(?:~h)?(?:\s+\d+;?)?\}\n.+\Z/m m1,m2,hd=nil,nil,nil tbl=/^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1] @@ -550,7 +675,7 @@ module SiSU_AO_DocumentStructureExtract cols=nil rws.each do |r| cols=(cols ? cols : (r.scan('|').length) +1) - r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") + r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") rows += r + Mx[:tc_c] end col=[] @@ -563,18 +688,30 @@ module SiSU_AO_DocumentStructureExtract width=100.00/cols cols.times { col << width } end - h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] } + h={ + head_: hd, + cols: cols, + widths: col, + obj: rows, + idx: idx, + tags: tags, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o - h={ obj: '', sym: :table_close, num: @num_id[:table] } + h={ + obj: '', + sym: :table_close, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) t_o elsif t_o=~/^```[ ]+table(?:~h)?\s+/ m1,m2,hd=nil,nil,nil h=case t_o - when /^```[ ]+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one + when /^```[ ]+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one m1,tbl,hd=$1,$2,true - when /^```[ ]+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one + when /^```[ ]+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one m1,tbl,hd=$1,$2,false else nil end @@ -583,13 +720,25 @@ module SiSU_AO_DocumentStructureExtract rws=tbl.split(/\n/) rows='' rws.each do |r| - r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") + r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") rows += r + Mx[:tc_c] end - h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] } + h={ + head_: hd, + cols: col.length, + widths: col, + obj: rows, + idx: idx, + tags: tags, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o - h={ obj: '', sym: :table_close, num: @num_id[:table] } + h={ + obj: '', + sym: :table_close, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) t_o elsif t_o=~/^\{table(?:~h)?\s+/ @@ -606,13 +755,25 @@ module SiSU_AO_DocumentStructureExtract rws=tbl.split(/\n/) rows='' rws.each do |r| - r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") + r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}") rows += r + Mx[:tc_c] end - h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] } + h={ + head_: hd, + cols: col.length, + widths: col, + obj: rows, + idx: idx, + tags: tags, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil? tuned_file << t_o - h={ obj: '', sym: :table_close, num: @num_id[:table] } + h={ + obj: '', + sym: :table_close, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) t_o end @@ -626,11 +787,21 @@ module SiSU_AO_DocumentStructureExtract and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) @@flag[:table]=:off headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx] - @h={ head_: headings, cols: columns, widths: widths, idx: idx, obj: @rows } + @h={ + head_: headings, + cols: columns, + widths: widths, + idx: idx, + obj: @rows, + } t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(@h) tuned_file << t_o @h,@rows=nil,'' - h={ obj: '', sym: :table_close, num: @num_id[:table] } + h={ + obj: '', + sym: :table_close, + num: @num_id[:table], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) t_o else @@ -650,12 +821,22 @@ module SiSU_AO_DocumentStructureExtract @tuned_code[-1].gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'') obj=@tuned_code.join("\n") tags=[] - h={ obj: obj, syntax: @@flag[:lngsyn], tags: tags, num: @num_id[:code_block], number_: @codeblock_numbered } + h={ + obj: obj, + syntax: @@flag[:lngsyn], + tags: tags, + num: @num_id[:code_block], + number_: @codeblock_numbered, + } @@flag[:lngsyn]=:txt t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.code(h) @tuned_code=[] tuned_file << t_o - h={ obj: '', sym: :code_close, num: @num_id[:code_block] } + h={ + obj: '', + sym: :code_close, + num: @num_id[:code_block], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) end if (@@flag[:code]==:curls or @@flag[:code]==:tics) \ @@ -676,55 +857,102 @@ module SiSU_AO_DocumentStructureExtract if (@@flag[:poem]==:curls and t_o =~/^\}poem/) \ or (@@flag[:poem]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) @@flag[:poem]=:off - h={ obj: '', sym: :poem_close, num: @num_id[:poem] } + h={ + obj: '', + 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*$/) @@flag[:box]=:off obj,tags=extract_tags(@tuned_block.join("\n")) - h={ obj: obj, tags: tags, num: @num_id[:box] } + h={ + obj: obj, + tags: tags, + num: @num_id[:box], + } @tuned_block=[] t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.box(h) tuned_file << t_o - h={ obj: '', sym: :box_close, num: @num_id[:box] } + h={ + obj: '', + 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*$/) @@flag[:group]=:off obj,tags=extract_tags(@tuned_block.join("\n")) - h={ obj: obj, tags: tags, num: @num_id[:group] } + h={ + obj: obj, + tags: tags, + num: @num_id[:group], + } @tuned_block=[] t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.group(h) tuned_file << t_o - h={ obj: '', sym: :group_close, num: @num_id[:group] } + h={ + obj: '', + sym: :group_close, + 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*$/) @@flag[:block]=:off obj,tags=extract_tags(@tuned_block.join("\n")) - h={ obj: obj, tags: tags, num: @num_id[:block] } + h={ + obj: obj, + tags: tags, + num: @num_id[:block], + } @tuned_block=[] t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.block(h) tuned_file << t_o - h={ obj: '', sym: :block_close, num: @num_id[:block] } + h={ obj: '', + sym: :block_close, + 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*$/) @@flag[:alt]=:off obj,tags=extract_tags(@tuned_block.join("\n")) - h={ obj: obj, tags: tags, num: @num_id[:alt] } + h={ + obj: obj, + tags: tags, + num: @num_id[:alt], + } t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.alt(h) @tuned_block=[] tuned_file << t_o - h={ obj: '', sym: :alt_close, num: @num_id[:alt] } + h={ + obj: '', + sym: :alt_close, + num: @num_id[:alt], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) elsif @@flag[:quote]==:open and t_o =~/`:quote_close`/m @@flag[:quote]=:off - h={ obj: '', sym: :quote_close, num: @num_id[:quote] } + h={ + obj: '', + sym: :quote_close, + num: @num_id[:quote], + } t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h) elsif @@flag[:quote]==:open t_o,tags=extract_tags(t_o) - h={ indent: 1, obj: t_o, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? } + h={ + indent: 1, + obj: t_o, + idx: idx, + note_: note, + image_: image, + tags: tags, + quote: quotes?, + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end if (@@flag[:poem]==:curls or @@flag[:poem]==:tics \ @@ -741,7 +969,11 @@ module SiSU_AO_DocumentStructureExtract poem.each do |v| v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n") obj,tags=extract_tags(v) - h={ obj: obj, tags: tags, num: @num_id[:poem] } + h={ + obj: obj, + tags: tags, + num: @num_id[:poem], + } t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.verse(h) tuned_file << t_o end @@ -779,26 +1011,67 @@ module SiSU_AO_DocumentStructureExtract end if @md.flag_endnotes tuned_file << @pb - h={ ln: 1, lc: 1, obj: 'Endnotes', autonum_: false } + h={ + ln: 1, + lc: 1, + obj: 'Endnotes', + autonum_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, lc: 2, obj: 'Endnotes', name: 'endnotes', autonum_: false } + h={ + ln: 4, + lc: 2, + obj: 'Endnotes', + name: 'endnotes', + autonum_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ obj: 'Endnotes' } + h={ + obj: 'Endnotes' + } end if @md.book_idx tuned_file << @pb - h={ ln: 1, lc: 1, obj: 'Index', autonum_: false } + h={ + ln: 1, + lc: 1, + obj: 'Index', + autonum_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, lc: 2, obj: 'Index', name: 'book_index', autonum_: false } + h={ + ln: 4, + lc: 2, + obj: 'Index', + name: 'book_index', + autonum_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ obj: 'Index' } + h={ + obj: 'Index' + } end tuned_file << @pb - h={ ln: 1, lc: 1, obj: 'Metadata', autonum_: false, ocn_: false } + h={ + ln: 1, + lc: 1, + obj: 'Metadata', + autonum_: false, + ocn_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ ln: 4, lc: 2, obj: 'SiSU Metadata, document information', name: 'metadata', autonum_: false, ocn_: false } + h={ + ln: 4, + lc: 2, + obj: 'SiSU Metadata, document information', + name: 'metadata', + autonum_: false, + ocn_: false, + } tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h) - h={ obj: 'eof' } + h={ + obj: 'eof', + } meta=SiSU_AO_DocumentStructure::ObjectMetadata.new.metadata(@metadata) [tuned_file,meta] end @@ -811,11 +1084,20 @@ module SiSU_AO_DocumentStructureExtract table end def meta_heading(h) - h={ lv: h[:lv], ln: h[:ln], name: h[:name], obj: h[:obj], ocn: '0' } + h={ + lv: h[:lv], + ln: h[:ln], + name: h[:name], + obj: h[:obj], + ocn: '0', + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) end def meta_para(str) - h={ obj: str, ocn_: false } + h={ + obj: str, + ocn_: false, + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end def build_lines(type=:none) @@ -831,7 +1113,7 @@ module SiSU_AO_DocumentStructureExtract line=line.gsub(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type==:code # REMOVE try sort for texpdf special case line=if line =~/(?:https?|file|ftp):\/\/\S+$/ line.gsub(/\s*$/," #{Mx[:br_nl]}") - else line.gsub(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code' + else line.gsub(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code' end elsif line =~/^\s*$/ line.gsub(/\s*$/,"#{Mx[:br_nl]}") @@ -857,25 +1139,46 @@ module SiSU_AO_DocumentStructureExtract and not @dob.bullet_ @dob=case @dob.obj when /^#{@md.lv0}/ - h={ lv: 'A', ln: 0 } + h={ + lv: 'A', + ln: 0, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv1}/ - h={ lv: 'B', ln: 1 } + h={ + lv: 'B', + ln: 1, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv2}/ - h={ lv: 'C', ln: 2 } + h={ + lv: 'C', + ln: 2, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv3}/ - h={ lv: 'D', ln: 3 } + h={ + lv: 'D', + ln: 3, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv4}/ - h={ lv: '1', ln: 4 } + h={ + lv: '1', + ln: 4, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv5}/ - h={ lv: '2', ln: 5 } + h={ + lv: '2', + ln: 5, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) when /^#{@md.lv6}/ - h={ lv: '3', ln: 6 } + h={ + lv: '3', + ln: 6, + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) else @dob end @@ -1269,7 +1572,8 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} end if dob.is==:heading if ocn_flag==true - dob.ln,dob.node,dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent,dob.lc=ln,node,ocn,ocn_flag,ocn_dv,ocn_sp,parent,collapsed_level + dob.ln,dob.node,dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent,dob.lc= + ln, node, ocn, ocn_flag, ocn_dv,ocn_sp, parent, collapsed_level else ocnu+=1 heading_use=:ok @@ -1280,19 +1584,22 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_dummy_heading]}/,'') heading_use=:dummy end - dob.ln,dob.node,dob.ocn,dob.ocn_,dob.use_,dob.odv,dob.osp,dob.parent,dob.lc=ln,node,nil,ocn_flag,heading_use,ocn_dv,ocn_sp,parent,collapsed_level + dob.ln,dob.node,dob.ocn,dob.ocn_,dob.use_, dob.odv,dob.osp,dob.parent,dob.lc= + ln, node, nil, ocn_flag,heading_use,ocn_dv, ocn_sp, parent, collapsed_level end else if dob.of !=:meta \ && dob.of !=:comment \ && dob.of !=:layout if ocn_flag == true - dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent=ocn,ocn_flag,ocn_dv,ocn_sp,parent + dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent= + ocn, ocn_flag,ocn_dv, ocn_sp, parent else ocnu+=1 dob.obj=dob.obj.gsub(/#{Mx[:fa_o]}[~-]##{Mx[:fa_c]}/,'') if dob.obj ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}" - dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent=nil,ocn_flag,ocn_dv,ocn_sp,parent + dob.ocn,dob.ocn_,dob.odv,dob.osp,dob.parent= + nil, ocn_flag,ocn_dv, ocn_sp, parent end end end @@ -1340,7 +1647,10 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} data=@data tuned_file=[] hs=[0,false,false,false] - t={ lv: @s[0], status: :open } + t={ + lv: @s[0], + status: :open, + } tuned_file << tags(t) if @md.opt.act[:verbose_plus][:set]==:on puts "\nXML sisu structure outline --->\n" @@ -1432,7 +1742,13 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} when '5' then 8 when '6' then 9 end - h={ tag: tag, node: o[:node], lv: o[:lv], ln: ln, status: o[:status] } + h={ + tag: tag, + node: o[:node], + lv: o[:lv], + ln: ln, + status: o[:status], + } SiSU_AO_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments end def tag_open(o,tag) @@ -1445,121 +1761,205 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} case hs[0] when 0 if (lev <= 0) and hs[0] - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 1 if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 2 if (lev <= 2) and hs[2] - t={ lv: @s[2], status: :close } + t={ + lv: @s[2], + status: :close, + } ary << tags(t) end if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 3 if (lev <= 3) and hs[3] - t={ lv: @s[3], status: :close } + t={ + lv: @s[3], + status: :close, + } ary << tags(t) end if (lev <= 2) and hs[2] - t={ lv: @s[2], status: :close } + t={ + lv: @s[2], + status: :close, + } ary << tags(t) end if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 4 if (lev <= 4) - t={ lv: @s[4], status: :close } + t={ + lv: @s[4], + status: :close, + } ary << tags(t) end if (lev <= 3) and hs[3] - t={ lv: @s[3], status: :close } + t={ + lv: @s[3], + status: :close, + } ary << tags(t) end if (lev <= 2) and hs[2] - t={ lv: @s[2], status: :close } + t={ + lv: @s[2], + status: :close, + } ary << tags(t) end if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 5 if (lev <= 5) - t={ lv: @s[5], status: :close } + t={ + lv: @s[5], + status: :close, + } ary << tags(t) end if (lev <= 4) - t={ lv: @s[4], status: :close } + t={ + lv: @s[4], + status: :close, + } ary << tags(t) end if (lev <= 3) and hs[3] - t={ lv: @s[3], status: :close } + t={ + lv: @s[3], + status: :close, + } ary << tags(t) end if (lev <= 2) and hs[2] - t={ lv: @s[2], status: :close } + t={ + lv: @s[2], + status: :close, + } ary << tags(t) end if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end when 6 if (lev <= 6) - t={ lv: @s[6], status: :close } + t={ + lv: @s[6], + status: :close, + } ary << tags(t) end if (lev <= 5) - t={ lv: @s[5], status: :close } + t={ + lv: @s[5], + status: :close, + } ary << tags(t) end if (lev <= 4) - t={ lv: @s[4], status: :close } + t={ + lv: @s[4], + status: :close, + } ary << tags(t) end if (lev <= 3) and hs[3] - t={ lv: @s[3], status: :close } + t={ + lv: @s[3], + status: :close, + } ary << tags(t) end if (lev <= 2) and hs[2] - t={ lv: @s[2], status: :close } + t={ + lv: @s[2], + status: :close, + } ary << tags(t) end if (lev <= 1) and hs[1] - t={ lv: @s[1], status: :close } + t={ + lv: @s[1], + status: :close, + } ary << tags(t) end if (lev==0) - t={ lv: @s[0], status: :close } + t={ + lv: @s[0], + status: :close, + } ary << tags(t) end end diff --git a/lib/sisu/v6/ao_endnotes.rb b/lib/sisu/v6/ao_endnotes.rb index 21509098..dbc8b214 100644 --- a/lib/sisu/v6/ao_endnotes.rb +++ b/lib/sisu/v6/ao_endnotes.rb @@ -63,8 +63,12 @@ module SiSU_AO_Endnotes class Endnotes def initialize(md,data,endnote_array=nil) - @md,@data,@endnote_array=md,data,endnote_array - @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1 + @md,@data,@endnote_array= + md, data, endnote_array + @endnote_counter, + @endnote_counter_asterisk, + @endnote_counter_dag= + 1,1,1 end def endnotes data=@data @@ -73,17 +77,20 @@ module SiSU_AO_Endnotes data.each do |dob| # manually numbered endnotes --> if @md.opt.mod.inspect =~/--no-asterisk|--no-annotate/ - dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') + dob.obj=dob.obj. + gsub(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') end if @md.opt.mod.inspect =~/--no-dagger|--no-annotate/ - dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') + dob.obj=dob.obj. + gsub(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') end if (defined? dob.obj) \ && (defined? dob.is) \ && dob.is !=:code case dob.obj # auto-numbered endnotes --> when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ - dob.obj=dob.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'\1') + dob.obj=dob.obj. + gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'\1') word_mode=dob.obj.scan(/\S+/m) word_mode=endnote_call_number(word_mode) dob.obj=word_mode.join(' ') @@ -97,7 +104,10 @@ module SiSU_AO_Endnotes end @tuned_file << dob end - @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1 + @endnote_counter, + @endnote_counter_asterisk, + @endnote_counter_dag= + 1,1,1 @tuned_file=@tuned_file.flatten end def endnote_call_number(words) @@ -105,20 +115,24 @@ module SiSU_AO_Endnotes case word when /#{Mx[:en_a_o]}/ unless word =~/#{Mx[:en_a_o]}[*+]+/ - word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@endnote_counter} ") + word.gsub!(/#{Mx[:en_a_o]}/, + "#{Mx[:en_a_o]}#{@endnote_counter} ") @endnote_counter+=1 end when /#{Mx[:en_b_o]}/ if word =~/#{Mx[:en_b_o]}[+]/ - word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@endnote_counter_dag} ") + word.gsub!(/#{Mx[:en_b_o]}[+]/, + "#{Mx[:en_b_o]}\+#{@endnote_counter_dag} ") @endnote_counter_dag+=1 else - word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ") + word.gsub!(/#{Mx[:en_b_o]}[*]?/, + "#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ") @endnote_counter_asterisk+=1 end when /~\^|<:e>/ if @endnote_array - word.gsub!(/~\^|<:e>/,"#{@endnote_array[@endnote_counter-1]}") + word.gsub!(/~\^|<:e>/, + "#{@endnote_array[@endnote_counter-1]}") @endnote_counter+=1 end end diff --git a/lib/sisu/v6/ao_expand_insertions.rb b/lib/sisu/v6/ao_expand_insertions.rb index 22e3b1ea..eee89f3e 100644 --- a/lib/sisu/v6/ao_expand_insertions.rb +++ b/lib/sisu/v6/ao_expand_insertions.rb @@ -77,33 +77,53 @@ module SiSU_AO_Insertions end file_type_names={} file_type_names[:gen],file_type_names[:src]=[],[] - file_type_names[:gen] <<= if cmd_list =~ /y/ then "~^ { document manifest }#{lnk[:manifest]}" + file_type_names[:gen] <<= if cmd_list =~ /y/ + "~^ { document manifest }#{lnk[:manifest]}" end - file_type_names[:gen] <<= if cmd_list =~ /h/ then [" { html, segmented text }#{lnk[:html_toc]}"," { html, scroll, document in one }#{lnk[:html_doc]}"] + file_type_names[:gen] <<= if cmd_list =~ /h/ + [ + " { html, segmented text }#{lnk[:html_toc]}", + " { html, scroll, document in one }#{lnk[:html_doc]}", + ] end - file_type_names[:gen] <<= if cmd_list =~ /e/ then [" { epub }#{lnk[:epub]}"] + file_type_names[:gen] <<= if cmd_list =~ /e/ + [" { epub }#{lnk[:epub]}"] end - file_type_names[:gen] <<= if cmd_list =~ /p/ then [" { pdf, landscape }#{lnk[:pdf_landscape]}"," { pdf, portrait }#{lnk[:pdf_portrait]}"] + file_type_names[:gen] <<= if cmd_list =~ /p/ + [ + " { pdf, landscape }#{lnk[:pdf_landscape]}", + " { pdf, portrait }#{lnk[:pdf_portrait]}", + ] end - file_type_names[:gen] <<= if cmd_list =~ /o/ then " { odf:odt, open document text }#{lnk[:odt]}" + file_type_names[:gen] <<= if cmd_list =~ /o/ + " { odf:odt, open document text }#{lnk[:odt]}" end - file_type_names[:gen] <<= if cmd_list =~ /b/ then " { xhtml scroll }#{lnk[:xhtml]}" + file_type_names[:gen] <<= if cmd_list =~ /b/ + " { xhtml scroll }#{lnk[:xhtml]}" end - file_type_names[:gen] <<= if cmd_list =~ /x/ then " { xml, sax }#{lnk[:xml_sax]}" + file_type_names[:gen] <<= if cmd_list =~ /x/ + " { xml, sax }#{lnk[:xml_sax]}" end - file_type_names[:gen] <<= if cmd_list =~ /X/ then " { xml, dom }#{lnk[:xml_dom]}" + file_type_names[:gen] <<= if cmd_list =~ /X/ + " { xml, dom }#{lnk[:xml_dom]}" end - file_type_names[:gen] <<= if cmd_list =~ /a/ then " { plain text utf-8 }#{lnk[:txt]}" + file_type_names[:gen] <<= if cmd_list =~ /a/ + " { plain text utf-8 }#{lnk[:txt]}" end - file_type_names[:gen] <<= if cmd_list =~ /g/ then 'wiki.txt' + file_type_names[:gen] <<= if cmd_list =~ /g/ + 'wiki.txt' end - file_type_names[:gen] <<= if cmd_list =~ /w/ then " { concordance }#{lnk[:html_concordance]}" + file_type_names[:gen] <<= if cmd_list =~ /w/ + " { concordance }#{lnk[:html_concordance]}" end - file_type_names[:gen] <<= if cmd_list =~ /N/ then " { dcc, document content certificate (digests) }#{lnk[:digest]}" + file_type_names[:gen] <<= if cmd_list =~ /N/ + " { dcc, document content certificate (digests) }#{lnk[:digest]}" end - file_type_names[:src] <<= if source and cmd_shortcut =~ /s/ then " { markup source text }#{lnk[:source]}" + file_type_names[:src] <<= if source and cmd_shortcut =~ /s/ + " { markup source text }#{lnk[:source]}" end - file_type_names[:src] <<= if cmd_shortcut =~ /S/ then " { markup source (zipped) pod }#{lnk[:sisupod]}" + file_type_names[:src] <<= if cmd_shortcut =~ /S/ + " { markup source (zipped) pod }#{lnk[:sisupod]}" end file_type_names[:gen]=file_type_names[:gen].flatten file_type_names[:src]=file_type_names[:src].flatten diff --git a/lib/sisu/v6/ao_hash_digest.rb b/lib/sisu/v6/ao_hash_digest.rb index 257902f4..b5a6aaea 100644 --- a/lib/sisu/v6/ao_hash_digest.rb +++ b/lib/sisu/v6/ao_hash_digest.rb @@ -85,8 +85,8 @@ module SiSU_AO_Hash t_o.obj=t_o.obj.strip end if (t_o.of !=:structure \ - && t_o.of !=:comment \ - && t_o.of !=:layout) \ + && t_o.of !=:comment \ + && t_o.of !=:layout) \ && t_o.ocn.is_a?(Fixnum) case sha_ when :sha512 @@ -114,7 +114,9 @@ module SiSU_AO_Hash t_o_bit <<= case en_plus when /#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ if en_plus =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/ - t_o_txt,en_open,en_txt,en_close=/(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m.match(en_plus)[1..4] + t_o_txt,en_open,en_txt,en_close= + /(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m. + match(en_plus)[1..4] stripped_en=SiSU_TextRepresentation::Alter.new(en_txt).strip_clean_of_markup digest_en_strip=case @env.digest(@md.opt).type when :sha512 @@ -126,7 +128,13 @@ module SiSU_AO_Hash else Digest::SHA256.hexdigest(stripped_en) end - t_o_txt + en_open + en_txt + Mx[:id_o] + digest_en_strip + Mx[:id_c] + en_close + t_o_txt + + en_open + + en_txt + + Mx[:id_o] + + digest_en_strip + + Mx[:id_c] + + en_close else STDERR.puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up end else en_plus @@ -143,8 +151,10 @@ module SiSU_AO_Hash case t_o.obj when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m en_and_t_o_digest=[] - t_o.obj=t_o.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch - t_o_plus_en=t_o.obj.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m) + t_o.obj=t_o.obj. + gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch + t_o_plus_en=t_o.obj. + scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m) t_o_tail=if t_o.obj =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+.*/m.match(t_o.obj)[1] else '' diff --git a/lib/sisu/v6/ao_idx.rb b/lib/sisu/v6/ao_idx.rb index eaaf7a90..7a4b1f03 100644 --- a/lib/sisu/v6/ao_idx.rb +++ b/lib/sisu/v6/ao_idx.rb @@ -67,14 +67,26 @@ module SiSU_AO_BookIndex @rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/ @rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/ @rgx_idx_ocn=/(.+?)~(\d+)/ - @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier + @ocn_html_identifier= + SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier @env ||=SiSU_Env::InfoEnv.new(@md.fns) end def indexing_song data=@data - data,sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx=extract_book_index(data) - data=clean_and_insert_index(data,sisu_markup_idx_rel_html_seg) - [data,sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx] + data, + sisu_markup_idx_rel, + sisu_markup_idx_rel_html_seg, + html_idx,xhtml_idx= + extract_book_index(data) + data= + clean_and_insert_index(data,sisu_markup_idx_rel_html_seg) + [ + data, + sisu_markup_idx_rel, + sisu_markup_idx_rel_html_seg, + html_idx, + xhtml_idx, + ] end def extract_book_index(data) tuned_file=[] @@ -93,13 +105,25 @@ module SiSU_AO_BookIndex end if idx_array.length > 0 the_idx=construct_book_index(idx_array) - sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx=nil,nil,nil,nil if @md.book_idx idx=index(the_idx) - sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx=idx[:sst_rel],idx[:sst_rel_html_seg],idx[:html],idx[:xhtml] + sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx, xhtml_idx= + idx[:sst_rel], idx[:sst_rel_html_seg], idx[:html],idx[:xhtml] + else + sisu_markup_idx_rel= + sisu_markup_idx_rel_html_seg= + html_idx= + xhtml_idx= + nil end end - [tuned_file,sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx] + [ + tuned_file, + sisu_markup_idx_rel, + sisu_markup_idx_rel_html_seg, + html_idx, + xhtml_idx, + ] end def construct_book_index(idx_array) the_idx={} @@ -108,8 +132,12 @@ module SiSU_AO_BookIndex location=(term_info[:plus].to_i > 0) \ ? (%{#{idx[:ocn]}-#{idx[:ocn].to_i + term_info[:plus].to_i}}) : idx[:ocn].to_s - the_idx[term]={} unless the_idx[term] and defined? the_idx[term] - the_idx[term]['node_0_terms']=[] unless the_idx[term]['node_0_terms'] and defined? the_idx[term]['node_0_terms'] + the_idx[term]={} \ + unless the_idx[term] \ + and defined? the_idx[term] + the_idx[term]['node_0_terms']=[] \ + unless the_idx[term]['node_0_terms'] \ + and defined? the_idx[term]['node_0_terms'] the_idx[term]['node_0_terms'] << { ocn: idx[:ocn], range: location, seg: idx[:seg] } if term_info[:sub].is_a?(Array) \ and term_info[:sub].length > 0 @@ -118,11 +146,20 @@ module SiSU_AO_BookIndex location=(subterm_info[:plus].to_i > 0) \ ? (%{#{idx[:ocn]}-#{idx[:ocn].to_i + subterm_info[:plus].to_i}}) : idx[:ocn].to_s - the_idx[term]={} unless the_idx[term] and defined? the_idx[term] - the_idx[term]['node_0_terms']=[] unless the_idx[term]['node_0_terms'] and defined? the_idx[term]['node_0_terms'] - the_idx[term]['node_1_subterms']={} unless the_idx[term]['node_1_subterms'] and defined? the_idx[term]['node_1_subterms'] - the_idx[term]['node_1_subterms'][subterm]=[] unless the_idx[term]['node_1_subterms'][subterm] and defined? the_idx[term]['node_1_subterms'][subterm] - the_idx[term]['node_1_subterms'][subterm] << { ocn: idx[:ocn], range: location, seg: idx[:seg] } + the_idx[term]={} \ + unless the_idx[term] \ + and defined? the_idx[term] + the_idx[term]['node_0_terms']=[] \ + unless the_idx[term]['node_0_terms']\ + and defined? the_idx[term]['node_0_terms'] + the_idx[term]['node_1_subterms']={} \ + unless the_idx[term]['node_1_subterms'] \ + and defined? the_idx[term]['node_1_subterms'] + the_idx[term]['node_1_subterms'][subterm]=[] \ + unless the_idx[term]['node_1_subterms'][subterm] \ + and defined? the_idx[term]['node_1_subterms'][subterm] + the_idx[term]['node_1_subterms'][subterm] << + { ocn: idx[:ocn], range: location, seg: idx[:seg] } end end end @@ -138,16 +175,27 @@ module SiSU_AO_BookIndex def index(the_idx) @x=1 idx={} - idx[:sst_rel_html_seg],idx[:sst_rel],idx[:html],idx[:xhtml]=[],[],[],[] - h={obj: Mx[:br_page]} + idx[:sst_rel_html_seg],idx[:sst_rel],idx[:html],idx[:xhtml]= + [], [], [], [] + h={ + obj: Mx[:br_page] + } o=SiSU_AO_DocumentStructure::ObjectLayout.new.break(h) idx[:sst_rel_html_seg] << o idx[:sst_rel] << o - h={lv: '1', name: 'index', obj: "Index"} + h={ + lv: '1', + name: 'index', + obj: "Index" + } o=SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) idx[:sst_rel_html_seg] << o idx[:sst_rel] << o - h={lv: '4', name: 'idx', obj: " [Index] #{Mx[:pa_non_object_dummy_heading]}"} + h={ + lv: '4', + name: 'idx', + obj: " [Index] #{Mx[:pa_non_object_dummy_heading]}" + } o=SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) idx[:sst_rel_html_seg] << o idx[:sst_rel] << o @@ -159,15 +207,19 @@ module SiSU_AO_BookIndex idx[:html] << '' idx[:xhtml] << '' else - idx[:html] << %{#{x},#{$ep[:hsp]}} - idx[:xhtml] << %{#{x},#{$ep[:hsp]}} + idx[:html] << + %{#{x},#{$ep[:hsp]}} + idx[:xhtml] << + %{#{x},#{$ep[:hsp]}} end end idx[:html] << '

' idx[:xhtml] << '

' letter=alph.shift - idx[:html] << %{\n

} - idx[:xhtml] << %{\n

0 - 9

} + idx[:html] << + %{\n

} + idx[:xhtml] << + %{\n

0 - 9

} the_idx.each do |i| i.each do |x| if x.is_a?(String) @@ -176,18 +228,24 @@ module SiSU_AO_BookIndex while letter < f if alph.length > 0 letter=alph.shift - idx[:html] << %{\n

#{letter}

} - idx[:xhtml] << %{\n

#{letter}

} + idx[:html] << + %{\n

#{letter}

} + idx[:xhtml] << + %{\n

#{letter}

} else break end end end - idx[:sst_rel_html_seg] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } - idx[:sst_rel] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } + idx[:sst_rel_html_seg] << + %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } + idx[:sst_rel] << + %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } aname=x.gsub(/\s+/,'_') - idx[:html] << %{\n

#{x}, } + idx[:html] << + %{\n

#{x}, } c=clean_xml(x.dup) - idx[:xhtml] << %{\n

#{c}, } + idx[:xhtml] << + %{\n

#{c}, } @o=idx[:sst_rel_html_seg].index(idx[:sst_rel_html_seg].last) @t=idx[:sst_rel].index(idx[:sst_rel].last) @q=idx[:html].index(idx[:html].last) @@ -200,16 +258,32 @@ module SiSU_AO_BookIndex if x['node_0_terms'].is_a?(Array) x['node_0_terms'].each do |a| if a[:range] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{a[:range]}, } - idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:range]}, } + idx[:sst_rel_html_seg][@o]= + idx[:sst_rel_html_seg][@o] + + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel][@t]= + idx[:sst_rel][@t] + + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } + idx[:html][@q]= + idx[:html][@q] + + %{#{a[:range]}, } + idx[:xhtml][@q]= + idx[:xhtml][@q] + + %{#{a[:range]}, } print a[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on elsif a[:ocn] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{a[:ocn]}, } - idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{a[:ocn]}, } + idx[:sst_rel_html_seg][@o]= + idx[:sst_rel_html_seg][@o] + + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel][@t]= + idx[:sst_rel][@t] + + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, } + idx[:html][@q]= + idx[:html][@q] + + %{#{a[:ocn]}, } + idx[:xhtml][@q]= + idx[:xhtml][@q] + + %{#{a[:ocn]}, } print a[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on else p 'error' end @@ -220,24 +294,48 @@ module SiSU_AO_BookIndex if x['node_1_subterms'] x['node_1_subterms'].sort.each do |k,y| if k !~/node_0_terms/ - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{k}, } - idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{k}, } - idx[:html][@q]=idx[:html][@q] + %{\n

#{k}, } + idx[:sst_rel_html_seg][@o]= + idx[:sst_rel_html_seg][@o] + + %{#{k}, } + idx[:sst_rel][@t]= + idx[:sst_rel][@t] + + %{#{k}, } + idx[:html][@q]= + idx[:html][@q] + + %{\n

#{k}, } c=clean_xml(k.dup) - idx[:xhtml][@r]=idx[:xhtml][@r] + %{\n

#{c}, } + idx[:xhtml][@r]= + idx[:xhtml][@r] + + %{\n

#{c}, } print "\n\t" + k + ', ' if @md.opt.act[:verbose_plus][:set]==:on y.each do |z| if z[:range] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{z[:range]}, } - idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:range]}, } + idx[:sst_rel_html_seg][@o]= + idx[:sst_rel_html_seg][@o] + + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel][@t]= + idx[:sst_rel][@t] + + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } + idx[:html][@q]= + idx[:html][@q] + + %{#{z[:range]}, } + idx[:xhtml][@q]= + idx[:xhtml][@q] + + %{#{z[:range]}, } print z[:range] + ', ' if @md.opt.act[:verbose_plus][:set]==:on elsif z[:ocn] - idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } - idx[:html][@q]=idx[:html][@q] + %{#{z[:ocn]}, } - idx[:xhtml][@q]=idx[:xhtml][@q] + %{#{z[:ocn]}, } + idx[:sst_rel_html_seg][@o]= + idx[:sst_rel_html_seg][@o] + + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}#{Mx[:rel_c]}, } + idx[:sst_rel][@t]= + idx[:sst_rel][@t] + + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{z[:ocn]}#{Mx[:rel_c]}, } + idx[:html][@q]= + idx[:html][@q] + + %{#{z[:ocn]}, } + idx[:xhtml][@q]= + idx[:xhtml][@q] + + %{#{z[:ocn]}, } print z[:ocn] + ', ' if @md.opt.act[:verbose_plus][:set]==:on else p 'error' end diff --git a/lib/sisu/v6/ao_images.rb b/lib/sisu/v6/ao_images.rb index 030dbd19..93ed4d84 100644 --- a/lib/sisu/v6/ao_images.rb +++ b/lib/sisu/v6/ao_images.rb @@ -85,7 +85,10 @@ module SiSU_AO_Images else if (@md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* use of RMagick is not enabled in sisurc.yml').warn + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + '*WARN* use of RMagick is not enabled in sisurc.yml' + ).warn end end data.each do |dob| @@ -99,7 +102,11 @@ module SiSU_AO_Images img_col=img_row=nil images=imgs.each do |image| dir=SiSU_Env::InfoEnv.new(@md.fns) - path_image=[dir.path.image_source_include_local,dir.path.image_source_include_remote,dir.path.image_source_include] + path_image=[ + dir.path.image_source_include_local, + dir.path.image_source_include_remote, + dir.path.image_source_include + ] image_path=nil path_image.each do |img_pth| image_path=img_pth @@ -112,7 +119,10 @@ module SiSU_AO_Images else if (@md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* RMagick not present, will attempt to use imagemagick (identify) directly').warn + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + '*WARN* RMagick not present, will attempt to use imagemagick (identify) directly' + ).warn end imgk=SiSU_Env::SystemCall.new.imagemagick gmgk=SiSU_Env::SystemCall.new.graphicksmagick @@ -144,12 +154,18 @@ module SiSU_AO_Images end end dob.obj=dob.obj.gsub(/(#{image})/,"#{image} #{img_col}x#{img_row}") - else dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,'[ \1 (\2 missing) ]') + else + dob.obj=dob.obj. + gsub(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, + '[ \1 (\2 missing) ]') end end else images=dob.obj.scan(m) do |image| - SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],'*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image).warn unless @md.opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + '*WARN* where image dimensions have not been provided RMagick or imagemagick is required',image + ).warn unless @md.opt.act[:quiet][:set]==:on end end end diff --git a/lib/sisu/v6/ao_metadata.rb b/lib/sisu/v6/ao_metadata.rb index 3ca232f3..975d261d 100644 --- a/lib/sisu/v6/ao_metadata.rb +++ b/lib/sisu/v6/ao_metadata.rb @@ -69,11 +69,20 @@ module SiSU_AO_Metadata @tr=SiSU_Translate::Source.new(md,language) end def make_para(obj,ocn) - h={ obj: obj, ocn: 0 } + h={ + obj: obj, + ocn: 0 + } SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) end def make_heading(obj,ocn,name,lv,ln) - h={ lv: lv, ln: ln, name: name, obj: obj, ocn: 0 } + h={ + lv: lv, + ln: ln, + name: name, + obj: obj, + ocn: 0 + } SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h) end def metadata diff --git a/lib/sisu/v6/ao_misc_arrange.rb b/lib/sisu/v6/ao_misc_arrange.rb index de32f560..387c14ca 100644 --- a/lib/sisu/v6/ao_misc_arrange.rb +++ b/lib/sisu/v6/ao_misc_arrange.rb @@ -67,10 +67,13 @@ module SiSU_AO_MiscArrangeText end def conditional_headings(para) para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author'). #conditional header - gsub(/^((?:[1-9]|:?[A-D])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 + gsub(/^((?:[1-9]|:?[A-D])~\S*)\s*$/, + '\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 if para =~/^@\S+?:/ - para=para.gsub(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2"). - gsub(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3") + para=para.gsub(/^@(\S+?):(\s+|$)/, + "#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2"). + gsub(/^@(\S+?):([+-])(\s+|$)/, + "#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3") end para end @@ -79,7 +82,9 @@ module SiSU_AO_MiscArrangeText block_open,block_close,text=nil,nil,nil if para =~/\A```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?\n.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m @flag=:close - block_open,text,block_close=/\A(```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?)\n(.+?)\n(```([ ]+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1..3] + block_open,text,block_close= + /\A(```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?)\n(.+?)\n(```([ ]+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m. + match(para)[1..3] ((para=~/^```[ ]+table(?:~h)?\s+/) \ and (para !~/^```[ ]+table(?:~h)?\s+c\d+/)) \ ? para @@ -96,7 +101,8 @@ module SiSU_AO_MiscArrangeText elsif para =~/\A.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m \ and @flag==:open @flag=:close - text,block_close=/\A(.+?)\n(```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2] + text,block_close= + /\A(.+?)\n(```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2] para=[] if not text.to_s.empty? para << text.to_s << block_close @@ -109,7 +115,8 @@ module SiSU_AO_MiscArrangeText end def ticks_remove(para) unless @md.opt.act[:quiet][:set] ==:on - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark("ticks not recognized, ticks removed from pargraph\n#{para}") + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + mark("ticks not recognized, ticks removed from pargraph\n#{para}") end para=para.gsub(/```[ ]+\S+[ ]*/m,''). gsub(/```\s*/m,''). @@ -134,11 +141,15 @@ module SiSU_AO_MiscArrangeText def curly_braces(para) block_open,block_close,text=nil,nil,nil para=if para =~/\A(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?\n.+?\n\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m - block_open,text,block_close=/\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1..3] + block_open,text,block_close= + /\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m. + match(para)[1..3] para=[] para << block_open << text << block_close elsif para =~/\A(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?\n.+?\Z/m - block_open,text=/\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\Z/m.match(para)[1,2] + block_open,text= + /\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\Z/m. + match(para)[1,2] para=[] if not text.to_s.empty? para << block_open << text @@ -146,7 +157,9 @@ module SiSU_AO_MiscArrangeText para << block_open end elsif para =~/\A.+?\n\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m - text,block_close=/\A(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1,2] + text,block_close= + /\A(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\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/ao_numbering.rb b/lib/sisu/v6/ao_numbering.rb index 0dbb1a71..791f5bfc 100644 --- a/lib/sisu/v6/ao_numbering.rb +++ b/lib/sisu/v6/ao_numbering.rb @@ -121,7 +121,8 @@ module SiSU_AO_Numbering dob end def heading_tag_clean(heading_tag) - heading_tag=heading_tag.gsub(/[ ]+/,'_'). + heading_tag=heading_tag. + gsub(/[ ]+/,'_'). gsub(/["']/,''). gsub(/[\/]/,'-'). gsub(/#{Mx[:fa_bold_o]}|#{Mx[:fa_bold_c]}/,''). @@ -315,7 +316,8 @@ module SiSU_AO_Numbering if dob.name !~/^\S+/ \ and dob.obj =~/^\s*(?:\S+\s+)?([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name possible_seg_name=$1 - possible_seg_name=possible_seg_name.gsub(/(?:[:,-]|\W)/,'.'). + possible_seg_name=possible_seg_name. + gsub(/(?:[:,-]|\W)/,'.'). gsub(/\.$/,'') if @md.seg_names.is_a?(Array) \ and not @md.seg_names.include?(possible_seg_name) @@ -363,11 +365,17 @@ module SiSU_AO_Numbering m=dob.ln.to_s dob_tmp=[] if @md.pagenew.inspect =~/#{m}/ - dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) << dob + dob_tmp << + SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new]) << + dob elsif @md.pagebreak.inspect =~/#{m}/ - dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) << dob + dob_tmp << + SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page]) << + dob elsif @md.pageline.inspect =~/#{m}/ - dob_tmp << SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line]) << dob + dob_tmp << + SiSU_AO_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_line]) << + dob end unless dob_tmp.length > 0; dob else dob_tmp @@ -381,11 +389,23 @@ module SiSU_AO_Numbering : @segname tags["#{dob.ocn}"]={ segname: @segname } ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert) - if dob.ln =~/[0-3]/ then { seg: nil, level: dob.ln } + if dob.ln =~/[0-3]/ + { + seg: nil, + level: dob.ln, + } #elsif dob.ln =~/[4-6]/ - else { seg: @seg, level: dob.ln } + else + { + seg: @seg, + level: dob.ln, + } end - else { seg: @seg, level: nil } + else + { + seg: @seg, + level: nil, + } end end dob.tags=dob.tags.uniq if defined? dob.tags @@ -434,7 +454,9 @@ module SiSU_AO_Numbering and defined? @md.title.full \ and defined? @md.creator \ and @md.creator - head=@md.title.main ? ([@lv='1',@obj=@md.title.main]) : ([@lv='1',@obj='[no title provided]']) + head=@md.title.main \ + ? ([@lv='1',@obj=@md.title.main]) + : ([@lv='1',@obj='[no title provided]']) @tuned_file << head end end @@ -479,7 +501,8 @@ module SiSU_AO_Numbering unless @md.set_header_title if t_o !~/^%{1,2}\s/m \ and t_o !~/\A\s*\Z/m - @tuned_file << "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}" + @tuned_file << + "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}" @md.title.main=@md.heading_seg_first @md.set_header_title=true end diff --git a/lib/sisu/v6/ao_syntax.rb b/lib/sisu/v6/ao_syntax.rb index 68720aca..cdd4a389 100644 --- a/lib/sisu/v6/ao_syntax.rb +++ b/lib/sisu/v6/ao_syntax.rb @@ -143,7 +143,8 @@ module SiSU_AO_Syntax && dob.is !=:comment \ && dob.is !=:code \ && dob.is !=:table - dob.obj=dob.obj.gsub(/^-\\\\-\s*$/,"#{Mx[:br_page]}"). + dob.obj=dob.obj. + gsub(/^-\\\\-\s*$/,"#{Mx[:br_page]}"). gsub(/^=\\\\=\s*$/,"#{Mx[:br_page_new]}"). gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}"). gsub(/(?:<:?pb>)/,"#{Mx[:br_page]}"). # depreciated @@ -190,7 +191,8 @@ module SiSU_AO_Syntax dob end def embolden(given) - given=given.gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + given=given. + gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2"). gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/, "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}"). @@ -204,7 +206,8 @@ module SiSU_AO_Syntax "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end def italicise(given) - given=given.gsub(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + given=given. + gsub(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2"). gsub(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/, "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2"). @@ -282,11 +285,13 @@ module SiSU_AO_Syntax word.each do |w| unless /#{@manmkp_bold}|#{@http_m}/.match(w) if defined? @md.bold_match_list[:regx] \ - and @md.bold_match_list[:regx] #document header: @bold: [bold word list] - w=w.gsub(@md.bold_match_list[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") + and @md.bold_match_list[:regx] #document header: @bold: [bold word list] + w=w.gsub(@md.bold_match_list[:regx], + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") elsif defined? @vz.markup_make_bold \ and @vz.markup_make_bold #defaults adjusted bold word list - w=w.gsub(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") + w=w.gsub(@vz.markup_make_bold, + "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") end else w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/ @@ -324,7 +329,9 @@ module SiSU_AO_Syntax else '' end txt="#{lead_break}#{fce}\{" + txt.split(Mx[:br_nl]).join("\}#{fce}#{Mx[:br_nl]}#{fce}\{") + "\}#{fce}" - dob.obj=dob.obj.sub(/(?:^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)([*!\/_#])\{.+?\}\1/m,"#{lead}#{txt}") + dob.obj=dob.obj. + sub(/(?:^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)([*!\/_#])\{.+?\}\1/m, + "#{lead}#{txt}") dob else dob end @@ -336,7 +343,8 @@ module SiSU_AO_Syntax def fontface(dob) leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|[、。「‹«¿¡]|\>/ dob=fontface_lines(dob,leader) - dob.obj=dob.obj.gsub(/(#{leader})\*\{(.+?)\}\*/m, + dob.obj=dob.obj. + gsub(/(#{leader})\*\{(.+?)\}\*/m, "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis gsub(/(#{leader})!\{(.+?)\}!/m, "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold @@ -399,18 +407,20 @@ module SiSU_AO_Syntax word=dob.obj.scan(/\S+|\n/) #unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit if word word.each do |w| # _ - / # | : ! ^ ~ - unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/ # do something earlier about table!! - w=w.gsub(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character + unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/ # do something earlier about table!! + w=w.gsub(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character end - w=w.gsub(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}").gsub(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character + w=w.gsub(/^\<$/, + "#{Mx[:gl_o]}#lt#{Mx[:gl_c]}").gsub(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character line_array << w end dob.obj=line_array.join(' ') dob.obj=dob.obj.strip end - dob.obj=dob.obj.gsub(/^([*#-.]{1,12})$/,'\1 ~#'). #ocn off for these paragraph separators + dob.obj=dob.obj. + gsub(/^([*#-.]{1,12})$/,'\1 ~#'). #ocn off for these paragraph separators gsub(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]). - gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify + gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify gsub(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c]) if dob.is ==:heading \ and dob.ln ==0 @@ -431,12 +441,14 @@ module SiSU_AO_Syntax dob.obj=if dob.lv =~/[23]/ \ and defined? @md.creator.author \ and @md.creator.author - dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.creator.author}") + dob.obj. + gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/, + "\\1#{@md.creator.author}") else dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1') end end end - dob.obj=dob.obj.gsub(/<(https?:\/\/\S+?)>/,'< \1 >'). #catch problem markup + dob.obj=dob.obj.gsub(/<(https?:\/\/\S+?)>/,'< \1 >'). #catch problem markup gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image'). gsub(//,'<:\1>'). #escaped special character gsub(/ /,"#{Mx[:nbsp]}"). #escaped special character @@ -463,15 +475,18 @@ module SiSU_AO_Syntax gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}") #escaped special character if dob.obj=~/(?:https?:|ftp:|\{([^{}]+?)\}(?:#|:|[.]{1,2}\/))\S+/m if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m - dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, - "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]}\\3 \\4#{Mx[:en_a_c]}") # watch + dob.obj=dob.obj. + gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]}\\3 \\4#{Mx[:en_a_c]}") # watch end if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m - dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, - "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ") + dob.obj=dob.obj. + gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ") end - dob.obj=dob.obj.gsub(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, - "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3"). #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline) + dob.obj=dob.obj. + gsub(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3"). #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline) gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}). gsub(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, @@ -486,7 +501,8 @@ module SiSU_AO_Syntax %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}) end dob=fontface(dob) - dob.obj=dob.obj.gsub(/<[:e]\s+(.+?)!?>/, + dob.obj=dob.obj. + gsub(/<[:e]\s+(.+?)!?>/, "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}"). #not tested gsub(/(^|#{Mx[:br_nl]})\s*_\*\s*/, "\\1#{Mx[:gl_bullet]}"). #bullets, shortcut @@ -526,7 +542,8 @@ module SiSU_AO_Syntax elsif dob.is==:table dob=fontface(dob) elsif dob.is ==:code - dob.obj=dob.obj.gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: '). + dob.obj=dob.obj. + gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: '). gsub(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert

back, clumsy if dob.number_ codeline=[] @@ -569,7 +586,8 @@ module SiSU_AO_Syntax # +2 puts 'tech' @data.each do |line| - line=line.gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/, + line=line. + gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/, "\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/, "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb index bfe0cbe2..94d0eb8e 100644 --- a/lib/sisu/v6/hub.rb +++ b/lib/sisu/v6/hub.rb @@ -75,7 +75,8 @@ module SiSU 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 class HubMaster def initialize(argv) @@ -159,7 +160,11 @@ module SiSU end end if files_translated_idx.flatten.length > 1 - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Manifest re-run on (currently generated) translated files',"").grey_title_hi unless @opt.act[:quiet][:set] ==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Manifest re-run on (currently generated) translated files', + '' + ).grey_title_hi unless @opt.act[:quiet][:set] ==:on files_translated_idx.flatten.each do |i| @opt.fns=@opt.files[i] @opt.f_pth=@opt.f_pths[i] @@ -191,22 +196,26 @@ module SiSU @@n_do=0 end def remote_put_base_site_rsync # -CR - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) if @opt.act[:maintenance][:set] ==:on + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ + if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base end def remote_put_base_site_rsync_match # -CCRZ - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) if @opt.act[:maintenance][:set] ==:on + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ + if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).rsync_base_sync end def remote_put_base_site # -Cr - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) if @opt.act[:maintenance][:set] ==:on + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ + if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base end def remote_put_base_site_all # -CCr - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) if @opt.act[:maintenance][:set] ==:on + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \ + if @opt.act[:maintenance][:set] ==:on require_relative 'remote' # remote.rb SiSU_Remote::Put.new(@opt).scp_base_all end @@ -217,7 +226,10 @@ module SiSU def termsheet # -t system("sisu_termsheet #{@opt.cmd} #{@opt.fns}\n") @@n_do=@@n_do+1 - SiSU_Screen::Ansi.new(@opt.cmd,@@n_do,'Termsheet(s) processed').term_sheet_title unless @opt.act[:quiet][:set] ==:on + SiSU_Screen::Ansi.new( + @opt.cmd,@@n_do, + 'Termsheet(s) processed' + ).term_sheet_title unless @opt.act[:quiet][:set] ==:on end def webrick # -W prt=SiSU_Env::InfoEnv.new(@fns).port.webrick_port @@ -254,7 +266,8 @@ module SiSU 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 @@env=nil attr_accessor :op @@ -262,7 +275,9 @@ module SiSU @opt=opt @@env=@env=SiSU_Env::InfoEnv.new @msg,@msgs='',nil - @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") } + @tell=lambda { + SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") + } end def remove_skipped_files_if_any_from_processing_files_array if @remove_faulty_markup_files_array.length > 0 @@ -272,7 +287,8 @@ module SiSU def print_error_message_if_files_skipped if @remove_faulty_markup_files_array.length > 0 puts '---' - STDERR.puts 'ERROR with file(s), did not process: ' + @remove_faulty_markup_files_array.join(',') + STDERR.puts 'ERROR with file(s), did not process: ' + + @remove_faulty_markup_files_array.join(',') end end def do_loops @@ -288,7 +304,8 @@ module SiSU def do_each_file_loop_options @opt.files.each_with_index do |fno,i| @opt.fno=fno - @opt.fns=fno.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst'). + @opt.fns=fno. + gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst'). gsub(/\.ssm$/,'.ssm.sst') @opt.f_pth=@opt.f_pths[i] if @opt.fns !~/\.-sst$/ @@ -492,7 +509,8 @@ module SiSU ensure path_pod=@env.processing_path.processing_sisupod(@opt).paths unless @opt.act[:maintenance][:set]==:on - FileUtils::rm_rf("#{path_pod[:sisupod]}/*") if FileTest.directory?(path_pod[:sisupod]) + FileUtils::rm_rf("#{path_pod[:sisupod]}/*") \ + if FileTest.directory?(path_pod[:sisupod]) end end end @@ -518,7 +536,7 @@ module SiSU case @opt.fns when /\.(termsheet.rb)$/ SiSU::Operations.new(@opt).termsheet - else #print "not processed --> ", fns, "\n" + else #print "not processed --> ", fns, "\n" end else SiSU::Operations.new(@opt).not_found end @@ -528,13 +546,13 @@ module SiSU if @opt.act[:psql][:set]==:on #% --pg, -D DB postgresql require_relative 'dbi' OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb end end if @opt.act[:sqlite][:set]==:on #% --sqlite, -d DB sqlite require_relative 'dbi' OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb + SiSU_DBI::SQL.new(@opt).connect # -D -d dbi.rb end end if @opt.act[:manifest][:set]==:on #% --manifest, -y @@ -579,7 +597,10 @@ module SiSU if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],' ' + File.dirname(__FILE__)).grey + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + ' ' + File.dirname(__FILE__) + ).grey end end if @opt.act[:ao][:set]==:on \ @@ -676,7 +697,8 @@ module SiSU begin require 'profile' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('profile NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('profile NOT FOUND (LoadError)') end end action_on_file_ =if @opt.act[:rsync][:set]==:on \ diff --git a/lib/sisu/v6/options.rb b/lib/sisu/v6/options.rb index d7719ea4..e181ee8e 100644 --- a/lib/sisu/v6/options.rb +++ b/lib/sisu/v6/options.rb @@ -72,7 +72,22 @@ module SiSU_Commandline @@sisu_call_origin_path=nil class HeaderCommon def sisu_document_make_instructions - @pagenew=@pagebreak=@pageline=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@num_top=@i18n=@man_section=@emphasis_set_to=@bold_match_list=@italics_match_list=@substitution_match_list=@footer_links=@home_button_links=@links=nil + @pagenew= + @pagebreak= + @pageline= + @toc= + @lv1=@lv2=@lv3=@lv4=@lv5=@lv6= + @num_top= + @i18n= + @man_section= + @emphasis_set_to= + @bold_match_list= + @italics_match_list= + @substitution_match_list= + @footer_links= + @home_button_links= + @links= + nil make_instruct_array=SiSU_Env::GetInit.new.sisu_document_make.makefile_read @makeset=false if make_instruct_array @@ -143,7 +158,8 @@ module SiSU_Commandline attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod @@act=nil def initialize(a) - @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','','','' + @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location= + '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::InfoEnv.new @lng_base=@env.language_default_set @@ -316,7 +332,8 @@ module SiSU_Commandline FileUtils::mkdir_p(pt.to_s) pod_make_path=fullname + '/sisupod/doc/_sisu' make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path) - @make_instructions_pod=HeaderCommon.new(make_instruct_array).sisu_document_make_instructions + @make_instructions_pod= + HeaderCommon.new(make_instruct_array).sisu_document_make_instructions Dir.chdir(pt.realpath) system(" chdir #{fullname} @@ -410,7 +427,7 @@ module SiSU_Commandline lng: lng_is, lng_is: lng_is, url_base: nil, - url: nil + url: nil, } else puts "file not found: #{x}" end @@ -422,7 +439,16 @@ module SiSU_Commandline puts "#{x} in #{a.join(' ')}?" end end - { cmd: c, mod: m, what: w, paths: pth, files: f, f_pths: f_pths, lng: lng_is, lngs: lngs } + { + cmd: c, + mod: m, + what: w, + paths: pth, + files: f, + f_pths: f_pths, + lng: lng_is, + lngs: lngs, + } end def expand_numeric_shortcuts(a) shortcut=SiSU_Env::InfoProcessingFlag.new diff --git a/lib/sisu/v6/param.rb b/lib/sisu/v6/param.rb index 19769027..1e7ea9de 100644 --- a/lib/sisu/v6/param.rb +++ b/lib/sisu/v6/param.rb @@ -65,15 +65,34 @@ module SiSU_Param require 'uri' require 'pstore' rescue LoadError - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('uri or pstore NOT FOUND (LoadError)') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('uri or pstore NOT FOUND (LoadError)') end require_relative 'sysenv' # sysenv.rb include SiSU_Env require_relative 'param_make' # param_make.rb require_relative 'param_identify_markup' # param_identify_markup.rb @@date=SiSU_Env::InfoDate.new - @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=nil - @doc={ initialise: nil, markup: '', lnks: '', stmp: '', req: {} } + @@proc= + @@filename_txt= + @@filename_texinfo= + @@filename_lout_portrait= + @@filename_lout_landscape= + @@filename_html_scroll= + @@filename_html_index= + @@filename_html_segtoc= + @@filename_semantic= + @@filename_rss= + @@newfile= + @@drr= + nil + @doc={ + initialise: nil, + markup: '', + lnks: '', + stmp: '', + req: {}, + } @@yaml=@@yamladdr=nil @@trigger=nil @@lv,@@flag={},{} @@ -99,7 +118,8 @@ module SiSU_Param # you may need to change Dir.pwd to @opt.f_pth[:pth] where the latter # has a path value that is different, however, f_pth is not always set! Dir.chdir(@opt.f_pth[:pth]) - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('-- bug alert --') + SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). + error('-- bug alert --') p 'f_pth ' + @opt.f_pth[:pth] p 'pwd ' + Dir.pwd end @@ -186,7 +206,11 @@ module SiSU_Param STDERR.puts "#{n} is #{s.class}: programming error, String expected #{__FILE__}:#{__LINE__}" s else - SiSU_Screen::Ansi.new('v',"*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped",@opt.fns).warn unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + 'v', + "*WARN* #{n} length #{s.length} exceeds set db field length #{l}, metadata dropped", + @opt.fns + ).warn unless @opt.act[:quiet][:set]==:on nil end end @@ -504,7 +528,10 @@ module SiSU_Param elsif @h['text'] then @h['text'] elsif @h['main'] then @h['main'] else - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING Document Copyright missing; provide @rights: :copyright:').warn unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'WARNING Document Copyright missing; provide @rights: :copyright:' + ).warn unless @opt.act[:quiet][:set]==:on '' end l,n=Db[:col_info_note],'rights.copyright.text' @@ -603,7 +630,10 @@ module SiSU_Param s +='License: ' + 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 + 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) @@ -835,8 +865,10 @@ module SiSU_Param attr_accessor :make,:env,:path,:file,:fn,:fns,:fno,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv0,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:pageline,:num_top,:bold_match_list,:italics_match_list,:substitution_match_list,:emphasis_set_to,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:flag_tables,:vocabulary,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:lang_code_insert,:en,:notes,:dgst,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy,:home_button_image,:home_button_links,:footer_links,:cover_image,:man_section def initialize(fns_array,opt) @env=@path,@file=@fn=@fns=@fno=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv0=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@pageline=@num_top=@bold_match_list=@italics_match_list=@substitution_match_list=@emphasis_set_to=@toc_lev_limit=@flag_tables=@vocabulary=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@lang_code_insert=@en=@notes=@dgst=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=@home_button_image=@home_button_links=@cover_image=@man_section=nil - @data,@path,@fns,@fno,@opt=fns_array,opt.pth,opt.fns,opt.fno,opt #@data used as data - @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=false,false,false,false,false,false,false + @data, @path, @fns, @fno, @opt= + fns_array,opt.pth,opt.fns,opt.fno,opt #@data used as data + @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx= + false, false, false, false, false, false, false @seg_autoname_safe=true @daisy,@sem_tag=false,false @authorship,@markup_instruction,@image='','','','' #check which other values should be set to empty rather than nil @@ -1020,37 +1052,48 @@ module SiSU_Param @lv4=(makes[:lv4]) ? (makes[:lv4]) : @lv4 @lv5=(makes[:lv5]) ? (makes[:lv5]) : @lv5 @lv6=(makes[:lv6]) ? (makes[:lv6]) : @lv6 - @num_top=(makes[:num_top]) \ + @num_top= + (makes[:num_top]) \ ? (makes[:num_top]) \ : @num_top - @substitution_match_list=(makes[:substitution_match_list]) \ + @substitution_match_list= + (makes[:substitution_match_list]) \ ? (makes[:substitution_match_list]) \ : @substitution_match_list - @bold_match_list=(makes[:bold_match_list]) \ + @bold_match_list= + (makes[:bold_match_list]) \ ? (makes[:bold_match_list]) \ : @bold_match_list - @italics_match_list=(makes[:italics_match_list]) \ + @italics_match_list= + (makes[:italics_match_list]) \ ? (makes[:italics_match_list]) \ : @italics_match_list - @emphasis_set_to=(makes[:emphasis_set_to]) \ + @emphasis_set_to= + (makes[:emphasis_set_to]) \ ? (makes[:emphasis_set_to]) \ : @emphasis_set_to - @i18n=(makes[:i18n]) \ + @i18n= + (makes[:i18n]) \ ? (makes[:i18n]) \ : @i18n - @man_section=(makes[:man_section]) \ + @man_section= + (makes[:man_section]) \ ? (makes[:man_section]) \ : @man_section - @footer_links=(makes[:footer_links]) \ + @footer_links= + (makes[:footer_links]) \ ? (makes[:footer_links]) \ : @footer_links - @home_button_links=(makes[:home_button_links]) \ + @home_button_links= + (makes[:home_button_links]) \ ? (makes[:home_button_links]) \ : @home_button_links - @home_button_image=(makes[:home_button_image]) \ + @home_button_image= + (makes[:home_button_image]) \ ? (makes[:home_button_image]) \ : @home_button_image - @cover_image=(makes[:cover_image]) \ + @cover_image= + (makes[:cover_image]) \ ? (makes[:cover_image]) \ : @cover_image end @@ -1117,7 +1160,11 @@ module SiSU_Param : '' title=@title.full.gsub(/\s*(?:

|

|
|
)\s*/,' '). gsub(/~\{.+?\}~/,'') - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Parameters',%{#{title}#{creator}}).txt_grey if @opt.act[:verbose][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'Parameters', + %{#{title}#{creator}} + ).txt_grey if @opt.act[:verbose][:set]==:on end if not @book_idx \ and para =~/^=\{(.+?)\}\s*$/ @@ -1151,11 +1198,11 @@ module SiSU_Param elsif para =~/^1~\s+(.+)$/ t=$1 end - unless @heading_seg_first_flag # extract first segment name + unless @heading_seg_first_flag # extract first segment name @heading_seg_first=t @heading_seg_first_flag=true end - if m # list all segment names + if m # list all segment names @seg_names << m @set_heading_seg=true if m=~/^\d{1,3}/ \ @@ -1164,7 +1211,7 @@ module SiSU_Param end end end - para=para.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image) + para=para.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') # embedded symbol (image) if para !~/^%+\s/ \ and para =~@rgx_image @ec[:image] << para.scan(@rgx_image).uniq @@ -1178,7 +1225,11 @@ module SiSU_Param unless @make if (@opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'@make:','header absent').warn + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + '@make:', + 'header absent' + ).warn end @make=SiSU_Param::Parameters::MdMake.new('@make: ',@opt,@env).make end @@ -1318,15 +1369,25 @@ module SiSU_Param if @en[:note] > 0 \ and @en[:sum] > 0 if @en[:sum] > 0 - else SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'*WARN* both endnote styles used',"~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}").warn unless @opt.act[:quiet][:set]==:on + else + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + '*WARN* both endnote styles used', + "~{ #{@en[:sum]} }~ and ^~ #{@en[:mark]}" + ).warn unless @opt.act[:quiet][:set]==:on end end if @en[:mark] != @en[:note] \ and @en[:note] > 0 @en[:mismatch]=@en[:note] - @en[:mark] - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'*WARN* endnote number mismatch',"endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})").warn unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + '*WARN* endnote number mismatch', + "endnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})" + ).warn unless @opt.act[:quiet][:set]==:on footnote_conversion_errors=File.new("#{Dir.pwd}/footnote_conversion_errors.txt",'a') - footnote_conversion_errors << "#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})\n" + footnote_conversion_errors << + "#{@fns}:\n\tendnotes: #{@en[:note]} != endnote reference marks: #{@en[:mark]} (difference = #{@en[:mismatch]})\n" end if not @title \ or not defined? @title.main \ @@ -1335,7 +1396,11 @@ module SiSU_Param and @opt.inspect =~/P/ #@title=Md.new('Text Insert',@opt,@env).title else - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING: Document Title missing','please provide @title:').warn unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'WARNING: Document Title missing', + 'please provide @title:' + ).warn unless @opt.act[:quiet][:set]==:on end end if @author !~/[\S]/ @@ -1343,7 +1408,11 @@ module SiSU_Param and @opt.inspect =~/P/ #@creator=SiSU_Param::Md.new('Text Insert',@opt,@env).creator else - SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'WARNING: Document Author missing','please provide @creator: :author:').warn unless @opt.act[:quiet][:set]==:on + SiSU_Screen::Ansi.new( + @opt.act[:color_state][:set], + 'WARNING: Document Author missing', + 'please provide @creator: :author:' + ).warn unless @opt.act[:quiet][:set]==:on end end @struct={} @@ -1426,7 +1495,10 @@ module SiSU_Param File.unlink(pstorefile) if FileTest.file?(pstorefile) if (@md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on) - SiSU_Screen::Ansi.new(@md.opt.act[:color_state][:set],"PStore -> #{pstorefile}").txt_grey + SiSU_Screen::Ansi.new( + @md.opt.act[:color_state][:set], + "PStore -> #{pstorefile}" + ).txt_grey end store=PStore.new(pstorefile) store.transaction do @@ -1447,10 +1519,26 @@ module SiSU_Param class Instantiate def param_instantiate @@date=SiSU_Env::InfoDate.new - @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=nil + @@proc= + @@filename_txt= + @@filename_texinfo= + @@filename_lout_portrait= + @@filename_lout_landscape= + @@filename_html_scroll= + @@filename_html_index= + @@filename_html_segtoc= + @@filename_semantic= + @@filename_rss= + @@newfile= + @@drr= + nil @doc={ initialise: nil, - markup: '', lnks: '', stmp: '', prefix_a: '', prefix_b: '', + markup: '', + lnks: '', + stmp: '', + prefix_a: '', + prefix_b: '', req: {} } @@yaml=@@yamladdr=nil -- cgit v1.2.3