diff options
| author | Ralph Amissah <ralph@amissah.com> | 2014-07-01 01:00:30 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2014-07-01 01:00:30 -0400 | 
| commit | f3832f0acc5b335fc820287ce2530435ad651202 (patch) | |
| tree | ecd2004aecd2b706316291a98645ed98a5a25a75 | |
| parent | debian/changelog (5.4.2-1) (diff) | |
| parent | v5 v6: sysenv, developer _CONSTRUCTION_ZONE warning setup modified (diff) | |
Merge tag 'sisu_5.4.3' into debian/sid
SiSU 5.4.3
58 files changed, 3526 insertions, 1315 deletions
| diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index e3cab630..ec8eb24f 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -31,6 +31,45 @@ v2 branch is removed; it is available in sisu =< 3.3.2  %% Reverse Chronological: +%% 5.4.3.orig.tar.xz (2014-07-01:26/2) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.4.3 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.4.3-1 +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 +  * book index, strip white spaces around terms +    (fix uppercase first character where spaces used) +  * quote block, insert text indent markup, exclude book index +  * doc objects, layout group open & close identify is_for +  * segment numbering, fixed width, leading zeros (for alphanumeric sorting) + +* code cosmetic rearrangement +  * ao*, param, hub, options, composite + +* sysenv, developer _CONSTRUCTION_ZONE warning modified + +* merge what was sisu_6.0.8 into v5 +  * ao, +    * syntax, able optionally to indicate the language syntax of a code block +    * syntax, introduce box text block/group +    * syntax, introduce tics quotes markup (blockquote equivalent) +  * docbook, +    * ocn & footnote numbers (as xml comments) +    * metadata header (docinfo) +    * quotes (blockquote) +    * tables +    * images +    * code block +  * vim syntax, add +    * code block, language syntax, optional +    * box block +    * quote block + +* epub, a fix, double check +  %% 5.4.2.orig.tar.xz (2014-06-22:24/7)  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.4.2  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.4.2-1 diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 4d324faa..ada19da7 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -21,6 +21,28 @@ v2 branch is removed; it is available in sisu =< 3.3.2  %% Reverse Chronological: +%% 6.0.9.orig.tar.xz (2014-07-01:26/2) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_6.0.9 +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_6.0.9-1 +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 +  * book index, strip white spaces around terms +    (fix uppercase first character where spaces used) +  * quote block, insert text indent markup, exclude book index +  * doc objects, layout group open & close identify is_for +  * segment numbering, fixed width, leading zeros (for alphanumeric sorting) + +* code cosmetic rearrangement +  * ao*, param, hub, options, composite + +* sysenv, developer _CONSTRUCTION_ZONE warning modified + +* epub, a fix, double check +  %% 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/data/doc/sisu/sisu.org b/data/doc/sisu/sisu.org index 341cdd52..83e74f11 100644 --- a/data/doc/sisu/sisu.org +++ b/data/doc/sisu/sisu.org @@ -1459,7 +1459,7 @@ That said re pdf, LaTeX XeTeX are flexible, it may be possible to drop the ocn  at the start of a code block lower on its line so that it is closer to the code  that follows -**** DONE (6.0.5) [#D] #744353 [w|u] sisu output: please do not use typewriter for urls :output:consider: +**** DONE (5.3.5::6.0.5) [#D] #744353 [w|u] sisu output: please do not use typewriter for urls :output:consider:        <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744353>  From: Daniel Baumann <daniel.baumann@progress-technologies.net> @@ -1640,7 +1640,7 @@ Daniel  for pdf fix/implement mailto links  done but requires further testing & possibly refinement -**** DONE (6.0.5) [#C] #744358 [w|u] sisu output: please do not add ';' after \:copyright: :output:fix: +**** DONE (5.3.5::6.0.5) [#C] #744358 [w|u] sisu output: please do not add ';' after \:copyright: :output:fix:        <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744358>  From: Daniel Baumann <daniel.baumann@progress-technologies.net> @@ -1864,7 +1864,7 @@ there has been no rule to the contrary (i.e. that headings should be on a single  consider, should there be such a rule? -**** DONE (6.0.5) [#B] #744386 [w|u] sisu syntax: 1~ and 2~ result in the same formatting :output:pdf:fix: (see #744383) +**** DONE (5.3.5::6.0.5) [#B] #744386 [w|u] sisu syntax: 1~ and 2~ result in the same formatting :output:pdf:fix: (see #744383)        <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744386>  From: Daniel Baumann <daniel.baumann@progress-technologies.net> @@ -1931,7 +1931,7 @@ seemed to work (checked pdf & html (scroll & seg))  was not able to reproduce  will look again -**** DONE (6.0.5) [#C] #744391 [w|u] sisu output: no color on a4 portrait :output:pdf:contemplate: +**** DONE (5.3.5::6.0.5) [#C] #744391 [w|u] sisu output: no color on a4 portrait :output:pdf:contemplate:        <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744391>  From: Daniel Baumann <daniel.baumann@progress-technologies.net> @@ -2062,7 +2062,7 @@ Daniel  will look at: should be possible; requires a configuration option -**** DONE (6.0.5) [#B] #744399 [w|u] sisu syntax: :A smaller formatted than :B :output:fix: (see #744383) (partial solution) +**** DONE (5.3.5::6.0.5) [#B] #744399 [w|u] sisu syntax: :A smaller formatted than :B :output:fix: (see #744383) (partial solution)        <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744399>  From: Daniel Baumann <daniel.baumann@progress-technologies.net> @@ -2099,7 +2099,7 @@ now is same size see #744383  \subsection    (level 2)  \subsubsection (level 3) -**** DONE (6.0.5) [#C] #744402 [w|u] sisu: support sha512 :implement: +**** DONE (5.3.5::6.0.5) [#C] #744402 [w|u] sisu: support sha512 :implement:        <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744402>  From: Daniel Baumann <daniel.baumann@progress-technologies.net> @@ -2124,7 +2124,7 @@ Daniel  implemented  document command line option --sha512 -**** DONE (6.0.5) [#C] #744405 [w|u] sisu: set default font size :configuration:pdf:implement: +**** DONE (5.3.5::6.0.5) [#C] #744405 [w|u] sisu: set default font size :configuration:pdf:implement:        <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744405>  From: Daniel Baumann <daniel.baumann@progress-technologies.net> diff --git a/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim b/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim index 03e1766f..3bb1a5ea 100644 --- a/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim @@ -1,7 +1,7 @@  " SiSU Vim syntax file  " SiSU Maintainer: Ralph Amissah <ralph@amissah.com> -" SiSU Markup:     SiSU (sisu-6.0.8) -" Last Change:     2014-06-19 +" SiSU Markup:     SiSU (sisu-5.4.3) +" Last Change:     2014-07-01  " URL: <http://git.sisudoc.org/?p=code/sisu.git;a=blob;f=data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim;hb=HEAD>  "(originally looked at Ruby Vim by Mirko Nasato) diff --git a/data/sisu/v5/v/version.yml b/data/sisu/v5/v/version.yml index a6fa41e7..b6d8dfa8 100644 --- a/data/sisu/v5/v/version.yml +++ b/data/sisu/v5/v/version.yml @@ -1,5 +1,5 @@  ---  :project: SiSU -:version: 5.4.2 -:date_stamp: 2014w24/7 -:date: "2014-06-22" +:version: 5.4.3 +:date_stamp: 2014w26/2 +:date: "2014-07-01" diff --git a/data/sisu/v6/v/version.yml b/data/sisu/v6/v/version.yml index 563a9713..fb9cc955 100644 --- a/data/sisu/v6/v/version.yml +++ b/data/sisu/v6/v/version.yml @@ -1,5 +1,5 @@  ---  :project: SiSU -:version: 6.0.8 -:date_stamp: 2014w24/4 -:date: "2014-06-19" +:version: 6.0.9 +:date_stamp: 2014w26/2 +:date: "2014-07-01" 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(/<br>/,"#{Mx[:br_line]}").                              #needed by xml, xhtml etc. +            gsub(/<br>/,"#{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/composite.rb b/lib/sisu/v5/ao_composite.rb index 9f722799..a7d0e48c 100644 --- a/lib/sisu/v5/composite.rb +++ b/lib/sisu/v5/ao_composite.rb @@ -51,7 +51,7 @@   * Git     <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> -   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/composite.rb;hb=HEAD> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/ao_composite.rb;hb=HEAD>   * Ralph Amissah     <ralph@amissah.com> @@ -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 c53c60d6..b372da4c 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,208 +142,249 @@ 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    class ObjectPara -    attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp +    attr_accessor :obj,:is,:tags,:of,:name,:idx,:quote_,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp      def initialize        @of=:para -      @is=@obj=@name=@idx=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil +      @is=@obj=@name=@idx=@quote_=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil        @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? -      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_,@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_,@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    class ObjectBlockTxt -    attr_accessor :obj,:is,:of,:tags,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp +    attr_accessor :obj,:is,:of,:tags,:lngsyn,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp      def initialize        @of=:block -      @is=@obj=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil +      @is=@obj=@lngsyn=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil        @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 -      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 +      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? +                                   ((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,@number_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,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,@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 @@ -356,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 @@ -398,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 @@ -455,10 +499,10 @@ module SiSU_AO_DocumentStructure      end    end    class ObjectLayout -    attr_accessor :obj,:is,:of,:from,:tmp +    attr_accessor :obj,:sym,:attr,:is,:is_for,:of,:from,:tmp,:num      def initialize        @of=:layout -      @is=@obj=@from=@tmp=nil +      @is=@is_for=@obj=@from=@tmp=@num=nil      end      def break(h,f=nil)                                                         #decide how to deal with        of=     @of                                                              #Symbol, classification - group @@ -477,6 +521,19 @@ module SiSU_AO_DocumentStructure        @of,@is,@obj,@tmp=of,is,obj,tmp        self      end +    def open_close(h,o=nil)                                                    #useful for poem & quote +      of=     @of                                                              #Symbol, classification - group +      is=     :open_close_tags                                                 #Symbol, classification - specific type +      is_for= h[:is_for]  || ((defined? o.is_for)    ? o.is_for  : nil)        #String, text content +      obj=    h[:obj]     || ((defined? o.obj)       ? o.obj     : nil)        #String, text content +      sym=    h[:sym]     || ((defined? o.sym)       ? o.sym     : nil)        #Symbol tag_open, tag_close +      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,@is_for,@obj,@sym,@attr,@tmp,@num= +      of, is, is_for, obj, sym, attr, tmp, num +      self +    end    end    class ObjectComment      attr_accessor :obj,:is,:of,:tmp diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb index 4708a126..931e51d3 100644 --- a/lib/sisu/v5/ao_doc_str.rb +++ b/lib/sisu/v5/ao_doc_str.rb @@ -65,10 +65,13 @@ module SiSU_AO_DocumentStructureExtract      @@flag={        ocn:         :on,        code:        :off, +      lngsyn:      :txt,        poem:        :off,        block:       :off, +      box:         :off,        group:       :off,        alt:         :off, +      quote:       :off,        table:       :off,        table_to:    :off,      } @@ -81,10 +84,13 @@ module SiSU_AO_DocumentStructureExtract      @@flag={        ocn:         :on,        code:        :off, +      lngsyn:      :txt,        poem:        :off,        block:       :off, +      box:         :off,        group:       :off,        alt:         :off, +      quote:       :off,        table:       :off,        table_to:    :off,      } @@ -119,6 +125,11 @@ module SiSU_AO_DocumentStructureExtract        ? true        : false      end +    def quotes? +      @@flag[:quote]==:open \ +      ? true +      : false +    end      def hang_and_indent_test(str)        hang_indent=if str=~/^_([1-9])[^_]/          [$1,$1] @@ -143,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=~/~\{.+?\}~|~\[.+?\]~/) \ @@ -171,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+)/ @@ -180,14 +200,19 @@ module SiSU_AO_DocumentStructureExtract        idx_array_raw=idxraw.scan(/[^;]+/)        idx_hash,idx_array,idx_lst={},[],[]        idx_array_raw.each do |idx| +        idx=idx.strip          idx_lst=case idx          when /\S+?\s*:/            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] @@ -196,14 +221,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| @@ -212,15 +240,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=[] @@ -229,8 +262,10 @@ module SiSU_AO_DocumentStructureExtract        @num_id={          code_block: 0,          poem:       0, +        box:        0,          group:      0,          alt:        0, +        quote:      0,          table:      0,        }        @metadata={} @@ -239,35 +274,46 @@ 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          end          t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") if @@flag[:code]==:off -        if t_o !~/^(?:code|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \ -        and t_o !~/^```[ ]+(?:code|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ \ +        if t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \ +        and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$|^`:quote_(?:open|close)`/ \          and @@flag[:code]==:off \          and @@flag[:poem]==:off \          and @@flag[:group]==:off \          and @@flag[:block]==:off \          and @@flag[:alt]==:off \ +        and @@flag[:box]==:off \          and @@flag[:table]==:off            unless t_o =~/^(?:@\S+?:|%+)\s/                  # extract book index for paragraph if any -            idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1 -              m=m.split(/\n/).join(' '). +            idx=if t_o=~/^=\{\s*(.+)\s*\}\s*$\Z/m; m=$1 +              m=m.split(/[ ]*\n/).join(' ').                  gsub(/\s+([|:;])\s+/,'\1').                  gsub(/\s+([+]\d+)\s+/,'\1') -              t_o=t_o.gsub(/\n=\{.+\}\s*$\Z/m,'') +              t_o=t_o.gsub(/\n=\{.+?\}\s*$/m,'')                idx_array_and_hash=construct_idx_array_and_hash(m)                idx_array_and_hash[:hash]              else nil @@ -282,7 +328,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 @@ -305,7 +351,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 @@ -323,7 +375,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 @@ -341,7 +400,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 @@ -364,7 +429,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 } +                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 @@ -387,7 +462,16 @@ module SiSU_AO_DocumentStructureExtract                      obj << ' ~#'                    end                  end -                h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } +                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 @@ -411,22 +495,52 @@ 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 } -              SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) +              h={ +                bullet_: false, +                indent: 0, +                hang: 0, +                obj: obj, +                idx: idx, +                note_: note, +                image_: image, +                tags: tags, +                quote: quotes?, +              } +              t_o=SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)              end +            t_o=SiSU_AO_DocumentStructureExtract::Structure.new(@md).structure_markup(t_o) #must happen earlier, node info etc. require            end          elsif @@flag[:code]==:off -          if t_o =~/^(?:code\{|```[ ]+code)/ +          if t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?)/              @@flag[:code]=case t_o -            when /^code\{/         then :curls -            when /^```[ ]+code/    then :tics -            else                   @@flag[:code] #error +            when /^code(?:\.[a-z][0-9a-z_]+)?\{/ then :curls +            when /^```[ ]+code/                  then :tics +            else                                 @@flag[:code] #error +            end +            @@flag[:lngsyn]=if t_o =~/^(?:code\.[a-z][0-9a-z_]+\{|```[ ]+code\.[a-z_]+)/ +              case t_o +              when /^code\.([a-z][0-9a-z_]+)\{/ +                :"#{$1}" +              when /^```[ ]+code\.([a-z][0-9a-z_]+)/ +                :"#{$1}" +              else :txt +              end +            else :txt              end              @@counter=1 -            @codeblock_numbered=(t_o =~/^(?:code\{#|```[ ]+code\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: "group text start #{@num_id[:code_block]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={ +              is_for: :code, +              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              when /^poem\{/        then :curls @@ -434,44 +548,95 @@ module SiSU_AO_DocumentStructureExtract              else                  @@flag[:poem] #error              end              @num_id[:poem] +=1 -            h={ obj: "poem start #{@num_id[:poem]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={ +              is_for: :poem, +              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 +            end +            @num_id[:box] +=1 +            h={ +              is_for: :box, +              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: "group text start #{@num_id[:group]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={ +              is_for: :group, +              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: "block text start #{@num_id[:block]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={ +              is_for: :block, +              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: "alt text start #{@num_id[:alt]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={ +              is_for: :alt, +              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={ +              is_for: :quote, +              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: "table start #{@num_id[:table]}" } -            ins=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) -            tuned_file << ins +            h={ +              is_for: :table, +              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+/                @@flag[:table]=:curls                @rows='' @@ -485,7 +650,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='' @@ -499,7 +669,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] @@ -510,7 +685,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=[] @@ -523,18 +698,31 @@ 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: "table end #{@num_id[:table]}" } -              t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +              h={ +                is_for: :table, +                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 @@ -543,14 +731,27 @@ 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: "table end #{@num_id[:table]}" } -              t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +              h={ +                is_for: :table, +                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 @@ -566,14 +767,27 @@ 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: "table end #{@num_id[:table]}" } -              t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +              h={ +                is_for: :table, +                obj: '', +                sym: :table_close, +                num: @num_id[:table], +              } +              t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)                t_o              end            end @@ -586,17 +800,28 @@ 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: "table end #{@num_id[:table]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={ +              is_for: :table, +              obj: '', +              sym: :table_close, +              num: @num_id[:table], +            } +            t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)              t_o            else              if t_o.is_a?(String) \              and t_o !~/^(?:table\{|```[ ]+table)/ -              t_o=t_o.gsub(/^\n+/m,''). #check added for ruby 1.9.2 not needed in 1.8 series (tested in v2) +              t_o=t_o.gsub(/^\n+/m,'').                  gsub(/\n+/m,"#{Mx[:tc_p]}")                @rows += t_o + Mx[:tc_c]              end @@ -610,12 +835,24 @@ 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, 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: "code block end #{@num_id[:code_block]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={ +              is_for: :code, +              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) \            and t_o.is_a?(String) @@ -627,51 +864,125 @@ module SiSU_AO_DocumentStructureExtract              t_o=nil            end          elsif (@@flag[:poem]==:curls or @@flag[:poem]==:tics) \ +        or (@@flag[:box]==:curls or @@flag[:box]==:tics) \          or (@@flag[:group]==:curls or @@flag[:group]==:tics) \          or (@@flag[:block]==:curls or @@flag[:block]==:tics) \ -        or (@@flag[:alt]==:curls or @@flag[:alt]==:tics) +        or (@@flag[:alt]==:curls or @@flag[:alt]==:tics) \ +        or (@@flag[:quote]==:open and t_o =~/`:quote_close`/m) #not            if (@@flag[:poem]==:curls and t_o =~/^\}poem/) \            or (@@flag[:poem]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)              @@flag[:poem]=:off -            h={ obj: "poem end #{@num_id[:poem]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={ +              is_for: :poem, +              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], +            } +            @tuned_block=[] +            t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.box(h) +            tuned_file << t_o +            h={ +              is_for: :box, +              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: "group text end #{@num_id[:group]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={ +              is_for: :group, +              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: "block text end #{@num_id[:block]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={ +              is_for: :block, +              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: "alt text end #{@num_id[:alt]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={ +              is_for: :alt, +              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={ +              is_for: :quote, +              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?, +            } +            SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)            end            if (@@flag[:poem]==:curls or @@flag[:poem]==:tics \            or @@flag[:group]==:curls or @@flag[:group]==:tics \            or @@flag[:alt]==:curls or @@flag[:alt]==:tics) \            and t_o =~/\S/ \ -          and t_o !~/^(?:\}(?:verse|code|alt|group|block)|(?:verse|code|alt|group|block)\{)/ \ -          and t_o !~/^```[ ]+(?:code|poem|alt|group|block)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic +          and t_o !~/^(?:\}(?:verse|code|box|alt|group|block)|(?:verse|code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|alt|group|block)\{)/ \ +          and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic              sub_array=t_o.dup              @line_mode=sub_array.scan(/.+/)              type=if @@flag[:poem]==:curls or @@flag[:poem]==:tics @@ -680,7 +991,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 @@ -692,8 +1007,10 @@ module SiSU_AO_DocumentStructureExtract          end          if @@flag[:code]==:off            if @@flag[:poem]==:curls or @@flag[:poem]==:tics \ +          or @@flag[:box]==:curls or @@flag[:box]==:tics \            or @@flag[:group]==:curls or @@flag[:group]==:tics \ -          or @@flag[:alt]==:curls or @@flag[:alt]==:tics +          or @@flag[:alt]==:curls or @@flag[:alt]==:tics \ +          or (@@flag[:quote]==:open and t_o =~/`:quote_close`/m)              if t_o.is_a?(String)                t_o=t_o.gsub(/\n/m,"#{Mx[:br_nl]}").                  gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}"). @@ -702,6 +1019,7 @@ module SiSU_AO_DocumentStructureExtract              elsif t_o.is==:group \              || t_o.is==:block \              || t_o.is==:alt \ +            || t_o.is==:box \              || t_o.is==:verse                t_o.obj=t_o.obj.gsub(/\n/m,"#{Mx[:br_nl]}").                  gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}"). @@ -715,26 +1033,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 @@ -747,19 +1106,28 @@ 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)        lines,lines_new=@data,[]        lines.each do |line|          line=if line =~/\S/ \ -        and line !~/^(?:code\{|\}code)/ \ -        and line !~/^(?:```[ ]+code|```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$)/ \ +        and line !~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|\}code)/ \ +        and line !~/^(?:```[ ]+code(?:\.[a-z][0-9a-z_]+)?|```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$)/ \          and not line.is_a?(Hash) #watch            @@counter+=1 if @@flag[:code]==:curls or @@flag[:code]==:tics            line=line.gsub(/\s\s/,"#{Mx[:nbsp]*2}"). @@ -767,7 +1135,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]}") @@ -779,45 +1147,74 @@ module SiSU_AO_DocumentStructureExtract      end    end    class Structure                                          # this must happen early -    def initialize(md,dob) -      @md,@dob=md,dob +    def initialize(md) +      @md=md      end -    def structure -      structure_markup -      @dob +    def structure(data) +      data.compact.each do |dob| +        structure_markup(dob) +      end      end -    def structure_markup                                   #build structure where structure provided only in meta header -      @dob=if @dob.is==:para \ -      && (((@dob.hang !~/[1-9]/) && (@dob.indent !~/[1-9]/)) \ -      || (@dob.hang != @dob.indent)) \ -      and not @dob.bullet_ -        @dob=case @dob.obj +    def structure_markup(dob)                                   #build structure where structure provided only in meta header +      dob=if dob.is==:para \ +      && (((dob.hang !~/[1-9]/) && (dob.indent !~/[1-9]/)) \ +      || (dob.hang != dob.indent)) \ +      and not dob.bullet_ +        dob=case dob.obj          when /^#{@md.lv0}/ -          h={ lv: 'A', ln: 0 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: 'A', +            ln: 0, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv1}/ -          h={ lv: 'B', ln: 1 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: 'B', +            ln: 1, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv2}/ -          h={ lv: 'C', ln: 2 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: 'C', +            ln: 2, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv3}/ -          h={ lv: 'D', ln: 3 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: 'D', +            ln: 3, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv4}/ -          h={ lv: '1', ln: 4 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: '1', +            ln: 4, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv5}/ -          h={ lv: '2', ln: 5 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: '2', +            ln: 5, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv6}/ -          h={ lv: '3', ln: 6 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) -        else @dob +          h={ +            is: :heading, +            lv: '3', +            ln: 6, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob) +        else dob          end -      else @dob +      else dob        end -      @dob +      dob      end    end    class OCN @@ -1190,6 +1587,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}                ocnc+=1                ocn_sp,parent="c#{ocnc}",node              elsif dob.is==:group \ +            || dob.is==:box \              || dob.is==:block \              || dob.is==:alt \              || dob.is==:verse @@ -1204,7 +1602,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 @@ -1215,19 +1614,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 @@ -1237,6 +1639,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}          if dob.is==:code \          || dob.is==:verse \          || dob.is==:alt \ +        || dob.is==:box \          || dob.is==:group \          || dob.is==:block            dob.obj=dob.obj.gsub(/\n+/,"\n") #newlines taken out @@ -1274,7 +1677,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" @@ -1366,7 +1772,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) @@ -1379,121 +1791,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 <!e(\d)!> <!e_(\d)!> -->          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 <!e!> <!e_!> -->            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 ea499119..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 @@ -333,7 +353,7 @@ module SiSU_AO_Insertions        tuned_file,tuned_file_tmp=[],[]        codeblock_=false        data.each do |para| -        codeblock_=if para =~/^(?:code\{|```[ ]+code)/ +        codeblock_=if para =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?)/            true          elsif para =~/^(?:\}code|```(?:\s|$))/m            false 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] << %{<a href="##{x}">#{x}</a>,#{$ep[:hsp]}} -          idx[:xhtml] << %{<a href="##{x.downcase}">#{x}</a>,#{$ep[:hsp]}} +          idx[:html] << +            %{<a href="##{x}">#{x}</a>,#{$ep[:hsp]}} +          idx[:xhtml] << +            %{<a href="##{x.downcase}">#{x}</a>,#{$ep[:hsp]}}          end        end        idx[:html] << '</p>'        idx[:xhtml] << '</p>'        letter=alph.shift -      idx[:html] << %{\n<p class="book_index_lev1"><a name="numeral"></a></p>} -      idx[:xhtml] << %{\n<p class="letter" id="numeral">0 - 9</p>} +      idx[:html] << +        %{\n<p class="book_index_lev1"><a name="numeral"></a></p>} +      idx[:xhtml] << +        %{\n<p class="letter" id="numeral">0 - 9</p>}        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<p class="letter"><a name="#{letter}">#{letter}</a></p><p class="book_index_lev1"><a name="#{letter.downcase}"> </a></p>} -                  idx[:xhtml] << %{\n<p class="letter" id="#{letter.downcase}">#{letter}</p>} +                  idx[:html] << +                    %{\n<p class="letter"><a name="#{letter}">#{letter}</a></p><p class="book_index_lev1"><a name="#{letter.downcase}"> </a></p>} +                  idx[:xhtml] << +                    %{\n<p class="letter" id="#{letter.downcase}">#{letter}</p>}                  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<p class="book_index_lev1"><a name="#{aname}"><b>#{x}</b></a>, } +            idx[:html] << +              %{\n<p class="book_index_lev1"><a name="#{aname}"><b>#{x}</b></a>, }              c=clean_xml(x.dup) -            idx[:xhtml] << %{\n<p class="book_index_lev1"><b>#{c}</b>, } +            idx[:xhtml] << +              %{\n<p class="book_index_lev1"><b>#{c}</b>, }              @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 href="#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}">#{a[:range]}</a>, } -                  idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:range]}</a>, } +                  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 href="#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}">#{a[:range]}</a>, } +                  idx[:xhtml][@q]= +                    idx[:xhtml][@q] + +                    %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:range]}</a>, }                    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 href="#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}">#{a[:ocn]}</a>, } -                  idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:ocn]}</a>, } +                  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 href="#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}">#{a[:ocn]}</a>, } +                  idx[:xhtml][@q]= +                    idx[:xhtml][@q] + +                    %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:ocn]}</a>, }                    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<p class="book_index_lev2">#{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<p class="book_index_lev2">#{k}, }                    c=clean_xml(k.dup) -                  idx[:xhtml][@r]=idx[:xhtml][@r] + %{\n<p class="book_index_lev2">#{c}, } +                  idx[:xhtml][@r]= +                    idx[:xhtml][@r] + +                    %{\n<p class="book_index_lev2">#{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] + %{<a href="#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}">#{z[:range]}</a>, } -                      idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:range]}</a>, } +                      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] + +                        %{<a href="#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}">#{z[:range]}</a>, } +                      idx[:xhtml][@q]= +                        idx[:xhtml][@q] + +                        %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:range]}</a>, }                        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] + %{<a href="#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}">#{z[:ocn]}</a>, } -                      idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:ocn]}</a>, } +                      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] + +                        %{<a href="#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}">#{z[:ocn]}</a>, } +                      idx[:xhtml][@q]= +                        idx[:xhtml][@q] + +                        %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:ocn]}</a>, }                        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 419241e1..09842fcc 100644 --- a/lib/sisu/v5/ao_misc_arrange.rb +++ b/lib/sisu/v5/ao_misc_arrange.rb @@ -66,25 +66,30 @@ module SiSU_AO_MiscArrangeText        @md,@data=md,data      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 +      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        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      def markup_blocks(para)        def ticks(para)          block_open,block_close,text=nil,nil,nil -        if para =~/\A```[ ]+(?:code|poem|alt|group|block|table).*?\n.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m +        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|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            : (para=[]; para << block_open << text << block_close) -        elsif para =~/\A```[ ]+(?:code|poem|alt|group|block|table).*?\n.*?\Z/m #look at, study +        elsif para =~/\A```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?\n.*?\Z/m #look at, study            @flag=:open            block_open,text=/\A(```(?:[ ]+.+?))\n(.*?)\Z/m.match(para)[1,2]            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,28 +115,56 @@ 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,'').            strip        end +      def ticks_quote(para) +        @flag=:quote_open +        text=para +        para=[] +        if text =~ /```[ ]+quote/m +          para << '`:quote_open`' +          text=text.gsub(/```[ ]+quote/m,'') +        end +        text=if text =~/(?:\n|\A)=\{.+?\}/m                               #exclude book index from indent markup +          txt,bkidx,tail=/(.+?)((?:\n|\A)=\{.+?\}$)(.*)/m.match(text).captures +          txt=txt.gsub(/(?:\n|\A)([^`\n]+)/m,'_1 \1') +          txt + bkidx + tail +        else text.gsub(/(?:\n|\A)([^`\n]+)/m,'_1 \1') +        end +        para << text.gsub(/```/m,'') +        if text =~/```/m +          @flag=:quote_close +          para << '`:quote_close`' +        end +        para +      end        def curly_braces(para)          block_open,block_close,text=nil,nil,nil -        para=if para =~/\A(?:code|poem|alt|group|block|table)\{ .+?\n.+?\n\}(?:code|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m -          block_open,text,block_close=/\A((?:code|poem|alt|group|block|table)\{ .+?)\n(.+?)\n(\}(?:code|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1..3] +        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]            para=[]            para << block_open << text << block_close -        elsif para =~/\A(?:code|poem|alt|group|block|table)\{ .+?\n.+?\Z/m -          block_open,text=/\A((?:code|poem|alt|group|block|table)\{ .+?)\n(.+?)\Z/m.match(para)[1,2] +        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]            para=[]            if not text.to_s.empty?              para << block_open << text            else              para << block_open            end -        elsif para =~/\A.+?\n\}(?:code|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m -          text,block_close=/\A(.+?)\n(\}(?:code|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1,2] +        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]            para=[]            if not text.to_s.empty?              para << text.to_s << block_close @@ -141,7 +175,11 @@ module SiSU_AO_MiscArrangeText          end          para        end -      para=if para =~/\A```[ ]+(?:code|poem|alt|group|block|table).*?\n.*?\Z/m \ +      para=if (para =~/\A```[ ]+quote/m \ +      and @flag !=:open) \ +      or @flag==:quote_open +        ticks_quote(para) +      elsif para =~/\A```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?\n.*?\Z/m \        or @flag==:open          ticks(para)        elsif para =~/```/m @@ -149,9 +187,11 @@ module SiSU_AO_MiscArrangeText        else          para        end -      para=(para =~/^(?:code|poem|alt|group|block|table)\{|^\}(?:code|poem|alt|group|block|table)/m) \ -      ? curly_braces(para) -      : para +      para=if para =~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{|^\}(?:code|box|poem|alt|group|block|table)/m +        curly_braces(para) +      else +        para +      end      end      def prepare_text        data=@data diff --git a/lib/sisu/v5/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb index a143abeb..c4b6558f 100644 --- a/lib/sisu/v5/ao_numbering.rb +++ b/lib/sisu/v5/ao_numbering.rb @@ -63,10 +63,23 @@  module SiSU_AO_Numbering    class Numbering      attr_accessor :obj,:osp,:ocn,:lv,:name,:index,:comment +    @@segments_count=0      def initialize(md,data)        @md,@data=md,data        @obj=@type=@ocn=@lv=@name=@index=@comment=nil      end +    def number_of_segments? +      if @@segments_count==0 +        @data.each do |dob| +          if dob.is ==  :heading \ +          and dob.lv == '1' +            @@segments_count += 1 +          end +        end +        @@segments_count +      else @@segments_count +      end +    end      def numbering_song        data=@data        data=number_plaintext_para(data) @@ -121,7 +134,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]}/,''). @@ -151,7 +165,6 @@ module SiSU_AO_Numbering        data=data.compact        data.each do |dob| #@md.seg_names << [additions to segment names]          title_no=nil -        dob=SiSU_AO_DocumentStructureExtract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require          if dob.is ==:heading \          && dob.autonum_ \          and defined? @md.make.num_top \ @@ -279,6 +292,33 @@ module SiSU_AO_Numbering        end        @tuned_file=@tuned_file.flatten      end +    def leading_zeros_fixed_width_number(possible_seg_name) +      if possible_seg_name =~/^([\d]+?\.|[\d]+)$/m          #!~/[.,:-]+/ +        possible_seg_name=possible_seg_name. +          gsub(/\.$/,'') +        nl=possible_seg_name.to_s.length +        zero='0' +        zeros_fixed_width=number_of_segments?.to_s.length +        zero_width=(zeros_fixed_width - nl) +        zero_width == 0 \ +        ? Mx[:auto_seg_prefix] + +          possible_seg_name.to_s +        : Mx[:auto_seg_prefix] + +          zero*zero_width + +          possible_seg_name.to_s +      end +    end +    def auto_seg_name(possible_seg_name) +      if possible_seg_name =~/^([\d]+?\.|[\d]+)$/m          #!~/[.,:-]+/ +        leading_zeros_fixed_width_number(possible_seg_name) +      elsif possible_seg_name =~/^[\d.,:-]+$/m +        possible_seg_name=possible_seg_name. +          gsub(/(?:[:,-]|\W)/,'.'). +          gsub(/\.$/,'') +        #Mx[:auto_seg_prefix] + possible_seg_name +      else possible_seg_name +      end +    end      def name_para_seg_filename(data)                                                   #segment naming, remaining        # paragraph name/numbering rules        # manual naming overrides, manual naming may be @@ -313,9 +353,12 @@ module SiSU_AO_Numbering              @md.set_heading_seg=true            end            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 +          and dob.obj =~/^\s*(?:\S+\s+)?([\d.,:-]+)/m      #heading starts with a recognised numeric or word followed by a recognised numeric construct, use that as name              possible_seg_name=$1 -            possible_seg_name=possible_seg_name.gsub(/(?:[:,-]|\W)/,'.'). +            possible_seg_name= +              auto_seg_name(possible_seg_name) +            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) @@ -337,13 +380,13 @@ module SiSU_AO_Numbering            end            if dob.ln==4 \            and not dob.name                                 #if still no segment name, provide a numerical one -            pf='_'                                         #pg='' #may use e.g. '' or '~' or '_' -            segn_auto="#{pf}#{art_filename_auto.to_s}" +            possible_seg_name= +              auto_seg_name(art_filename_auto)              if @md.seg_names.is_a?(Array) \ -            and not @md.seg_names.include?(segn_auto) -             dob.name=segn_auto +            and not @md.seg_names.include?(possible_seg_name) +             dob.name=possible_seg_name               dob.tags=set_tags(dob.tags,dob.name) -              @md.seg_names << segn_auto +              @md.seg_names << possible_seg_name              else puts 'segment name (numbering) error'              end              art_filename_auto+=1 @@ -363,11 +406,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 +430,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 +495,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 +542,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 a75e2690..99cb6ca0 100644 --- a/lib/sisu/v5/ao_syntax.rb +++ b/lib/sisu/v5/ao_syntax.rb @@ -91,7 +91,7 @@ module SiSU_AO_Syntax          { o: Mx[:fa_underscore_o], c: Mx[:fa_underscore_c] }        else p __LINE__.to_s + '::' + __FILE__        end -      @http_m=%r{\{.+?\}https?://\S+|https?:\S+|:\S+|\.\.\/\S+|#\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|block|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}} +      @http_m=%r{\{.+?\}https?://\S+|https?:\S+|:\S+|\.\.\/\S+|#\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|block|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}}        @manmkp_ital=emph_italics \        ? '[i/*]\\{.+?\\}[i/*]'        : '[i/]\\{.+?\\}[i/]' @@ -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 @@ -163,6 +164,7 @@ module SiSU_AO_Syntax          && dob.is !=:heading \          && dob.is !=:heading_insert \          && dob.is !=:code \ +        && dob.is !=:layout \          && dob.is !=:comment            word=dob.obj.scan(@line_scan_ital)            word=word.flatten.compact @@ -189,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]}"). @@ -203,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"). @@ -281,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+/ @@ -323,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 @@ -335,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 @@ -398,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 @@ -430,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(/<!(\S+)!>/,'<:\1>').                                              #escaped special character            gsub(/ /,"#{Mx[:nbsp]}").                                          #escaped special character @@ -462,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, @@ -485,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 @@ -525,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 <br> <br /> back, clumsy          if dob.number_            codeline=[] @@ -568,7 +586,8 @@ module SiSU_AO_Syntax        # +2                  <!i2!>        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/constants.rb b/lib/sisu/v5/constants.rb index 42ab53a3..eb252fda 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -104,6 +104,7 @@ Xx={    html_relative1:            '※',  }  Mx={ +  auto_seg_prefix:           's',    ocn_id_char:               'o',    note:                      'note_',    note_ref:                  'noteref_', @@ -333,6 +334,7 @@ DISABLE={  }  DEVELOPER={    maintenance:               :false, +  under_construction:        '_CONSTRUCTION_ZONE',  }  __END__  utils.rb diff --git a/lib/sisu/v5/concordance.rb b/lib/sisu/v5/html_concordance.rb index b9030123..b9030123 100644 --- a/lib/sisu/v5/concordance.rb +++ b/lib/sisu/v5/html_concordance.rb diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 152de391..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$/ @@ -307,7 +324,7 @@ module SiSU            $process_document = :ok            unless @opt.act[:po4a][:set]==:on            # --po4a, -P              if @opt.fno =~ /\.ssm$/ -              require_relative 'composite'             # composite.rb #pre-processing +              require_relative 'ao_composite'          # ao_composite.rb #pre-processing                SiSU_Assemble::Composite.new(@opt).read              end              require_relative 'ao'                      # -m     ao.rb @@ -357,7 +374,7 @@ module SiSU              end            end            if @opt.act[:concordance][:set]==:on           #% --concordance, -w -            require_relative 'concordance'               #  concordance.rb +            require_relative 'html_concordance'          #  html_concordance.rb              SiSU_Concordance::Source.new(@opt).read            end            if @opt.act[:epub][:set]==:on                  #% --epub, -e @@ -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..b2e50d41 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,10 +1160,14 @@ module SiSU_Param                : ''                title=@title.full.gsub(/\s*(?:<p>|<p \/>|<br>|<br \/>)\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*$/ +            and para =~/^=\{(.+?)\}[\s`]*\Z/m                @book_idx=true              end              unless @code_flag @@ -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/v5/po4a.rb b/lib/sisu/v5/po4a.rb index 990600aa..0b11600a 100644 --- a/lib/sisu/v5/po4a.rb +++ b/lib/sisu/v5/po4a.rb @@ -65,7 +65,7 @@ module SiSU_Po4a    require_relative 'ao'                                 # ao.rb    require_relative 'sysenv'                             # sysenv.rb      include SiSU_Env -  require_relative 'composite'                          # composite.rb +  require_relative 'ao_composite'                       # ao_composite.rb    require_relative 'shared_metadata'                    # shared_metadata.rb    require_relative 'po4a_set'                           # po4a_set.rb    include SiSU_Param diff --git a/lib/sisu/v5/remote.rb b/lib/sisu/v5/remote.rb index e06e7b33..191b2edc 100644 --- a/lib/sisu/v5/remote.rb +++ b/lib/sisu/v5/remote.rb @@ -118,7 +118,7 @@ module SiSU_Remote        rescue LoadError          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('open-uri or pp NOT FOUND (LoadError)')        end -      require_relative 'composite'                      # composite.rb +      require_relative 'ao_composite'                   # ao_composite.rb        @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/        threads=[]        for requested_page in @get_s diff --git a/lib/sisu/v5/shared_metadata.rb b/lib/sisu/v5/shared_metadata.rb index 4ada2db1..1f21af3f 100644 --- a/lib/sisu/v5/shared_metadata.rb +++ b/lib/sisu/v5/shared_metadata.rb @@ -297,6 +297,57 @@ module SiSU_Metadata        end        meta      end +    def metadata_alt +      meta=[] +      if @display_heading +        @tag,@inf=%{<b><u>Document Metadata</u></b>},'' +        meta << self.meta_para +      end +      if defined? @md.title.main \ +      and @md.title.main=~/\S+/ +        @tag='title' +        @inf=@md.title.main +        meta << self.meta_para +      end +      if defined? @md.title.sub \ +      and @md.title.sub=~/\S+/ +        @tag='subtitle' +        @inf=@md.title.sub +        meta << self.meta_para +      end +      if defined? @md.creator.author \ +      and @md.creator.author=~/\S+/ +        @tag='author' +        @inf=@md.creator.author +        meta << self.meta_para +      end +      if defined? @md.creator.translator \ +      and @md.creator.translator=~/\S+/ +        @tag='translator' +        @inf=@md.creator.translator +        meta << self.meta_para +      end +      if defined? @md.creator.illustrator \ +      and @md.creator.illustrator=~/\S+/ +        @tag='illustrator' +        @inf=@md.creator.illustrator +        meta << self.meta_para +      end +      if defined? @md.rights.copyright.text \ +      and @md.rights.copyright.text=~/\S+/ +        @tag='copyright' +        @inf=@md.rights.copyright.text # year & holder +        @inf=@inf.gsub(/(?:Copyright|\(C\))+\s*/,'') +        meta << self.meta_para +      end +      if defined? @md.rights.license \ +      and @md.rights.license=~/\S+/ +        @tag='license' +        @inf=@md.rights.license +        meta << self.meta_para +      end +      meta +    end      def processing_tags        def make          def language @@ -756,6 +807,21 @@ module SiSU_Metadata        end        self      end +    def xml_docbook +      def meta_para +        inf_xml=char_enc(@inf).utf8 +        inf_xml=char_enc(inf_xml).br +        <<WOK +#{Ax[:tab]}<#{@tag}> +#{Ax[:tab]*2}#{inf_xml} +#{Ax[:tab]}</#{@tag}> +WOK +      end +      def metadata +        SiSU_Metadata::Summary.new(@md).metadata_alt +      end +      self +    end      def xml_sax        def meta_para          inf_xml=char_enc(@inf).utf8 diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index cfd40460..7358ff40 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -6032,7 +6032,7 @@ WOK        end        def textile          def ft -         'textile_CONSTRUCTION_ZONE' +         'textile' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6053,7 +6053,7 @@ WOK        end        def asciidoc          def ft -         'asciidoc_CONSTRUCTION_ZONE' +         'asciidoc' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6074,7 +6074,7 @@ WOK        end        def markdown          def ft -         'markdown_CONSTRUCTION_ZONE' +         'markdown' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6095,7 +6095,7 @@ WOK        end        def rst          def ft -         'rst_CONSTRUCTION_ZONE' +         'rst' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6315,7 +6315,7 @@ WOK        end        def xml_docbook          def ft -         'docbook_CONSTRUCTION_ZONE' +         'docbook' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6339,7 +6339,7 @@ WOK        end        def xml_docbook_article          def ft -         'docbook' +         'docbook' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6363,7 +6363,7 @@ WOK        end        def xml_docbook_book          def ft -         'docbook_CONSTRUCTION_ZONE' +         'docbook' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6387,7 +6387,7 @@ WOK        end        def xml_fictionbook          def ft -         'fictionbook_CONSTRUCTION_ZONE' +         'fictionbook' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc diff --git a/lib/sisu/v5/txt_shared.rb b/lib/sisu/v5/txt_shared.rb index 0b6c1953..2bf633ea 100644 --- a/lib/sisu/v5/txt_shared.rb +++ b/lib/sisu/v5/txt_shared.rb @@ -62,8 +62,8 @@  =end  module SiSU_TextUtils    class Wrap -    def initialize(para='',n_char_max=76,n_indent=0,n_hang=nil) -      @para,@n_char_max,@n_indent=para,n_char_max,n_indent +    def initialize(para='',n_char_max=76,n_indent=0,n_hang=nil,post='') +      @para,@n_char_max,@n_indent,@post,=para,n_char_max,n_indent,post        @n_char_max_extend = n_char_max        @n_hang=n_hang ? n_hang : @n_indent      end @@ -110,7 +110,10 @@ module SiSU_TextUtils          end          @oldword=word if word =~/\S+/        end -      spaces_hang + out.join(spaces_indent) +      post=(@post.empty?) \ +      ? '' +      : "\n" + (' '*@n_indent) +@post +      spaces_hang + out.join(spaces_indent) + post      end      def line_wrap_indent1        @n_indent,@n_hang=2,2 diff --git a/lib/sisu/v5/xhtml_epub2_segments.rb b/lib/sisu/v5/xhtml_epub2_segments.rb index 8612696f..3c3b3263 100644 --- a/lib/sisu/v5/xhtml_epub2_segments.rb +++ b/lib/sisu/v5/xhtml_epub2_segments.rb @@ -80,6 +80,7 @@ module SiSU_XHTML_EPUB2_Seg            filename_seg << @seg[:heading_endnotes] << @seg[:headings] << %{\n<div class="content">\n} << @seg[:endnote_all] << '</div>'          elsif @type=='idx'            @seg[:headings]=[] +          txt_obj={ txt: 'Index', ocn_display: ''}            format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)            @seg[:headings] << format_seg.title_heading1            filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n<div class="content">\n} << @seg[:idx] << '</div>' diff --git a/lib/sisu/v5/xml_docbook5.rb b/lib/sisu/v5/xml_docbook5.rb index 98450520..3a59f839 100644 --- a/lib/sisu/v5/xml_docbook5.rb +++ b/lib/sisu/v5/xml_docbook5.rb @@ -70,6 +70,7 @@ module SiSU_XML_Docbook_Book      include SiSU_TextUtils    require_relative 'xml_shared'                         # xml_shared.rb      include SiSU_XML_Munge +  require_relative 'shared_metadata'                    # shared_metadata.rb    class Source      def initialize(opt)        @opt=opt @@ -135,7 +136,7 @@ module SiSU_XML_Docbook_Book          def collapsed            %w[ 0 1 2 3 4 5 ]          end -        def docbook(lc,chlv='') +        def docbook_tag(lc,chlv='')            case lc            when 0 then 'book'            when 1 then lc==chlv ? 'chapter' : 'section' @@ -162,7 +163,7 @@ module SiSU_XML_Docbook_Book        end        def markup_text(data)          data.each_with_index do |o,i| -          if o.is ==:heading || o.is ==:para +          if o.is ==:heading || o.is ==:para || o.is ==:open_close_tags              o=@trans.markup_docbook(o) #unless o.obj==nil            end          end @@ -189,6 +190,38 @@ module SiSU_XML_Docbook_Book        end        #def chapterlevel        #end +      def xml_head +        [ +          '<docinfo>', +          SiSU_Metadata::Summary.new(@md).xml_docbook.metadata, +          '</docinfo>' +        ].flatten +      end +      def code_output(o,ocn,filename_docbook) +        filename_docbook.puts o.obj.gsub(/\n?(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\n?/m,"\n") +      end +      def adjust_output(o,ocn,filename_docbook,splv) +        if o.obj =~/#{Xx[:split]}/ +          outs=o.obj.split(/#{Xx[:split]}/) +          outs.each do |out| +            if out =~/<figure id=/m +              out=out.gsub(/:spaces0:/m, +                  %{#{spaces*(splv)}#{spaces}}). +                gsub(/:spaces1:/m, +                  %{#{spaces*(splv)}#{spaces*2}}) +              filename_docbook.puts out +              filename_docbook.puts "#{spaces*3}#{ocn}" +            else +              unless out.empty? +                filename_docbook.puts SiSU_TextUtils::Wrap.new(out,80,(splv*2+2),nil).line_wrap +                filename_docbook.puts "#{spaces*3}#{ocn}" +              end +            end +          end +        else +          filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj,80,(splv*2+2),nil,ocn).line_wrap +        end +      end        def structure_build_collapsed(data)          #output_file=@md.file.output_path.xml_docbook_book.dir + '/' + @md.file.base_filename.xml_docbook_book          file=SiSU_Env::FileOp.new(@md) @@ -197,10 +230,11 @@ module SiSU_XML_Docbook_Book          @chlv=chlv=0          doc_position=:head          filename_docbook.puts head +        filename_docbook.puts xml_head          data.each_with_index do |o,i|            if (defined? o.ocn and not o.ocn.nil?)              ocn=(@make.build.ocn?) \ -            ? "\n#{Dx[:ocn_o]}#{o.ocn}#{Dx[:ocn_c]}" +            ? "<!-- o#{o.ocn} -->"              : ''              id=%{ id="o#{o.ocn}" }            else @@ -217,16 +251,40 @@ module SiSU_XML_Docbook_Book                doc_position=:body_and_tail              else                filename_docbook.puts structure_build_tag_close(o.lc,h) -              filename_docbook.puts  %{#{spaces*(o.lc)}<#{tags.docbook(o.lc,chlv)}#{tag_id}> +              filename_docbook.puts  %{#{spaces*(o.lc)}<#{tags.docbook_tag(o.lc,chlv)}#{tag_id}>  #{spaces*o.lc}<title#{id}>  }              end -            filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap +            adjust_output(o,ocn,filename_docbook,@splv)              filename_docbook.puts %{#{spaces*o.lc}</title>}              h=o.lc -          elsif (o.of ==:para or o.of ==:block) +          elsif o.of ==:layout \ +          and o.is ==:open_close_tags +            xml_tag=case o.sym +            when :quote_open then '<blockquote>' +            when :quote_close then '</blockquote>' +            else '' +            end +            unless xml_tag.empty? +              filename_docbook.puts "#{spaces*(@splv)}#{xml_tag}" +            end +          elsif o.of ==:block +            if o.is ==:table +              filename_docbook.puts SiSU_Tables::TableXMLdocbook.new(o,id).table.obj +            elsif o.is ==:code +              filename_docbook.puts "#{spaces*(@splv)}<para#{id}>" +              filename_docbook.puts "#{spaces*(@splv+1)}<programlisting>" +              code_output(o,ocn,filename_docbook) +              filename_docbook.puts "#{spaces*(@splv+1)}</programlisting>" +              filename_docbook.puts "#{spaces*(@splv)}</para>" +            else +              filename_docbook.puts "#{spaces*(@splv)}<para#{id}>" +              adjust_output(o,ocn,filename_docbook,@splv) +              filename_docbook.puts "#{spaces*(@splv)}</para>" +            end +          elsif o.of ==:para              filename_docbook.puts "#{spaces*(@splv)}<para#{id}>" -            filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap +            adjust_output(o,ocn,filename_docbook,@splv)              filename_docbook.puts "#{spaces*(@splv)}</para>"            end          end @@ -237,40 +295,40 @@ module SiSU_XML_Docbook_Book          x=[]          case h          when 0 -          x << "#{spaces*0}</#{tags.docbook(0)}>"       if (lc <= 0) +          x << "#{spaces*0}</#{tags.docbook_tag(0)}>"       if (lc <= 0)          when 1 -          x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) -          x << "#{spaces*0}</#{tags.docbook(0)}>"       if (lc <= 0) +          x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1) +          x << "#{spaces*0}</#{tags.docbook_tag(0)}>"       if (lc <= 0)          when 2 -          x << "#{spaces*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) -          x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) -          x << "#{spaces*0}</#{tags.docbook(0)}>"       if (lc <= 0) +          x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2) +          x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1) +          x << "#{spaces*0}</#{tags.docbook_tag(0)}>"       if (lc <= 0)          when 3 -          x << "#{spaces*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) -          x << "#{spaces*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) -          x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) -          x << "#{spaces*0}</#{tags.docbook(0)}>"       if (lc <= 0) +          x << "#{spaces*3}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3) +          x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2) +          x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1) +          x << "#{spaces*0}</#{tags.docbook_tag(0)}>"       if (lc <= 0)          when 4 -          x << "#{spaces*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) -          x << "#{spaces*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) -          x << "#{spaces*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) -          x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) -          x << "#{spaces*0}</#{tags.docbook(0)}>"       if (lc <= 0) +          x << "#{spaces*4}</#{tags.docbook_tag(4,@chlv)}>" if (lc <= 4) +          x << "#{spaces*3}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3) +          x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2) +          x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1) +          x << "#{spaces*0}</#{tags.docbook_tag(0)}>"       if (lc <= 0)          when 5 -          x << "#{spaces*5}</#{tags.docbook(5)}>"       if (lc <= 5) -          x << "#{spaces*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) -          x << "#{spaces*5}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) -          x << "#{spaces*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) -          x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) -          x << "#{spaces*0}</#{tags.docbook(0)}>"       if (lc <= 0) +          x << "#{spaces*5}</#{tags.docbook_tag(5)}>"       if (lc <= 5) +          x << "#{spaces*4}</#{tags.docbook_tag(4,@chlv)}>" if (lc <= 4) +          x << "#{spaces*5}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3) +          x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2) +          x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1) +          x << "#{spaces*0}</#{tags.docbook_tag(0)}>"       if (lc <= 0)          when 6 -          x << "#{spaces*6}</#{tags.docbook(6)}>"       if (lc <= 6) -          x << "#{spaces*5}</#{tags.docbook(5)}>"       if (lc <= 5) -          x << "#{spaces*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) -          x << "#{spaces*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) -          x << "#{spaces*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) -          x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) -          x << "#{spaces*0}</#{tags.docbook(0)}>"       if (lc <= 0) +          x << "#{spaces*6}</#{tags.docbook_tag(6)}>"       if (lc <= 6) +          x << "#{spaces*5}</#{tags.docbook_tag(5)}>"       if (lc <= 5) +          x << "#{spaces*4}</#{tags.docbook_tag(4,@chlv)}>" if (lc <= 4) +          x << "#{spaces*3}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3) +          x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2) +          x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1) +          x << "#{spaces*0}</#{tags.docbook_tag(0)}>"       if (lc <= 0)          end          x.join("\n")        end diff --git a/lib/sisu/v5/xml_shared.rb b/lib/sisu/v5/xml_shared.rb index fc972833..f1113495 100644 --- a/lib/sisu/v5/xml_shared.rb +++ b/lib/sisu/v5/xml_shared.rb @@ -460,28 +460,33 @@ module SiSU_XML_Munge        clean(str)      end      def markup_docbook(dob='')                                  # work on, initially a copy of fictionbook! -      dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,'<footnote>\1</footnote>'). -        gsub(/&/,'&'). #sort -        gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). -        gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& '). #sort -        gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') -      dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table -      dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). -        gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). -        gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). -        gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>'). -        gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>'). -        gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>'). -        gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>'). -        gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>'). -        gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd -        gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m,'<image xl:href="../../_sisu/image/\1" />'). #taken unmodified except path from fictionbook -        gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}"). -        gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>'). -        gsub(/#{Mx[:gl_bullet]}/m,'● '). #  not available -        gsub(/#{Mx[:nbsp]}/,' '). #  not available -        gsub(/<(p|br)>/,'<\1 />') -      dob.obj=clean(dob.obj) +      if dob.is !=:code +        dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s*(.+?)#{Mx[:en_a_c]}/m,'<footnote><para><!-- fn\1 -->\2</para></footnote>'). +          gsub(/\\\\/,'</para><para>'). +          gsub(/&/,'&'). #sort +          gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). +          gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& '). #sort +          gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') +        dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table +        dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). +          gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). +          gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). +          gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>'). +          gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>'). +          gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>'). +          gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>'). +          gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>'). +          gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd +          gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m, +            %{#{Xx[:split]}:spaces0:<figure id="\\1">\n:spaces1:<title></title>\n:spaces1:<graphic fileref="images/\\1" align="center" width="50%"></graphic>\n:spaces0:</figure>#{Xx[:split]}}). +          gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}"). +          gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>'). +          gsub(/#{Mx[:gl_bullet]}/m,'● '). #  not available +          gsub(/#{Mx[:nbsp]}/,' '). #  not available +          gsub(/<(p|br)>/,'<\1 />') +        dob.obj=clean(dob.obj) +      else # codeblock +      end        dob      end      def markup_group(dob='') diff --git a/lib/sisu/v5/xml_tables.rb b/lib/sisu/v5/xml_tables.rb index 4ae41190..1587afbc 100644 --- a/lib/sisu/v5/xml_tables.rb +++ b/lib/sisu/v5/xml_tables.rb @@ -122,6 +122,64 @@ module SiSU_Tables        @parablock      end    end +  class TableXMLdocbook +    @@tablehead=0 +    @@tablefoot=[] #watch +    def initialize(table,id='') +      @table_obj,@id=table,id +      @vz=SiSU_Viz::Defaults.new +    end +    def spaces +      Ax[:spaces] +    end +    def table +      table_obj=@table_obj +      if table_obj.obj !~/^<table\s/m +        table_obj=table_rows_and_columns_array(table_obj) +      else p __LINE__; p caller +      end +      table_obj +    end +    def table_rows_and_columns_array(table_obj) # provides basic (x)html table +      table_rows,nr=[],0 +      table_obj.obj.split(Mx[:tc_c]).each do |table_row| +        table_row_with_columns=table_row.split(Mx[:tc_p]) +        trc,nc=[],0 +        table_row_with_columns.each do |c| +          c=c.gsub(/^(?:~| )$/,''). # tilde / empty cell +            gsub(/ /,' '). +            gsub(/<:br>/,'<br />') +          trc <<= if table_obj.head_ and nr==0 +            %{#{spaces*6}<entry>#{c}</entry>\n} +          else %{#{spaces*6}<entry>#{c}</entry>\n} +          end +          nc+=1 +        end +        trc=(trc.is_a?(Array)) ? trc.flatten.join : trc +        trc = if table_obj.head_ and nr==0 +          "#{spaces*4}<thead>\n#{spaces*5}<row>\n#{trc}#{spaces*5}</row>\n#{spaces*4}</thead>\n#{spaces*4}<tbody>\n" +        else +          "#{spaces*5}<row>\n#{trc}#{spaces*5}</row>\n" +        end +        nr+=1 +        table_rows << trc +      end +      tbody_close=if table_obj.head_ +        "#{spaces*4}</tbody>" +      else '' +      end +      table_rows=table_rows.flatten.join +      # include table_id <table id=''> +      table_obj.obj=%{#{spaces*3}<para #{@id}> +#{spaces*4}<table> +#{spaces*4}<tgroup cols="#{table_obj.cols}" align="char"> +#{table_rows}#{tbody_close} +#{spaces*4}</tgroup> +#{spaces*4}</table> +#{spaces*3}</para>} +      table_obj +    end +  end    class TableXMLexp <Table      @@tablehead=0      @@tablefoot=[] 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(/<br>/,"#{Mx[:br_line]}").                              #needed by xml, xhtml etc. +            gsub(/<br>/,"#{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/composite.rb b/lib/sisu/v6/ao_composite.rb index 2afff1bf..2f864228 100644 --- a/lib/sisu/v6/composite.rb +++ b/lib/sisu/v6/ao_composite.rb @@ -51,7 +51,7 @@   * Git     <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> -   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/composite.rb;hb=HEAD> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/ao_composite.rb;hb=HEAD>   * Ralph Amissah     <ralph@amissah.com> @@ -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..44660469 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 @@ -477,10 +499,10 @@ module SiSU_AO_DocumentStructure      end    end    class ObjectLayout -    attr_accessor :obj,:sym,:attr,:is,:of,:from,:tmp,:num +    attr_accessor :obj,:sym,:attr,:is,:is_for,:of,:from,:tmp,:num      def initialize        @of=:layout -      @is=@obj=@from=@tmp=@num=nil +      @is=@is_for=@obj=@from=@tmp=@num=nil      end      def break(h,f=nil)                                                         #decide how to deal with        of=     @of                                                              #Symbol, classification - group @@ -502,12 +524,14 @@ module SiSU_AO_DocumentStructure      def open_close(h,o=nil)                                                    #useful for poem & quote        of=     @of                                                              #Symbol, classification - group        is=     :open_close_tags                                                 #Symbol, classification - specific type +      is_for= h[:is_for]  || ((defined? o.is_for)    ? o.is_for  : nil)        #String, text content        obj=    h[:obj]     || ((defined? o.obj)       ? o.obj     : nil)        #String, text content        sym=    h[:sym]     || ((defined? o.sym)       ? o.sym     : nil)        #Symbol tag_open, tag_close        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,@is_for,@obj,@sym,@attr,@tmp,@num= +      of, is, is_for, 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..2a96abb7 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+)/ @@ -191,14 +200,19 @@ module SiSU_AO_DocumentStructureExtract        idx_array_raw=idxraw.scan(/[^;]+/)        idx_hash,idx_array,idx_lst={},[],[]        idx_array_raw.each do |idx| +        idx=idx.strip          idx_lst=case idx          when /\S+?\s*:/            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 +221,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 +240,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 +274,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 @@ -277,11 +309,11 @@ module SiSU_AO_DocumentStructureExtract          and @@flag[:box]==:off \          and @@flag[:table]==:off            unless t_o =~/^(?:@\S+?:|%+)\s/                  # extract book index for paragraph if any -            idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1 -              m=m.split(/\n/).join(' '). +            idx=if t_o=~/^=\{\s*(.+)\s*\}\s*$\Z/m; m=$1 +              m=m.split(/[ ]*\n/).join(' ').                  gsub(/\s+([|:;])\s+/,'\1').                  gsub(/\s+([+]\d+)\s+/,'\1') -              t_o=t_o.gsub(/\n=\{.+\}\s*$\Z/m,'') +              t_o=t_o.gsub(/\n=\{.+?\}\s*$/m,'')                idx_array_and_hash=construct_idx_array_and_hash(m)                idx_array_and_hash[:hash]              else nil @@ -296,7 +328,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 +351,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 +375,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 +400,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 +429,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 +462,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,9 +495,20 @@ 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? } -              SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h) +              h={ +                bullet_: false, +                indent: 0, +                hang: 0, +                obj: obj, +                idx: idx, +                note_: note, +                image_: image, +                tags: tags, +                quote: quotes?, +              } +              t_o=SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)              end +            t_o=SiSU_AO_DocumentStructureExtract::Structure.new(@md).structure_markup(t_o) #must happen earlier, node info etc. require            end          elsif @@flag[:code]==:off            if t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?)/ @@ -447,9 +528,18 @@ 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={ +              is_for: :code, +              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 +548,93 @@ module SiSU_AO_DocumentStructureExtract              else                  @@flag[:poem] #error              end              @num_id[:poem] +=1 -            h={  obj: '', sym: :poem_open, num: @num_id[:poem] } +            h={ +              is_for: :poem, +              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={ +              is_for: :box, +              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={ +              is_for: :group, +              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={ +              is_for: :block, +              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={ +              is_for: :alt, +              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={ +              is_for: :quote, +              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={ +              is_for: :table, +              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 +650,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 +669,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 +685,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 +698,31 @@ 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={ +                is_for: :table, +                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 +731,26 @@ 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={ +                is_for: :table, +                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 +767,26 @@ 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={ +                is_for: :table, +                obj: '', +                sym: :table_close, +                num: @num_id[:table], +              }                t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)                t_o              end @@ -626,11 +800,22 @@ 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={ +              is_for: :table, +              obj: '', +              sym: :table_close, +              num: @num_id[:table], +            }              t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)              t_o            else @@ -650,12 +835,23 @@ 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={ +              is_for: :code, +              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 +872,109 @@ 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={ +              is_for: :poem, +              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={ +              is_for: :box, +              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={ +              is_for: :group, +              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={ +              is_for: :block, +              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={ +              is_for: :alt, +              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={ +              is_for: :quote, +              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 +991,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 +1033,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 +1106,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 +1135,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]}") @@ -843,45 +1147,74 @@ module SiSU_AO_DocumentStructureExtract      end    end    class Structure                                          # this must happen early -    def initialize(md,dob) -      @md,@dob=md,dob +    def initialize(md) +      @md=md      end -    def structure -      structure_markup -      @dob +    def structure(data) +      data.compact.each do |dob| +        structure_markup(dob) +      end      end -    def structure_markup                                   #build structure where structure provided only in meta header -      @dob=if @dob.is==:para \ -      && (((@dob.hang !~/[1-9]/) && (@dob.indent !~/[1-9]/)) \ -      || (@dob.hang != @dob.indent)) \ -      and not @dob.bullet_ -        @dob=case @dob.obj +    def structure_markup(dob)                                   #build structure where structure provided only in meta header +      dob=if dob.is==:para \ +      && (((dob.hang !~/[1-9]/) && (dob.indent !~/[1-9]/)) \ +      || (dob.hang != dob.indent)) \ +      and not dob.bullet_ +        dob=case dob.obj          when /^#{@md.lv0}/ -          h={ lv: 'A', ln: 0 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: 'A', +            ln: 0, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv1}/ -          h={ lv: 'B', ln: 1 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: 'B', +            ln: 1, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv2}/ -          h={ lv: 'C', ln: 2 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: 'C', +            ln: 2, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv3}/ -          h={ lv: 'D', ln: 3 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: 'D', +            ln: 3, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv4}/ -          h={ lv: '1', ln: 4 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: '1', +            ln: 4, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv5}/ -          h={ lv: '2', ln: 5 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) +          h={ +            is: :heading, +            lv: '2', +            ln: 5, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob)          when /^#{@md.lv6}/ -          h={ lv: '3', ln: 6 } -          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,@dob) -        else @dob +          h={ +            is: :heading, +            lv: '3', +            ln: 6, +          } +          SiSU_AO_DocumentStructure::ObjectHeading.new.heading(h,dob) +        else dob          end -      else @dob +      else dob        end -      @dob +      dob      end    end    class OCN @@ -1269,7 +1602,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 +1614,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 +1677,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 +1772,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 +1791,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 <!e(\d)!> <!e_(\d)!> -->          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 <!e!> <!e_!> -->            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] << %{<a href="##{x}">#{x}</a>,#{$ep[:hsp]}} -          idx[:xhtml] << %{<a href="##{x.downcase}">#{x}</a>,#{$ep[:hsp]}} +          idx[:html] << +            %{<a href="##{x}">#{x}</a>,#{$ep[:hsp]}} +          idx[:xhtml] << +            %{<a href="##{x.downcase}">#{x}</a>,#{$ep[:hsp]}}          end        end        idx[:html] << '</p>'        idx[:xhtml] << '</p>'        letter=alph.shift -      idx[:html] << %{\n<p class="book_index_lev1"><a name="numeral"></a></p>} -      idx[:xhtml] << %{\n<p class="letter" id="numeral">0 - 9</p>} +      idx[:html] << +        %{\n<p class="book_index_lev1"><a name="numeral"></a></p>} +      idx[:xhtml] << +        %{\n<p class="letter" id="numeral">0 - 9</p>}        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<p class="letter"><a name="#{letter}">#{letter}</a></p><p class="book_index_lev1"><a name="#{letter.downcase}"> </a></p>} -                  idx[:xhtml] << %{\n<p class="letter" id="#{letter.downcase}">#{letter}</p>} +                  idx[:html] << +                    %{\n<p class="letter"><a name="#{letter}">#{letter}</a></p><p class="book_index_lev1"><a name="#{letter.downcase}"> </a></p>} +                  idx[:xhtml] << +                    %{\n<p class="letter" id="#{letter.downcase}">#{letter}</p>}                  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<p class="book_index_lev1"><a name="#{aname}"><b>#{x}</b></a>, } +            idx[:html] << +              %{\n<p class="book_index_lev1"><a name="#{aname}"><b>#{x}</b></a>, }              c=clean_xml(x.dup) -            idx[:xhtml] << %{\n<p class="book_index_lev1"><b>#{c}</b>, } +            idx[:xhtml] << +              %{\n<p class="book_index_lev1"><b>#{c}</b>, }              @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 href="#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}">#{a[:range]}</a>, } -                  idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:range]}</a>, } +                  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 href="#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}">#{a[:range]}</a>, } +                  idx[:xhtml][@q]= +                    idx[:xhtml][@q] + +                    %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:range]}</a>, }                    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 href="#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}">#{a[:ocn]}</a>, } -                  idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:ocn]}</a>, } +                  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 href="#{a[:seg]}.html##{@ocn_html_identifier}#{a[:ocn]}">#{a[:ocn]}</a>, } +                  idx[:xhtml][@q]= +                    idx[:xhtml][@q] + +                    %{<a href="#{a[:seg]}.xhtml#o#{a[:ocn]}">#{a[:ocn]}</a>, }                    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<p class="book_index_lev2">#{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<p class="book_index_lev2">#{k}, }                    c=clean_xml(k.dup) -                  idx[:xhtml][@r]=idx[:xhtml][@r] + %{\n<p class="book_index_lev2">#{c}, } +                  idx[:xhtml][@r]= +                    idx[:xhtml][@r] + +                    %{\n<p class="book_index_lev2">#{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] + %{<a href="#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}">#{z[:range]}</a>, } -                      idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:range]}</a>, } +                      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] + +                        %{<a href="#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}">#{z[:range]}</a>, } +                      idx[:xhtml][@q]= +                        idx[:xhtml][@q] + +                        %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:range]}</a>, }                        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] + %{<a href="#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}">#{z[:ocn]}</a>, } -                      idx[:xhtml][@q]=idx[:xhtml][@q] + %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:ocn]}</a>, } +                      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] + +                        %{<a href="#{z[:seg]}.html##{@ocn_html_identifier}#{z[:ocn]}">#{z[:ocn]}</a>, } +                      idx[:xhtml][@q]= +                        idx[:xhtml][@q] + +                        %{<a href="#{z[:seg]}.xhtml#o#{z[:ocn]}">#{z[:ocn]}</a>, }                        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..8adebfd5 100644 --- a/lib/sisu/v6/ao_misc_arrange.rb +++ b/lib/sisu/v6/ao_misc_arrange.rb @@ -66,11 +66,14 @@ module SiSU_AO_MiscArrangeText        @md,@data=md,data      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 +      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        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,''). @@ -123,7 +130,12 @@ module SiSU_AO_MiscArrangeText            para << '`:quote_open`'            text=text.gsub(/```[ ]+quote/m,'')          end -        text=text.gsub(/(?:\n|\A)([^`=\n]+)/m,'_1 \1') #not a perfect match for book index \n={ +        text=if text =~/(?:\n|\A)=\{.+?\}/m                               #exclude book index from indent markup +          txt,bkidx,tail=/(.+?)((?:\n|\A)=\{.+?\}$)(.*)/m.match(text).captures +          txt=txt.gsub(/(?:\n|\A)([^`\n]+)/m,'_1 \1') +          txt + bkidx + tail +        else text.gsub(/(?:\n|\A)([^`\n]+)/m,'_1 \1') +        end          para << text.gsub(/```/m,'')          if text =~/```/m            @flag=:quote_close @@ -134,11 +146,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 +162,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..d6faf3a6 100644 --- a/lib/sisu/v6/ao_numbering.rb +++ b/lib/sisu/v6/ao_numbering.rb @@ -63,10 +63,23 @@  module SiSU_AO_Numbering    class Numbering      attr_accessor :obj,:osp,:ocn,:lv,:name,:index,:comment +    @@segments_count=0      def initialize(md,data)        @md,@data=md,data        @obj=@type=@ocn=@lv=@name=@index=@comment=nil      end +    def number_of_segments? +      if @@segments_count==0 +        @data.each do |dob| +          if dob.is ==  :heading \ +          and dob.lv == '1' +            @@segments_count += 1 +          end +        end +        @@segments_count +      else @@segments_count +      end +    end      def numbering_song        data=@data        data=number_plaintext_para(data) @@ -121,7 +134,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]}/,''). @@ -151,7 +165,6 @@ module SiSU_AO_Numbering        data=data.compact        data.each do |dob| #@md.seg_names << [additions to segment names]          title_no=nil -        dob=SiSU_AO_DocumentStructureExtract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require          if dob.is ==:heading \          && dob.autonum_ \          and defined? @md.make.num_top \ @@ -279,6 +292,33 @@ module SiSU_AO_Numbering        end        @tuned_file=@tuned_file.flatten      end +    def leading_zeros_fixed_width_number(possible_seg_name) +      if possible_seg_name =~/^([\d]+?\.|[\d]+)$/m          #!~/[.,:-]+/ +        possible_seg_name=possible_seg_name. +          gsub(/\.$/,'') +        nl=possible_seg_name.to_s.length +        zero='0' +        zeros_fixed_width=number_of_segments?.to_s.length +        zero_width=(zeros_fixed_width - nl) +        zero_width == 0 \ +        ? Mx[:auto_seg_prefix] + +          possible_seg_name.to_s +        : Mx[:auto_seg_prefix] + +          zero*zero_width + +          possible_seg_name.to_s +      end +    end +    def auto_seg_name(possible_seg_name) +      if possible_seg_name =~/^([\d]+?\.|[\d]+)$/m          #!~/[.,:-]+/ +        leading_zeros_fixed_width_number(possible_seg_name) +      elsif possible_seg_name =~/^[\d.,:-]+$/m +        possible_seg_name=possible_seg_name. +          gsub(/(?:[:,-]|\W)/,'.'). +          gsub(/\.$/,'') +        #Mx[:auto_seg_prefix] + possible_seg_name +      else possible_seg_name +      end +    end      def name_para_seg_filename(data)                                                   #segment naming, remaining        # paragraph name/numbering rules        # manual naming overrides, manual naming may be @@ -313,9 +353,12 @@ module SiSU_AO_Numbering              @md.set_heading_seg=true            end            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 +          and dob.obj =~/^\s*(?:\S+\s+)?([\d.,:-]+)/m      #heading starts with a recognised numeric or word followed by a recognised numeric construct, use that as name              possible_seg_name=$1 -            possible_seg_name=possible_seg_name.gsub(/(?:[:,-]|\W)/,'.'). +            possible_seg_name= +              auto_seg_name(possible_seg_name) +            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) @@ -337,13 +380,13 @@ module SiSU_AO_Numbering            end            if dob.ln==4 \            and not dob.name                                 #if still no segment name, provide a numerical one -            pf='_'                                         #pg='' #may use e.g. '' or '~' or '_' -            segn_auto="#{pf}#{art_filename_auto.to_s}" +            possible_seg_name= +              auto_seg_name(art_filename_auto)              if @md.seg_names.is_a?(Array) \ -            and not @md.seg_names.include?(segn_auto) -             dob.name=segn_auto +            and not @md.seg_names.include?(possible_seg_name) +             dob.name=possible_seg_name               dob.tags=set_tags(dob.tags,dob.name) -              @md.seg_names << segn_auto +              @md.seg_names << possible_seg_name              else puts 'segment name (numbering) error'              end              art_filename_auto+=1 @@ -363,11 +406,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 +430,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 +495,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 +542,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(/<!(\S+)!>/,'<:\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 <br> <br /> back, clumsy          if dob.number_            codeline=[] @@ -569,7 +586,8 @@ module SiSU_AO_Syntax        # +2                  <!i2!>        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/constants.rb b/lib/sisu/v6/constants.rb index 43fff554..d25478d1 100644 --- a/lib/sisu/v6/constants.rb +++ b/lib/sisu/v6/constants.rb @@ -104,6 +104,7 @@ Xx={    html_relative1:            '※',  }  Mx={ +  auto_seg_prefix:           's',    ocn_id_char:               'o',    note:                      'note_',    note_ref:                  'noteref_', @@ -333,6 +334,7 @@ DISABLE={  }  DEVELOPER={    maintenance:               :false, +  under_construction:        '_CONSTRUCTION_ZONE',  }  __END__  utils.rb diff --git a/lib/sisu/v6/concordance.rb b/lib/sisu/v6/html_concordance.rb index 5422056f..b94949b9 100644 --- a/lib/sisu/v6/concordance.rb +++ b/lib/sisu/v6/html_concordance.rb @@ -51,7 +51,7 @@   * Git     <http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary> -   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/concordance.rb;hb=HEAD> +   <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/html_concordance.rb;hb=HEAD>   * Ralph Amissah     <ralph@amissah.com> diff --git a/lib/sisu/v6/hub.rb b/lib/sisu/v6/hub.rb index 736fa8bc..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$/ @@ -307,7 +324,7 @@ module SiSU            $process_document = :ok            unless @opt.act[:po4a][:set]==:on            # --po4a, -P              if @opt.fno =~ /\.ssm$/ -              require_relative 'composite'             # composite.rb #pre-processing +              require_relative 'ao_composite'          # ao_composite.rb #pre-processing                SiSU_Assemble::Composite.new(@opt).read              end              require_relative 'ao'                      # -m     ao.rb @@ -357,7 +374,7 @@ module SiSU              end            end            if @opt.act[:concordance][:set]==:on           #% --concordance, -w -            require_relative 'concordance'               #  concordance.rb +            require_relative 'html_concordance'          #  html_concordance.rb              SiSU_Concordance::Source.new(@opt).read            end            if @opt.act[:epub][:set]==:on                  #% --epub, -e @@ -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..bacee802 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,10 +1160,14 @@ module SiSU_Param                : ''                title=@title.full.gsub(/\s*(?:<p>|<p \/>|<br>|<br \/>)\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*$/ +            and para =~/^=\{(.+?)\}[\s`]*\Z/m                @book_idx=true              end              unless @code_flag @@ -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/po4a.rb b/lib/sisu/v6/po4a.rb index 3f890cec..66c68fce 100644 --- a/lib/sisu/v6/po4a.rb +++ b/lib/sisu/v6/po4a.rb @@ -65,7 +65,7 @@ module SiSU_Po4a    require_relative 'ao'                                 # ao.rb    require_relative 'sysenv'                             # sysenv.rb      include SiSU_Env -  require_relative 'composite'                          # composite.rb +  require_relative 'ao_composite'                       # ao_composite.rb    require_relative 'shared_metadata'                    # shared_metadata.rb    require_relative 'po4a_set'                           # po4a_set.rb    include SiSU_Param diff --git a/lib/sisu/v6/remote.rb b/lib/sisu/v6/remote.rb index ed5d7fba..37ff723f 100644 --- a/lib/sisu/v6/remote.rb +++ b/lib/sisu/v6/remote.rb @@ -118,7 +118,7 @@ module SiSU_Remote        rescue LoadError          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('open-uri or pp NOT FOUND (LoadError)')        end -      require_relative 'composite'                      # composite.rb +      require_relative 'ao_composite'                   # ao_composite.rb        @rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/        threads=[]        for requested_page in @get_s diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index 2c2a8c10..3c774c46 100644 --- a/lib/sisu/v6/sysenv.rb +++ b/lib/sisu/v6/sysenv.rb @@ -6032,7 +6032,7 @@ WOK        end        def textile          def ft -         'textile_CONSTRUCTION_ZONE' +         'textile' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6053,7 +6053,7 @@ WOK        end        def asciidoc          def ft -         'asciidoc_CONSTRUCTION_ZONE' +         'asciidoc' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6074,7 +6074,7 @@ WOK        end        def markdown          def ft -         'markdown_CONSTRUCTION_ZONE' +         'markdown' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6095,7 +6095,7 @@ WOK        end        def rst          def ft -         'rst_CONSTRUCTION_ZONE' +         'rst' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6315,7 +6315,7 @@ WOK        end        def xml_docbook          def ft -         'docbook_CONSTRUCTION_ZONE' +         'docbook' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6339,7 +6339,7 @@ WOK        end        def xml_docbook_article          def ft -         'docbook' +         'docbook' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6363,7 +6363,7 @@ WOK        end        def xml_docbook_book          def ft -         'docbook_CONSTRUCTION_ZONE' +         'docbook' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc @@ -6387,7 +6387,7 @@ WOK        end        def xml_fictionbook          def ft -         'fictionbook_CONSTRUCTION_ZONE' +         'fictionbook' + DEVELOPER[:under_construction]          end          def dir            set_path(ft).dir.abc diff --git a/lib/sisu/v6/xhtml_epub2_segments.rb b/lib/sisu/v6/xhtml_epub2_segments.rb index d249b0ff..8b9254d4 100644 --- a/lib/sisu/v6/xhtml_epub2_segments.rb +++ b/lib/sisu/v6/xhtml_epub2_segments.rb @@ -80,6 +80,7 @@ module SiSU_XHTML_EPUB2_Seg            filename_seg << @seg[:heading_endnotes] << @seg[:headings] << %{\n<div class="content">\n} << @seg[:endnote_all] << '</div>'          elsif @type=='idx'            @seg[:headings]=[] +          txt_obj={ txt: 'Index', ocn_display: ''}            format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj)            @seg[:headings] << format_seg.title_heading1            filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n<div class="content">\n} << @seg[:idx] << '</div>' @@ -37,8 +37,8 @@  #require 'mkmf'  #create_makefile("sisu")  #% manual settings, edit/update as required (note current default settings are obtained from sisu version yml file) -SiSU_version_next_stable     = '5.4.2' -SiSU_version_next_unstable   = '6.0.8' +SiSU_version_next_stable     = '5.4.3' +SiSU_version_next_unstable   = '6.0.9'  #% rake file  SiSU_version_generic_next_stable     = '5.4.x'  SiSU_version_generic_next_unstable   = '6.0.x' | 
