diff options
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v5 | 2 | ||||
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v6 | 2 | ||||
| -rw-r--r-- | lib/sisu/v5/ao.rb | 31 | ||||
| -rw-r--r-- | lib/sisu/v5/ao_doc_objects.rb | 102 | ||||
| -rw-r--r-- | lib/sisu/v5/ao_doc_str.rb | 98 | ||||
| -rw-r--r-- | lib/sisu/v5/ao_numbering.rb | 15 | ||||
| -rw-r--r-- | lib/sisu/v5/constants.rb | 5 | ||||
| -rw-r--r-- | lib/sisu/v6/ao.rb | 31 | ||||
| -rw-r--r-- | lib/sisu/v6/ao_doc_objects.rb | 102 | ||||
| -rw-r--r-- | lib/sisu/v6/ao_doc_str.rb | 98 | ||||
| -rw-r--r-- | lib/sisu/v6/ao_numbering.rb | 15 | ||||
| -rw-r--r-- | lib/sisu/v6/constants.rb | 5 | 
12 files changed, 260 insertions, 246 deletions
| diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 292d0c21..99f59534 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -38,6 +38,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.4.1.orig.tar.xz    sisu_5.4.1.orig.tar.xz    sisu_5.4.1-1.dsc +* ao, misc, minorish +  %% 5.4.0.orig.tar.xz (2014-05-25:20/7)  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.4.0  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.4.0-1 diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index eef26941..645d482d 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.8.orig.tar.xz    sisu_6.0.8.orig.tar.xz    sisu_6.0.8-1.dsc +* ao, misc, minorish +  %% 6.0.7.orig.tar.xz (2014-05-25:20/7)  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_6.0.7  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_6.0.7-1 diff --git a/lib/sisu/v5/ao.rb b/lib/sisu/v5/ao.rb index 2a02ad63..c69e3be9 100644 --- a/lib/sisu/v5/ao.rb +++ b/lib/sisu/v5/ao.rb @@ -505,17 +505,26 @@ module SiSU_AO      end      def song        reset -      data=@data -      data=SiSU_AO_Insertions::Insertions.new(@md,data).expand_insertions?                                              # ao_expand_insertions.rb -      data=SiSU_AO_MiscArrangeText::SI.new(@md,data).prepare_text                                                       # ao_misc_arrange.rb -      data,metadata=SiSU_AO_DocumentStructureExtract::Build.new(@md,data).identify_parts                                # ao_doc_str.rb -      data=SiSU_AO_Syntax::Markup.new(@md,data).songsheet                                                               # ao_syntax.rb -      data,endnote_array=SiSU_AO_CharacterCheck::Check.new(data).character_check_and_oldstyle_endnote_array             # ao_character_check.rb -      data=SiSU_AO_Images::Images.new(@md,data).images                                                                  # ao_images.rb -      data,tags_map,ocn_html_seg_map=SiSU_AO_Numbering::Numbering.new(@md,data).numbering_song                          # ao_numbering.rb -      data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_AO_BookIndex::BookIndex.new(@md,data,@env).indexing_song if @md.book_idx  # ao_idx.rb -      data=SiSU_AO_Endnotes::Endnotes.new(@md,data,endnote_array).endnotes                                              # ao_endnotes.rb -      outputdata=data +      data_txt=@data +      data_txt= +        SiSU_AO_Insertions::Insertions.new(@md,data_txt).expand_insertions?                        # ao_expand_insertions.rb +      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 +      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 +      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 +      data_obj= +        SiSU_AO_Endnotes::Endnotes.new(@md,data_obj,endnote_array).endnotes                        # ao_endnotes.rb +      outputdata=data_obj        if (@md.opt.act[:ao][:set]==:on \        || @md.opt.act[:maintenance][:set]==:on)          SiSU_AO::Output.new(@fn,@md,outputdata).hard_output diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb index 216349c1..cd0d196c 100644 --- a/lib/sisu/v5/ao_doc_objects.rb +++ b/lib/sisu/v5/ao_doc_objects.rb @@ -74,8 +74,8 @@ module SiSU_AO_DocumentStructure        @of=:meta      end      def metadata(tags) -      of=     @of                                                              #String, classification - group -      is=     :meta                                                            #String, classification - specific type +      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 @@ -89,8 +89,8 @@ module SiSU_AO_DocumentStructure        @of=:meta      end      def metadata(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :meta                                                            #String, classification - specific type +      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 @@ -142,8 +142,8 @@ module SiSU_AO_DocumentStructure        and (h[:ln] and h[:ln].to_s=~/[0-9]/)          h[:lv]=heading_lv(h[:ln])        end -      of=     @of                                                              #String, classification - group -      is=     :heading                                                         #String, classification - specific type +      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 @@ -191,8 +191,8 @@ module SiSU_AO_DocumentStructure        @tags=[]      end      def paragraph(h,o=nil) -      of=    @of                                                               #String, classification - group -      is=    :para                                                             #String, classification - specific type +      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 @@ -247,8 +247,8 @@ module SiSU_AO_DocumentStructure        @tags=[]      end      def code(h,o=nil) -      of=      @of                                                             #String, classification - group #alt 'code' -      is=      :code                                                           #String, classification - specific type +      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? @@ -268,8 +268,8 @@ module SiSU_AO_DocumentStructure        self      end      def block(h,o=nil) -      of=      @of                                                             #String, classification - group -      is=      :block                                                          #String, classification - specific type +      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? @@ -288,8 +288,8 @@ module SiSU_AO_DocumentStructure        self      end      def group(h,o=nil) -      of=      @of                                                             #String, classification - group -      is=      :group                                                          #String, classification - specific type +      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? @@ -308,8 +308,8 @@ module SiSU_AO_DocumentStructure        self      end      def alt(h,o=nil)                                                           #see block -      of=      @of                                                             #String, classification - group -      is=      :alt                                                            #String, classification - specific type +      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? @@ -328,8 +328,8 @@ module SiSU_AO_DocumentStructure        self      end      def verse(h,o=nil)                                                         #part of poem decide how you deal with this -      of=      @of                                                             #String, classification - group -      is=      :verse                                                          #String, classification - specific type +      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? @@ -349,15 +349,15 @@ module SiSU_AO_DocumentStructure      end    end    class ObjectTable -    attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp +    attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:num,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp      def initialize        @of=:block -      @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@num=@digest=@tmp=nil +      @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@num,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@num=@digest=@tmp=nil        @tags=[]      end      def table(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :table                                                           #String, classification - specific type +      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) @@ -370,9 +370,9 @@ module SiSU_AO_DocumentStructure        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_] +      else    h[:ocn_]        end -      num=     h[:num]     || ((defined? o.num)      ? o.num     : nil) +      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 @@ -387,8 +387,8 @@ module SiSU_AO_DocumentStructure        @tags=[]      end      def image(h,o=nil)                                                         #not yet used, and what of a paragraph containing several images, consider -      of=     @of                                                              #String, classification - group -      is=     :image                                                           #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :image                                                           #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        size=   h[:size]    || ((defined? o.size)      ? o.size    : nil) @@ -414,8 +414,8 @@ module SiSU_AO_DocumentStructure        @is=@obj=@node=@lv=@ln=@lc=@status=@tmp=nil      end      def xml_dom(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :xml_dom                                                         #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :xml_dom                                                         #Symbol, classification - specific type        obj=    h[:obj]     || ((defined? o.obj)       ? o.obj     : '')         #String, text content        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 @@ -427,21 +427,6 @@ module SiSU_AO_DocumentStructure        self      end    end -  class ObjectComment -    attr_accessor :obj,:is,:of,:tmp -    def initialize -      @of=:comment -      @is=@obj=@tmp=nil -    end -    def comment(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :comment                                                         #String, classification - specific type -      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 -      @of,@is,@obj,@tmp=of,is,obj,tmp -      self -    end -  end    class ObjectFlag      attr_accessor :obj,:is,:of,:flag,:mod,:tmp      def initialize @@ -449,8 +434,8 @@ module SiSU_AO_DocumentStructure        @is=@obj=@flag=@mod=@tmp=nil      end      def flag(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :flag                                                            #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :flag                                                            #Symbol, classification - specific type        obj=    nil                                                              #String, text content        flag=   h[:flag]     || ((defined? o.flag)      ? o.flag    : nil)       #String, text content        mod=    h[:mod]      || ((defined? o.mod)       ? o.mod     : nil)       #String, text content @@ -459,8 +444,8 @@ module SiSU_AO_DocumentStructure        self      end      def flag_ocn(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :flag_ocn                                                        #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :flag_ocn                                                        #Symbol, classification - specific type        obj=    nil                                                              #String, text content        flag=   h[:flag]     || ((defined? o.flag)      ? o.flag    : nil)       #String, text content        mod=    h[:mod]      || ((defined? o.mod)       ? o.mod     : nil)       #String, text content @@ -476,8 +461,8 @@ module SiSU_AO_DocumentStructure        @is=@obj=@from=@tmp=nil      end      def break(h,f=nil)                                                         #decide how to deal with -      of=     @of                                                              #String, classification - group -      is=     :break                                                           #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :break                                                           #Symbol, classification - specific type        obj=    h[:obj]                                                          #String, text content        from=   f        tmp=    h[:tmp]                                                          #available for processing, empty after use @@ -485,8 +470,23 @@ module SiSU_AO_DocumentStructure        self      end      def insert(h,o=nil)                                                        #decide how to deal with, could mimic paragraph? -      of=     @of                                                              #String, classification - group -      is=     :insert                                                          #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :insert                                                          #Symbol, classification - specific type +      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 +      @of,@is,@obj,@tmp=of,is,obj,tmp +      self +    end +  end +  class ObjectComment +    attr_accessor :obj,:is,:of,:tmp +    def initialize +      @of=:comment +      @is=@obj=@tmp=nil +    end +    def comment(h,o=nil) +      of=     @of                                                              #Symbol, classification - group +      is=     :comment                                                         #Symbol, classification - specific type        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        @of,@is,@obj,@tmp=of,is,obj,tmp diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb index b66f01d1..15d4aa9e 100644 --- a/lib/sisu/v5/ao_doc_str.rb +++ b/lib/sisu/v5/ao_doc_str.rb @@ -63,14 +63,14 @@  module SiSU_AO_DocumentStructureExtract    class Instantiate < SiSU_Param::Parameters::Instructions      @@flag={ -      ocn:      :on, -      code:     :off, -      poem:     :off, -      block:    :off, -      group:    :off, -      alt:      :off, -      table:    :off, -      table_to: :off, +      ocn:         :on, +      code:        :off, +      poem:        :off, +      block:       :off, +      group:       :off, +      alt:         :off, +      table:       :off, +      table_to:    :off,      }      def initialize        @@counter=@@column=@@columns=0 @@ -79,14 +79,14 @@ module SiSU_AO_DocumentStructureExtract    end    class Build      @@flag={ -      ocn:      :on, -      code:     :off, -      poem:     :off, -      block:    :off, -      group:    :off, -      alt:      :off, -      table:    :off, -      table_to: :off, +      ocn:         :on, +      code:        :off, +      poem:        :off, +      block:       :off, +      group:       :off, +      alt:         :off, +      table:       :off, +      table_to:    :off,      }      def initialize(md,data)        @md,@data=md,data @@ -516,7 +516,7 @@ 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_table  } +              h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }                t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?                tuned_file << t_o                h={ obj: "table end #{@num_table}" } @@ -539,7 +539,7 @@ module SiSU_AO_DocumentStructureExtract                  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_table  } +              h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }                t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?                tuned_file << t_o                h={ obj: "table end #{@num_table}" } @@ -1231,7 +1231,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}          || dob.is==:alt \          || dob.is==:group \          || dob.is==:block -          dob.obj=dob.obj.gsub(/\n\n/,"\n") #newlines taken out +          dob.obj=dob.obj.gsub(/\n+/,"\n") #newlines taken out          end          @o_array << dob        end @@ -1255,19 +1255,13 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}        @data,@md=data,md      end      def dom -      @s=[ -        'A', -        'B', -        'C', -        'D', -        '1', -        '2', -        '3' -      ] -      @sp='  ' +      @s=[ 'A', 'B', 'C', 'D', '1', '2', '3' ]        tuned_file=structure_build        tuned_file      end +    def spaces +      Ax[:spaces] +    end      def structure_build        data=@data        tuned_file=[] @@ -1498,45 +1492,45 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}        ary      end      def puts_tag_open(o,tag) -      puts %{#{@sp*o.ln}<#{tag[o.ln]} id="#{o.node}">} +      puts %{#{spaces*o.ln}<#{tag[o.ln]} id="#{o.node}">}      end      def puts_tag_close(lev,hs)        case hs[0]        when 0 -        #puts "#{@sp*0}</#{@s[0]}>" if (lev <= 0) and hs[0] +        #puts "#{spaces*0}</#{@s[0]}>" if (lev <= 0) and hs[0]          puts "</#{@s[0]}>"         if (lev==0)        when 1 -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        when 2 -        puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2] -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        when 3 -        puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3] -        puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2] -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3] +        puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        when 4 -        puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) -        puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3] -        puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2] -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4) +        puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3] +        puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        when 5 -        puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5) -        puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) -        puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3] -        puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2] -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5) +        puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4) +        puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3] +        puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        when 6 -        puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6) -        puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5) -        puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) -        puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3] -        puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2] -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6) +        puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5) +        puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4) +        puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3] +        puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        end      end diff --git a/lib/sisu/v5/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb index 7affbe93..a143abeb 100644 --- a/lib/sisu/v5/ao_numbering.rb +++ b/lib/sisu/v5/ao_numbering.rb @@ -286,7 +286,7 @@ module SiSU_AO_Numbering        #   numeric only (a number), if        #     all segments have been named,        #     the numbers used are over 1000 or -      #     it is  not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented) +      #     it is not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented)        #       [for now a warning is printed for such documents on use of maintenance or very-verbose flag]        # auto-naming takes the form of giving numbers to segments        # the rules for which are as follows @@ -381,13 +381,11 @@ 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]/ -              { seg: nil, level: dob.ln } -            else #elsif dob.ln =~/[4-6]/ -              { seg: @seg, level: dob.ln } +            if dob.ln =~/[0-3]/ then { seg: nil, level: dob.ln } +            #elsif dob.ln =~/[4-6]/ +            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 @@ -406,7 +404,8 @@ module SiSU_AO_Numbering          if ocn \          and ocn[:level].to_s=~/[1-3]/            (1..4).each do |x| -            if ocn_html_seg[i+x] and ocn_html_seg[i+x][:level]==4 +            if ocn_html_seg[i+x] \ +            and ocn_html_seg[i+x][:level]==4                ocn[:seg]=ocn_html_seg[i+x][:seg]              end            end diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index 748051b6..42ab53a3 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -92,9 +92,12 @@ Sfx={  }  Ax={    tab:                       "\t", +  comment:                   '%', +  spaces:                    '  ',  }  Xx={    protect:                   '☞', +  split:                     '✠',    segment:                   'Ф',    relative_path:             '☼',    html_relative2:            '※※', @@ -348,7 +351,7 @@ check:    ·  ¤ - #˝ " λ Ω  β   α π  Ѫ Ж  Я Ѳ  ѳ   Ф ㈣ + #˝ " λ Ω  β α π Ѫ Ж Я Ѳ ѳ Ф ✠ ㈣   Ѳ  ѳ   Ф   ♩ ♭   ✠   ▭  ▬  ▪  【】〖〗◢ ◣ ◀ ▶ ◘ ◙ diff --git a/lib/sisu/v6/ao.rb b/lib/sisu/v6/ao.rb index 6f7b1ac8..064436ae 100644 --- a/lib/sisu/v6/ao.rb +++ b/lib/sisu/v6/ao.rb @@ -505,17 +505,26 @@ module SiSU_AO      end      def song        reset -      data=@data -      data=SiSU_AO_Insertions::Insertions.new(@md,data).expand_insertions?                                              # ao_expand_insertions.rb -      data=SiSU_AO_MiscArrangeText::SI.new(@md,data).prepare_text                                                       # ao_misc_arrange.rb -      data,metadata=SiSU_AO_DocumentStructureExtract::Build.new(@md,data).identify_parts                                # ao_doc_str.rb -      data=SiSU_AO_Syntax::Markup.new(@md,data).songsheet                                                               # ao_syntax.rb -      data,endnote_array=SiSU_AO_CharacterCheck::Check.new(data).character_check_and_oldstyle_endnote_array             # ao_character_check.rb -      data=SiSU_AO_Images::Images.new(@md,data).images                                                                  # ao_images.rb -      data,tags_map,ocn_html_seg_map=SiSU_AO_Numbering::Numbering.new(@md,data).numbering_song                          # ao_numbering.rb -      data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_AO_BookIndex::BookIndex.new(@md,data,@env).indexing_song if @md.book_idx  # ao_idx.rb -      data=SiSU_AO_Endnotes::Endnotes.new(@md,data,endnote_array).endnotes                                              # ao_endnotes.rb -      outputdata=data +      data_txt=@data +      data_txt= +        SiSU_AO_Insertions::Insertions.new(@md,data_txt).expand_insertions?                        # ao_expand_insertions.rb +      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 +      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 +      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 +      data_obj= +        SiSU_AO_Endnotes::Endnotes.new(@md,data_obj,endnote_array).endnotes                        # ao_endnotes.rb +      outputdata=data_obj        if (@md.opt.act[:ao][:set]==:on \        || @md.opt.act[:maintenance][:set]==:on)          SiSU_AO::Output.new(@fn,@md,outputdata).hard_output diff --git a/lib/sisu/v6/ao_doc_objects.rb b/lib/sisu/v6/ao_doc_objects.rb index 9555ab5e..972a8392 100644 --- a/lib/sisu/v6/ao_doc_objects.rb +++ b/lib/sisu/v6/ao_doc_objects.rb @@ -74,8 +74,8 @@ module SiSU_AO_DocumentStructure        @of=:meta      end      def metadata(tags) -      of=     @of                                                              #String, classification - group -      is=     :meta                                                            #String, classification - specific type +      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 @@ -89,8 +89,8 @@ module SiSU_AO_DocumentStructure        @of=:meta      end      def metadata(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :meta                                                            #String, classification - specific type +      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 @@ -142,8 +142,8 @@ module SiSU_AO_DocumentStructure        and (h[:ln] and h[:ln].to_s=~/[0-9]/)          h[:lv]=heading_lv(h[:ln])        end -      of=     @of                                                              #String, classification - group -      is=     :heading                                                         #String, classification - specific type +      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 @@ -191,8 +191,8 @@ module SiSU_AO_DocumentStructure        @tags=[]      end      def paragraph(h,o=nil) -      of=    @of                                                               #String, classification - group -      is=    :para                                                             #String, classification - specific type +      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 @@ -247,8 +247,8 @@ module SiSU_AO_DocumentStructure        @tags=[]      end      def code(h,o=nil) -      of=      @of                                                             #String, classification - group #alt 'code' -      is=      :code                                                           #String, classification - specific type +      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? @@ -268,8 +268,8 @@ module SiSU_AO_DocumentStructure        self      end      def block(h,o=nil) -      of=      @of                                                             #String, classification - group -      is=      :block                                                          #String, classification - specific type +      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? @@ -288,8 +288,8 @@ module SiSU_AO_DocumentStructure        self      end      def group(h,o=nil) -      of=      @of                                                             #String, classification - group -      is=      :group                                                          #String, classification - specific type +      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? @@ -308,8 +308,8 @@ module SiSU_AO_DocumentStructure        self      end      def alt(h,o=nil)                                                           #see block -      of=      @of                                                             #String, classification - group -      is=      :alt                                                            #String, classification - specific type +      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? @@ -328,8 +328,8 @@ module SiSU_AO_DocumentStructure        self      end      def verse(h,o=nil)                                                         #part of poem decide how you deal with this -      of=      @of                                                             #String, classification - group -      is=      :verse                                                          #String, classification - specific type +      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? @@ -349,15 +349,15 @@ module SiSU_AO_DocumentStructure      end    end    class ObjectTable -    attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp +    attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:num,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp      def initialize        @of=:block -      @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@num=@digest=@tmp=nil +      @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@num,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@num=@digest=@tmp=nil        @tags=[]      end      def table(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :table                                                           #String, classification - specific type +      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) @@ -370,9 +370,9 @@ module SiSU_AO_DocumentStructure        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_] +      else    h[:ocn_]        end -      num=     h[:num]     || ((defined? o.num)      ? o.num     : nil) +      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 @@ -387,8 +387,8 @@ module SiSU_AO_DocumentStructure        @tags=[]      end      def image(h,o=nil)                                                         #not yet used, and what of a paragraph containing several images, consider -      of=     @of                                                              #String, classification - group -      is=     :image                                                           #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :image                                                           #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        size=   h[:size]    || ((defined? o.size)      ? o.size    : nil) @@ -414,8 +414,8 @@ module SiSU_AO_DocumentStructure        @is=@obj=@node=@lv=@ln=@lc=@status=@tmp=nil      end      def xml_dom(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :xml_dom                                                         #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :xml_dom                                                         #Symbol, classification - specific type        obj=    h[:obj]     || ((defined? o.obj)       ? o.obj     : '')         #String, text content        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 @@ -427,21 +427,6 @@ module SiSU_AO_DocumentStructure        self      end    end -  class ObjectComment -    attr_accessor :obj,:is,:of,:tmp -    def initialize -      @of=:comment -      @is=@obj=@tmp=nil -    end -    def comment(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :comment                                                         #String, classification - specific type -      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 -      @of,@is,@obj,@tmp=of,is,obj,tmp -      self -    end -  end    class ObjectFlag      attr_accessor :obj,:is,:of,:flag,:mod,:tmp      def initialize @@ -449,8 +434,8 @@ module SiSU_AO_DocumentStructure        @is=@obj=@flag=@mod=@tmp=nil      end      def flag(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :flag                                                            #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :flag                                                            #Symbol, classification - specific type        obj=    nil                                                              #String, text content        flag=   h[:flag]     || ((defined? o.flag)      ? o.flag    : nil)       #String, text content        mod=    h[:mod]      || ((defined? o.mod)       ? o.mod     : nil)       #String, text content @@ -459,8 +444,8 @@ module SiSU_AO_DocumentStructure        self      end      def flag_ocn(h,o=nil) -      of=     @of                                                              #String, classification - group -      is=     :flag_ocn                                                        #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :flag_ocn                                                        #Symbol, classification - specific type        obj=    nil                                                              #String, text content        flag=   h[:flag]     || ((defined? o.flag)      ? o.flag    : nil)       #String, text content        mod=    h[:mod]      || ((defined? o.mod)       ? o.mod     : nil)       #String, text content @@ -476,8 +461,8 @@ module SiSU_AO_DocumentStructure        @is=@obj=@from=@tmp=nil      end      def break(h,f=nil)                                                         #decide how to deal with -      of=     @of                                                              #String, classification - group -      is=     :break                                                           #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :break                                                           #Symbol, classification - specific type        obj=    h[:obj]                                                          #String, text content        from=   f        tmp=    h[:tmp]                                                          #available for processing, empty after use @@ -485,8 +470,23 @@ module SiSU_AO_DocumentStructure        self      end      def insert(h,o=nil)                                                        #decide how to deal with, could mimic paragraph? -      of=     @of                                                              #String, classification - group -      is=     :insert                                                          #String, classification - specific type +      of=     @of                                                              #Symbol, classification - group +      is=     :insert                                                          #Symbol, classification - specific type +      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 +      @of,@is,@obj,@tmp=of,is,obj,tmp +      self +    end +  end +  class ObjectComment +    attr_accessor :obj,:is,:of,:tmp +    def initialize +      @of=:comment +      @is=@obj=@tmp=nil +    end +    def comment(h,o=nil) +      of=     @of                                                              #Symbol, classification - group +      is=     :comment                                                         #Symbol, classification - specific type        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        @of,@is,@obj,@tmp=of,is,obj,tmp diff --git a/lib/sisu/v6/ao_doc_str.rb b/lib/sisu/v6/ao_doc_str.rb index d060d89c..846a7027 100644 --- a/lib/sisu/v6/ao_doc_str.rb +++ b/lib/sisu/v6/ao_doc_str.rb @@ -63,14 +63,14 @@  module SiSU_AO_DocumentStructureExtract    class Instantiate < SiSU_Param::Parameters::Instructions      @@flag={ -      ocn:      :on, -      code:     :off, -      poem:     :off, -      block:    :off, -      group:    :off, -      alt:      :off, -      table:    :off, -      table_to: :off, +      ocn:         :on, +      code:        :off, +      poem:        :off, +      block:       :off, +      group:       :off, +      alt:         :off, +      table:       :off, +      table_to:    :off,      }      def initialize        @@counter=@@column=@@columns=0 @@ -79,14 +79,14 @@ module SiSU_AO_DocumentStructureExtract    end    class Build      @@flag={ -      ocn:      :on, -      code:     :off, -      poem:     :off, -      block:    :off, -      group:    :off, -      alt:      :off, -      table:    :off, -      table_to: :off, +      ocn:         :on, +      code:        :off, +      poem:        :off, +      block:       :off, +      group:       :off, +      alt:         :off, +      table:       :off, +      table_to:    :off,      }      def initialize(md,data)        @md,@data=md,data @@ -516,7 +516,7 @@ 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_table  } +              h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }                t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?                tuned_file << t_o                h={ obj: "table end #{@num_table}" } @@ -539,7 +539,7 @@ module SiSU_AO_DocumentStructureExtract                  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_table  } +              h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }                t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?                tuned_file << t_o                h={ obj: "table end #{@num_table}" } @@ -1231,7 +1231,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}          || dob.is==:alt \          || dob.is==:group \          || dob.is==:block -          dob.obj=dob.obj.gsub(/\n\n/,"\n") #newlines taken out +          dob.obj=dob.obj.gsub(/\n+/,"\n") #newlines taken out          end          @o_array << dob        end @@ -1255,19 +1255,13 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}        @data,@md=data,md      end      def dom -      @s=[ -        'A', -        'B', -        'C', -        'D', -        '1', -        '2', -        '3' -      ] -      @sp='  ' +      @s=[ 'A', 'B', 'C', 'D', '1', '2', '3' ]        tuned_file=structure_build        tuned_file      end +    def spaces +      Ax[:spaces] +    end      def structure_build        data=@data        tuned_file=[] @@ -1498,45 +1492,45 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}        ary      end      def puts_tag_open(o,tag) -      puts %{#{@sp*o.ln}<#{tag[o.ln]} id="#{o.node}">} +      puts %{#{spaces*o.ln}<#{tag[o.ln]} id="#{o.node}">}      end      def puts_tag_close(lev,hs)        case hs[0]        when 0 -        #puts "#{@sp*0}</#{@s[0]}>" if (lev <= 0) and hs[0] +        #puts "#{spaces*0}</#{@s[0]}>" if (lev <= 0) and hs[0]          puts "</#{@s[0]}>"         if (lev==0)        when 1 -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        when 2 -        puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2] -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        when 3 -        puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3] -        puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2] -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3] +        puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        when 4 -        puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) -        puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3] -        puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2] -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4) +        puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3] +        puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        when 5 -        puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5) -        puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) -        puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3] -        puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2] -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5) +        puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4) +        puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3] +        puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        when 6 -        puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6) -        puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5) -        puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4) -        puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3] -        puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2] -        puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1] +        puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6) +        puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5) +        puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4) +        puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3] +        puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2] +        puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]          puts "</#{@s[0]}>"         if (lev==0)        end      end diff --git a/lib/sisu/v6/ao_numbering.rb b/lib/sisu/v6/ao_numbering.rb index e04befb0..0dbb1a71 100644 --- a/lib/sisu/v6/ao_numbering.rb +++ b/lib/sisu/v6/ao_numbering.rb @@ -286,7 +286,7 @@ module SiSU_AO_Numbering        #   numeric only (a number), if        #     all segments have been named,        #     the numbers used are over 1000 or -      #     it is  not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented) +      #     it is not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented)        #       [for now a warning is printed for such documents on use of maintenance or very-verbose flag]        # auto-naming takes the form of giving numbers to segments        # the rules for which are as follows @@ -381,13 +381,11 @@ 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]/ -              { seg: nil, level: dob.ln } -            else #elsif dob.ln =~/[4-6]/ -              { seg: @seg, level: dob.ln } +            if dob.ln =~/[0-3]/ then { seg: nil, level: dob.ln } +            #elsif dob.ln =~/[4-6]/ +            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 @@ -406,7 +404,8 @@ module SiSU_AO_Numbering          if ocn \          and ocn[:level].to_s=~/[1-3]/            (1..4).each do |x| -            if ocn_html_seg[i+x] and ocn_html_seg[i+x][:level]==4 +            if ocn_html_seg[i+x] \ +            and ocn_html_seg[i+x][:level]==4                ocn[:seg]=ocn_html_seg[i+x][:seg]              end            end diff --git a/lib/sisu/v6/constants.rb b/lib/sisu/v6/constants.rb index be60431e..43fff554 100644 --- a/lib/sisu/v6/constants.rb +++ b/lib/sisu/v6/constants.rb @@ -92,9 +92,12 @@ Sfx={  }  Ax={    tab:                       "\t", +  comment:                   '%', +  spaces:                    '  ',  }  Xx={    protect:                   '☞', +  split:                     '✠',    segment:                   'Ф',    relative_path:             '☼',    html_relative2:            '※※', @@ -348,7 +351,7 @@ check:    ·  ¤ - #˝ " λ Ω  β   α π  Ѫ Ж  Я Ѳ  ѳ   Ф ㈣ + #˝ " λ Ω  β α π Ѫ Ж Я Ѳ ѳ Ф ✠ ㈣   Ѳ  ѳ   Ф   ♩ ♭   ✠   ▭  ▬  ▪  【】〖〗◢ ◣ ◀ ▶ ◘ ◙ | 
