diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2020-04-14 11:10:59 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2020-05-09 20:40:02 -0400 | 
| commit | 88ed8a0c1376fbe6d45059694ce31db597fde3e9 (patch) | |
| tree | 4fb95449893c488b2954bf432db4997829f54284 | |
| parent | emacs sisu-mode.el, syntax highlighting match https (diff) | |
ruby 2.7 fix
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | lib/sisu/ao_doc_str.rb | 85 | ||||
| -rw-r--r-- | lib/sisu/ao_numbering.rb | 2 | ||||
| -rw-r--r-- | lib/sisu/db_columns.rb | 21 | ||||
| -rw-r--r-- | lib/sisu/db_load_tuple.rb | 25 | ||||
| -rw-r--r-- | lib/sisu/db_sqltxt.rb | 2 | ||||
| -rw-r--r-- | lib/sisu/dp.rb | 4 | ||||
| -rw-r--r-- | lib/sisu/html.rb | 12 | ||||
| -rw-r--r-- | lib/sisu/html_minitoc.rb | 2 | ||||
| -rw-r--r-- | lib/sisu/html_scroll.rb | 6 | ||||
| -rw-r--r-- | lib/sisu/shared_metadata.rb | 11 | ||||
| -rw-r--r-- | lib/sisu/texpdf.rb | 12 | ||||
| -rw-r--r-- | lib/sisu/xhtml_epub2.rb | 6 | ||||
| -rw-r--r-- | lib/sisu/xml_odf_odt.rb | 13 | ||||
| -rw-r--r-- | lib/sisu/xml_shared.rb | 1 | 
15 files changed, 101 insertions, 103 deletions
| @@ -5,8 +5,10 @@  *.\#*  *.tmp  *_tmp +.*  *.gem  *.gemspec +!.gitignore  *_.rb  *.rb_  .pc diff --git a/lib/sisu/ao_doc_str.rb b/lib/sisu/ao_doc_str.rb index 40f5a045..31fd62ec 100644 --- a/lib/sisu/ao_doc_str.rb +++ b/lib/sisu/ao_doc_str.rb @@ -296,15 +296,17 @@ module SiSU_AO_DocumentStructureExtract            else nil            end          end -        if t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?(?:\(.+?\))?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\(.+?\)\{|\{table\()|^(?: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 @per.code==:off \ -        and @per.poem==:off \ -        and @per.group==:off \ -        and @per.block==:off \ -        and @per.alt==:off \ -        and @per.box==:off \ -        and @per.table==:off +        if (t_o.is_a?(String) \ +          && t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?(?:\(.+?\))?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\(.+?\)\{|\{table\()|^(?:table\{|\{table)[ ~]/ \ +           && t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?(?:\(.+?\))?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$|^`:quote_(?:open|close)`/ \ +          and @per.code==:off \ +          and @per.poem==:off \ +          and @per.group==:off \ +          and @per.block==:off \ +          and @per.alt==:off \ +          and @per.box==:off \ +          and @per.table==:off +        )            t_o=case t_o            when /^#{Mx[:meta_o]}\S+?#{Mx[:meta_c]}/                                 #metadata, header              if t_o=~/^#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*(.+)/m @@ -962,9 +964,9 @@ module SiSU_AO_DocumentStructureExtract          end          if @per.table==:curls or @per.table==:tics            if (@per.table==:curls \ -          and t_o =~/^\}table/) \ +          and (t_o.is_a?(String) and t_o =~/^\}table/)) \            or (@per.table==:tics \ -          and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) +          and (t_o.is_a?(String) and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/))              @per.table=:off              headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx]              @h={ @@ -998,9 +1000,10 @@ module SiSU_AO_DocumentStructureExtract          if @per.code==:curls \          or @per.code==:tics            if (@per.code==:curls \ -          && t_o =~/^\}code/) \ +          && (t_o.is_a?(String) && t_o =~/^\}code/)) \            or (@per.code==:tics \ -          && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/m) +          && (t_o.is_a?(String) && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/m) \ +          )              @per.code=:off              if @tuned_code[-1]                @tuned_code[-1]. @@ -1049,11 +1052,11 @@ module SiSU_AO_DocumentStructureExtract          or (@per.alt==:curls \          || @per.alt==:tics) \          or (@per.quote==:open \ -        && t_o =~/`:quote_close`/m) #not +        && (t_o.is_a?(String) && t_o =~/`:quote_close`/m))            if (@per.poem==:curls \ -          && t_o =~/^\}poem$/m) \ +          && (t_o.is_a?(String) && t_o.to_s =~/^\}poem$/m)) \            or (@per.poem==:tics \ -          && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) +          && (t_o.is_a?(String) && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/))              @per.poem=:off              h={                is_for: :poem, @@ -1064,9 +1067,9 @@ module SiSU_AO_DocumentStructureExtract              }              t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)            elsif (@per.box==:curls \ -          && t_o =~/^\}box/) \ +          && (t_o.is_a?(String) && t_o =~/^\}box/)) \            or (@per.box==:tics \ -          && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) +          && (t_o.is_a?(String) && t_o.to_s =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/))              @per.box=:off              obj,tags=extract_tags(@tuned_block.join("\n"))              h={ @@ -1087,9 +1090,9 @@ module SiSU_AO_DocumentStructureExtract              }              t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)            elsif (@per.group==:curls \ -          && t_o =~/^\}group/) \ +          && ( t_o.is_a?(String) && t_o.to_s =~/^\}group/)) \            or (@per.group==:tics \ -          && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) +          && (t_o.is_a?(String) && t_o.to_s =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/))              @per.group=:off              obj,tags=extract_tags(@tuned_block.join("\n"))              h={ @@ -1109,9 +1112,11 @@ module SiSU_AO_DocumentStructureExtract              }              t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)            elsif (@per.block==:curls \ -          && t_o =~/^\}block/) \ +          && t_o.to_s =~/^\}block/) \            or (@per.block==:tics \ -          && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) +          && (t_o.is_a?(String) \ +            && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) \ +          )              @per.block=:off              obj,tags=extract_tags(@tuned_block.join("\n"))              h={ @@ -1131,9 +1136,11 @@ module SiSU_AO_DocumentStructureExtract              }              t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)            elsif (@per.alt==:curls \ -          && t_o =~/^\}alt/) \ +          && (t_o.is_a?(String) && t_o =~/^\}alt/)) \            or (@per.alt==:tics \ -          && t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) +          && t_o.is_a?(String) \ +            && (t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/) +          )              @per.alt=:off              obj,tags=extract_tags(@tuned_block.join("\n"))              h={ @@ -1153,7 +1160,7 @@ module SiSU_AO_DocumentStructureExtract              }              t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)            elsif @per.quote==:open \ -          and t_o =~/`:quote_close`/m +          and (t_o.is_a?(String) &&  t_o =~/`:quote_close`/m)              @per.quote=:off              h={                is_for: :quote, @@ -1184,10 +1191,12 @@ module SiSU_AO_DocumentStructureExtract            || @per.block==:tics) \            or (@per.alt==:curls \            || @per.alt==:tics) \ -          and t_o =~/\S/ \ -          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 +          and (t_o.is_a?(String) \ +            and t_o.to_s =~/\S/ \ +            and t_o.to_s !~/^(?:\}(?:verse|code|box|alt|group|block)|(?:verse|code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|alt|group|block)\{)/ \ +            and t_o.to_s !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ +          ) +            sub_array=t_o.to_s.dup              @line_mode=sub_array.scan(/.+/)              type=if @per.poem==:curls or @per.poem==:tics                t_o=SiSU_AO_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(type).join @@ -1230,7 +1239,7 @@ module SiSU_AO_DocumentStructureExtract                  gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}").                  gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")              end -            @tuned_block << t_o if t_o =~/\S+/ +            @tuned_block << t_o if t_o.to_s =~/\S+/            else tuned_file << t_o            end          else tuned_file << t_o @@ -1700,7 +1709,7 @@ SKIPPED processing file:                  ocnh+=1                end                if ln==0 \ -              or ln=~@md.lv0 +              or ln.to_s =~@md.lv0                  @lev_occurences[:a] += 1                  if not dob.obj =~/~#|-#/                    ocn_flag=true @@ -1716,7 +1725,7 @@ SKIPPED processing file:                  collapsed_level=@collapsed_lv0                  node,ocn_sp,parent=node0,"h#{ocnh}",'ROOT'                elsif ln==1 \ -              or ln=~@md.lv1 +              or ln.to_s =~@md.lv1                  @lev_occurences[:b] += 1                  if not dob.obj =~/~#|-#/                    ocn_flag=true @@ -1739,7 +1748,7 @@ SKIPPED processing file:                  collapsed_level=@collapsed_lv1                  node,ocn_sp,parent=node1,"h#{ocnh}",node0 #FIX                elsif ln==2 \ -              or ln=~@md.lv2 +              or ln.to_s =~@md.lv2                  @lev_occurences[:c] += 1                  if not dob.obj =~/~#|-#/                    ocn_flag=true @@ -1762,7 +1771,7 @@ SKIPPED processing file:                  collapsed_level=@collapsed_lv2                  node,ocn_sp=node2,"h#{ocnh}"                elsif ln==3 \ -              or ln=~@md.lv3 +              or ln.to_s =~@md.lv3                  @lev_occurences[:d] += 1                  if not dob.obj =~/~#|-#/                    ocn_flag=true @@ -1793,7 +1802,7 @@ or this level should be level :B~ rather than #{dob.lv}}                  collapsed_level=@collapsed_lv3                  node,ocn_sp=node3,"h#{ocnh}"                elsif ln==4 \ -              or ln=~@md.lv4 +              or ln.to_s =~@md.lv4                  @lev_occurences[:l1] += 1                  if not dob.obj =~/~#|-#/                    ocn_flag=true @@ -1827,7 +1836,7 @@ or this level should be level :B~ rather than #{dob.lv}}                  collapsed_level=@collapsed_lv4                  node,ocn_sp=node4,"h#{ocnh}"                elsif ln==5 \ -              or ln=~@md.lv5 +              or ln.to_s =~@md.lv5                  @lev_occurences[:l2] += 1                  if not dob.obj =~/~#|-#/                    ocn_flag=true @@ -1864,7 +1873,7 @@ or this level should be level :B~ rather than #{dob.lv}}                  collapsed_level=@collapsed_lv5                  node,ocn_sp=node5,"h#{ocnh}"                elsif ln==6 \ -              or ln=~@md.lv6 +              or ln.to_s =~@md.lv6                  @lev_occurences[:l3] += 1                  if not dob.obj =~/~#|-#/                    ocn_flag=true @@ -1909,7 +1918,7 @@ or this level should be #5 (2~) rather ##{dob.ln} (#{dob.lv}~)"                  collapsed_level=@collapsed_lv6                  node,ocn_sp=node6,"h#{ocnh}"                elsif ln==7 \ -              or ln=~@md.lv7 +              or ln.to_s =~@md.lv7                  @lev_occurences[:l4] += 1                  if not dob.obj =~/~#|-#/                    ocn_flag=true diff --git a/lib/sisu/ao_numbering.rb b/lib/sisu/ao_numbering.rb index c8bafc23..777c5a44 100644 --- a/lib/sisu/ao_numbering.rb +++ b/lib/sisu/ao_numbering.rb @@ -590,7 +590,7 @@ 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]/ +            if dob.ln.to_s =~/[0-3]/                {                  seg: nil,                  level: dob.ln, diff --git a/lib/sisu/db_columns.rb b/lib/sisu/db_columns.rb index 5ed6e680..608b59a7 100644 --- a/lib/sisu/db_columns.rb +++ b/lib/sisu/db_columns.rb @@ -1886,7 +1886,7 @@ module SiSU_DbColumns          end          def tuple            if defined? @md.wc_words \ -          and @md.wc_words=~/\S+/ +          and @md.wc_words.to_s=~/\S+/              txt=@md.wc_words              txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "] @@ -1957,15 +1957,16 @@ module SiSU_DbColumns            %{COMMENT ON COLUMN metadata_and_text.#{name}             IS 'metadata document links';}          end -        def tuple -          if defined? @md.links \ -          and @md.links=~/\S+/ -            txt=@md.links -            txt=special_character_escape(txt) -            ["#{name}, ","'#{txt}', "] -          else ['',''] -          end -        end +        #def tuple +        #  #BUG HERE - links is an array of paired values :say :url +        #  if defined? @md.links \ +        #  and @md.links=~/\S+/ +        #    txt=@md.links +        #    txt=special_character_escape(txt) +        #    ["#{name}, ","'#{txt}', "] +        #  else ['',''] +        #  end +        #end          self        end        self diff --git a/lib/sisu/db_load_tuple.rb b/lib/sisu/db_load_tuple.rb index 23496388..d7b8e857 100644 --- a/lib/sisu/db_load_tuple.rb +++ b/lib/sisu/db_load_tuple.rb @@ -75,17 +75,12 @@ module SiSU_DbTuple          "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev0, lev1, lev2, lev3, lev4, lev5, lev6, lev7, t_of, t_is, node, parent, digest_clean, digest_all) " +          "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv0]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:lv7]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');"        end -      if @opt.act[:verbose_plus][:set]==:on -        if @opt.act[:maintenance][:set]==:on +      if @opt.act[:maintenance][:set]==:on            puts @file_maint.inspect            puts sql_entry -        end -        @file_maint.puts sql_entry -      else -        if @opt.act[:verbose_plus][:set]==:on -          puts sql_entry            @file_maint.puts sql_entry -        end +      elsif @opt.act[:verbose_plus][:set]==:on +          puts sql_entry        end        if @opt.act[:verbose][:set]==:on          if @col[:lev].inspect =~/[0-35-7]/ @@ -189,7 +184,6 @@ module SiSU_DbTuple  #{@tp.column.src_word_count.tuple[0]}  #{@tp.column.src_txt.tuple[0]}  #{@tp.column.fulltext.tuple[0]} -#{@tp.column.links.tuple[0]}  tid)  " +         "VALUES ( @@ -269,16 +263,11 @@ tid)  #{@tp.column.src_word_count.tuple[1]}  #{@tp.column.src_txt.tuple[1]}  #{@tp.column.fulltext.tuple[1]} -#{@tp.column.links.tuple[1]}  #{@id}  );"        if @md.opt.act[:maintenance][:set]==:on          puts "maintenance mode on: creating sql transaction file (for last transaction set (document) only):\n\t#{@file_maint.inspect}"          @file_maint.puts sql_entry -      else -        if @md.opt.act[:verbose_plus][:set]==:on -          @file_maint.puts sql_entry -        end        end        sql_entry      end @@ -292,10 +281,6 @@ tid)        "VALUES (#{@u[:txt]} #{@u[:html_toc]} #{@u[:html_doc]} #{@u[:xhtml]} #{@u[:xml_sax]} #{@u[:xml_dom]} #{@u[:odf]} #{@u[:pdf_p]} #{@u[:pdf_l]} #{@u[:concordance]} #{@u[:latex_p]} #{@u[:latex_l]} #{@u[:manifest]} #{@u[:digest]} #{@u[:markup]} #{@u[:sisupod]} #{@id});"        if @opt.act[:maintenance][:set]==:on          @file_maint.puts sql_entry -      else -        if @opt.act[:verbose_plus][:set]==:on -          @file_maint.puts sql_entry -        end        end        sql_entry      end @@ -309,10 +294,6 @@ tid)        "VALUES ('#{@en[:id]}', '#{@en[:lid]}', '#{@en[:nr]}', '#{@en[:txt]}', '#{@en[:body]}', '#{@en[:ocn]}', '#{@en[:ocnd]}', '#{@en[:ocns]}', '#{@en[:id_t]}', '#{@en[:hash]}');"        if @opt.act[:maintenance][:set]==:on          @file_maint.puts sql_entry -      else -        if @opt.act[:verbose_plus][:set]==:on -          @file_maint.puts sql_entry -        end        end        sql_entry      end diff --git a/lib/sisu/db_sqltxt.rb b/lib/sisu/db_sqltxt.rb index 9f311242..c6c2e301 100644 --- a/lib/sisu/db_sqltxt.rb +++ b/lib/sisu/db_sqltxt.rb @@ -55,7 +55,7 @@  module SiSU_DbText    class Prepare      def special_character_escape(str) -      str=str.gsub(/'/m,"''"). #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'") +      str=str.to_s.gsub(/'/m,"''"). #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'")          gsub(/(\\)/m,'\1\1'). #ok but with warnings, double backslash on sqlite #str.gsub!(/[\\]/m,'\\x5C') #ok but with warnings, but not for sqlite #str.gsub!(/(\\)/m,'\1') #ok for sqlite not for pgsql          gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/m,"<br>\n").          gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/m,''). #check diff --git a/lib/sisu/dp.rb b/lib/sisu/dp.rb index 522510ad..3c7b9203 100644 --- a/lib/sisu/dp.rb +++ b/lib/sisu/dp.rb @@ -1305,8 +1305,8 @@ module SiSU_Param            end            if @home_button_image \            and @home_button_image.is_a?(Hash) \ -          and (@home_button_image =~@rgx_image \ -            or @home_button_image =~/\S+?\.(?:jpg|png|gif)/) +          and (@home_button_image[:home] =~@rgx_image \ +            or @home_button_image[:home] =~/\S+?\.(?:jpg|png|gif)/)              @ec[:image] << @home_button_image            end            if @ec[:image].length > 0 diff --git a/lib/sisu/html.rb b/lib/sisu/html.rb index 6ce8b1b4..ddece373 100644 --- a/lib/sisu/html.rb +++ b/lib/sisu/html.rb @@ -361,7 +361,7 @@ WOK          dob=@data          linkname,link=dob.obj.strip,dob.ocn          if link \ -        and link !~/#/ #% keep eye on link +        and link.to_s !~/#/ #% keep eye on link            SiSU_HTML_Format::ParagraphNumber.new(@md,link)          end          title=linkname @@ -384,7 +384,7 @@ WOK          dob=@data          linkname,link=dob.obj.strip,dob.ocn          if link \ -        and link !~/#/ #% keep eye on link +        and link.to_s !~/#/ #% keep eye on link            SiSU_HTML_Format::ParagraphNumber.new(@md,link)          end          title=if dob.obj !~/^Metadata$/ then linkname @@ -430,7 +430,7 @@ WOK          dob=@data          linkname,ocn=dob.obj.strip,dob.ocn          p_num=if ocn \ -        and ocn !~/#/ +        and ocn.to_s !~/#/            SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)          else nil          end @@ -454,7 +454,7 @@ WOK          dob=@data          linkname,ocn=dob.obj.strip,dob.ocn          p_num=if ocn \ -        and ocn !~/#/ +        and ocn.to_s !~/#/            SiSU_HTML_Format::ParagraphNumber.new(@md,ocn)          else nil          end @@ -526,7 +526,7 @@ WOK          linkname,ocn=dob.obj.strip,dob.ocn          toc={}          if ocn \ -        and ocn !~/#/ +        and ocn.to_s !~/#/            fnh={              fn: @@seg_url,            } @@ -551,7 +551,7 @@ WOK          linkname,ocn=dob.obj.strip,dob.ocn          toc={}          if ocn \ -        and ocn !~/#/ +        and ocn.to_s !~/#/            fnh={              fn: @@seg_url,            } diff --git a/lib/sisu/html_minitoc.rb b/lib/sisu/html_minitoc.rb index 9e2f5295..158e391b 100644 --- a/lib/sisu/html_minitoc.rb +++ b/lib/sisu/html_minitoc.rb @@ -161,7 +161,7 @@        end        def level_4          txt=@data -        unless txt =~/~metadata/ +        unless txt.obj =~/~metadata/            if txt.ln ==4              fnh={                fn: txt.name, diff --git a/lib/sisu/html_scroll.rb b/lib/sisu/html_scroll.rb index 172a88a4..f2a8bb4f 100644 --- a/lib/sisu/html_scroll.rb +++ b/lib/sisu/html_scroll.rb @@ -209,9 +209,9 @@ module SiSU_HTML_Scroll              sto.table            elsif dob.is==:break            end -          if dob =~/<a name="n\d+">/ \ -          and dob =~/^(?:\^~\d+\s|<!e[:_]\d+!>)/ # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though -            dob='' +          if dob.obj =~/<a name="n\d+">/ \ +          and dob.obj =~/^(?:\^~\d+\s|<!e[:_]\d+!>)/ # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though +            dob.obj=''            end            unless @rcdc              @scr[:body] << para_html unless para_html =~/\A\s*\Z/ diff --git a/lib/sisu/shared_metadata.rb b/lib/sisu/shared_metadata.rb index 1e893ce9..8a57eaeb 100644 --- a/lib/sisu/shared_metadata.rb +++ b/lib/sisu/shared_metadata.rb @@ -1151,9 +1151,14 @@ WOK          tag,inf=tr.prefix_b,@md.notes.prefix_b          meta << meta_para(tag,inf)        end -      if defined? @md.classify.identifier \ -      and @md.classify.identifier=~/\S+/ -        tag,inf=tr.identifier,@md.classify.identifier +      if defined? @md.identifier.isbn \ +      and @md.identifier.isbn=~/\S+/ +        tag,inf=tr.cls_isbn,@md.identifier.isbn +        meta << meta_para(tag,inf) +      end +      if defined? @md.identifier.oclc \ +      and @md.identifier.oclc=~/\S+/ +        tag,inf=tr.cls_oclc,@md.identifier.oclc          meta << meta_para(tag,inf)        end        if defined? @md.original.source \ diff --git a/lib/sisu/texpdf.rb b/lib/sisu/texpdf.rb index 57202bfd..923b7ad1 100644 --- a/lib/sisu/texpdf.rb +++ b/lib/sisu/texpdf.rb @@ -639,7 +639,7 @@ module SiSU_TeX              dob            else 'error' #should never occur            end -          dob=enclose(dob) unless dob.tmp =~/^$/ +          dob=enclose(dob) unless (dob.tmp.is_a?(String) && dob.tmp =~/^$/)            dob          else            tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob) @@ -710,11 +710,11 @@ module SiSU_TeX                dob.tmp=tst.hang              else                dob.tmp=dob.tmp.strip -              dob=enclose(dob) unless dob.tmp =~/^$/ +              dob=enclose(dob) unless (dob.tmp.is_a?(String) && dob.tmp =~/^$/)              end            else              dob.tmp=dob.tmp.strip unless dob.is==:code -            dob=enclose(dob) unless dob.tmp =~/^$/ +            dob=enclose(dob) unless (dob.tmp.is_a?(String) && dob.tmp =~/^$/)            end            if dob.is_a?(String)              dob.tmp=dob.tmp.gsub(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \newline ').   #% tread with care @@ -722,20 +722,20 @@ module SiSU_TeX            end            dob          end -        if dob.tmp =~/(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image\b)/m \ +        if (dob.tmp.is_a?(String) and dob.tmp =~/(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image\b)/m) \          && dob.is !=:code            dob=SiSU_TeX_Pdf::BareUrls.new(@md,dob).bare_urls            tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob)            dob=tst.urls_txt_and_images            dob -        elsif dob.tmp =~/https?:\/\/\S+\b/m \ +        elsif (dob.tmp.is_a?(String) and dob.tmp  =~/https?:\/\/\S+\b/m) \          && dob.is ==:code \          && @codeblock_box !='listings'            dob=SiSU_TeX_Pdf::BareUrls.new(@md,dob).bare_urls_in_code            dob          end          if dob.class !=Hash \ -        && dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\b/ \ +        && (dob.tmp.is_a?(String) and dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\b/) \          && dob.is !=:code            tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob)          end diff --git a/lib/sisu/xhtml_epub2.rb b/lib/sisu/xhtml_epub2.rb index 513b8436..c80a90df 100644 --- a/lib/sisu/xhtml_epub2.rb +++ b/lib/sisu/xhtml_epub2.rb @@ -579,7 +579,7 @@ module SiSU_XHTML_EPUB2          ocn=dob.ocn          toc={}          if ocn \ -        and ocn !~/#/ +        and ocn.to_s !~/#/            p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)            lnk_n_txt=%{  <a href="#{@@seg_url}#{Sfx[:epub_xhtml]}#o#{ocn}">      #{linkname} @@ -600,7 +600,7 @@ module SiSU_XHTML_EPUB2          ocn=dob.ocn          toc={}          if ocn \ -        and ocn !~/#/ +        and ocn.to_s !~/#/            p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)            lnk_n_txt=%{  <a href="#{@@seg_url}#{Sfx[:epub_xhtml]}#o#{ocn}">    #{linkname} @@ -621,7 +621,7 @@ module SiSU_XHTML_EPUB2          ocn=dob.ocn          toc={}          if ocn \ -        and ocn !~/#/ +        and ocn.to_s !~/#/            p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn)            lnk_n_txt=%{  <a href="#{@@seg_url}#{Sfx[:epub_xhtml]}#o#{ocn}">    #{linkname} diff --git a/lib/sisu/xml_odf_odt.rb b/lib/sisu/xml_odf_odt.rb index 4d670a92..1f1c69b7 100644 --- a/lib/sisu/xml_odf_odt.rb +++ b/lib/sisu/xml_odf_odt.rb @@ -215,7 +215,8 @@ module SiSU_XML_ODF_ODT          end          unless @@docstart            breakpage=if (@md.pagenew || @md.pagebreak) \ -          and (@md.pagenew =~m or @md.pagebreak =~m) +          and (@md.pagenew.to_s =~m \ +            or @md.pagebreak.to_s =~m)              '<text:p text:style-name="P_normal_page_new"> </text:p>'            elsif @md.pageline \            and @md.pageline =~m #fix @@ -612,7 +613,7 @@ module SiSU_XML_ODF_ODT          if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/            if @make.build.odt_ocn?              if defined? dob.ocn \ -            and dob.ocn.is_a?(Fixnum) +            and dob.ocn.is_a?(Integer)                p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(@make,dob.ocn).set_bookmark_and_display              end            end @@ -670,7 +671,7 @@ module SiSU_XML_ODF_ODT            word=dob.obj.scan(/\S+|\n/)            if word              word.each do |w| # _ - / # | : ! ^ ~ -              unless dob =~/^(?:#{Rx[:meta]}|%+ )/m +              unless dob.obj =~/^(?:#{Rx[:meta]}|%+ )/m                  w=w.gsub(/&#(?:126|152);/,'~'). #126 usual                    gsub(/ /,' ')                  if w !~/(?:&\S{2,7}?;)+/ @@ -735,9 +736,9 @@ module SiSU_XML_ODF_ODT            dob.obj=tidywords(wordlist).join(' ').strip            @rcdc=true if @rcdc==false \            and (dob.obj =~/~metadata/ \ -          or dob =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) #fix Mx[:lv_o] +          or dob.obj =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) #fix Mx[:lv_o]            if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ #check -            if defined? dob.ocn and dob.ocn =~/\d+/ +            if defined? dob.ocn and dob.ocn.to_s =~/\d+/                @p_num=SiSU_XML_ODF_ODT_Format::ParagraphNumber.new(@make,dob.ocn)              end              if dob.is ==:heading \ @@ -859,7 +860,7 @@ WOK          env.make_path(@md.file.output_path.odt.dir)          filename="#{@env.processing_path.odt}/content.xml"          od=File.new(filename,'w+') -        @content.compact.each do |para|                                                # this is a hack +        @content.flatten.compact.each do |para|             # this is a hack, check change does not alter behavior            od.puts para unless para =~/\A\s*\Z/          end          od.close diff --git a/lib/sisu/xml_shared.rb b/lib/sisu/xml_shared.rb index 7d1aceb1..906da2a0 100644 --- a/lib/sisu/xml_shared.rb +++ b/lib/sisu/xml_shared.rb @@ -81,7 +81,6 @@ module SiSU_XML_Munge            inst:  'institute',            co:    'company',            com:   'company', -          conv:  'convention',            dt:    'date',            y:     'year',            m:     'month', | 
