diff options
| author | Ralph Amissah <ralph@amissah.com> | 2014-06-19 19:27:29 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2014-06-19 19:27:29 -0400 | 
| commit | 46410b13582eaadee20eac8e26b3d7f19966c57e (patch) | |
| tree | 1a8fa7cc6c3724a013bbfe256d64a5de2917ac70 | |
| parent | v5 v6: ao, regex match for tics "```" followed by space tweaked (diff) | |
v5 v6: ao, Symbol to match grouped text open & close (instead of String)
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v5 | 1 | ||||
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v6 | 1 | ||||
| -rw-r--r-- | lib/sisu/v5/ao_doc_objects.rb | 2 | ||||
| -rw-r--r-- | lib/sisu/v5/ao_doc_str.rb | 66 | ||||
| -rw-r--r-- | lib/sisu/v6/ao_doc_objects.rb | 2 | ||||
| -rw-r--r-- | lib/sisu/v6/ao_doc_str.rb | 66 | 
6 files changed, 70 insertions, 68 deletions
| diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 61971a6c..010b9189 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -40,6 +40,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.4.1.orig.tar.xz  * ao,    * regex match for tics "```" followed by space tweaked +  * Symbol to match grouped text open & close (instead of String)    * turn id numbers (for tags) into a hash    * code blocks, clean trailing newlines    * misc, minorish diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 8f374569..ed9bac41 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -30,6 +30,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.8.orig.tar.xz  * ao,    * regex match for tics "```" followed by space tweaked +  * Symbol to match grouped text open & close (instead of String)    * turn id numbers (for tags) into a hash    * code blocks, clean trailing newlines    * misc, minorish diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb index cd0d196c..c53c60d6 100644 --- a/lib/sisu/v5/ao_doc_objects.rb +++ b/lib/sisu/v5/ao_doc_objects.rb @@ -421,7 +421,7 @@ module SiSU_AO_DocumentStructure        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)        node=   h[:node]    || ((defined? o.node)      ? o.node    : nil)        #[Node relationship doc structure info] -      status= h[:status]  || ((defined? o.status)    ? o.status  : nil)        #tag status open or close +      status= h[:status]  || ((defined? o.status)    ? o.status  : nil)        #tag status Symbol :open or :close        tmp=    h[:tmp]     || ((defined? o.tmp)       ? o.tmp     : nil)        #available for processing, empty after use        @of,@is,@obj,@status,@node,@lv,@ln,@lc,@tmp=of,is,obj,status,node,lv,ln,lc,tmp        self diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb index ec925018..43fa8e5e 100644 --- a/lib/sisu/v5/ao_doc_str.rb +++ b/lib/sisu/v5/ao_doc_str.rb @@ -425,8 +425,8 @@ module SiSU_AO_DocumentStructureExtract              @@counter=1              @codeblock_numbered=(t_o =~/^(?:code\{#|```[ ]+code\s[#])/) ? true : false              @num_id[:code_block] +=1 -            h={ obj: "code block start #{@num_id[:code_block]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={  obj: '', sym: :code_block_open, num: @num_id[:code_block] } +            t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)            elsif t_o =~/^(?:poem\{|```[ ]+poem)/              @@flag[:poem]=case t_o              when /^poem\{/        then :curls @@ -1274,7 +1274,7 @@ 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" @@ -1351,7 +1351,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}        tuned_file=tuned_file.flatten      end      def tags(o) -      tag=(o[:status]=='open') \ +      tag=(o[:status]==:open) \        ? %{<#{o[:lv]} id="#{o[:node]}">}        : "</#{o[:lv]}>"        ln=case o[:lv] @@ -1370,7 +1370,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}        SiSU_AO_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments      end      def tag_open(o,tag) -      t={ lv: tag[o.ln], node: o.node, status: 'open' } +      t={ lv: tag[o.ln], node: o.node, status: :open }        t_o=tags(t)        t_o      end @@ -1379,121 +1379,121 @@ 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_doc_objects.rb b/lib/sisu/v6/ao_doc_objects.rb index 972a8392..1d95e2c9 100644 --- a/lib/sisu/v6/ao_doc_objects.rb +++ b/lib/sisu/v6/ao_doc_objects.rb @@ -421,7 +421,7 @@ module SiSU_AO_DocumentStructure        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)        node=   h[:node]    || ((defined? o.node)      ? o.node    : nil)        #[Node relationship doc structure info] -      status= h[:status]  || ((defined? o.status)    ? o.status  : nil)        #tag status open or close +      status= h[:status]  || ((defined? o.status)    ? o.status  : nil)        #tag status Symbol :open or :close        tmp=    h[:tmp]     || ((defined? o.tmp)       ? o.tmp     : nil)        #available for processing, empty after use        @of,@is,@obj,@status,@node,@lv,@ln,@lc,@tmp=of,is,obj,status,node,lv,ln,lc,tmp        self diff --git a/lib/sisu/v6/ao_doc_str.rb b/lib/sisu/v6/ao_doc_str.rb index 6ddc706a..2b2a86fc 100644 --- a/lib/sisu/v6/ao_doc_str.rb +++ b/lib/sisu/v6/ao_doc_str.rb @@ -425,8 +425,8 @@ module SiSU_AO_DocumentStructureExtract              @@counter=1              @codeblock_numbered=(t_o =~/^(?:code\{#|```[ ]+code\s[#])/) ? true : false              @num_id[:code_block] +=1 -            h={ obj: "code block start #{@num_id[:code_block]}" } -            t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h) +            h={  obj: '', sym: :code_block_open, num: @num_id[:code_block] } +            t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)            elsif t_o =~/^(?:poem\{|```[ ]+poem)/              @@flag[:poem]=case t_o              when /^poem\{/        then :curls @@ -1274,7 +1274,7 @@ 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" @@ -1351,7 +1351,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}        tuned_file=tuned_file.flatten      end      def tags(o) -      tag=(o[:status]=='open') \ +      tag=(o[:status]==:open) \        ? %{<#{o[:lv]} id="#{o[:node]}">}        : "</#{o[:lv]}>"        ln=case o[:lv] @@ -1370,7 +1370,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}        SiSU_AO_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments      end      def tag_open(o,tag) -      t={ lv: tag[o.ln], node: o.node, status: 'open' } +      t={ lv: tag[o.ln], node: o.node, status: :open }        t_o=tags(t)        t_o      end @@ -1379,121 +1379,121 @@ 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 | 
