diff options
Diffstat (limited to 'lib')
72 files changed, 2702 insertions, 2719 deletions
| diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index 43008c3d..76fc5d37 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -1366,6 +1366,14 @@ WOK          '^\copyright \textnormal{\1} \2') # watch likely to be problematic        str      end +    def special_characters_safe_close(str) +      str.gsub!(/<=tilde>/,'{$\tilde$}') +      str.gsub!(/<=hash>/,'{\#}') +      str.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005 +      str.gsub!(/<=copymark>\s*(.+)/, +        '^\copyright \textnormal{\1} \2') # watch likely to be problematic +      str +    end      def special_characters_code_fix(str)        str.gsub!(/<=tilde>/,'{$\tilde$}')        str @@ -1398,6 +1406,7 @@ WOK        str,is=@txt,@is        str=xetex_special_characters_1(str,is) unless str.nil?        str=xetex_special_characters_2(str,is) unless str.nil? # remove this to start with, causes issues +      str=special_characters_safe_close(str) unless str.nil?        @txt=str      end      def characters_code_listings                                   #special characters - some substitutions are sequence sensitive, rearrange with care. diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index b188187a..a2385376 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -266,7 +266,7 @@ module SiSU_urls          if x=~/^o/ \          and @opt.cmd=~/o/ \          and x=~/^[#{@opt.cmd}]/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.odf}/content.xml").maintenance #not implemented +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.odf}/#{@opt.fns}/odt/content.xml").maintenance          end        end      end diff --git a/lib/sisu/v3dv/author_format.rb b/lib/sisu/v3dv/author_format.rb index 8d219c93..cfc485f3 100644 --- a/lib/sisu/v3dv/author_format.rb +++ b/lib/sisu/v3dv/author_format.rb @@ -65,14 +65,14 @@ module SiSU_FormatAuthor        @authors,@author_array=[],[]        authors=@author_param.scan(/[^;]+/)        authors.each do |a| -        a.strip! +        a=a.strip          if a =~/"(.+?)"/            @authors << { the: $1 }            @author_array << $1.upcase          else #if a =~/,/            x=a.scan(/[^,]+/) -          x[0].strip! -          x[1].strip! if x[1] +          x[0]=x[0].strip +          x[1]=x[1].strip if x[1]            if x.length==1              @authors << { the: x[0] }              @author_array << x[0].upcase diff --git a/lib/sisu/v3dv/cgi_pgsql.rb b/lib/sisu/v3dv/cgi_pgsql.rb index 48d49774..26a85874 100644 --- a/lib/sisu/v3dv/cgi_pgsql.rb +++ b/lib/sisu/v3dv/cgi_pgsql.rb @@ -82,7 +82,7 @@ module  SiSU_CGI_PgSQL            end          else put "WARNING: no postgresql database available, (have you created one?)"          end -        serve.sort! +        serve=serve.sort          f1,f2,f3='','',''          serve.each do |x|            f1 << %{              <option value="#{Db[:name_prefix]}#{x}">#{x}</option>\n} unless x =~/apache|sisu\/image/ #check @@ -151,12 +151,12 @@ module  SiSU_CGI_PgSQL              elsif @q =~/\S+/;  unescaped_search=CGI.unescape(@q)              end              search_construct=[] -            if @c -              unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~\( '") -              unescaped_search.gsub!(/(.+)/,"#{@l}~\( '\\1' \)") +            unescaped_search=if @c +              unescaped_search.gsub(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~\( '"). +                gsub(/(.+)/,"#{@l}~\( '\\1' \)")              else -              unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~*\( '") -              unescaped_search.gsub!(/(.+)/,"#{@l}~*\( '\\1' \)") +              unescaped_search.gsub(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~*\( '"). +                gsub(/(.+)/,"#{@l}~*\( '\\1' \)")              end              search_construct << unescaped_search              search_construct=search_construct.join(' ') @@ -173,11 +173,11 @@ module  SiSU_CGI_PgSQL        <<-'WOK_SQL'            @search_text,@search_endnotes='',''            search[:text].flatten.each {|x| @search_text << "#{x} AND " } -          @search_text=@search_text.gsub!(/AND\s+$/m,'') #watch -          @search_text.gsub!(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)') +          @search_text=@search_text.gsub(/AND\s+$/m,''). #watch +            gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')            search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " } -          @search_endnotes=@search_endnotes.gsub!(/AND\s+$/m,'') #watch -          @search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') +          @search_endnotes=@search_endnotes.gsub(/AND\s+$/m,''). #watch +            gsub(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)')          end        WOK_SQL      end diff --git a/lib/sisu/v3dv/cgi_sql_common.rb b/lib/sisu/v3dv/cgi_sql_common.rb index 59844d2b..0f17bb79 100644 --- a/lib/sisu/v3dv/cgi_sql_common.rb +++ b/lib/sisu/v3dv/cgi_sql_common.rb @@ -311,12 +311,10 @@ module SiSU_CGI_SQL              elsif @search_field =~m[:string];            m[:string].match(@search_field)[1]              else                str=m[:word].match(@search_field)[1] -              str.gsub!(/[()]/,'') +              str=str.gsub(/[()]/,'')                str              end -            search_string.strip! -            search_string.gsub!(/\s+/,'+') -            search_string +            search_string=search_string.strip.search_string.gsub(/\s+/,'+')            #else            #  "__"            end @@ -756,13 +754,13 @@ module SiSU_CGI_SQL            elsif checked_all =~/checked/ or checked_url =~/checked/              canned_search=@@canned_search_url.scan(/(?:s1|ft|au|ti|fns|tr)=[^&]+/)              af=canned_search.join('; ') -            af.gsub!(/s1=/,'text: ') -            af.gsub!(/ft=/,'fulltxt: ') -            af.gsub!(/au=/,'author: ') -            af.gsub!(/ti=/,'title: ') -            af.gsub!(/fns=/,'filename: ') -            af.gsub!(/tr=/,'topic_register: ') -            af.gsub!(/%2B/,' ') +            af=af.gsub(/s1=/,'text: '). +              gsub(/ft=/,'fulltxt: '). +              gsub(/au=/,'author: '). +              gsub(/ti=/,'title: '). +              gsub(/fns=/,'filename: '). +              gsub(/tr=/,'topic_register: '). +              gsub(/%2B/,' ')              analyze_format=af              st=af.split(/\s*;\s*/)              search_field=st.join("\n") @@ -916,7 +914,7 @@ module SiSU_CGI_SQL              file_suffix=c['src_filename'][/.+?\.(_?sst|ssm)$/,1]              lang=if location =~ /\S+?~(\S\S\S?)$/                l=location[/\S+?~(\S\S\S?)$/,1] -              location.gsub!(/(\S+?)~\S\S\S?/,'\1') +              location=location.gsub(/(\S+?)~\S\S\S?/,'\1')                l=".#{l}"              else ''              end @@ -1008,7 +1006,7 @@ module SiSU_CGI_SQL              file_suffix=e['src_filename'][/.+?\.(_?sst|ssm)$/,1]              lang=if location =~ /\S+?~(\S\S\S?)$/                l=location[/\S+?~(\S\S\S?)$/,1] -              location.gsub!(/(\S+?)~\S\S\S?/,'\1') +              location=location.gsub(/(\S+?)~\S\S\S?/,'\1')                l=".#{l}"              else ''              end diff --git a/lib/sisu/v3dv/cgi_sqlite.rb b/lib/sisu/v3dv/cgi_sqlite.rb index 166bda77..31ba44c4 100644 --- a/lib/sisu/v3dv/cgi_sqlite.rb +++ b/lib/sisu/v3dv/cgi_sqlite.rb @@ -78,7 +78,7 @@ module  SiSU_CGI_SQLite            end          end        end -      serve.sort! +      serve=serve.sort        f1,f2,f3='','',''        serve.each do |x|          f1 << %{              <option value="#{Db[:name_prefix]}#{x}">#{x}</option>\n} @@ -148,8 +148,8 @@ module  SiSU_CGI_SQLite              elsif @q =~/\S+/;  unescaped_search=CGI.unescape(@q)              end              search_construct=[] -            unescaped_search.gsub!(/\s*(AND|OR)\s*/,"%' \) \\1 #{@l} LIKE \( '%") -            unescaped_search.gsub!(/(.+)/,"#{@l} LIKE \( '%\\1%' \)") +            unescaped_search=unescaped_search.gsub(/\s*(AND|OR)\s*/,"%' \) \\1 #{@l} LIKE \( '%"). +              gsub(/(.+)/,"#{@l} LIKE \( '%\\1%' \)")              search_construct << unescaped_search              search_construct=search_construct.join(' ')              search[:search]                    << search_construct @@ -165,11 +165,11 @@ module  SiSU_CGI_SQLite        <<-'WOK_SQL'            @search_text,@search_endnotes='',''            search[:text].flatten.each {|x| @search_text << "#{x} AND " } -          @search_text=@search_text.gsub!(/AND\s+$/m,'') -          @search_text.gsub!(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') +          @search_text=@search_text.gsub(/AND\s+$/m,''). +            gsub(/(doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')            search[:endnotes].flatten.each {|x| @search_endnotes << "#{x} AND " } -          @search_endnotes=@search_endnotes.gsub!(/AND\s+$/m,'') -          @search_endnotes.gsub!(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') +          @search_endnotes=@search_endnotes.gsub(/AND\s+$/m,''). +            gsub(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)')          end        WOK_SQL      end diff --git a/lib/sisu/v3dv/composite.rb b/lib/sisu/v3dv/composite.rb index abfba7a2..21adb030 100644 --- a/lib/sisu/v3dv/composite.rb +++ b/lib/sisu/v3dv/composite.rb @@ -161,11 +161,11 @@ module SiSU_Assemble          end          if not @code_flag \          and i !~/^%+\s/ -          i.gsub!(/^([123]|:?[ABC])~\? /,'% [conditional heading:] \1~ ')            #off conditional heading (consider syntax) +          i=i.gsub(/^([123]|:?[ABC])~\? /,'% [conditional heading:] \1~ ')            #off conditional heading (consider syntax)            if i =~/^@\S+?:/ -            i.gsub!(/\n/m,"\n%  ") -            i.gsub!(/\n%\s+$/m,'') -            i.gsub!(/^@\S+?:/m,"\n% [imported header:] ")                          #off imported headers +            i=i.gsub(/\n/m,"\n%  "). +              gsub(/\n%\s+$/m,''). +              gsub(/^@\S+?:/m,"\n% [imported header:] ")                          #off imported headers            end          end          file[:prepared] << i @@ -176,8 +176,7 @@ module SiSU_Assemble        end        file[:prepared] << "\n% end import" << "\n\n"        if file[:images].length > 0 -        file[:images].flatten! -        file[:images].uniq! +        file[:images]=file[:images].flatten.uniq          file[:images].delete_if {|x| x =~/https?:\/\// }        end        file @@ -218,15 +217,13 @@ module SiSU_Assemble            end          else tuned_file << para          end -        tuned_file.flatten! -        tuned_file.compact! +        tuned_file=tuned_file.flatten.compact        end        if @@imager.length >0          @@imager.each do |d,i| -          i.flatten! -          i.uniq! +          i=i.flatten.uniq            image_info=d + i -          download_images(mage_info.flatten) +          download_images(image_info.flatten)          end        end        tuned_file diff --git a/lib/sisu/v3dv/concordance.rb b/lib/sisu/v3dv/concordance.rb index 2e14ab14..e51514c3 100644 --- a/lib/sisu/v3dv/concordance.rb +++ b/lib/sisu/v3dv/concordance.rb @@ -245,54 +245,55 @@ WOK              ocn=line.ocn.to_s              if ocn =~/\d+/ \              and ocn !~/^0$/ -              line.obj.gsub!(/#{@rxp_excluded1}/,' ') +              line.obj=line.obj.gsub(/#{@rxp_excluded1}/,' ')                line.obj=line.obj.split(@rgx_splitlist).join(' ') #%take in word or other match                for word in line.obj.scan(@rgx_scanlist) #%take in word or other match                  if word =~ /^([#{@alphlst[:l]}])/                    firstletter=$1                    flu=firstletter.tr(@alphlst[:l],@alphlst[:u]) -                  word.gsub!(/^#{firstletter}/,flu ) +                  word=word.gsub(/^#{firstletter}/,flu )                  end -                word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'') -                word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'') -                word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') -                word.gsub!(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'') -                word.gsub!(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'') -                word.gsub!(/[0-9a-f]{10,}/,' ') if word =~/[0-9]/ -                word.gsub!(/#{Mx[:br_line]}/,' ') -                word.gsub!(/^ +/,'') -                word.gsub!(/^\S$/,'') +                word=word.gsub(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,''). +                  gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''). +                  gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,''). +                  gsub(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,''). +                  gsub(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'') +                word=word.gsub(/[0-9a-f]{10,}/,' ') if word =~/[0-9]/ +                word=word.gsub(/#{Mx[:br_line]}/,' '). +                  gsub(/^ +/,''). +                  gsub(/^\S$/,'')                  word=nil if word.empty?                  word=nil if word =~@rxp_excluded0 #watch                  word=nil if word =~/^\S$/                  if word -                  word.gsub!(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ') -                  word.gsub!(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'') -                  word.gsub!(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'') -                  word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''); word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') -                  word.gsub!(/<\/?\S+?>/,'') -                  word.gsub!(/^\@+/,'') -                  word.strip! -                  word.gsub!(/#{Mx[:tc_p]}.+/,'') -                  word.gsub!(/[\.,;:"]$/,'') -                  word.gsub!(/["]/,'') -                  word.gsub!(/^\s*[\(]/,'') -                  word.gsub!(/[\(]\s*$/,'') -                  word.gsub!(/^(?:See|e\.?g\.?).+/,'') -                  word.gsub!(/^\s*[.,;:]\s*/,'') -                  word.strip! -                  word.gsub!(/^\(?[a-zA-Z]\)$/,'') -                  word.gsub!(/^\d+(st|nd|rd|th)$/,'') -                  word.gsub!(/^(\d+\.?)+$/, '') -                  word.gsub!(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'') -                  word.gsub!(/:name#\S+/,'') -                  word.gsub!(/^\S$/,'') +                  word=word.gsub(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' '). +                    gsub(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,''). +                    gsub(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,''). +                    gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''). +                    gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,''). +                    gsub(/<\/?\S+?>/,''). +                    gsub(/^\@+/,''). +                    strip. +                    gsub(/#{Mx[:tc_p]}.+/,''). +                    gsub(/[\.,;:"]$/,''). +                    gsub(/["]/,''). +                    gsub(/^\s*[\(]/,''). +                    gsub(/[\(]\s*$/,''). +                    gsub(/^(?:See|e\.?g\.?).+/,''). +                    gsub(/^\s*[.,;:]\s*/,''). +                    strip. +                    gsub(/^\(?[a-zA-Z]\)$/,''). +                    gsub(/^\d+(st|nd|rd|th)$/,''). +                    gsub(/^(\d+\.?)+$/, ''). +                    gsub(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,''). +                    gsub(/:name#\S+/,''). +                    gsub(/^\S$/,'')                    word=nil if word =~/^\S$/                    word=nil if word =~/^\s*$/ #watch                    if word                      unless word =~/[A-Z][A-Z]/ \                      or word =~/\w+\s\w+/ -                      word.capitalize! +                      word=word.capitalize                      end                      @freq[word] +=1                      @word_map[word] ||= [] @@ -316,8 +317,8 @@ WOK          scr='<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text"> scroll: </font><font size="1" color="#222222" face=times new roman>doc# </font> '          seg=''          head=SiSU_Concordance::Source::DocTitle.new(@particulars).create -        head.gsub!(/#{Xx[:html_relative2]}/m,@file.path_rel_links.html_seg_2) -        head.gsub!(/#{Xx[:html_relative1]}/m,@file.path_rel_links.html_seg_1) +        head=head.gsub(/#{Xx[:html_relative2]}/m,@file.path_rel_links.html_seg_2). +          gsub(/#{Xx[:html_relative1]}/m,@file.path_rel_links.html_seg_1)          @file_concordance << head          @file_concordance << '<p>'          alph=@alph[:u] diff --git a/lib/sisu/v3dv/dal.rb b/lib/sisu/v3dv/dal.rb index 21d6eebd..d5a4a948 100644 --- a/lib/sisu/v3dv/dal.rb +++ b/lib/sisu/v3dv/dal.rb @@ -119,7 +119,7 @@ module SiSU_DAL          create_dal        rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@@fns).error        ensure -        Instantiate.new +        SiSU_DAL::Instantiate.new        end      end      def get                                                                    #reads dal, unless does not exist then creates first @@ -135,7 +135,7 @@ module SiSU_DAL          dal=(@@dal_array.empty?) ? read_fnc : @@dal_array.dup        rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error        ensure -        Instantiate.new +        SiSU_DAL::Instantiate.new        end      end      def get_idx_sst                                                            #reads dal idx.sst, #unless does not exist then creates first @@ -151,7 +151,7 @@ module SiSU_DAL          dal=(@@idx_arr[:sst].empty?) ? read_idx_sst : @@idx_arr[:sst].dup #check        rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error        ensure -        Instantiate.new +        SiSU_DAL::Instantiate.new        end      end      def get_idx_tex                                                            #reads dal idx.tex, #unless does not exist then creates first @@ -167,7 +167,7 @@ module SiSU_DAL          dal=(@@idx_arr[:tex].empty?) ? read_idx_tex : @@idx_arr[:tex].dup #check        rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error        ensure -        Instantiate.new +        SiSU_DAL::Instantiate.new        end      end      def get_idx_html                                                           #reads dal idx.html, #unless does not exist then creates first @@ -183,7 +183,7 @@ module SiSU_DAL          dal=(@@idx_arr[:html].empty?) ? read_idx_html : @@idx_arr[:html].dup        rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error        ensure -        Instantiate.new +        SiSU_DAL::Instantiate.new        end      end      def get_idx_xhtml                                                          #reads dal idx.xhtml, #unless does not exist then creates first @@ -199,7 +199,7 @@ module SiSU_DAL          dal=(@@idx_arr[:xhtml].empty?) ? read_idx_xhtml : @@idx_arr[:xhtml].dup        rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error        ensure -        Instantiate.new +        SiSU_DAL::Instantiate.new        end      end      def get_map_nametags                                                       #reads dal map.nametags, #unless does not exist then creates first @@ -215,7 +215,7 @@ module SiSU_DAL          dal=(@@map_arr[:nametags].empty?) ? read_map_nametags : @@map_arr[:nametags].dup        rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error        ensure -        Instantiate.new +        SiSU_DAL::Instantiate.new        end      end      def get_map_ocn_htmlseg                                                    #reads dal map.ocn_htmlseg, #unless does not exist then creates first @@ -231,7 +231,7 @@ module SiSU_DAL          dal=(@@map_arr[:ocn_htmlseg].empty?) ? read_map_ocn_htmlseg : @@map_arr[:ocn_htmlseg].dup        rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error        ensure -        Instantiate.new +        SiSU_DAL::Instantiate.new        end      end    protected @@ -475,15 +475,15 @@ module SiSU_DAL        reset        data=@data        data=data.join.split("\n\n") -      data=SiSU_DAL_Insertions::Insertions.new(@md,data).expand_insertions?                                                # dal_expand_insertions.rb +      data=SiSU_DAL_Insertions::Insertions.new(@md,data).expand_insertions?                                              # dal_expand_insertions.rb        data=SiSU_DAL_SubstituteAndInsert::SI.new(@md,data).substitutions_and_insertions?                                  # dal_substitutions_and_insertions.rb        data,metadata=SiSU_DAL_DocumentStructureExtract::Build.new(@md,data).identify_parts                                # dal_doc_str.rb -      data=SiSU_DAL_Syntax::Markup.new(@md,data).songsheet                                                                 # dal_syntax.rb -      data,endnote_array=SiSU_DAL_CharacterCheck::Check.new(data).character_check_and_oldstyle_endnote_array              # dal_character_check.rb -      data=SiSU_DAL_Images::Images.new(@md,data).images                                                                    # dal_images.rb -      data,tags_map,ocn_html_seg_map=SiSU_DAL_Numbering::Numbering.new(@md,data).numbering_song                            # dal_numbering.rb +      data=SiSU_DAL_Syntax::Markup.new(@md,data).songsheet                                                               # dal_syntax.rb +      data,endnote_array=SiSU_DAL_CharacterCheck::Check.new(data).character_check_and_oldstyle_endnote_array             # dal_character_check.rb +      data=SiSU_DAL_Images::Images.new(@md,data).images                                                                  # dal_images.rb +      data,tags_map,ocn_html_seg_map=SiSU_DAL_Numbering::Numbering.new(@md,data).numbering_song                          # dal_numbering.rb        data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_DAL_BookIndex::BookIndex.new(@md,data,@env).indexing_song if @md.book_idx  # dal_idx.rb -      data=SiSU_DAL_Endnotes::Endnotes.new(@md,data,endnote_array).endnotes                                                # dal_endnotes.rb +      data=SiSU_DAL_Endnotes::Endnotes.new(@md,data,endnote_array).endnotes                                              # dal_endnotes.rb        outputdata=data        if @md.opt.cmd =~/[mM]/          SiSU_DAL::Output.new(@fn,@md,outputdata).hard_output diff --git a/lib/sisu/v3dv/dal_character_check.rb b/lib/sisu/v3dv/dal_character_check.rb index 2857cb98..4ec95f82 100644 --- a/lib/sisu/v3dv/dal_character_check.rb +++ b/lib/sisu/v3dv/dal_character_check.rb @@ -69,25 +69,26 @@ module SiSU_DAL_CharacterCheck        endnote_no=1        data.each do |dob|          unless dob.is =='table' -          dob.obj.strip! -          dob.obj.gsub!(/^[{~}]\s*$/,'') -          dob.obj.gsub!(/~#\s*/,"#{Mx[:pa_non_object_no_heading]}") -          dob.obj.gsub!(/-#\s*/,"#{Mx[:pa_non_object_dummy_heading]}") -          dob.obj.gsub!(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '); dob.obj.gsub!(/(~\{\s*)\s+/,'\1 ') -          dob.obj.gsub!(/ \/\//,"#{Mx[:br_line]}") -          dob.obj.gsub!(/<br>/,"#{Mx[:br_line]}")                              #needed by xml, xhtml etc. -          dob.obj.gsub!(/\t/,' ') -          dob.obj.gsub!(/\342\200\231/u,"'") #if dob =~/’/  #Avoid #‘ ’ #“ ” -          dob.obj.gsub!(/�/u,' ')                                              #watch, replace with char code -          dob.obj.gsub!(/·/u,'*') -          dob.obj.gsub!(/\\copy(?:right)?\b/,'©') -          dob.obj.gsub!(/\\trademark\b|\\tm\b/,'®') +          dob.obj=dob.obj.strip. +            gsub(/^[{~}]\s*$/,''). +            gsub(/~#\s*/,"#{Mx[:pa_non_object_no_heading]}"). +            gsub(/-#\s*/,"#{Mx[:pa_non_object_dummy_heading]}"). +            gsub(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '). +            gsub(/(~\{\s*)\s+/,'\1 '). +            gsub(/ \/\//,"#{Mx[:br_line]}"). +            gsub(/<br>/,"#{Mx[:br_line]}").                              #needed by xml, xhtml etc. +            gsub(/\t/,' '). +            gsub(/\342\200\231/u,"'"). #if dob =~/’/  #Avoid #‘ ’ #“ ” +            gsub(/�/u,' ').                                              #watch, replace with char code +            gsub(/·/u,'*'). +            gsub(/\\copy(?:right)?\b/,'©'). +            gsub(/\\trademark\b|\\tm\b/,'®')            dob.obj=dob.obj + "\n"            unless dob.is =~/^code/              case dob.obj              when /\^~/                                     #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+                sub_dob=dob.obj.dup -              @endnote_array << sub_dob.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip +              @endnote_array << sub_dob.gsub(/\n/,'').gsub(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip                endnote_no+=1                dob=nil if dob.obj =~/\^~ .+/                #watch, removes 'binary' endnote now in endnote array for later insertion              end diff --git a/lib/sisu/v3dv/dal_doc_str.rb b/lib/sisu/v3dv/dal_doc_str.rb index 5ab3553f..91fa9458 100644 --- a/lib/sisu/v3dv/dal_doc_str.rb +++ b/lib/sisu/v3dv/dal_doc_str.rb @@ -69,7 +69,7 @@ module SiSU_DAL_DocumentStructureExtract      @@flag={} #Beware!!      def initialize(md,data)        @md,@data=md,data -      Instantiate.new +      SiSU_DAL_DocumentStructureExtract::Instantiate.new        @pb=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page])        @pbn=SiSU_DAL_DocumentStructure::ObjectLayout.new.break(Hx[:br_page_new])      end @@ -131,11 +131,11 @@ module SiSU_DAL_DocumentStructureExtract        if str.nil?        else          if str =~/(?:^|[ ])\*~([a-z0-9._-]+)(?=[ #{Mx[:br_nl]}]|$)/ -          str.gsub!(/(^|[ ])\*~([a-z0-9._-]+)(?=[ #{Mx[:br_nl]}]|$)/i, -            "\\1#{Mx[:tag_o]}\\2#{Mx[:tag_c]}") -          str.gsub!(/ [ ]+/i,' ') +          str=str.gsub(/(^|[ ])\*~([a-z0-9._-]+)(?=[ #{Mx[:br_nl]}]|$)/i, +              "\\1#{Mx[:tag_o]}\\2#{Mx[:tag_c]}"). +            gsub(/ [ ]+/i,' ')            tags=str.scan(/#{Mx[:tag_o]}(\S+?)#{Mx[:tag_c]}/).flatten -          str.gsub!(/[ ]?#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}[ ]?/,' ') #may be issues with spaces would leave one, but "code" blocks? +          str=str.gsub(/[ ]?#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}[ ]?/,' ') #may be issues with spaces would leave one, but "code" blocks?          end          tags=nametag ? (tags << nametag) : tags        end @@ -148,7 +148,7 @@ module SiSU_DAL_DocumentStructureExtract        @@counter,@verse_count=0,0        @metadata={}        @data.each do |t_o| -        t_o.gsub!(/(?:\n\s*\n)+/m,"\n") unless @@flag['code'] +        t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") unless @@flag['code']          if t_o !~/^(?:code|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \          and not @@flag['code'] \          and not @@flag['poem'] \ @@ -158,7 +158,7 @@ module SiSU_DAL_DocumentStructureExtract          and not @@flag['table']            unless t_o =~/^(?:@\S+?:|%+)\s/                  # extract book index for paragraph if any              idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1 -              t_o.gsub!(/\n=\{.+\}\s*$\Z/m,'') +              t_o=t_o.gsub(/\n=\{.+\}\s*$\Z/m,'')                m              else nil              end @@ -304,7 +304,7 @@ module SiSU_DAL_DocumentStructureExtract                cols=nil                rws.each do |r|                  cols=(cols ? cols : (r.scan('|').length) +1) -                r.gsub!(/\s*\|\s*/m,"#{Mx[:tc_p]}")        #r.gsub!(/\|/m,"#{Mx[:tc_p]}") +                r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}")        #r.gsub!(/\|/m,"#{Mx[:tc_p]}")                  rows += r + Mx[:tc_c]                end                col=[] @@ -337,7 +337,7 @@ module SiSU_DAL_DocumentStructureExtract                rws=tbl.split(/\n/)                rows=''                rws.each do |r| -                r.gsub!(/\s*\|\s*/m,"#{Mx[:tc_p]}")        #r.gsub!(/\|/m,"#{Mx[:tc_p]}") +                r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}")        #r.gsub!(/\|/m,"#{Mx[:tc_p]}")                  rows += r + Mx[:tc_c]                end                h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags } @@ -366,8 +366,8 @@ module SiSU_DAL_DocumentStructureExtract            else              if t_o !~/^table\{/ \              and not t_o.nil? -              t_o.gsub!(/^\n+/m,'') #check added for ruby 1.9.2 not needed in 1.8 series (tested in v2) -              t_o.gsub!(/\n+/m,"#{Mx[:tc_p]}") +              t_o=t_o.gsub(/^\n+/m,''). #check added for ruby 1.9.2 not needed in 1.8 series (tested in v2) +                gsub(/\n+/m,"#{Mx[:tc_p]}")                @rows += t_o + Mx[:tc_c]              end              t_o=nil @@ -447,7 +447,7 @@ module SiSU_DAL_DocumentStructureExtract              t_o=SiSU_DAL_DocumentStructureExtract::Build.new(@md,@line_mode).build_lines(type).join              poem=t_o.split(/\n\n/)              poem.each do |v| -              v.gsub!(/\n/m,"#{Mx[:br_nl]}\n") +              v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n")                obj,tags=extract_tags(v)                h={ obj: obj, tags: tags }                t_o=SiSU_DAL_DocumentStructure::ObjectBlockTxt.new.verse(h) @@ -463,17 +463,17 @@ module SiSU_DAL_DocumentStructureExtract            or @@flag['group'] \            or @@flag['alt']              if t_o.class==String -              t_o.gsub!(/\n/m,"#{Mx[:br_nl]}") -              t_o.gsub!(/[ ][ ]/m,"#{Mx[:nbsp]*2}") -              t_o.gsub!(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") +              t_o=t_o.gsub(/\n/m,"#{Mx[:br_nl]}"). +                gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}"). +                gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")                t_o=t_o + Mx[:br_nl] if t_o =~/\S+/              elsif t_o.is=='group' \              or t_o.is=='block' \              or t_o.is=='alt' \              or t_o.is=='verse' -              t_o.obj.gsub!(/\n/m,"#{Mx[:br_nl]}") -              t_o.obj.gsub!(/[ ][ ]/m,"#{Mx[:nbsp]*2}") -              t_o.obj.gsub!(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") +              t_o.obj=t_o.obj.gsub(/\n/m,"#{Mx[:br_nl]}"). +                gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}"). +                gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}")              end              @tuned_block << t_o if t_o =~/\S+/            else tuned_file << t_o @@ -742,26 +742,26 @@ module SiSU_DAL_DocumentStructureExtract        meta      end      def build_lines(type='') -      data=@data -      data.each do |line| -        if line =~/\S/ \ +      lines,lines_new=@data,[] +      lines.each do |line| +        line=if line =~/\S/ \          and line !~/^code\{|^\}code/ \          and line.class != Hash -          line.gsub!(/\s\s/,"#{Mx[:nbsp]*2}") -          line.gsub!(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") -          line.gsub!(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type=='code' # REMOVE try sort for texpdf special case -          if line =~/(?:https?|file|ftp):\/\/\S+$/ -            line.gsub!(/\s*$/," #{Mx[:br_nl]}") -          else line.gsub!(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code' -          end -          if @@flag['code']; @@counter+=1 -          else +          @@counter+=1 if @@flag['code'] +          line=line.gsub(/\s\s/,"#{Mx[:nbsp]*2}"). +            gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") +          line=line.gsub(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type=='code' # REMOVE try sort for texpdf special case +          line=if line =~/(?:https?|file|ftp):\/\/\S+$/ +            line.gsub(/\s*$/," #{Mx[:br_nl]}") +          else line.gsub(/\s*$/,"#{Mx[:br_nl]}") #unless type=='code'            end          elsif line =~/^\s*$/ -          line.gsub!(/\s*$/,"#{Mx[:br_nl]}") +          line.gsub(/\s*$/,"#{Mx[:br_nl]}") +        else line          end +        lines_new << line        end -      data +      lines_new      end    end    class Structure                                          # this must happen early @@ -805,26 +805,26 @@ module SiSU_DAL_DocumentStructureExtract      end      def structure_markup_normalize                         #needs a bit of thinking        dob=if @md.markup_version.determined < 0.38                #%convert internal representation, consider making 0.38 structure default ([A-C1-6] instead of [1-9]), requires downstream changes -        @dob.gsub!(/^[456]~/,'!_') -        @dob.gsub!(/^3~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}") -        @dob.gsub!(/^3~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}") -        @dob.gsub!(/^2~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}") -        @dob.gsub!(/^2~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}") -        @dob.gsub!(/^1~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}") -        @dob.gsub!(/^1~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}") -        @dob.gsub!(/^:?C~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}") -        @dob.gsub!(/^:?C~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}") -        @dob.gsub!(/^:?B~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}") -        @dob.gsub!(/^:?B~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}") -        @dob.gsub!(/^:?A~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}") -        @dob.gsub!(/^:?A~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}") +        @dob=@dob.gsub(/^[456]~/,'!_'). +          gsub(/^3~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}"). +          gsub(/^3~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}"). +          gsub(/^2~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}"). +          gsub(/^2~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}"). +          gsub(/^1~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}"). +          gsub(/^1~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}"). +          gsub(/^:?C~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}"). +          gsub(/^:?C~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}"). +          gsub(/^:?B~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}"). +          gsub(/^:?B~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}"). +          gsub(/^:?A~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}"). +          gsub(/^:?A~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}")          @dob=if @dob =~/^@(?:level|markup):\s/ -          @dob.gsub!(/3/,'6') -          @dob.gsub!(/2/,'5') -          @dob.gsub!(/1/,'4') -          @dob.gsub!(/:?C/,'3') -          @dob.gsub!(/:?B/,'2') -          @dob.gsub!(/:?A/,'1') +          @dob=@dob.gsub(/3/,'6'). +            gsub(/2/,'5'). +            gsub(/1/,'4'). +            gsub(/:?C/,'3'). +            gsub(/:?B/,'2'). +            gsub(/:?A/,'1')            @dob          else @dob          end @@ -833,19 +833,19 @@ module SiSU_DAL_DocumentStructureExtract      end      def structure_marks        t_o=if @md.markup_version.determined < 0.38 -        @t_o.gsub!(/^1~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}") -        @t_o.gsub!(/^1~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}") -        @t_o.gsub!(/^2~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}") -        @t_o.gsub!(/^2~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}") -        @t_o.gsub!(/^3~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}") -        @t_o.gsub!(/^3~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}") -        @t_o.gsub!(/^4~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}") -        @t_o.gsub!(/^4~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}") -        @t_o.gsub!(/^5~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}") -        @t_o.gsub!(/^5~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}") -        @t_o.gsub!(/^6~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}") -        @t_o.gsub!(/^6~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}") -        @t_o.gsub!(/^[789]~/,'!_') +        @t_o=@t_o.gsub(/^1~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}"). +          gsub(/^1~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}"). +          gsub(/^2~(\S+)/,"#{Mx[:lv_o]}2:\\1#{Mx[:lv_c]}"). +          gsub(/^2~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}"). +          gsub(/^3~(\S+)/,"#{Mx[:lv_o]}3:\\1#{Mx[:lv_c]}"). +          gsub(/^3~\s+/,"#{Mx[:lv_o]}3:#{Mx[:lv_c]}"). +          gsub(/^4~(\S+)/,"#{Mx[:lv_o]}4:\\1#{Mx[:lv_c]}"). +          gsub(/^4~\s+/,"#{Mx[:lv_o]}4:#{Mx[:lv_c]}"). +          gsub(/^5~(\S+)/,"#{Mx[:lv_o]}5:\\1#{Mx[:lv_c]}"). +          gsub(/^5~\s+/,"#{Mx[:lv_o]}5:#{Mx[:lv_c]}"). +          gsub(/^6~(\S+)/,"#{Mx[:lv_o]}6:\\1#{Mx[:lv_c]}"). +          gsub(/^6~\s+/,"#{Mx[:lv_o]}6:#{Mx[:lv_c]}"). +          gsub(/^[789]~/,'!_')          @t_o        else @t_o        end @@ -945,13 +945,13 @@ module SiSU_DAL_DocumentStructureExtract                end              end            else ocnu+=1 -            dob.obj.gsub!(/#{Mx[:fa_o]}~##{Mx[:fa_c]}/,'') if dob.obj +            dob.obj=dob.obj.gsub(/#{Mx[:fa_o]}~##{Mx[:fa_c]}/,'') if dob.obj              ocn_dv,ocn_sp="u#{ocnu}","u#{ocnu}"              dob.ocn,dob.odv,dob.osp=ocn,ocn_dv,ocn_sp            end            h          elsif dob.obj=~/#{Mx[:pa_non_object_no_heading]}/ -          dob.obj.gsub!(/#{Mx[:pa_non_object_no_heading]}/,'') +          dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_no_heading]}/,'')            if dob.is=='para'              h={ obj: dob.obj, ocn_: false, ocn: nil }              dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob) @@ -960,7 +960,7 @@ module SiSU_DAL_DocumentStructureExtract              dob=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,dob)            end          elsif dob.obj=~/#{Mx[:pa_non_object_dummy_heading]}/ -          dob.obj.gsub!(/#{Mx[:pa_non_object_dummy_heading]}/,'') +          dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_dummy_heading]}/,'')            if dob.is=='para'              h={ obj: dob.obj, ocn_: false, ocn: nil }              dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob) @@ -970,7 +970,7 @@ module SiSU_DAL_DocumentStructureExtract            end          else dob          end -        dob.obj.gsub!(/\n\n/,"\n") if dob.is =~/(?:code|verse|alt|group|block)/ #newlines taken out +        dob.obj=dob.obj.gsub(/\n\n/,"\n") if dob.is =~/(?:code|verse|alt|group|block)/ #newlines taken out          @o_array << dob        end        @o_array @@ -1060,8 +1060,7 @@ module SiSU_DAL_DocumentStructureExtract        end        puts_tag_close(0,hs) if @md.opt.cmd =~/V/        tuned_file << tag_close(0,hs) -      tuned_file.flatten! -      tuned_file +      tuned_file=tuned_file.flatten      end      def tags(o)        tag=if o[:status]=='open' diff --git a/lib/sisu/v3dv/dal_endnotes.rb b/lib/sisu/v3dv/dal_endnotes.rb index bb327f39..eb5e3429 100644 --- a/lib/sisu/v3dv/dal_endnotes.rb +++ b/lib/sisu/v3dv/dal_endnotes.rb @@ -69,17 +69,17 @@ module SiSU_DAL_Endnotes        data.each do |dob|                                                                                 # manually numbered endnotes <!e(\d)!> <!e_(\d)!> -->          if @md.opt.mod.inspect =~/--no-asterisk|--no-annotate/ -          dob.obj.gsub!(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') +          dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'')          end          if @md.opt.mod.inspect =~/--no-dagger|--no-annotate/ -          dob.obj.gsub!(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') +          dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'')          end          if defined? dob.obj \          and defined? dob.is \          and dob.is !~/^code/            case dob.obj                                                         # auto-numbered endnotes <!e!> <!e_!> -->            when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ -            dob.obj.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1')          # required 2003w31 +            dob.obj=dob.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1')          # required 2003w31              word_mode=dob.obj.scan(/\S+/m)              word_mode=endnote_call_number(word_mode)              dob.obj=word_mode.join(' ') diff --git a/lib/sisu/v3dv/dal_expand_insertions.rb b/lib/sisu/v3dv/dal_expand_insertions.rb index f821769e..8ec52065 100644 --- a/lib/sisu/v3dv/dal_expand_insertions.rb +++ b/lib/sisu/v3dv/dal_expand_insertions.rb @@ -274,7 +274,7 @@ module SiSU_DAL_Insertions            pre=txt=cmd=source=linked_doc=note=''            if defined? @u.remote              if /(?<pre>.+?)\{(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}(?<source>(?<linked_doc>\S+?)\.ss[tm]\b)(?<note>.*)/m =~ para -              pre.strip! +              pre=pre.strip              elsif /\{(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}(?<source>(?<linked_doc>\S+?)\.ss[tm]\b)(?<note>.*)/m =~ para              end              if linked_doc =~ /(\S+?)\/(\S+)/  diff --git a/lib/sisu/v3dv/dal_hash_digest.rb b/lib/sisu/v3dv/dal_hash_digest.rb index 8353b5a0..40f81197 100644 --- a/lib/sisu/v3dv/dal_hash_digest.rb +++ b/lib/sisu/v3dv/dal_hash_digest.rb @@ -68,14 +68,13 @@ module SiSU_DAL_Hash      # 2. endnotes clean/stripped text digest only (there may be several endnotes within a paragraph)      # 3. whole object, text with markup and any endnotes, (question: with or without the endnote digests??? presumption better without, [however may be easier to check with?])      # [digests should not include other digests] -      data=@data +      data=@data.compact        @tuned_file=[] -      data.compact!        sha_ =(@env.digest.type=='sha256' ? true : false)        sha_ ? (require 'digest/sha2') : (require 'digest/md5')        data.each do |t_o|          unless t_o.obj.class==Array -          t_o.obj.strip! +          t_o.obj=t_o.obj.strip          end          if t_o.of !~/structure|comment|layout/ \          and t_o.ocn.class==Fixnum @@ -125,7 +124,7 @@ module SiSU_DAL_Hash          case t_o.obj          when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m            en_and_t_o,en_and_t_o_digest=[],[] -          t_o.obj.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch +          t_o.obj=t_o.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch            t_o_plus_en=t_o.obj.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m)            t_o_tail=if t_o.obj =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m              /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+.*/m.match(t_o.obj)[1] @@ -144,11 +143,11 @@ module SiSU_DAL_Hash      def strip_clean_extra_spaces(s)                                            # dal output tuned        s=s.dup        s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ -      s=s.gsub(/ [ ]+/,' ') -      s=s.gsub(/^ [ ]+/,'') -      s=s.gsub(/ [ ]+$/,'') -      s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') -      s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') +      s=s.gsub(/ [ ]+/,' '). +        gsub(/^ [ ]+/,''). +        gsub(/ [ ]+$/,''). +        gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2'). +        gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')      end    end  end diff --git a/lib/sisu/v3dv/dal_idx.rb b/lib/sisu/v3dv/dal_idx.rb index 8ba2f2b5..5f4a38e0 100644 --- a/lib/sisu/v3dv/dal_idx.rb +++ b/lib/sisu/v3dv/dal_idx.rb @@ -101,21 +101,20 @@ module SiSU_DAL_BookIndex            g=idx_list.scan(/[^;]+/)            idxl=[]            g.each do |i| -            i.strip! +            i=i.strip              idxl << { rough_idx: i, ocn: ocn, seg: seg }            end            idxl          else { rough_idx: idx_list, ocn: ocn, seg: seg }          end        end -      idx_lst.flatten! -      idx_lst +      idx_lst=idx_lst.flatten      end      def construct_book_index(idx_array)        the_idx={}        idx_array.each do |idx|          idx_lst=idx[:rough_idx].scan(/[^|:]+/) -        idx_lst[0].strip! +        idx_lst[0]=idx_lst[0].strip          if idx_lst[0] =~/.+?\+\d+/            use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2]          else use=idx_lst[0] @@ -123,7 +122,7 @@ module SiSU_DAL_BookIndex          use=use[0].chr.capitalize + use[1,use.length]          the_idx[use]={} unless the_idx[use] and defined? the_idx[use]          idx_lst.each do |i| -          i.strip! +          i=i.strip            i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/            x=if idx_lst.length==1 or idx_lst[0].gsub(/\+\d+/,'')==i              the_idx[use]['term_node_lev1']=[] unless the_idx[use]['term_node_lev1'] and defined? the_idx[use]['term_node_lev1'] @@ -151,12 +150,12 @@ module SiSU_DAL_BookIndex        the_idx      end      def clean_xml(str) -      str.gsub!(/&/,'&') -      str.gsub!(/\(/,'(') -      str.gsub!(/\)/,')') -      str.gsub!(/\*/,'*') -      str.gsub!(/\+/,'+') -      str.gsub!(/,/,',') +      str=str.gsub(/&/,'&'). +        gsub(/\(/,'('). +        gsub(/\)/,')'). +        gsub(/\*/,'*'). +        gsub(/\+/,'+'). +        gsub(/,/,',')        str      end      def index(the_idx) @@ -347,7 +346,7 @@ module SiSU_DAL_BookIndex      def clean_index(data)                                  #check on use of dob        tuned_file=[]        data.each do |para| -        para.gsub!(/\n*#{@rgx_idx}/m,'') +        para=para.gsub(/\n*#{@rgx_idx}/m,'')          tuned_file << para        end        tuned_file diff --git a/lib/sisu/v3dv/dal_images.rb b/lib/sisu/v3dv/dal_images.rb index fd058c72..0f65b814 100644 --- a/lib/sisu/v3dv/dal_images.rb +++ b/lib/sisu/v3dv/dal_images.rb @@ -81,7 +81,7 @@ module SiSU_DAL_Images        end        data.each do |dob|          unless dob.is =~/^table/ -          dob.obj.strip! +          dob.obj=dob.obj.strip            if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/              if dob.obj !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+/                m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/ @@ -133,8 +133,8 @@ module SiSU_DAL_Images                          img_col=((1.00*img_row/row)*col).round                        end                      end -                    dob.obj.gsub!(/(#{image})/,"#{image} #{img_col}x#{img_row}") -                  else dob.obj.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,'[ \1 (\2 missing) ]') +                    dob.obj=dob.obj.gsub(/(#{image})/,"#{image} #{img_col}x#{img_row}") +                  else dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,'[ \1 (\2 missing) ]')                    end                  end                else @@ -144,7 +144,9 @@ module SiSU_DAL_Images                end              end            end -          dob.obj.gsub!(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ') if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/ +          if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/ +            dob.obj=dob.obj.gsub(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ') +          end          end          tuned_file << dob unless dob.nil?        end diff --git a/lib/sisu/v3dv/dal_numbering.rb b/lib/sisu/v3dv/dal_numbering.rb index cf7d861a..332db4bf 100644 --- a/lib/sisu/v3dv/dal_numbering.rb +++ b/lib/sisu/v3dv/dal_numbering.rb @@ -77,12 +77,13 @@ module SiSU_DAL_Numbering      def number_plaintext_para(data)        @tuned_file=[]        data.each do |dob| -        if dob.of !~/(?:block|comment|layout)/ and dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX -          dob.obj.gsub!(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks +        if dob.of !~/(?:block|comment|layout)/ \ +        and dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX +          dob.obj=dob.obj.gsub(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks          end          unless dob.obj.class==Array -          dob.obj.gsub!(/^\s+/,'') -          dob.obj.gsub!(/\s$/,"\n") +          dob.obj=dob.obj.gsub(/^\s+/,''). +            gsub(/\s$/,"\n")          end          @tuned_file << dob        end @@ -90,37 +91,35 @@ module SiSU_DAL_Numbering      end      def number_sub_heading(dob,num,title_no)        unless dob.obj =~/\d+\.|(?:chapter|article|section|clause)\s+\d+/i #name selection arbitrary, fix -        case dob.name -        when /-/;  dob.obj.gsub!(/^/,"#{title_no} ") -        when /^#/; dob.obj.gsub!(/^/,"#{title_no} ") -        when /^[a-z_\.]+/ -          dob.obj.gsub!(/^/,"#{title_no} ") +        dob.obj=case dob.name +        when /-/;  dob.obj.gsub(/^/,"#{title_no} ") +        when /^#/; dob.obj.gsub(/^/,"#{title_no} ") +        when /^[a-z_\.]+/; dob.obj.gsub(/^/,"#{title_no} ")          else            dob.name=title_no if dob.name=~/^$/ #where title contains title number -          dob.obj.gsub!(/^/,"#{title_no} ") if title_no =~/\d+/ #main, where title number is to be provided #watch changed placement +          dob.obj.gsub(/^/,"#{title_no} ") if title_no =~/\d+/ #main, where title number is to be provided #watch changed placement          end          if @md.toc_lev_limit \          and @md.toc_lev_limit < num -          dob.obj.gsub!(/^/,'!_ ') #bold line, watch +          dob.obj=dob.obj.gsub(/^/,'!_ ') #bold line, watch          end        end        dob      end      def heading_tag_clean(heading_tag) -      heading_tag.gsub!(/[ ]+/,'_') -      heading_tag.gsub!(/["']/,'') -      heading_tag.gsub!(/[\/]/,'-') -      heading_tag.gsub!(/#{Mx[:fa_bold_o]}|#{Mx[:fa_bold_c]}/,'') -      heading_tag.gsub!(/#{Mx[:fa_italics_o]}|#{Mx[:fa_italics_c]}/,'') -      heading_tag.gsub!(/#{Mx[:fa_underscore_o]}|#{Mx[:fa_underscore_c]}/,'') -      heading_tag.gsub!(/#{Mx[:fa_cite_o]}|#{Mx[:fa_cite_c]}/,'') -      heading_tag.gsub!(/#{Mx[:fa_insert_o]}|#{Mx[:fa_insert_c]}/,'') -      heading_tag.gsub!(/#{Mx[:fa_strike_o]}|#{Mx[:fa_strike_c]}/,'') -      heading_tag.gsub!(/#{Mx[:fa_superscript_o]}|#{Mx[:fa_superscript_c]}/,'') -      heading_tag.gsub!(/#{Mx[:fa_subscript_o]}|#{Mx[:fa_subscript_c]}/,'') -      heading_tag.gsub!(/#{Mx[:fa_hilite_o]}|#{Mx[:fa_hilite_c]}/,'') -      heading_tag.gsub!(/#{Mx[:gl_bullet]}/,'') -      heading_tag +      heading_tag=heading_tag.gsub(/[ ]+/,'_'). +        gsub(/["']/,''). +        gsub(/[\/]/,'-'). +        gsub(/#{Mx[:fa_bold_o]}|#{Mx[:fa_bold_c]}/,''). +        gsub(/#{Mx[:fa_italics_o]}|#{Mx[:fa_italics_c]}/,''). +        gsub(/#{Mx[:fa_underscore_o]}|#{Mx[:fa_underscore_c]}/,''). +        gsub(/#{Mx[:fa_cite_o]}|#{Mx[:fa_cite_c]}/,''). +        gsub(/#{Mx[:fa_insert_o]}|#{Mx[:fa_insert_c]}/,''). +        gsub(/#{Mx[:fa_strike_o]}|#{Mx[:fa_strike_c]}/,''). +        gsub(/#{Mx[:fa_superscript_o]}|#{Mx[:fa_superscript_c]}/,''). +        gsub(/#{Mx[:fa_subscript_o]}|#{Mx[:fa_subscript_c]}/,''). +        gsub(/#{Mx[:fa_hilite_o]}|#{Mx[:fa_hilite_c]}/,''). +        gsub(/#{Mx[:gl_bullet]}/,'')      end      def auto_number_heading_ie_title(data)                                             #also does some segment naming        @tuned_file=[] @@ -135,8 +134,8 @@ module SiSU_DAL_Numbering          no1=num_top; no2=(num_top + 1); no3=(num_top + 2);  no4=(num_top + 3)        end        t_not=0 -      data.compact!        chapter_number_counter=0 +      data=data.compact        data.each do |dob| #@md.seg_names << [additions to segment names]          title_no=nil          dob=SiSU_DAL_DocumentStructureExtract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require @@ -147,8 +146,8 @@ module SiSU_DAL_Numbering            if  dob.lv=='1' \            and dob.obj =~/^#\s|\s#(?:\s|$)/              chapter_number_counter +=1 -            dob.obj.gsub!(/^#\s/,"#{chapter_number_counter} ") -            dob.obj.gsub!(/#([:,]?\s|[.]?$)/,"#{chapter_number_counter}\\1") +            dob.obj=dob.obj.gsub(/^#\s/,"#{chapter_number_counter} "). +              gsub(/#([:,]?\s|[.]?$)/,"#{chapter_number_counter}\\1")            end            if dob.ln==no1              @subnumber=1 @@ -168,15 +167,15 @@ module SiSU_DAL_Numbering                    tag=dob.obj.gsub(/(Article|Clause|Section|Chapter)\s+/,"\\1_#{title_no}").downcase                    tag=heading_tag_clean(tag)                    dob.tags=[tag,dob.tags].flatten if tag !~/^\d+$/ #check whether will work across file types with stop signs -                  (dob.obj =~/(Article|Clause|Section)\s+/) \ -                  ? (dob.obj.gsub!(/(Article|Clause|Section)\s+/,"\\1 #{title_no} ")) -                  : (dob.obj.gsub!(/^/,"#{title_no}. ")) #fix stop later +                  dob.obj=(dob.obj =~/(Article|Clause|Section)\s+/) \ +                  ? (dob.obj.gsub(/(Article|Clause|Section)\s+/,"\\1 #{title_no} ")) +                  : (dob.obj.gsub(/^/,"#{title_no}. ")) #fix stop later                  end                  if dob.ln !=no1 \                  and dob.obj =~/^[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review                    dob.name ="#{title_no}" if not dob.name                    dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs -                  dob.obj.gsub!(/^/,"#{title_no}. ") +                  dob.obj=dob.obj.gsub(/^/,"#{title_no}. ")                  end                  @md.seg_names << title_no                end @@ -184,7 +183,7 @@ module SiSU_DAL_Numbering                and dob.name!~/^[a-z_\.]+$/ \                and dob.obj !~/[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required # not fixed, work on                  dob.tags=[title_no,dob.tags].flatten if title_no !~/^\d+$/ #check whether will work across file types with stop signs -                dob.obj.gsub!(/^/i,"#{title_no}. ") +                dob.obj=dob.obj.gsub(/^/i,"#{title_no}. ")                end              end              if dob.ln==no1         #watch because here you change dob.name @@ -251,10 +250,10 @@ module SiSU_DAL_Numbering                letter_small=0                number_small=0 if dob.obj =~ /^#1/                number_small+=1 -              dob.obj.gsub!(/^#[ 1]/,"#{number_small}. ") #change 2004 +              dob.obj=dob.obj.gsub(/^#[ 1]/,"#{number_small}. ")              end              if dob.obj =~/^_# / -              dob.obj.gsub!(/^_# /,"#{letter[letter_small]}. ") #change 2004 +              dob.obj=dob.obj.gsub(/^_# /,"#{letter[letter_small]}. ")                dob.indent='1'                letter_small+=1              end @@ -298,8 +297,8 @@ module SiSU_DAL_Numbering            if dob.name !~/^\S+/ \            and dob.obj =~/^\s*(?:\S+\s+)?([\d.,:-]+)/m      #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name              possible_seg_name=$1 -            possible_seg_name.gsub!(/(?:[:,-]|\W)/,'.') -            possible_seg_name.gsub!(/\.$/,'') +            possible_seg_name=possible_seg_name.gsub(/(?:[:,-]|\W)/,'.'). +              gsub(/\.$/,'')              if not @md.seg_names.nil? \              and not @md.seg_names.include?(possible_seg_name)                dob.name=possible_seg_name diff --git a/lib/sisu/v3dv/dal_substitutions_and_insertions.rb b/lib/sisu/v3dv/dal_substitutions_and_insertions.rb index b81a91e2..2ae365be 100644 --- a/lib/sisu/v3dv/dal_substitutions_and_insertions.rb +++ b/lib/sisu/v3dv/dal_substitutions_and_insertions.rb @@ -66,12 +66,12 @@ module SiSU_DAL_SubstituteAndInsert        data=@data        data_expand=[]        if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content precedes it) -        data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'') -        data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'') +        data[0]=data[0].gsub(/^#!\s*\/usr\/bin\/sisu/,''). +          gsub(/^#!\s*\/usr\/bin\/env sisu/,'')        end        if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier -        data[0].gsub!(/^(SiSU\s*[\d.]*)$/,'% \1') -        data[0].gsub!(/^(sisu-[\d.]+)$/,'% \1') +        data[0]=data[0].gsub(/^(SiSU\s*[\d.]*)$/,'% \1'). +          gsub(/^(sisu-[\d.]+)$/,'% \1')        end        data.each do |para|          if para =~/<:(insert\d+)!?>/ \ @@ -132,22 +132,24 @@ module SiSU_DAL_SubstituteAndInsert            para.each {|x| data_expand << x }          else data_expand << para          end -        data_expand.flatten! -        data_expand.compact! +        data_expand=data_expand.flatten.compact        end +      data_new=[]        data_expand.each do |para|          para=if @md.markup_version.determined >= 0.38            SiSU_DAL_DocumentStructureExtract::Structure.new(@md,para).structure_markup_normalize          else            SiSU_DAL_DocumentStructureExtract::Structure.new(@md,para).structure_marks          end -        para.gsub!(/^(:?A~)\s*$/,'\1~ @title @author')                                    #conditional header -        para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#')    #conditional header for incorporated document 2004w12 +        para=para.gsub(/^(:?A~)\s*$/,'\1~ @title @author').                                    #conditional header +          gsub(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#')    #conditional header for incorporated document 2004w12          if para =~/^@\S+?:/ -          para.gsub!(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2") -          para.gsub!(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3") +          para=para.gsub(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2"). +            gsub(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3")          end +        data_new << para        end +      data_new      end    end  end diff --git a/lib/sisu/v3dv/dal_syntax.rb b/lib/sisu/v3dv/dal_syntax.rb index 6d923467..a8ece51e 100644 --- a/lib/sisu/v3dv/dal_syntax.rb +++ b/lib/sisu/v3dv/dal_syntax.rb @@ -120,7 +120,7 @@ module SiSU_DAL_Syntax        end      end      def songsheet -      @data.compact! +      @data=@data.compact        @data.each do |dob|          dob=breaks(dob)          dob=if @md.sem_tag then sem(dob) else dob end #revisit @@ -136,8 +136,8 @@ module SiSU_DAL_Syntax      end      def breaks(dob)        if dob.is !~/^(?:meta|comment|code|table)/ -        dob.obj.gsub!(/ \\\\(?: |$)/,"#{Mx[:br_line]}") -        dob.obj.gsub!(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}")                  # depreciated +        dob.obj=dob.obj.gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}"). +          gsub(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}")                  # depreciated        end        dob      end @@ -149,18 +149,17 @@ module SiSU_DAL_Syntax        and @vz.markup_make_italic[:str])          dob.obj=if dob.is !~/^(?:meta|heading|code|comment)/            word=dob.obj.scan(@line_scan_ital) -          word.flatten! -          word.compact! #reinstated +          word=word.flatten.compact            line_array=[]            word.each do |w|              unless /#{@manmkp_ital}|#{@http_m}/.match(w)                if defined? @md.make.italics[:regx] \                and @md.make.italics[:regx] -                w.gsub!(@md.make.italics[:regx], +                w=w.gsub(@md.make.italics[:regx],                    "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")                elsif defined? @vz.markup_make_italic \                and @vz.markup_make_italic -                w.gsub!(@vz.markup_make_italic, +                w=w.gsub(@vz.markup_make_italic,                    "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")                else w                end @@ -174,28 +173,28 @@ module SiSU_DAL_Syntax        dob      end      def embolden(given) -      given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, -        "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2") -      given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/, -        "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}") -      given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, -        "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") -      given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/, -        "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") -      given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/, -        "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") -      given.gsub!(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/, -        "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") +      given=given.gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, +          "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2"). +        gsub(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/, +          "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}"). +        gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, +          "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2"). +        gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s+((?:[*]~\S+\s*)+)/, +          "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2"). +        gsub(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)\s*([~-]#)$/, +          "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2"). +        gsub(/(?:^!_\s+|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]}\s*)(.*)?\s*$/, +          "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")      end      def italicise(given) -      given.gsub!(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, -        "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2") -      given.gsub!(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/, -        "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2") -      given.gsub!(/^\/_\s*(.+?)\s*([~-]#)$/, -        "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2") -      given.gsub!(/^\/_\s+(.*)?\s*$/, -        "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") +      given=given.gsub(/^\/_\s*(.+?)([#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, +          "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2"). +        gsub(/^\/_\s*(.+?)\s+((?:[*]~\S+\s*)+)/, +          "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2"). +        gsub(/^\/_\s*(.+?)\s*([~-]#)$/, +          "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}\\2"). +        gsub(/^\/_\s+(.*)?\s*$/, +          "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}")      end      def wordlist_bold(dob)        dob=dob.dup @@ -206,19 +205,18 @@ module SiSU_DAL_Syntax          dob.obj=if dob.is !~/^(?:meta|heading|code|comment|table)/            line_array=[]            word=dob.obj.scan(@line_scan_bold) -          word.flatten! -          word.compact! +          word=word.flatten.compact            word.each do |w|              unless /#{@manmkp_bold}|#{@http_m}/.match(w)                if defined? @md.make.bold[:regx] \                and @md.make.bold[:regx]                                                   #document header: @bold: [bold word list] -                w.gsub!(@md.make.bold[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") +                w=w.gsub(@md.make.bold[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")                elsif defined? @vz.markup_make_bold \                and @vz.markup_make_bold                                                   #defaults and skin adjusted bold word list -                w.gsub!(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") +                w=w.gsub(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}")                end              else -              if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/; embolden(w)      #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost! +              w=if w =~ /(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s+/; embolden(w)      #bold paragraph/emphasize #may wish to remove think about 7{ 8{ conversion not satisfactory, as information is lost!                elsif w =~/^\/_\s+/; italicise(w)                else w                end @@ -229,42 +227,43 @@ module SiSU_DAL_Syntax          else dob.obj          end        else -        if dob.is !~/^(?:heading|comment|meta)/ \ +        dob.obj=if dob.is !~/^(?:heading|comment|meta)/ \          and dob.obj =~ /^!_\s+/            embolden(dob.obj)          elsif dob.is=='heading' \          and dob.ln.to_s =~/[7-9]/            embolden(dob.obj) +        else dob.obj          end          if dob.obj =~ /\/_\s+/ -          italicise(dob.obj) +          dob.obj=italicise(dob.obj)          end        end        dob      end      def fontface(dob) -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)\*\{(.+?)\}\*/m, -        "\\1#{@emph[:o]}\\2#{@emph[:c]}")                                                                                                                              #emphasis -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)!\{(.+?)\}!/m, -        "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}")                                                                                                                    #bold -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\(|\>)\/\{(.+?)\}\//m, -        "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}")                                                                                                              #italics -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)_\{(.+?)\}_/m, -        "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}")                                                                                                        #underscore -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)#\{(.+?)\}#/m, -        "\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}")                                                                                                          #monospace -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/m, -        "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}")                                                                                                       #cite /blockquote? -      dob.obj.gsub!(/(^|[^\\])\^\{(.+?)\}\^/m, -        "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}")                                                                                                      #superscript -      dob.obj.gsub!(/(^|[^\\]),\{(.+?)\},/m, -        "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}")                                                                                                          #subscript -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/m, -        "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}")                                                                                                                #inserted text -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/m, -        "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}")                                                                                                                #strikethrough - deleted text -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/, -        "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}")                                                                                                      #superscript single word, watch digit added +      dob.obj=dob.obj.gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)\*\{(.+?)\}\*/m, +          "\\1#{@emph[:o]}\\2#{@emph[:c]}").                                                                                                                             #emphasis +        gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)!\{(.+?)\}!/m, +          "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}").                                                                                                                   #bold +        gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\(|\>)\/\{(.+?)\}\//m, +          "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}").                                                                                                             #italics +        gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)_\{(.+?)\}_/m, +          "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}").                                                                                                       #underscore +        gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|#{Mx[:br_line]}|#{Mx[:br_paragraph]}|[\(\[\{]|\>)#\{(.+?)\}#/m, +          "\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}").                                                                                                         #monospace +        gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/m, +          "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}").                                                                                                      #cite /blockquote? +        gsub(/(^|[^\\])\^\{(.+?)\}\^/m, +          "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}").                                                                                                     #superscript +        gsub(/(^|[^\\]),\{(.+?)\},/m, +          "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}").                                                                                                         #subscript +        gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/m, +          "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}").                                                                                                               #inserted text +        gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/m, +          "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}").                                                                                                               #strikethrough - deleted text +        gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/, +          "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}")                                                                                                      #superscript single word, watch digit added        dob      end      def bodymarkup(dob) @@ -304,26 +303,25 @@ module SiSU_DAL_Syntax          if word            word.each do |w| # _ - / # | : ! ^ ~              unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/             # do something earlier about table!! -              w.gsub!(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}")                                       #escaped special character +              w=w.gsub(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}")                                       #escaped special character              end -            w.gsub!(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}")                                          #escaped special character -            w.gsub!(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}")                                          #escaped special character +            w=w.gsub(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}").gsub(/^\>$/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}")                                          #escaped special character              line_array << w            end            dob.obj=line_array.join(' ')            dob.obj=dob.obj.strip          end -        dob.obj.gsub!(/^([*#-.]{1,12})$/,'\1 ~#')                                                 #ocn off for these paragraph separators -        dob.obj.gsub!(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]) -        dob.obj.gsub!(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c])                     #default if markup does not specify -        dob.obj.gsub!(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c]) +        dob.obj=dob.obj.gsub(/^([*#-.]{1,12})$/,'\1 ~#').                                                #ocn off for these paragraph separators +          gsub(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]). +          gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]).                    #default if markup does not specify +          gsub(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c])          if dob.is =='heading' \          and dob.ln ==1 -          dob.obj.gsub!(/\s*@title\b/," #{@md.title.full}") -          if defined? @md.creator.author \ +          dob.obj=dob.obj.gsub(/\s*@title\b/," #{@md.title.full}") +          dob.obj=if defined? @md.creator.author \            and @md.creator.author -            dob.obj.gsub!(/\s+(?:@creator|@author)/,",#{Mx[:br_line]}#{@md.creator.author}") -          else dob.obj.gsub!(/\s+(?:@creator|@author)/,'') +            dob.obj.gsub(/\s+(?:@creator|@author)/,",#{Mx[:br_line]}#{@md.creator.author}") +          else dob.obj.gsub(/\s+(?:@creator|@author)/,'')            end          end          if defined? @md.title \ @@ -332,113 +330,113 @@ module SiSU_DAL_Syntax          and defined? @md.creator \          and @md.creator            if dob.is =='heading' -            dob.obj.gsub!(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/ -            if dob.lv =~/[23]/ \ +            dob.obj=dob.obj.gsub(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/ +            dob.obj=if dob.lv =~/[23]/ \              and defined? @md.creator.author \              and @md.creator.author -              dob.obj.gsub!(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.creator.author}") -            else dob.obj.gsub!(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1') +              dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.creator.author}") +            else dob.obj.gsub(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1')              end            end          end -        dob.obj.gsub!(/<(https?:\/\/\S+?)>/,'< \1 >')                                   #catch problem markup -        dob.obj.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image') -        dob.obj.gsub!(/<!(\S+)!>/,'<:\1>')                                              #escaped special character -        dob.obj.gsub!(/ /,"#{Mx[:nbsp]}")                                          #escaped special character -        dob.obj.gsub!(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}")                             #escaped special character -        dob.obj.gsub!(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}")                            #escaped special character -        dob.obj.gsub!(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}")                            #escaped special character -        dob.obj.gsub!(/\\\<</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character -        dob.obj.gsub!(/\\\>>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}") #escaped special character -        dob.obj.gsub!(/\\\</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}")                             #escaped special character -        dob.obj.gsub!(/\\\>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}")                             #escaped special character -        dob.obj.gsub!(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}")                            #escaped special character -        dob.obj.gsub!(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}")                            #escaped special character -        dob.obj.gsub!(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}")                            #escaped special character -        dob.obj.gsub!(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}")                            #escaped special character -        dob.obj.gsub!(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}")                            #escaped special character -        dob.obj.gsub!(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}")                            #& #escaped special character -        dob.obj.gsub!(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}")                            #not really a sisu special character but made available as possibility -        dob.obj.gsub!(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}")                            #not really a sisu special character but made available as possibility -        dob.obj.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}")                            #not really a sisu special character but made available as possibility -        dob.obj.gsub!(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}")                            #not really a sisu special character but made available as possibility -        dob.obj.gsub!(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}")                            #not really a sisu special character but made available as possibility -        dob.obj.gsub!(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}")                            #escaped special character -        dob.obj.gsub!(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}")                            #escaped special character -        dob.obj.gsub!(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}")                            #escaped special character +        dob.obj=dob.obj.gsub(/<(https?:\/\/\S+?)>/,'< \1 >').                                   #catch problem markup +          gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image'). +          gsub(/<!(\S+)!>/,'<:\1>').                                              #escaped special character +          gsub(/ /,"#{Mx[:nbsp]}").                                          #escaped special character +          gsub(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}").                             #escaped special character +          gsub(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}").                            #escaped special character +          gsub(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}").                            #escaped special character +          gsub(/\\\<</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}#{Mx[:gl_o]}#lt#{Mx[:gl_c]}"). #escaped special character +          gsub(/\\\>>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}#{Mx[:gl_o]}#gt#{Mx[:gl_c]}"). #escaped special character +          gsub(/\\\</,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}").                             #escaped special character +          gsub(/\\\>/,"#{Mx[:gl_o]}#gt#{Mx[:gl_c]}").                             #escaped special character +          gsub(/\\\_/,"#{Mx[:gl_o]}#095#{Mx[:gl_c]}").                            #escaped special character +          gsub(/\\\-/,"#{Mx[:gl_o]}#045#{Mx[:gl_c]}").                            #escaped special character +          gsub(/\\\+/,"#{Mx[:gl_o]}#043#{Mx[:gl_c]}").                            #escaped special character +          gsub(/\\\//,"#{Mx[:gl_o]}#047#{Mx[:gl_c]}").                            #escaped special character +          gsub(/\\\#/,"#{Mx[:gl_o]}#035#{Mx[:gl_c]}").                            #escaped special character +          gsub(/\\\&/,"#{Mx[:gl_o]}#038#{Mx[:gl_c]}").                            #& #escaped special character +          gsub(/\\\|/,"#{Mx[:gl_o]}#124#{Mx[:gl_c]}").                            #not really a sisu special character but made available as possibility +          gsub(/\\\:/,"#{Mx[:gl_o]}#058#{Mx[:gl_c]}").                            #not really a sisu special character but made available as possibility +          gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}").                            #not really a sisu special character but made available as possibility +          gsub(/\\\^/,"#{Mx[:gl_o]}#094#{Mx[:gl_c]}").                            #not really a sisu special character but made available as possibility +          gsub(/\\\,/,"#{Mx[:gl_o]}#044#{Mx[:gl_c]}").                            #not really a sisu special character but made available as possibility +          gsub(/\\\\/,"#{Mx[:gl_o]}#092#{Mx[:gl_c]}").                            #escaped special character +          gsub(/\\\*/,"#{Mx[:gl_o]}#042#{Mx[:gl_c]}").                            #escaped special character +          gsub(/\\\!/,"#{Mx[:gl_o]}#033#{Mx[:gl_c]}")                             #escaped special character          if dob.obj=~/(?:https?:|ftp:|\{([^{}]+?)\}(?:#|:|[.]{1,2}\/))\S+/m            if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m -            dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, +            dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ ([^}]+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,                "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]}\\3 \\4#{Mx[:en_a_c]}") # watch            end            if dob.obj=~/(?:^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (?:.+?)\s*\}(?:(?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m -            dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, +            dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:nbsp]} ])\{~\^ (.+?)\s*\}((?:https?:|ftp:|:|[.]{1,2}\/)\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,                "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ")            end -          dob.obj.gsub!(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, -            "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3") #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline) -          dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, -            %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}) -          dob.obj.gsub!(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, -            %{#{Mx[:lnk_c]}#{Mx[:rel_o]}\\1#{Mx[:rel_c]}\\2}) -          dob.obj.gsub!(/#{Mx[:lnk_c]}:(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, -            %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}) -          dob.obj.gsub!(/#{Mx[:lnk_c]}[.]{2}\/(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, -            %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}) +          dob.obj=dob.obj.gsub(/(^|[^#])\{\s*([^{}]+?)\s*\}((?:https?:|:|[.]{2}\/|#)\S+?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, +              "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3"). #linked (text or image, however text cannot include modified face, e.g. bold, ital, underline) +            gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])((?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, +              %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}). +            gsub(/#{Mx[:lnk_c]}#(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, +              %{#{Mx[:lnk_c]}#{Mx[:rel_o]}\\1#{Mx[:rel_c]}\\2}). +            gsub(/#{Mx[:lnk_c]}:(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, +              %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2}). +            gsub(/#{Mx[:lnk_c]}[.]{2}\/(\S+?[^>< ]+?)([()\[\]]*[,.;:!?'"]{0,2})(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, +              %{#{Mx[:lnk_c]}#{Mx[:rel_o]}:\\1#{Mx[:rel_c]}\\2})          end          if dob.obj=~/_(?:https?|ftp):\S+/m           # _http://url #CHECK -          dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])(_(?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, +          dob.obj=dob.obj.gsub(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])(_(?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m,              %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3})          end          dob=fontface(dob) -        dob.obj.gsub!(/<[:e]\s+(.+?)!?>/, -          "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}")                                                                                                                             #not tested -        dob.obj.gsub!(/^\s*_\*\s*/, -          "#{Mx[:gl_bullet]}")                                                                                                                                           #bullets, shortcut -        dob.obj.gsub!(/=\{(.+?)\}/, -          "#{Mx[:idx_o]}\\1#{Mx[:idx_c]}") -        dob.obj.gsub!(/^\s*_([1-9])\*\s*/, -          "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}")                                                                                                              #bullets, shortcut -        dob.obj.gsub!(/^\s*_([1-9])\s+/, -          "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}")                                                                                                                               #indent -        dob.obj.gsub!(/^\s*_([1-9])!\s+(.+?)\s*$/, -          "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} ")                                                                                                                               #indent bold -        dob.obj.gsub!(/^\s*__([1-9])\s+/, -          "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}")                                                                                                                               #hang -        dob.obj.gsub!(/^\s*__([1-9])!\s+(.+?)\s*$/, -          "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} ")                                                                                                                          #hangdef -        dob.obj.gsub!(/^\s*_([0-9])_([0-9])\s+/, -          "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}")                                                                                                                               #hang -        dob.obj.gsub!(/^\s*_([0-9])_([0-9])!\s+(.+?)\s*$/, -          "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\3#{Mx[:fa_bold_c]} ")                                                                                                                          #hangdef -        dob.obj.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'<span style="background-color: rgb(255,240,196)">')   # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) -        dob.obj.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'</span>') -        dob.obj.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n") -        dob.obj.gsub!(/[ ]+($)/,'\1') -        dob.obj.gsub!(/\{\s*(.+?)\s*\}(https?:\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, -          "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3") #any remaining linked text or image -        dob.obj.gsub!(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/, -          "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #any remaining linked text or image -        dob.obj.gsub!(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}") -        dob.obj.gsub!(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, -          "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4") #any remaining linked text or image -        dob.obj.gsub!(/\{\s*(.+?)\s*\}#([a-zA-Z0-9][a-zA-Z0-9_-]*)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, -          "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:rel_o]}\\2#{Mx[:rel_c]}\\3") #any remaining linked text or image, check need -        dob.obj.gsub!(/\{\s*(.+?)\s*\}(#{Mx[:rel_o]}\S+?#{Mx[:rel_c]})/, -          "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #any remaining linked text or image, check need -        dob.obj.gsub!(/\{\s*(.+?)\s*\}(image)/, -          "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2")      #linked image +        dob.obj=dob.obj.gsub(/<[:e]\s+(.+?)!?>/, +            "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}").                                                                                                                             #not tested +          gsub(/^\s*_\*\s*/, +            "#{Mx[:gl_bullet]}").                                                                                                                                           #bullets, shortcut +          gsub(/=\{(.+?)\}/, +            "#{Mx[:idx_o]}\\1#{Mx[:idx_c]}"). +          gsub(/^\s*_([1-9])\*\s*/, +            "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}").                                                                                                              #bullets, shortcut +          gsub(/^\s*_([1-9])\s+/, +            "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}").                                                                                                                               #indent +          gsub(/^\s*_([1-9])!\s+(.+?)\s*$/, +            "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} ").                                                                                                                               #indent bold +          gsub(/^\s*__([1-9])\s+/, +            "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}").                                                                                                                               #hang +          gsub(/^\s*__([1-9])!\s+(.+?)\s*$/, +            "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} ").                                                                                                                          #hangdef +          gsub(/^\s*_([0-9])_([0-9])\s+/, +            "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}").                                                                                                                               #hang +          gsub(/^\s*_([0-9])_([0-9])!\s+(.+?)\s*$/, +            "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\3#{Mx[:fa_bold_c]} ").                                                                                                                          #hangdef +          gsub(/<:hi>/,"#{Mx[:fa_hilite_o]}"). #'<span style="background-color: rgb(255,240,196)">')   # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) +          gsub(/<:\/hi>/,"#{Mx[:fa_hilite_c]}"). #'</span>') +          gsub(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n"). +          gsub(/[ ]+($)/,'\1'). +          gsub(/\{\s*(.+?)\s*\}(https?:\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, +            "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3"). #any remaining linked text or image +          gsub(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/, +            "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image +          gsub(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}"). +          gsub(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, +            "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4"). #any remaining linked text or image +          gsub(/\{\s*(.+?)\s*\}#([a-zA-Z0-9][a-zA-Z0-9_-]*)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, +            "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:rel_o]}\\2#{Mx[:rel_c]}\\3"). #any remaining linked text or image, check need +          gsub(/\{\s*(.+?)\s*\}(#{Mx[:rel_o]}\S+?#{Mx[:rel_c]})/, +            "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image, check need +          gsub(/\{\s*(.+?)\s*\}(image)/, +            "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2")      #linked image        elsif dob.is=='table'          dob=fontface(dob)        elsif dob.is =='code' -        dob.obj.gsub!(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ') -        dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy +        dob.obj=dob.obj.gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: '). +          gsub(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy          if dob.number_            codeline=[]            ln=1            dob.obj.split(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}|<br(?: \/)?>|\n/).each_with_index do |cl,i|              unless i == 0 -              cl.gsub!(Mx[:br_nl],'') +              cl=cl.gsub(Mx[:br_nl],'')                w=3-ln.to_s.length                cl = "#{ln}#{Mx[:nbsp]*w}#{Mx[:vline]}#{cl}#{Mx[:br_nl]}"                ln +=1 @@ -448,7 +446,7 @@ module SiSU_DAL_Syntax            codeline= codeline.join("")            dob.obj=codeline          else -          dob.obj.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n") +          dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n")          end          dob        else # @\S+?: @@ -474,62 +472,62 @@ module SiSU_DAL_Syntax        # +2                  <!i2!>        puts 'tech'        @data.each do |line| -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/, -          "\\1#{@emph[:o]}\\2#{@emph[:c]}")                                                        #emphasis -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/, -          "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}")                                              #bold -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)u\{(.+?)\}u/, -          "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}")                                  #underscore -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)c\{(.+?)\}c/, -          "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}")                                 #cite -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)i\{(.+?)\}i/, -          "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}")                                        #italics -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)!\{(.+?)\}!/, -          "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}")                                              #bold -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/, -          "\\1#{@emph[:o]}\\2#{@emph[:c]}")                                                        #emphasis -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)_\{(.+?)\}_/, -          "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}")                                  #underscore -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//, -          "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}")                                        #italics -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/, -          "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^\{(.+?)\}\^/, -          "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)9\{(.+?)\}9/, -          "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>),\{(.+?)\},/, -          "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/, -          "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/, -          "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/, -          "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/, -          "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/, -          "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/, -          "\\1#{@emph[:o]}\\2#{@emph[:c]}")                                                        #emphasise single word, watch -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/, -          "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}")                                              #bold single word, watch -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/, -          "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3")                                     #italics single word, watch -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_/, -          "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}")                                  #underscore single word, watch -        line.gsub!(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^(\S+?)\^/, -          "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}")                                #check  #superscript single word, watch digit added -        line.gsub!(/^\s*_\([1-9]\)\(\*\+\)\s*/, -          "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}")                            #bullets, shortcut -        line.gsub!(/^\s*_\([1-9]\)\s+/, -          "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #watch -        line.gsub!(/^\s*__\([1-9]\)\s+/, -          "#{Mx[:pa_o]}:h\\1#{Mx[:pa_c]}") #watch -        #line.gsub!(/^\s*__\([1-9]\)!\s+/, -        #  "#{Mx[:pa_o]}:hd\\1#{Mx[:pa_c]}") #watch -        line.gsub!(/#{Mx[:br_line]}\s*_[12]\s+/, -          "#{Mx[:br_line]} ")                                                                      #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ') +        line=line.gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)e\{(.+?)\}e/, +            "\\1#{@emph[:o]}\\2#{@emph[:c]}").                                                        #emphasis +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)b\{(.+?)\}b/, +            "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}").                                              #bold +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)u\{(.+?)\}u/, +            "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}").                                  #underscore +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)c\{(.+?)\}c/, +            "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}").                                 #cite +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)i\{(.+?)\}i/, +            "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}").                                        #italics +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)!\{(.+?)\}!/, +            "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}").                                              #bold +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)\*\{(.+?)\}\*/, +            "\\1#{@emph[:o]}\\2#{@emph[:c]}").                                                        #emphasis +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\>)_\{(.+?)\}_/, +            "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}").                                  #underscore +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//, +            "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}").                                        #italics +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/, +            "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^\{(.+?)\}\^/, +            "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)9\{(.+?)\}9/, +            "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}"). +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>),\{(.+?)\},/, +            "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}"). +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/, +            "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}"). +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/, +            "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}"). +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/, +            "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}"). +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/, +            "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}"). +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/, +            "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}"). +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/, +            "\\1#{@emph[:o]}\\2#{@emph[:c]}").                                                        #emphasise single word, watch +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/, +            "\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}").                                              #bold single word, watch +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([ ,.;:'"~$]|[^a-zA-Z0-9])/, +            "\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3").                                     #italics single word, watch +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_/, +            "\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}").                                  #underscore single word, watch +          gsub(/(^|\s+|['"]|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\^(\S+?)\^/, +            "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}").                                #check  #superscript single word, watch digit added +          gsub(/^\s*_\([1-9]\)\(\*\+\)\s*/, +            "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}").                            #bullets, shortcut +          gsub(/^\s*_\([1-9]\)\s+/, +            "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}"). #watch +          gsub(/^\s*__\([1-9]\)\s+/, +            "#{Mx[:pa_o]}:h\\1#{Mx[:pa_c]}"). #watch +          #line.gsub(/^\s*__\([1-9]\)!\s+/, +          #  "#{Mx[:pa_o]}:hd\\1#{Mx[:pa_c]}"). #watch +          gsub(/#{Mx[:br_line]}\s*_[12]\s+/, +            "#{Mx[:br_line]} ")                                                                      #indent used in endnotes, not implemented, replace when ready with: line.gsub(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ')        end        @data      end diff --git a/lib/sisu/v3dv/db_columns.rb b/lib/sisu/v3dv/db_columns.rb index 89d4c7e3..cf4ba9c7 100644 --- a/lib/sisu/v3dv/db_columns.rb +++ b/lib/sisu/v3dv/db_columns.rb @@ -109,7 +109,7 @@ module SiSU_DbColumns            t=if defined? @md.title.full \            and @md.title.full=~/\S+/              txt=@md.title.full -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -131,7 +131,7 @@ module SiSU_DbColumns            t=if defined? @md.title.main \            and @md.title.main=~/\S+/              txt=@md.title.main -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -153,7 +153,7 @@ module SiSU_DbColumns            t=if defined? @md.title.sub \            and @md.title.sub=~/\S+/              txt=@md.title.sub -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -175,7 +175,7 @@ module SiSU_DbColumns            t=if defined? @md.title.short \            and @md.title.short=~/\S+/              txt=@md.title.short -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -197,7 +197,7 @@ module SiSU_DbColumns            t=if defined? @md.title.edition \            and @md.title.edition=~/\S+/              txt=@md.title.edition -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -219,7 +219,7 @@ module SiSU_DbColumns            t=if defined? @md.title.note \            and @md.title.note=~/\S+/              txt=@md.title.note -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -240,7 +240,7 @@ module SiSU_DbColumns          def tuple            t=if @lang.list[@md.opt.lng][:n]              txt=@lang.list[@md.opt.lng][:n] -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -262,7 +262,7 @@ module SiSU_DbColumns            t=if defined? @md.opt.lng \            and @md.opt.lng=~/\S+/              txt=@md.opt.lng -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -302,8 +302,8 @@ module SiSU_DbColumns              @md.creator.author_detail.each do |h|                txt=txt + %{#{h[:the]}, #{h[:others]}; }              end -            txt.gsub!(/[;, ]+\s*$/,'') -            special_character_escape(txt) +            txt=txt.gsub(/[;, ]+\s*$/,'') +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -325,7 +325,7 @@ module SiSU_DbColumns            t=if defined? @md.creator.author_hon \            and @md.creator.author_hon=~/\S+/              txt=@md.creator.author_hon -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -347,7 +347,7 @@ module SiSU_DbColumns            t=if defined? @md.creator.author_nationality_detail \            and @md.creator.author_nationality=~/\S+/              txt=@md.creator.author_nationality_detail -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -374,8 +374,8 @@ module SiSU_DbColumns              @md.creator.editor_detail.each do |h|                txt=txt + %{#{h[:the]}, #{h[:others]}; }              end -            txt.gsub!(/[;, ]+\s*$/,'') -            special_character_escape(txt) +            txt=txt.gsub(/[;, ]+\s*$/,'') +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -402,8 +402,8 @@ module SiSU_DbColumns              @md.creator.contributor_detail.each do |h|                txt=txt + %{#{h[:the]}, #{h[:others]}; }              end -            txt.gsub!(/[;, ]+\s*$/,'') -            special_character_escape(txt) +            txt=txt.gsub(/[;, ]+\s*$/,'') +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -430,8 +430,8 @@ module SiSU_DbColumns              @md.creator.illustrator_detail.each do |h|                txt=txt + %{#{h[:the]}, #{h[:others]}; }              end -            txt.gsub!(/[;, ]+\s*$/,'') -            special_character_escape(txt) +            txt=txt.gsub(/[;, ]+\s*$/,'') +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -458,8 +458,8 @@ module SiSU_DbColumns              @md.creator.photographer_detail.each do |h|                txt=txt + %{#{h[:the]}, #{h[:others]}; }              end -            txt.gsub!(/[;, ]+\s*$/,'') -            special_character_escape(txt) +            txt=txt.gsub(/[;, ]+\s*$/,'') +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -485,8 +485,8 @@ module SiSU_DbColumns              @md.creator.translator_detail.each do |h|                txt=txt + %{#{h[:the]}, #{h[:others]}; }              end -            txt.gsub!(/[;, ]+\s*$/,'') -            special_character_escape(txt) +            txt=txt.gsub(/[;, ]+\s*$/,'') +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -513,8 +513,8 @@ module SiSU_DbColumns              @md.creator.prepared_by_detail.each do |h|                txt=txt + %{#{h[:the]}, #{h[:others]}; }              end -            txt.gsub!(/[;, ]+\s*$/,'') -            special_character_escape(txt) +            txt=txt.gsub(/[;, ]+\s*$/,'') +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -541,8 +541,8 @@ module SiSU_DbColumns              @md.creator.digitized_by_detail.each do |h|                txt=txt + %{#{h[:the]}, #{h[:others]}; }              end -            txt.gsub!(/[;, ]+\s*$/,'') -            special_character_escape(txt) +            txt=txt.gsub(/[;, ]+\s*$/,'') +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -569,8 +569,8 @@ module SiSU_DbColumns              @md.creator.audio_detail.each do |h|                txt=txt + %{#{h[:the]}, #{h[:others]}; }              end -            txt.gsub!(/[;, ]+\s*$/,'') -            special_character_escape(txt) +            txt=txt.gsub(/[;, ]+\s*$/,'') +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -596,8 +596,8 @@ module SiSU_DbColumns              @md.creator.video_detail.each do |h|                txt=txt + %{#{h[:the]}, #{h[:others]}; }              end -            txt.gsub!(/[;, ]+\s*$/,'') -            special_character_escape(txt) +            txt=txt.gsub(/[;, ]+\s*$/,'') +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -630,7 +630,7 @@ module SiSU_DbColumns          def tuple            t=if @lang.list[@md.opt.lng][:n]              txt=@lang.list[@md.opt.lng][:n] -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -653,7 +653,7 @@ module SiSU_DbColumns            t=if defined? @md.opt.lng \            and @md.opt.lng=~/\S+/              txt=@md.opt.lng -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -675,7 +675,7 @@ module SiSU_DbColumns            t=if defined? @md.language.original \            and @md.language.original=~/\S+/              txt=@md.language.original -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -697,7 +697,7 @@ module SiSU_DbColumns            t=if defined? @md.language.original_char \            and @md.language.original_char=~/\S+/              txt=@md.language.original_char -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -733,7 +733,7 @@ module SiSU_DbColumns            t=if defined? @md.date.added_to_site \            and @md.date.added_to_site=~/\S+/              txt=@md.date.added_to_site -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -755,7 +755,7 @@ module SiSU_DbColumns            t=if defined? @md.date.available \            and @md.date.available=~/\S+/              txt=@md.date.available -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -777,7 +777,7 @@ module SiSU_DbColumns            t=if defined? @md.date.created \            and @md.date.created=~/\S+/              txt=@md.date.created -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -799,7 +799,7 @@ module SiSU_DbColumns            t=if defined? @md.date.issued \            and @md.date.issued=~/\S+/              txt=@md.date.issued -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -821,7 +821,7 @@ module SiSU_DbColumns            t=if defined? @md.date.modified \            and @md.date.modified=~/\S+/              txt=@md.date.modified -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -843,7 +843,7 @@ module SiSU_DbColumns            t=if defined? @md.date.published \            and @md.date.published=~/\S+/              txt=@md.date.published -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -865,7 +865,7 @@ module SiSU_DbColumns            t=if defined? @md.date.valid \            and @md.date.valid=~/\S+/              txt=@md.date.valid -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -887,7 +887,7 @@ module SiSU_DbColumns            t=if defined? @md.date.translated \            and @md.date.translated=~/\S+/              txt=@md.date.translated -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -909,7 +909,7 @@ module SiSU_DbColumns            t=if defined? @md.date.original_publication \            and @md.date.original_publication=~/\S+/              txt=@md.date.original_publication -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -932,7 +932,7 @@ module SiSU_DbColumns            t=if defined? @md.generated \            and @md.generated.to_s=~/\S+/              txt=@md.generated.to_s -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -958,7 +958,7 @@ module SiSU_DbColumns            t=if defined? @md.publisher \            and @md.publisher=~/\S+/              txt=@md.publisher -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -980,7 +980,7 @@ module SiSU_DbColumns  #        t=if defined? @md.current.publisher \  #        and @md.current.publisher=~/\S+/  #          txt=@md.current.publisher -#          special_character_escape(txt) +#          txt=special_character_escape(txt)  #          "'#{txt}', "  #        end  #      end @@ -1011,7 +1011,7 @@ module SiSU_DbColumns            t=if defined? @md.original.publisher \            and @md.original.publisher=~/\S+/              txt=@md.original.publisher -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1033,7 +1033,7 @@ module SiSU_DbColumns            t=if defined? @md.original.language \            and @md.original.language=~/\S+/              txt=@md.original.language -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1055,7 +1055,7 @@ module SiSU_DbColumns            t=if defined? @md.original.language_char \            and @md.original.language_char=~/\S+/              txt=@md.original.language_char -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1077,7 +1077,7 @@ module SiSU_DbColumns            t=if defined? @md.original.source \            and @md.original.source=~/\S+/              txt=@md.original.source -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1099,7 +1099,7 @@ module SiSU_DbColumns            t=if defined? @md.original.institution \            and @md.original.institution=~/\S+/              txt=@md.original.institution -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1121,7 +1121,7 @@ module SiSU_DbColumns            t=if defined? @md.original.nationality \            and @md.original.nationality=~/\S+/              txt=@md.original.nationality -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1158,7 +1158,7 @@ module SiSU_DbColumns            t=if defined? @md.rights.all \            and @md.rights.all=~/\S+/              txt=@md.rights.all -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1180,7 +1180,7 @@ module SiSU_DbColumns            t=if defined? @md.rights.copyright_text \            and @md.rights.copyright_text=~/\S+/              txt=@md.rights.copyright_text -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1202,7 +1202,7 @@ module SiSU_DbColumns            t=if defined? @md.rights.copyright_translation \            and @md.rights.copyright_translation=~/\S+/              txt=@md.rights.copyright_translation -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1224,7 +1224,7 @@ module SiSU_DbColumns            t=if defined? @md.rights.copyright_illustrations \            and @md.rights.copyright_illustrations=~/\S+/              txt=@md.rights.copyright_illustrations -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1246,7 +1246,7 @@ module SiSU_DbColumns            t=if defined? @md.rights.copyright_photographs \            and @md.rights.copyright_photographs=~/\S+/              txt=@md.rights.copyright_photographs -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1268,7 +1268,7 @@ module SiSU_DbColumns            t=if defined? @md.rights.copyright_preparation \            and @md.rights.copyright_preparation=~/\S+/              txt=@md.rights.copyright_preparation -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1290,7 +1290,7 @@ module SiSU_DbColumns            t=if defined? @md.rights.copyright_digitization \            and @md.rights.copyright_digitization=~/\S+/              txt=@md.rights.copyright_digitization -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1312,7 +1312,7 @@ module SiSU_DbColumns            t=if defined? @md.rights.copyright_audio \            and @md.rights.copyright_audio=~/\S+/              txt=@md.rights.copyright_audio -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1334,7 +1334,7 @@ module SiSU_DbColumns            t=if defined? @md.rights.copyright_video \            and @md.rights.copyright_video=~/\S+/              txt=@md.rights.copyright_video -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1356,7 +1356,7 @@ module SiSU_DbColumns            t=if defined? @md.rights.license \            and @md.rights.license=~/\S+/              txt=@md.rights.license -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1394,7 +1394,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.topic_register \            and @md.classify.topic_register=~/\S+/              txt=@md.classify.topic_register -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1416,7 +1416,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.subject \            and @md.classify.subject=~/\S+/              txt=@md.classify.subject -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1438,7 +1438,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.type \            and @md.classify.type=~/\S+/              txt=@md.classify.type -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1460,7 +1460,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.loc \            and @md.classify.loc=~/\S+/              txt=@md.classify.loc -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1482,7 +1482,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.dewey \            and @md.classify.dewey=~/\S+/              txt=@md.classify.dewey -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1504,7 +1504,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.oclc \            and @md.classify.oclc=~/\S+/              txt=@md.classify.oclc -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1526,7 +1526,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.pg \            and @md.classify.pg=~/\S+/              txt=@md.classify.pg -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1548,7 +1548,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.isbn \            and @md.classify.isbn=~/\S+/              txt=@md.classify.isbn -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1570,7 +1570,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.format \            and @md.classify.format=~/\S+/              txt=@md.classify.format -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1592,7 +1592,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.identifier \            and @md.classify.identifier=~/\S+/              txt=@md.classify.identifier -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1614,7 +1614,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.relation \            and @md.classify.relation=~/\S+/              txt=@md.classify.relation -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1636,7 +1636,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.coverage \            and @md.classify.coverage=~/\S+/              txt=@md.classify.coverage -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1658,7 +1658,7 @@ module SiSU_DbColumns            t=if defined? @md.classify.keywords \            and @md.classify.keywords=~/\S+/              txt=@md.classify.keywords -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1692,7 +1692,7 @@ module SiSU_DbColumns            t=if defined? @md.notes.abstract \            and @md.notes.abstract=~/\S+/              txt=@md.notes.abstract -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1714,7 +1714,7 @@ module SiSU_DbColumns            t=if defined? @md.notes.comment \            and @md.notes.comment=~/\S+/              txt=@md.notes.comment -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1736,7 +1736,7 @@ module SiSU_DbColumns            t=if defined? @md.notes.description \            and @md.notes.description=~/\S+/              txt=@md.notes.description -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1758,7 +1758,7 @@ module SiSU_DbColumns            t=if defined? @md.notes.history \            and @md.notes.history=~/\S+/              txt=@md.notes.history -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1780,7 +1780,7 @@ module SiSU_DbColumns            t=if defined? @md.notes.prefix \            and @md.notes.prefix=~/\S+/              txt=@md.notes.prefix -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1802,7 +1802,7 @@ module SiSU_DbColumns            t=if defined? @md.notes.prefix_a \            and @md.notes.prefix_a=~/\S+/              txt=@md.notes.prefix_a -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1824,7 +1824,7 @@ module SiSU_DbColumns            t=if defined? @md.notes.prefix_b \            and @md.notes.prefix_b=~/\S+/              txt=@md.notes.prefix_b -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1846,7 +1846,7 @@ module SiSU_DbColumns            t=if defined? @md.notes.suffix \            and @md.notes.suffix=~/\S+/              txt=@md.notes.suffix -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1871,7 +1871,7 @@ module SiSU_DbColumns            t=if defined? @md.fns \            and @md.fns=~/\S+/              txt=@md.fns -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -1916,7 +1916,7 @@ module SiSU_DbColumns           t=if defined? @md.filesize \           and @md.filesize=~/\S+/             txt=@md.filesize -           special_character_escape(txt) +           txt=special_character_escape(txt)             ["#{name}, ","'#{txt}', "]           else ['','']           end @@ -1938,7 +1938,7 @@ module SiSU_DbColumns            t=if defined? @md.wc_words \            and @md.wc_words=~/\S+/              txt=@md.wc_words -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -2006,7 +2006,7 @@ module SiSU_DbColumns            t=if defined? @md.skin_name \            and @md.skin_name=~/\S+/              txt=@md.skin_name -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -2029,7 +2029,7 @@ module SiSU_DbColumns            and @md.dgst_skin.class==Array \            and @md.dgst_skin[1]=~/\S+/              txt=@md.dgst_skin[1] -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -2051,7 +2051,7 @@ module SiSU_DbColumns            t=if defined? @md.skin \            and @md.skin=~/\S+/              txt=@md.skin -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end @@ -2074,7 +2074,7 @@ module SiSU_DbColumns            t=if defined? @md.links \            and @md.links=~/\S+/              txt=@md.links -            special_character_escape(txt) +            txt=special_character_escape(txt)              ["#{name}, ","'#{txt}', "]            else ['','']            end diff --git a/lib/sisu/v3dv/db_create.rb b/lib/sisu/v3dv/db_create.rb index 47d22915..6420c3ec 100644 --- a/lib/sisu/v3dv/db_create.rb +++ b/lib/sisu/v3dv/db_create.rb @@ -66,7 +66,7 @@ module SiSU_DbCreate        @opt,@conn,@file,@sql_type=opt,conn,file,sql_type        @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX        @comment=(@sql_type=='pg') \ -      ? (Comment.new(@conn,@sql_type)) +      ? (SiSU_DbCreate::Comment.new(@conn,@sql_type))        : nil        @@dl ||=SiSU_Env::InfoEnv.new.digest.length      end diff --git a/lib/sisu/v3dv/db_import.rb b/lib/sisu/v3dv/db_import.rb index adbe5af5..a2b66937 100644 --- a/lib/sisu/v3dv/db_import.rb +++ b/lib/sisu/v3dv/db_import.rb @@ -212,7 +212,7 @@ module SiSU_DbImport          src=special_character_escape(src)          @tp[:sisutxt_f],@tp[:sisutxt_i]='sisutxt, ',"'#{src}', "          txt=clean_searchable_text(txt_arr) -        #special_character_escape(txt) +        #txt=special_character_escape(txt)          @tp[:fulltxt_f],@tp[:fulltxt_i]='fulltxt, ',"'#{txt}', "        end  #% title @@ -268,7 +268,7 @@ module SiSU_DbImport                @col[:lid]+=1                txt=endnotes(txt).extract_any                @col[:body]=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_minus -              special_character_escape(@col[:body]) +              @col[:body]=special_character_escape(@col[:body])                @col[:plaintext]=@col[:body].dup                @col[:plaintext]=strip_markup(@col[:plaintext])                @col[:plaintext]=clean_searchable_text(@col[:plaintext]) @@ -302,7 +302,7 @@ module SiSU_DbImport                @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"                txt=endnotes(txt).extract_any                @col[:body]=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus -              special_character_escape(@col[:body]) +              @col[:body]=special_character_escape(@col[:body])                @col[:plaintext]=@col[:body].dup                @col[:plaintext]=strip_markup(@col[:plaintext])                @col[:plaintext]=clean_searchable_text(@col[:plaintext]) @@ -329,7 +329,7 @@ module SiSU_DbImport                @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"                txt=endnotes(txt).extract_any                @col[:body]=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus -              special_character_escape(@col[:body]) +              @col[:body]=special_character_escape(@col[:body])                @col[:plaintext]=@col[:body].dup                @col[:plaintext]=strip_markup(@col[:plaintext])                @col[:plaintext]=clean_searchable_text(@col[:plaintext]) @@ -356,7 +356,7 @@ module SiSU_DbImport                @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html"                txt=endnotes(txt).extract_any                @col[:body]=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus -              special_character_escape(@col[:body]) +              @col[:body]=special_character_escape(@col[:body])                @col[:plaintext]=@col[:body].dup                @col[:plaintext]=strip_markup(@col[:plaintext])                @col[:plaintext]=clean_searchable_text(@col[:plaintext]) @@ -406,7 +406,7 @@ module SiSU_DbImport                else                  SiSU_FormatShared::CSS_Format.new(@md,data).norm                end -              special_character_escape(@col[:body]) +              @col[:body]=special_character_escape(@col[:body])                @col[:plaintext]=@col[:body].dup                @col[:plaintext]=strip_markup(@col[:plaintext])                @col[:plaintext]=clean_searchable_text(@col[:plaintext]) @@ -424,9 +424,9 @@ module SiSU_DbImport                      nr,txt,digest_clean=$1,$2.strip,0                    end                    @id_n+=1 -                  special_character_escape(txt) +                  txt=special_character_escape(txt)                    body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt) -                  strip_markup(txt) +                  txt=strip_markup(txt)                    if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1)                      puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"                      open("#{Dir.pwd}/pg_documents_error_log",'a') do |error| @@ -463,9 +463,9 @@ module SiSU_DbImport                      nr,txt,digest_clean=$1,$2.strip,0                    end                    @id_n+=1 -                  special_character_escape(txt) +                  txt=special_character_escape(txt)                    body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt) -                  strip_markup(txt) +                  txt=strip_markup(txt)                    if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1)                      puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"                      open("#{Dir.pwd}/pg_documents_error_log",'a') do |error| @@ -502,9 +502,9 @@ module SiSU_DbImport                      nr,txt,digest_clean=$1,$2.strip,0                    end                    @id_n+=1 -                  special_character_escape(txt) +                  txt=special_character_escape(txt)                    body=SiSU_FormatShared::CSS_Format.new(@md,data).endnote(nr,txt) -                  strip_markup(txt) +                  txt=strip_markup(txt)                    if txt.size > (SiSU_DbColumns::ColumnSize.new.endnote_clean - 1)                      puts "\n\nTOO LARGE (ENDNOTE - see error log)\n\n"                      open("#{Dir.pwd}/pg_documents_error_log",'a') do |error| @@ -568,14 +568,14 @@ module SiSU_DbImport          : nil        end        def clean_text(base_url=nil) -        if base_url -          @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) -          @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) -          @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) +        @txt=if base_url +          @txt.gsub(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}). +            gsub(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}). +            gsub(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>})          else -          @txt.gsub!(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'<sup>\1</sup>') -          @txt.gsub!(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>') -          @txt.gsub!(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>') +          @txt.gsub(/#{Mx[:en_a_o]}(\d+).+?#{Mx[:en_a_c]}/,'<sup>\1</sup>'). +            gsub(/#{Mx[:en_b_o]}([*]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>'). +            gsub(/#{Mx[:en_b_o]}([+]\d+).+?#{Mx[:en_b_c]}/,'<sup>\1</sup>')          end          @txt        end diff --git a/lib/sisu/v3dv/db_sqltxt.rb b/lib/sisu/v3dv/db_sqltxt.rb index 49dcf10a..e65a8521 100644 --- a/lib/sisu/v3dv/db_sqltxt.rb +++ b/lib/sisu/v3dv/db_sqltxt.rb @@ -59,46 +59,45 @@  module SiSU_DbText    class Prepare      def special_character_escape(str) -      str.gsub!(/'/,"''") #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'") -      str.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 -      str.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"<br />\n") -      str.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check -      str.gsub!(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/,'[image: \1] \2') -      str.gsub!(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2') -      str.gsub!(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'\1') -      str +      str=str.gsub(/'/,"''"). #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]}/,"<br />\n"). +        gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,''). #check +        gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/,'[image: \1] \2'). +        gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2'). +        gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'\1')      end      def clean_searchable_text(arr) #produce clean, searchable, plaintext from document source        txt_arr,en=[],[]        arr=arr.class==String ? arr.split(/\n+/m) : arr        arr.each do |s| -        s.gsub!(/([*\/_-])\{(.+?)\}\1/m,'\2') -        s.gsub!(/^(?:block|group|poem|code)\{/m,''); s.gsub!(/^\}(?:block|group|poem|code)/m,'') -        s.gsub!(/\A(?:@\S+:\s+.+)\Z/m,'') +        s=s.gsub(/([*\/_-])\{(.+?)\}\1/m,'\2'). +          gsub(/^(?:block|group|poem|code)\{/m,'').gsub(/^\}(?:block|group|poem|code)/m,''). +          gsub(/\A(?:@\S+:\s+.+)\Z/m,'')          if s =~/^:A~/            if defined? @md.creator \            and defined? @md.creator.author \            and not @md.creator.author.empty? -            s.gsub!(/@author/,@md.creator.author) +            s=s.gsub(/@author/,@md.creator.author)            else              SiSU_Screen::Ansi.new('v','WARNING Document Author information missing; provide @creator: :author:',@md.fnb).warn unless @md.opt.cmd.inspect =~/q/            end            if defined? @md.title \            and defined? @md.title.full \            and not @md.title.full.empty? -            s.gsub!(/@title/,@md.title.full) +            s=s.gsub(/@title/,@md.title.full)            else              SiSU_Screen::Ansi.new('v','WARNING Document Title missing; provide @title:',@md.fnb).warn unless @md.opt.cmd.inspect =~/q/            end          end -        s.gsub!(/^(?:_[1-9]\*?|_\*)\s+/m,'') -        s.gsub!(/^(?:[1-9]\~(\S+)?)\s+/m,'') -        s.gsub!(/^(?::?[A-C]\~(\S+)?)\s+/m,'') -        s.gsub!(/^%{1,3} .+/m,'') #removed even if contained in code block -        s.gsub!(/<br>/m,' ') +        s=s.gsub(/^(?:_[1-9]\*?|_\*)\s+/m,''). +          gsub(/^(?:[1-9]\~(\S+)?)\s+/m,''). +          gsub(/^(?::?[A-C]\~(\S+)?)\s+/m,''). +          gsub(/^%{1,3} .+/m,''). #removed even if contained in code block +          gsub(/<br>/m,' ')          en << s.scan(/~\{\s*(.+?)\s*\}~/m) -        s.gsub!(/~\{.+?\}~/m,'') -        s.gsub!(/ \s+/m,' ') +        s=s.gsub(/~\{.+?\}~/m,''). +          gsub(/ \s+/m,' ')          #special_character_escape(s)          s        end @@ -109,17 +108,16 @@ module SiSU_DbText        txt      end      def strip_markup(str) #define rules, make same as in dal clean -      str.gsub!(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]') -      str.gsub!(/(?: \\;|#{Mx[:nbsp]})+/,' ') -      str.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1')         #tables -      str.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' ')                          #tables -      str.gsub!(/#{Mx[:tc_p]}/u,' ')                                                     #tables tidy later -      str.gsub!(/<.+?>/,'') -      str.gsub!(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:file|ftp)\/\/:\S+ /,' [image] ') # else image names found in search -      str.gsub!(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [image]') # else image names found in search -      str.gsub!(/\s\s+/,' ') -      str.strip! -      str +      str=str.gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]'). +        gsub(/(?: \\;|#{Mx[:nbsp]})+/,' '). +        gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1').         #tables +        gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' ').                          #tables +        gsub(/#{Mx[:tc_p]}/u,' ').                                                     #tables tidy later +        gsub(/<.+?>/,''). +        gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:file|ftp)\/\/:\S+ /,' [image] '). # else image names found in search +        gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [image]'). # else image names found in search +        gsub(/\s\s+/,' '). +        strip      end      def unique_words(str)        a=str.scan(/[a-zA-Z0-9\\\/_-]{2,}/) #a=str.scan(/\S+{2,}/) diff --git a/lib/sisu/v3dv/defaults.rb b/lib/sisu/v3dv/defaults.rb index 55aeef21..1c9dd94f 100644 --- a/lib/sisu/v3dv/defaults.rb +++ b/lib/sisu/v3dv/defaults.rb @@ -735,8 +735,8 @@ module SiSU_Viz            when /\/i$/; 'i'            else         ''            end -          r.gsub!(/^\/(.+?)\/i?/,'\1') -          r.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided +          r=r.gsub(/^\/(.+?)\/i?/,'\1'). +            gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided            m='\b(' + r + ')\b'            make[:str]            make[:regx]=if x =~/i/; /#{m}/i @@ -756,8 +756,8 @@ module SiSU_Viz            when /\/i$/; 'i'            else         ''            end -          r.gsub!(/^\/(.+?)\/i?/,'\1') -          r.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided +          r.gsub(/^\/(.+?)\/i?/,'\1'). +            gsub(/\(/,'(?:') # avoid need to escape use of brackets within regex provided            m='\b(' + r + ')\b'            make[:str]            make[:regx]=if x =~/i/; /#{m}/i diff --git a/lib/sisu/v3dv/digests.rb b/lib/sisu/v3dv/digests.rb index 5f5d90b3..91299d4c 100644 --- a/lib/sisu/v3dv/digests.rb +++ b/lib/sisu/v3dv/digests.rb @@ -153,9 +153,9 @@ module SiSU_DigestView            if para =~/#{Mx[:id_o]}~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)#{Mx[:id_c]}#{Mx[:id_o]}([0-9a-f]{#{@dl}}):([0-9a-f]{#{@dl}})#{Mx[:id_c]}/              ocn,h1,h2,d_clean,d_all=$1,$2,$3,$4,$5              @ocn=ocn unless ocn.to_i==0 -            para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') -            para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') -            para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') +            para=para.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). +              gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). +              gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>')              if para=~/#{Mx[:en_a_o]}[\d*+]+.+?#{Mx[:id_o]}[0-9a-f]{#{@dl}}#{Mx[:id_c]}#{Mx[:en_a_c]}/                para_endnotes << para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+).+?#{Mx[:id_o]}([0-9a-f]{#{@dl}})#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/)              end diff --git a/lib/sisu/v3dv/epub.rb b/lib/sisu/v3dv/epub.rb index 250b428f..c87112cf 100644 --- a/lib/sisu/v3dv/epub.rb +++ b/lib/sisu/v3dv/epub.rb @@ -106,7 +106,7 @@ module SiSU_EPUB          data=@tuned_file_array          scr_toc=SiSU_EPUB::Source::ScrollHeadAndSegToc.new(@md,toc).in_common #watch          SiSU_EPUB::Source::Seg.new(@md,data).songsheet -        SiSU_EPUB::Source::EPUB_Output.new(@md).songsheet +        SiSU_EPUB::Source::Output.new(@md).songsheet        rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error        ensure          unless @opt.cmd =~/[MV]/ #check maintenance flag @@ -242,7 +242,7 @@ module SiSU_EPUB                md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_a)                md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_a)                md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_a) -              Toc.new(@md,dob_toc).level_1 +              SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_1              when 2                @s_b_no +=1                name_s_b='section_b' + @s_b_no.to_s @@ -257,7 +257,7 @@ module SiSU_EPUB                md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_b)                md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_b)                md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_b) -              Toc.new(@md,dob_toc).level_2 +              SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_2              when 3                @s_c_no +=1                name_s_c='section_c' + @s_c_no.to_s @@ -271,7 +271,7 @@ module SiSU_EPUB                md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_c)                md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_c)                md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_c) -              Toc.new(@md,dob_toc).level_3 +              SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_3              when 4                @ncx_cls=[]                @nav_no+=1 @@ -281,9 +281,9 @@ module SiSU_EPUB                md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc)                md_opf_a_spine << @epub.metadata_opf.spine(dob_toc)                md_opf_a_guide << @epub.metadata_opf.guide(dob_toc) -              Toc.new(@md,dob_toc).level_4 -            when 5; Toc.new(@md,dob_toc).level_5 -            when 6; Toc.new(@md,dob_toc).level_6 +              SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_4 +            when 5; SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_5 +            when 6; SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_6              else nil              end              toc.each do |k,d| @@ -318,8 +318,8 @@ module SiSU_EPUB          @@toc[:opf] << @epub.metadata_opf.guide_open << md_opf_a_guide << @epub.metadata_opf.guide_close          @@toc[:opf] << @epub.metadata_opf.package_close          @@toc[:opf]=@@toc[:opf].flatten -        EPUB_Output.new(@md,@@toc[:opf]).epub_metadata_opf -        EPUB_Output.new(@md,@@toc[:ncx]).epub_toc_ncx +        SiSU_EPUB::Source::Output.new(@md,@@toc[:opf]).epub_metadata_opf +        SiSU_EPUB::Source::Output.new(@md,@@toc[:ncx]).epub_toc_ncx          @md.firstseg=@@firstseg          @@toc        end @@ -486,29 +486,6 @@ module SiSU_EPUB          end          toc        end -      def level_crosslink -        dob=@data -        if dob !~/^4~!/ -          dob.gsub!(/^4~!\s+(\S+)\s+(.+)/, -            %{<table><tr><td width =\"80\"></td> -  <td><a href="http://\\1"> -    #{@png.crosslink_ext} -        \\2 -    <\/a> -  </td></tr></table> -}) -        else -          dob.gsub!(/^4~!\s+(\S+)\s+(.+)/, -            %{<table><tr><td width ="80"> -  </td><td> -    <a href="\\1"> -      #{@png.crosslink} -          \\2 -    <\/a> -  </td></tr></table> -}) -        end -      end      end      class ScrollHeadAndSegToc < Toc        def initialize(md='',toc='',links_guide_toc='') @@ -521,7 +498,7 @@ module SiSU_EPUB          SiSU_Screen::Ansi.new(@md.opt.cmd,'Scroll & Segtoc').txt_grey if @md.opt.cmd =~/[MVv]/          format_head_toc=SiSU_EPUB_Format::HeadToc.new(@md)          dochead=format_head_toc.head -        dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge +        dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge          toc_shared << dochead #<< ads.div.major          segtoc << format_head_toc.head #<< ads.div.major          if SiSU_EPUB_Format::HeadToc.method_defined? :toc_head_escript @@ -589,8 +566,8 @@ module SiSU_EPUB          #Segtoc tail added here          segtoc << seg_toc_band_bottom          segtoc << format_head_toc.xhtml_close -        segtoc.flatten!.compact! -        EPUB_Output.new(@md,segtoc).segtoc +        segtoc=segtoc.flatten.compact #watch +        SiSU_EPUB::Source::Output.new(@md,segtoc).segtoc          segtoc=[]          @toc[:scr],@toc[:seg]=[],[]          toc_shared @@ -600,7 +577,7 @@ module SiSU_EPUB      end      class Seg < SiSU_EPUB_Seg::Seg      end -    class EPUB_Output +    class Output        def initialize(md,output='')          @md,@output=md,output          @epub_doc="#{@md.fnb}.epub" @@ -689,7 +666,7 @@ module SiSU_EPUB            filename_html_segtoc=@make.epub.xhtml_segtoc            filename_html_index=@make.epub.xhtml_index            @output.each do |para| -            para.strip! +            para=para.strip              unless para =~/\A\s*\Z/                filename_html_segtoc.puts para,"\n"                filename_html_index.puts para,"\n" diff --git a/lib/sisu/v3dv/epub_concordance.rb b/lib/sisu/v3dv/epub_concordance.rb index 9c90d482..1106ec13 100644 --- a/lib/sisu/v3dv/epub_concordance.rb +++ b/lib/sisu/v3dv/epub_concordance.rb @@ -213,46 +213,46 @@ WOK              and toy !~/^0$/                line.obj=line.obj.split(@rgx_splitlist).join(' ') #%take in word or other match                for word in line.obj.scan(@rgx_scanlist) #%take in word or other match -                word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'') -                word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'') -                word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') -                word.gsub!(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'') -                word.gsub!(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'') -                word.gsub!(/^\S$/,'') +                word=word.gsub(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,''). +                  gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''). +                  gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,''). +                  gsub(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,''). +                  gsub(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,''). +                  gsub(/^\S$/,'')                  word=nil if word.empty?                  word=nil if word =~@rxp_excluded0 #watch                  word=nil if word =~@rxp_excluded1 #watch                  word=nil if word =~/^\S$/                  if word -                  word.gsub!(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ') -                  word.gsub!(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'') -                  word.gsub!(/#{Mx[:mk_o]}(?:[0-9a-f]{32}:[0-9a-f]{32}|[0-9a-f]{64}:[0-9a-f]{64})#{Mx[:mk_c]}/,'') -                  word.gsub!(/#{Mx[:mk_o]}(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:mk_c]}/,'') -                  word.gsub!(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'') -                  word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''); word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') -                  word.gsub!(/<\/?\S+?>/,'') -                  word.gsub!(/^\@+/,'') -                  word.strip! -                  word.gsub!(/#{Mx[:tc_p]}.+/,'') -                  word.gsub!(/[\.,;:"]$/,'') -                  word.gsub!(/["]/,'') -                  word.gsub!(/^\s*[\(]/,'') -                  word.gsub!(/[\(]\s*$/,'') -                  word.gsub!(/^(?:See|e\.?g\.?).+/,'') -                  word.gsub!(/^\s*[.,;:]\s*/,'') -                  word.strip! -                  word.gsub!(/^\(?[a-zA-Z]\)$/,'') -                  word.gsub!(/^\d+(st|nd|rd|th)$/,'') -                  word.gsub!(/^(\d+\.?)+$/, '') -                  word.gsub!(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'') -                  word.gsub!(/:name#\S+/,'') -                  word.gsub!(/^\S$/,'') +                  word=word.gsub(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' '). +                    gsub(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,''). +                    gsub(/#{Mx[:mk_o]}(?:[0-9a-f]{32}:[0-9a-f]{32}|[0-9a-f]{64}:[0-9a-f]{64})#{Mx[:mk_c]}/,''). +                    gsub(/#{Mx[:mk_o]}(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:mk_c]}/,''). +                    gsub(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,''). +                    gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'').gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,''). +                    gsub(/<\/?\S+?>/,''). +                    gsub(/^\@+/,''). +                    strip. +                    gsub(/#{Mx[:tc_p]}.+/,''). +                    gsub(/[\.,;:"]$/,''). +                    gsub(/["]/,''). +                    gsub(/^\s*[\(]/,''). +                    gsub(/[\(]\s*$/,''). +                    gsub(/^(?:See|e\.?g\.?).+/,''). +                    gsub(/^\s*[.,;:]\s*/,''). +                    strip. +                    gsub(/^\(?[a-zA-Z]\)$/,''). +                    gsub(/^\d+(st|nd|rd|th)$/,''). +                    gsub(/^(\d+\.?)+$/, ''). +                    gsub(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,''). +                    gsub(/:name#\S+/,''). +                    gsub(/^\S$/,'')                    word=nil if word =~/^\S$/                    word=nil if word =~/^\s*$/ #watch                    if word                      unless word =~/[A-Z][A-Z]/ \                      or word =~/\w+\s\w+/ -                      word.capitalize! +                      word=word.capitalize                      end                      @freq[word] +=1                      @word_map[word] ||= [] diff --git a/lib/sisu/v3dv/epub_format.rb b/lib/sisu/v3dv/epub_format.rb index 46c9d4be..c1987fa0 100644 --- a/lib/sisu/v3dv/epub_format.rb +++ b/lib/sisu/v3dv/epub_format.rb @@ -1493,12 +1493,12 @@ WOK              m=(m.empty?) \              ? (surname + other_names)              : (m + '; ' + surname + ', ' + other_names) -            m.gsub!(/</,'<'); m.gsub!(/>/,'>') -            m.gsub!(/<br(?: \/)?>/,';') +            m=m.gsub(/</,'<').gsub(/>/,'>'). +              gsub(/<br(?: \/)?>/,';')            end            x=@md.creator.author.dup -          x.gsub!(/</,'<'); x.gsub!(/>/,'>') -          x.gsub!(/<br(?: \/)?>/,'<br />') +          x=x.gsub(/</,'<').gsub(/>/,'>'). +            gsub(/<br(?: \/)?>/,'<br />')            %{\n    <dc:creator opf:file-as="#{m}" opf:role="aut">#{x}</dc:creator>}          else ''          end @@ -1515,12 +1515,12 @@ WOK              m=(m.empty?) \              ? (surname + other_names)              : (m + '; ' + surname + ', ' + other_names) -            m.gsub!(/</,'<'); m.gsub!(/>/,'>') -            m.gsub!(/<br(?: \/)?>/,';') +            m=m.gsub(/</,'<').gsub(/>/,'>'). +              gsub(/<br(?: \/)?>/,';')            end            x=@md.creator.editor.dup -          x.gsub!(/</,'<'); x.gsub!(/>/,'>') -          x.gsub!(/<br(?: \/)?>/,'<br />') +          x=x.gsub(/</,'<').gsub(/>/,'>'). +            gsub(/<br(?: \/)?>/,'<br />')            %{\n    <dc:creator opf:file-as="#{m}" opf:role="edt">#{x}</dc:creator>}          else ''          end @@ -1537,12 +1537,12 @@ WOK              m=(m.empty?) \              ? (surname + other_names)              : (m + '; ' + surname + ', ' + other_names) -            m.gsub!(/</,'<'); m.gsub!(/>/,'>') -            m.gsub!(/<br(?: \/)?>/,';') +            m=m.gsub(/</,'<').gsub(/>/,'>'). +              gsub(/<br(?: \/)?>/,';')            end            x=@md.creator.translator.dup -          x.gsub!(/</,'<'); x.gsub!(/>/,'>') -          x.gsub!(/<br(?: \/)?>/,'<br />') +          x=x.gsub(/</,'<').gsub(/>/,'>'). +            gsub(/<br(?: \/)?>/,'<br />')            %{\n    <dc:creator opf:file-as="#{m}" opf:role="trl">#{x}</dc:creator>}          else ''          end @@ -1559,28 +1559,28 @@ WOK              m=(m.empty?) \              ? (surname + other_names)              : (m + '; ' + surname + ', ' + other_names) -            m.gsub!(/</,'<'); m.gsub!(/>/,'>') -            m.gsub!(/<br(?: \/)?>/,';') +            m=m.gsub(/</,'<').gsub(/>/,'>'). +              gsub(/<br(?: \/)?>/,';')            end            x=@md.creator.illustrator.dup -          x.gsub!(/</,'<'); x.gsub!(/>/,'>') -          x.gsub!(/<br(?: \/)?>/,'<br />') +          x=x.gsub(/</,'<').gsub(/>/,'>'). +            gsub(/<br(?: \/)?>/,'<br />')            %{\n    <dc:creator opf:file-as="#{m}" opf:role="ill">#{x}</dc:creator>}          else ''          end          date_published=if defined? @md.date.published \          and @md.date.published =~/\S+/            x=@md.date.published.dup -          x.gsub!(/</,'<'); x.gsub!(/>/,'>') -          x.gsub!(/<br(?: \/)?>/,'<br />') +          x=x.gsub(/</,'<').gsub(/>/,'>'). +            gsub(/<br(?: \/)?>/,'<br />')            %{\n    <dc:date opf:event="published">#{x}</dc:date>}          else ''          end          subject=if defined? @md.classify.subject \          and @md.classify.subject =~/\S+/            x=@md.classify.subject.dup -          x.gsub!(/</,'<'); x.gsub!(/>/,'>') -          x.gsub!(/<br(?: \/)?>/,'<br />') +          x=x.gsub(/</,'<').gsub(/>/,'>'). +            gsub(/<br(?: \/)?>/,'<br />')            %{\n    <dc:subject>#{x}</dc:subject>}          else ''          end @@ -1791,7 +1791,7 @@ WOK      end      def make_concordance        manifest=scroll=seg='' -      wgt=Widget.new(@md) +      wgt=SiSU_EPUB_Format::Widget.new(@md)        %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0">  <tr>    #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} @@ -1987,7 +1987,7 @@ WOK      end      def doc_types #used in seg_nav_band ###        scroll=seg='' -      wgt=Widget.new(@md) +      wgt=SiSU_EPUB_Format::Widget.new(@md)        x=if @md.concord_make          %{  <table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> @@ -2177,7 +2177,7 @@ WOK          end        end        if @txt and not @txt.empty? -        @txt.gsub!(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') +        @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'')        end        @p_num=ParagraphNumber.new(@md,@ocn)        @vz=SiSU_Env::GetInit.instance.skin @@ -2216,60 +2216,60 @@ WOK  </div>  }      end -    def para_form_css(tag,attrib)                                                    # regular paragraphs shaped here +    def para_form_css(tag,attrib,txt)                                                    # regular paragraphs shaped here        ul=ulc=''        ul,ulc="<ul>\n  ","\n  </ul>" if @tag =~/li/        %{  <div class="substance">    #{@p_num.ocn_display}    #{ul}<#{tag} class="#{attrib}" #{@p_num.id}> -    #{@named}#{@txt} +    #{@named}#{txt}    </#{tag}>#{ulc}  </div>  }      end      def para -      para_form_css('p','norm') +      para_form_css('p','norm',@txt)      end      def group -      para_form_css('p','group') +      para_form_css('p','group',@txt)      end      def block -      para_form_css('p','block') +      para_form_css('p','block',@txt)      end      def alt -      para_form_css('p','alt') +      para_form_css('p','alt',@txt)      end      def verse -      para_form_css('p','verse') +      para_form_css('p','verse',@txt)      end      def code -      para_form_css('p','code') +      para_form_css('p','code',@txt)      end      def center -      para_form_css('p','center') +      para_form_css('p','center',@txt)      end      def bold -      para_form_css('p','bold') +      para_form_css('p','bold',@txt)      end      def bullet -      para_form_css('li','bullet') +      para_form_css('li','bullet',@txt)      end      def table        @txt=if @t_o.obj !~/^<table\s/          table=SiSU_XHTML_Shared::TableXHTML.new(@t_o) #move, make happen earlier -        @txt=table.table.obj +        table.table.obj        else @txt        end -      para_form_css('p','norm') +      para_form_css('p','norm',@txt)      end      def break -      @txt.gsub!(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />') -      @txt.gsub!(/#{Mx[:br_obj]}/,'<hr style="width:30%" /><br />') -      para_form_css('p','norm') +      @txt=@txt.gsub(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />'). +        gsub(/#{Mx[:br_obj]}/,'<hr style="width:30%" /><br />') +      para_form_css('p','norm',@txt)      end      def format(tag,attrib) -      para_form_css(tag,attrib) +      para_form_css(tag,attrib,@txt)      end      def title_heading(tag,attrib)        %{ @@ -2298,8 +2298,8 @@ WOK      def title_heading4        ''      end -    def seg_heading_sub(tag,attrib) -      @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') +    def seg_heading_sub(tag,attrib,txt) +      txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')        %{  <div class="substance">    #{@p_num.ocn_display} @@ -2320,10 +2320,10 @@ WOK  }      end      def seg_heading5 -      seg_heading_sub('p','bold') +      seg_heading_sub('p','bold',@txt)      end      def seg_heading6 -      seg_heading_sub('p','bold') +      seg_heading_sub('p','bold',@txt)      end      def dl #check :trailer        "<dl><b>#{@txt}</b> #{@trailer}</dl>" @@ -2333,18 +2333,19 @@ WOK      </p>    </div>'      end -    def gsub_body -      case @txt +    def gsub_body #unused +      @txt=case @txt        when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\((i+|iv|v|vi+|ix|x|xi+)\)/ -        @txt.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>') -        @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>') +        @txt.gsub(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>'). +          gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>')        when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\(?(\d|[a-z])+\)/ -        @txt.gsub!(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>') -        @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>') +        @txt.gsub(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>'). +          gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>')        when /^\s*\d{1,3}\.\s/ -        @txt.gsub!(/^\s*(\d+\.)/,'<b>\1</b>') +        @txt.gsub(/^\s*(\d+\.)/,'<b>\1</b>')        when /^\s*[A-Z]\.\s/ -        @txt.gsub!(/^\s*([A-Z]\.)/,'<b>\1</b>') +        @txt.gsub(/^\s*([A-Z]\.)/,'<b>\1</b>') +      else @txt        end      end      def bold_para @@ -2356,9 +2357,9 @@ WOK         #{@vz.table_close}}      end -    def bold_heading -      @txt.gsub!(/[1-9]~\S+/,'') -      @txt.gsub!(/[1-9]~/,'') +    def bold_heading #unused +      @txt=@txt.gsub(/[1-9]~\S+/,''). +        gsub(/[1-9]~/,'')        %{<p class="bold">      #{@txt}    </p> @@ -2444,9 +2445,8 @@ WOK  }      end      def clean(txt) -      txt.gsub!(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'') -      txt.gsub!(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') -      txt +      txt=txt.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,''). +        gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'')      end      def subtoc_lev(tag,attrib)        @txt=clean(@txt) @@ -2458,10 +2458,10 @@ WOK        note=''        if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end          note=$1 -        note.gsub!(/[\n\s]+/m,' ') -        txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') -        txt.gsub!(/<a[\n\s]+"[\n\s]+href="#note_ref\d+"> <sup id="note\d+">\d+<\/sup> /m,'') -        txt.gsub!(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{Mx[:nbsp]}<sup id="note\d+">\d+<\/sup>#{Mx[:nbsp]}/m,'') #remove +        note=note.gsub(/[\n\s]+/m,' ') +        txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' '). +          gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+"> <sup id="note\d+">\d+<\/sup> /m,''). +          gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{Mx[:nbsp]}<sup id="note\d+">\d+<\/sup>#{Mx[:nbsp]}/m,'') #remove        end        %{<#{tag} class="#{attrib}">      <a href="#o#{@ocn}"><i>#{txt}</i></a> #{note} @@ -2473,8 +2473,8 @@ WOK      def subtoc_lev6        subtoc_lev('h6','subtoc') if @txt      end -    def heading_sub(tag,attrib) -      @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') +    def heading_sub(tag,attrib,txt) +      txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')        %{  <div class="substance">    #{@p_num.ocn_display} @@ -2496,10 +2496,10 @@ WOK  }      end      def heading5 -      heading_sub('p','bold') +      heading_sub('p','bold',@txt)      end      def heading6 -      heading_sub('p','bold') +      heading_sub('p','bold',@txt)      end      def navigation_heading4        %{<table summary="navigation segment heading 4" width=100% bgcolor="#08163f" border="0"> diff --git a/lib/sisu/v3dv/epub_segments.rb b/lib/sisu/v3dv/epub_segments.rb index 5545dc23..1119d8c8 100644 --- a/lib/sisu/v3dv/epub_segments.rb +++ b/lib/sisu/v3dv/epub_segments.rb @@ -60,7 +60,7 @@ module SiSU_EPUB_Seg    require_relative 'shared_xhtml'                       # shared_xhtml.rb    require_relative 'epub'                               # epub.rb    require_relative 'shared_metadata'                    # shared_metadata.rb -  class SegOutput +  class Output      def initialize(md,outputfile,seg,minitoc,type='')        @md,@output_epub_cont_seg,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type      end @@ -114,11 +114,10 @@ WOK            filename_seg << @seg[:headings] << @seg[:main] << "\n</div>\n"          end          filename_seg << @seg[:tail] << @seg[:nav] << @seg[:close] -        filename_seg.flatten!.compact! +        filename_seg=filename_seg.flatten.compact #watch          filename_seg.each do |str|            unless str =~/\A\s*\Z/ -            str.strip! -            @output_epub_cont_seg << str +            @output_epub_cont_seg << str.strip            end          end          @output_epub_cont_seg.close @@ -149,7 +148,7 @@ WOK          @minitoc=SiSU_EPUB::Source::Toc.new(@md,@data).minitoc          data=get_subtoc_endnotes(@data)          data=articles(data) -        Seg.new.cleanup # (((( added )))) +        SiSU_EPUB_Seg::Seg.new.cleanup # (((( added ))))          #### (((( END )))) ####        rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error        ensure @@ -187,10 +186,10 @@ WOK          #  #while dob.obj =~/href="#{Xx[:segment]}#+(\S+?)"/          #  #  m=$1          #  #  if map_nametags[m][:segname] -        #  #    dob.obj.sub!(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#{map_nametags[m][:segname]}#{Sfx[:html]}#\\1"}) +        #  #    dob.obj=dob.obj.sub(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#{map_nametags[m][:segname]}#{Sfx[:html]}#\\1"})          #  #  else          #  #    p "NOT FOUND name_tags: #{m}" -        #  #    dob.obj.sub!(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#\\1"}) # not satisfactory +        #  #    dob.obj=dob.obj.sub(/href="#{Xx[:segment]}#+(\S+?)"/,%{href="#\\1"}) # not satisfactory          #  #  end          #  #end          #end @@ -237,32 +236,32 @@ WOK              || dob.is=='heading_insert') \              and dob.ln==4                if tracking != 0 -                Seg.new(@md).tail +                SiSU_EPUB_Seg::Seg.new(@md).tail                  segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{Sfx[:epub_xhtml]}"                  output_epub_cont_seg=File.new(segfilename,'w') if @@seg_name_xhtml[tracking-1]                  if dob.is=='heading' \                  or @@seg_name_xhtml[tracking-1] !~/endnotes|book_index|metadata/ -                  SegOutput.new(@md,output_epub_cont_seg,@@seg,@minitoc).output +                  SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc).output                  elsif dob.is=='heading_insert'                    if @@seg_name_xhtml[tracking-1]=='endnotes' -                    SegOutput.new(@md,output_epub_cont_seg,@@seg,@minitoc,'endnotes').output +                    SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'endnotes').output                    elsif @@seg_name_xhtml[tracking-1]=='book_index' -                    SegOutput.new(@md,output_epub_cont_seg,@@seg,@minitoc,'idx').output +                    SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'idx').output                      @@seg[:idx]=[]                    elsif @@seg_name_xhtml[tracking-1]=='metadata' # navigation bug FIX -                    SegOutput.new(@md,output_epub_cont_seg,@@seg,@minitoc,'metadata').output +                    SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'metadata').output                    else puts "#{__FILE__}::#{__LINE__}"                    end                  else puts "#{__FILE__}::#{__LINE__}"                  end -                Seg.new.reinitialise +                SiSU_EPUB_Seg::Seg.new.reinitialise                  heading_art(dob)                  head(dob)                  if @@seg_name_xhtml[tracking]=='sisu_manifest' # this is for manifest, includes navigation bug                    segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{Sfx[:epub_xhtml]}"                    output_epub_cont_seg=File.new(segfilename,'w') -                  SegOutput.new(@md,output_epub_cont_seg,@@seg,@minitoc,'sisu_manifest').output -                  Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX +                  SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'sisu_manifest').output +                  SiSU_EPUB_Seg::Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX                  end                 #@output_epub_cont_seg.close                                         #%(((( EOF )))) -->                end @@ -329,7 +328,7 @@ WOK          txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display }          format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)          @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') -        @@heading1.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') +        @@heading1=@@heading1.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'')        end        if @@is2==1          heading2=@@heading2 @@ -340,7 +339,7 @@ WOK          txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display }          format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)          @@seg[:headings] << format_seg.title_heading2.gsub(clean,'') -        @@heading2.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') +        @@heading2=@@heading2.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'')        end        if @@is3==1          heading3=@@heading3 @@ -351,7 +350,7 @@ WOK          txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display }          format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj)          @@seg[:headings] << format_seg.title_heading3.gsub(clean,'') -        @@heading3.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') +        @@heading3=@@heading3.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'')        end        if @@is4==1          heading4=@@heading4 @@ -413,7 +412,7 @@ WOK            sto.break        end        if @md.flag_separate_endnotes # may need to revisit, check -        dob.obj.gsub!(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">})       #endnote- twice #removed file type +        dob.obj=dob.obj.gsub(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">})       #endnote- twice #removed file type        end        if dob.is =~/heading|para/ \        and (not dob.ocn or dob.ocn.to_s.empty?) @@ -464,7 +463,7 @@ WOK      end      def get_subtoc_endnotes(data) #get endnotes & sub-table of contents subtoc        data.each do |dob| -        dob.obj.gsub!(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1') +        dob.obj=dob.obj.gsub(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1')          if @md.flag_auto_endnotes            if (dob.is=='heading' \            || dob.is=='heading_insert') \ @@ -516,7 +515,7 @@ WOK              if dob.obj=~/#{Mx[:en_b_o]}#{pls}\d+\s.+?#{Mx[:en_b_c]}/m                endnote_array << dob.obj.scan(/#{Mx[:en_b_o]}#{pls}\d+\s.+?#{Mx[:en_b_c]}/m)              end -            endnote_array.flatten! #.compact! #check compacting +            endnote_array=endnote_array.flatten #.compact #check compacting              endnote_array.each do |note|                note_match=note.dup                note_match_seg=note.dup @@ -541,7 +540,7 @@ WOK                note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408                @@seg[:endnote_all] << note_match_all_seg              end -            dob.obj.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') +            dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')            end          end        end diff --git a/lib/sisu/v3dv/epub_tune.rb b/lib/sisu/v3dv/epub_tune.rb index 2f150006..dfb19caf 100644 --- a/lib/sisu/v3dv/epub_tune.rb +++ b/lib/sisu/v3dv/epub_tune.rb @@ -101,98 +101,97 @@ module SiSU_EPUB_Tune          html        else html.obj        end -      str.gsub!(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;') -      str.gsub!(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;') -      str.gsub!(/\*/u,'*')   # * -      str.gsub!(/\+/u,'+')   # + -      str.gsub!(/¢/u,'¢')    # ¢ -      str.gsub!(/£/u,'£')   # £ -      str.gsub!(/¥/u,'¥')     # ¥ -      str.gsub!(/§/u,'§')    # § -      str.gsub!(/©/u,'©')    # © -      str.gsub!(/ª/u,'ª')    # ª -      str.gsub!(/«/u,'«')   # « -      str.gsub!(/®/u,'®')     # ® -      str.gsub!(/°/u,'°')     # ° -      str.gsub!(/±/u,'±')  # ± -      str.gsub!(/²/u,'²')    # ² -      str.gsub!(/³/u,'³')    # ³ -      str.gsub!(/µ/u,'µ')   # µ -      str.gsub!(/¶/u,'¶')    # ¶ -      str.gsub!(/¹/u,'¹')    # ¹ -      str.gsub!(/º/u,'º')    # º -      str.gsub!(/»/u,'»')   # » -      str.gsub!(/¼/u,'¼')  # ¼ -      str.gsub!(/½/u,'½')  # ½ -      str.gsub!(/¾/u,'¾')  # ¾ -      str.gsub!(/×/u,'×')   # × -      str.gsub!(/÷/u,'÷')  # ÷ -      str.gsub!(/¿/u,'¿')  # ¿ -      str.gsub!(/À/u,'À')  # À -      str.gsub!(/Á/u,'Á')  # Á -      str.gsub!(/Â/u,'Â')   #  -      str.gsub!(/Ã/u,'Ã')  # à -      str.gsub!(/Ä/u,'Ä')    # Ä -      str.gsub!(/Å/u,'Å')   # Å -      str.gsub!(/Æ/u,'Æ')   # Æ -      str.gsub!(/Ç/u,'Ç')  # Ç -      str.gsub!(/È/u,'È')  # È -      str.gsub!(/É/u,'É')  # É -      str.gsub!(/Ê/u,'Ê')   # Ê -      str.gsub!(/Ë/u,'Ë')    # Ë -      str.gsub!(/Ì/u,'Ì')  # Ì -      str.gsub!(/Í/u,'Í')  # Í -      str.gsub!(/Î/u,'Î')   # Î -      str.gsub!(/Ï/u,'Ï')    # Ï -      str.gsub!(/Ð/u,'Ð')     # Ð -      str.gsub!(/Ñ/u,'Ñ')  # Ñ -      str.gsub!(/Ò/u,'Ò')  # Ò -      str.gsub!(/Ó/u,'Ó')  # Ó -      str.gsub!(/Ô/u,'Ô')   # Ô -      str.gsub!(/Õ/u,'Õ')  # Õ -      str.gsub!(/Ö/u,'Ö')    # Ö -      str.gsub!(/Ø/u,'Ø')  # Ø -      str.gsub!(/Ù/u,'Ù')  # Ù -      str.gsub!(/Ú/u,'Ú')  # Ú -      str.gsub!(/Û/u,'Û')   # Û -      str.gsub!(/Ü/u,'Ü')    # Ü -      str.gsub!(/Ý/u,'Ý')  # Ý -      str.gsub!(/Þ/u,'Þ')   # Þ -      str.gsub!(/ß/u,'ß')   # ß -      str.gsub!(/à/u,'à')  # à -      str.gsub!(/á/u,'á')  # á -      str.gsub!(/â/u,'â')   # â -      str.gsub!(/ã/u,'ã')  # ã -      str.gsub!(/ä/u,'ä')    # ä -      str.gsub!(/å/u,'å')   # å -      str.gsub!(/æ/u,'æ')   # æ -      str.gsub!(/ç/u,'ç')  # ç -      str.gsub!(/è/u,'è')  # è -      str.gsub!(/é/u,'é')  # é -      str.gsub!(/ê/u,'ê')   # ê -      str.gsub!(/ë/u,'ë')    # ë -      str.gsub!(/ì/u,'ì')  # ì -      str.gsub!(/í/u,'í')  # í -      str.gsub!(/î/u,'î')   # î -      str.gsub!(/ï/u,'ï')    # ï -      str.gsub!(/ð/u,'ð')     # ð -      str.gsub!(/ñ/u,'ñ')  # ñ -      str.gsub!(/ò/u,'ò')  # ò -      str.gsub!(/ó/u,'ó')  # ó -      str.gsub!(/ô/u,'ô')   # ô -      str.gsub!(/õ/u,'õ')  # õ -      str.gsub!(/ö/u,'ö')    # ö -      str.gsub!(/ø/u,'ø')  # ø -      str.gsub!(/ù/u,'ù')  # ú -      str.gsub!(/ú/u,'ú')  # û -      str.gsub!(/û/u,'û')   # ü -      str.gsub!(/ü/u,'ü')    # ý -      str.gsub!(/þ/u,'þ')   # þ -      str.gsub!(/ÿ/u,'ÿ')    # ÿ -      str.gsub!(/ý/u,'ý') -      str.gsub!(/<br>/u,'<br />') -      str.gsub(/#{Mx[:nbsp]}/u,' ') -      str +      str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). +        gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). +        gsub(/\*/u,'*').   # * +        gsub(/\+/u,'+').   # + +        gsub(/¢/u,'¢').    # ¢ +        gsub(/£/u,'£').   # £ +        gsub(/¥/u,'¥').     # ¥ +        gsub(/§/u,'§').    # § +        gsub(/©/u,'©').    # © +        gsub(/ª/u,'ª').    # ª +        gsub(/«/u,'«').   # « +        gsub(/®/u,'®').     # ® +        gsub(/°/u,'°').     # ° +        gsub(/±/u,'±').  # ± +        gsub(/²/u,'²').    # ² +        gsub(/³/u,'³').    # ³ +        gsub(/µ/u,'µ').   # µ +        gsub(/¶/u,'¶').    # ¶ +        gsub(/¹/u,'¹').    # ¹ +        gsub(/º/u,'º').    # º +        gsub(/»/u,'»').   # » +        gsub(/¼/u,'¼').  # ¼ +        gsub(/½/u,'½').  # ½ +        gsub(/¾/u,'¾').  # ¾ +        gsub(/×/u,'×').   # × +        gsub(/÷/u,'÷').  # ÷ +        gsub(/¿/u,'¿').  # ¿ +        gsub(/À/u,'À').  # À +        gsub(/Á/u,'Á').  # Á +        gsub(/Â/u,'Â').   #  +        gsub(/Ã/u,'Ã').  # à +        gsub(/Ä/u,'Ä').    # Ä +        gsub(/Å/u,'Å').   # Å +        gsub(/Æ/u,'Æ').   # Æ +        gsub(/Ç/u,'Ç').  # Ç +        gsub(/È/u,'È').  # È +        gsub(/É/u,'É').  # É +        gsub(/Ê/u,'Ê').   # Ê +        gsub(/Ë/u,'Ë').    # Ë +        gsub(/Ì/u,'Ì').  # Ì +        gsub(/Í/u,'Í').  # Í +        gsub(/Î/u,'Î').   # Î +        gsub(/Ï/u,'Ï').    # Ï +        gsub(/Ð/u,'Ð').     # Ð +        gsub(/Ñ/u,'Ñ').  # Ñ +        gsub(/Ò/u,'Ò').  # Ò +        gsub(/Ó/u,'Ó').  # Ó +        gsub(/Ô/u,'Ô').   # Ô +        gsub(/Õ/u,'Õ').  # Õ +        gsub(/Ö/u,'Ö').    # Ö +        gsub(/Ø/u,'Ø').  # Ø +        gsub(/Ù/u,'Ù').  # Ù +        gsub(/Ú/u,'Ú').  # Ú +        gsub(/Û/u,'Û').   # Û +        gsub(/Ü/u,'Ü').    # Ü +        gsub(/Ý/u,'Ý').  # Ý +        gsub(/Þ/u,'Þ').   # Þ +        gsub(/ß/u,'ß').   # ß +        gsub(/à/u,'à').  # à +        gsub(/á/u,'á').  # á +        gsub(/â/u,'â').   # â +        gsub(/ã/u,'ã').  # ã +        gsub(/ä/u,'ä').    # ä +        gsub(/å/u,'å').   # å +        gsub(/æ/u,'æ').   # æ +        gsub(/ç/u,'ç').  # ç +        gsub(/è/u,'è').  # è +        gsub(/é/u,'é').  # é +        gsub(/ê/u,'ê').   # ê +        gsub(/ë/u,'ë').    # ë +        gsub(/ì/u,'ì').  # ì +        gsub(/í/u,'í').  # í +        gsub(/î/u,'î').   # î +        gsub(/ï/u,'ï').    # ï +        gsub(/ð/u,'ð').     # ð +        gsub(/ñ/u,'ñ').  # ñ +        gsub(/ò/u,'ò').  # ò +        gsub(/ó/u,'ó').  # ó +        gsub(/ô/u,'ô').   # ô +        gsub(/õ/u,'õ').  # õ +        gsub(/ö/u,'ö').    # ö +        gsub(/ø/u,'ø').  # ø +        gsub(/ù/u,'ù').  # ú +        gsub(/ú/u,'ú').  # û +        gsub(/û/u,'û').   # ü +        gsub(/ü/u,'ü').    # ý +        gsub(/þ/u,'þ').   # þ +        gsub(/ÿ/u,'ÿ').    # ÿ +        gsub(/ý/u,'ý'). +        gsub(/<br>/u,'<br />'). +        gsub(/#{Mx[:nbsp]}/u,' ')      end    end    class Tune @@ -208,47 +207,39 @@ module SiSU_EPUB_Tune        begin          @cX=SiSU_Screen::Ansi.new(@md.opt.cmd).cX          SiSU_Screen::Ansi.new(@md.opt.cmd,'Tune').txt_grey if @md.opt.cmd =~/[MVv]/ -        data=Tune.new(@data,@md).amp_html -        data=Tune.new(data,@md).endnotes_html -        data=Tune.new(data,@md).url_markup -        data=Tune.new(data,@md).markup +        data=SiSU_EPUB_Tune::Tune.new(@data,@md).amp_html +        data=SiSU_EPUB_Tune::Tune.new(data,@md).endnotes_html +        data=SiSU_EPUB_Tune::Tune.new(data,@md).url_markup +        data=SiSU_EPUB_Tune::Tune.new(data,@md).markup          if @md.opt.cmd =~/M/  #Hard Output Tune Optional on/off here -          data=Output.new(data,@md).hard_output -          Output.new(data,@md).marshal +          data=SiSU_EPUB_Tune::Output.new(data,@md).hard_output +          SiSU_EPUB_Tune::Output.new(data,@md).marshal          end -        tuned=Tune.new(@data,@md).output +        tuned=SiSU_EPUB_Tune::Tune.new(@data,@md).output        rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error        ensure        end      end -    def para_numbers -      data=@data -      @tuned_file=[] -      data.each do |dob| -        dob.gsub!(/#{Mx[:lv_o]}\d:(\S?)#{Mx[:lv_c]}/,'\0#\1. ') #fix Mx[:lv_o] -        @tuned_file << dob -      end -    end      def markup        @tuned_file=[]        @data.each do |dob| -        dob.obj.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;') -        dob.obj.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') -        dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table' -        dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') -        dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') -        dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') -        dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>') -        dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>') -        dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>') -        dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>') -        dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') -        dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>') # tt, kbd -        dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') -        dob.obj.gsub!(/^#{Mx[:gl_bullet]}/m,'●  ') -        dob.obj.gsub!(/#{Mx[:nbsp]}/,' ') -        dob.obj.gsub!(/<(p|br)>/,'<\1 />') -        dob=SiSU_EPUB_Tune::CleanXHTML.new(dob).clean +        dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). +          gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') +        dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table' +        dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). +          gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). +          gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). +          gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>'). +          gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>'). +          gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>'). +          gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>'). +          gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>'). +          gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd +          gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). +          gsub(/^#{Mx[:gl_bullet]}/m,'●  '). +          gsub(/#{Mx[:nbsp]}/,' '). +          gsub(/<(p|br)>/,'<\1 />') +        dob.obj=SiSU_EPUB_Tune::CleanXHTML.new(dob.obj).clean          @tuned_file << dob        end      end @@ -280,29 +271,32 @@ module SiSU_EPUB_Tune                %{<a href="#{u}"><img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" /></a>#{caption}}              else %{<img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0" />#{caption}}              end -            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins) +            word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)            else              link=m[/(.+)/m]              png=m.scan(/\S+/)[0].strip              link=link.strip -            u.sub!(/^#*/,'') #make neater +            u=u.sub(/^#*/,'') #make neater              if map_nametags[u] \              and map_nametags[u][:segname] -              if u=~/^\d+$/ -                u.gsub!(/^(\d+)$/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#o\\1") if u !~/\// unless http_ -              else -                u.gsub!(/(\S+)/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#\\1") if u !~/\// unless http_ +              u=unless http_ +                u=if u=~/^\d+$/ +                  u.gsub(/^(\d+)$/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#o\\1") if u !~/\// +                else +                  u.gsub(/(\S+)/,"#{map_nametags[u][:segname]}#{Sfx[:xhtml]}#\\1") if u !~/\// +                end +              else u                end              elsif u =~/^:/ -              u.gsub!(/^:/,"#{@env.url.root}/") +              u=u.gsub(/^:/,"#{@env.url.root}/")              elsif u =~/^\.\.\// -              u.gsub!(/^\.\.\//,"#{@env.url.root}/") +              u=u.gsub(/^\.\.\//,"#{@env.url.root}/")              elsif u =~/https?:\/\//              else p "NOT FOUND name_tags: #{u}"              end              ins=%{<a href="#{u}">#{link}</a>} -            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins) -            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins) +            word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins). +              gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)            end            word          else word @@ -317,56 +311,57 @@ module SiSU_EPUB_Tune        data.each do |dob|          unless dob.is=='code'            if dob.obj =~/<::\s+/ #watch -            dob.obj.gsub!(/<::\s+(\S+?)\s+!>/, +            dob.obj=dob.obj.gsub(/<::\s+(\S+?)\s+!>/,                %{<img src="#{@env.url.images_epub}/c_\\1.png" alt="\\1" width="14" height="14" align="bottom" border="0" />})            end            if dob.obj =~/<:image\s+/ -            dob.obj.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+>/, -              %{<a href="\\1"><img src="#{@env.url.images_epub}/\\2" \\3 \\4 naturalsizeflag="0" align="bottom" border="0" /></a>}) -            dob.obj.gsub!(/<:image\s+(http\S+)\s+(\S+)\s+>/, -              %{<a href="\\1"><img src="#{@env.url.images_epub}/\\2" naturalsizeflag="0" align="bottom" border="0" /></a>}) -            dob.obj.gsub!(/<:image\s+(\S+)\s+(\S+)\s+(\S+)\s+>/, -              %{<img src="#{@env.url.images_epub}/\\1" \\2 \\3 naturalsizeflag="0" align="bottom" border="0" />}) -            dob.obj.gsub!(/<:image\s+(\S+)\s+>/, -              %{<img src="#{@env.url.images_epub}/\\1" naturalsizeflag="0" align="bottom" border="0" />}) +            dob.obj=dob.obj.gsub(/<:image\s+(http\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+>/, +                %{<a href="\\1"><img src="#{@env.url.images_epub}/\\2" \\3 \\4 naturalsizeflag="0" align="bottom" border="0" /></a>}). +              gsub(/<:image\s+(http\S+)\s+(\S+)\s+>/, +                %{<a href="\\1"><img src="#{@env.url.images_epub}/\\2" naturalsizeflag="0" align="bottom" border="0" /></a>}). +              gsub(/<:image\s+(\S+)\s+(\S+)\s+(\S+)\s+>/, +                %{<img src="#{@env.url.images_epub}/\\1" \\2 \\3 naturalsizeflag="0" align="bottom" border="0" />}). +              gsub(/<:image\s+(\S+)\s+>/, +                %{<img src="#{@env.url.images_epub}/\\1" naturalsizeflag="0" align="bottom" border="0" />})            end            if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/              @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)[()\[\]]*[,.;:!?'"]{0,2}|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu)              words=urls(@word_mode) -            dob.obj.gsub!(/.+/m,words) +            dob.obj=dob.obj.gsub(/.+/m,words)            end -          dob.obj.gsub!(/\\copyright/i,%{<sup>©</sup>}) -          if (dob.obj !~/\<:ad\s+\.\.\//) -            dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/, +          dob.obj=dob.obj.gsub(/\\copyright/i,%{<sup>©</sup>}) +          dob.obj=if (dob.obj !~/\<:ad\s+\.\.\//) +            dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/,                %{\n<center><a href="http:\/\/\\1" target="external"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n})            else -            dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/, +            dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/,                %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_epub}/\\2" alt="\\3" /></a></center>\n})            end -          dob.obj.gsub!(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_choice}" alt="stellar" />}) -          dob.obj.gsub!(/!new/,%{ <img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />}) -          dob.obj.gsub!(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>') -          dob.obj.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> ') -          dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #http ftp matches escaped, no decoration -          dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}) -          dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration +          dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_choice}" alt="stellar" />}). +            gsub(/!new/,%{ <img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />}). +            gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>'). +            gsub(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> '). +            gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration +            gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}). +            gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration            if dob.obj =~/..\/\S+/ \            and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ -            dob.obj.gsub!(/(\.\.\/\S+)/,'<a href="\1">\1</a>') +            dob.obj=dob.obj.gsub(/(\.\.\/\S+)/,'<a href="\1">\1</a>')            end -          dob.obj.gsub!(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/}) +          dob.obj=dob.obj.gsub(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/})          else -          dob.obj.gsub!(/</m,'<'); dob.obj.gsub!(/>/m,'>') +          dob.obj=dob.obj.gsub(/</m,'<').gsub(/>/m,'>')          end          @tuned_file << dob        end      end      def amp_html -      data=@data +      data,data_new=@data,[]        data.each do |dob| -        dob.obj.gsub!(/&/u,'&') +        dob.obj=dob.obj.gsub(/&/u,'&') +        data_new << dob        end -      data +      data_new      end      def endnotes_html        data=@data @@ -375,23 +370,23 @@ module SiSU_EPUB_Tune        ast,pls='*','+'        data.each do |dob|          unless dob.is =~/^code/ -          dob.obj.gsub!(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/, -            %{#{Mx[:nbsp]}<a href="#note\\2">#{Mx[:nbsp]}<sup id="note_ref\\2">\\2</sup>#{Mx[:nbsp]}</a> } +  #note- endnote- -            %{\\1\\2 <a href="#note_ref\\2">#{Mx[:nbsp]}<sup id="note\\2">\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched) -          dob.obj.gsub!(/(#{Mx[:en_b_o]})[*](\d+)\s+(.+?)(#{Mx[:en_b_c]})/, -            %{#{Mx[:nbsp]}<a href="#note_astx\\2">#{Mx[:nbsp]}<sup id="note_ref_astx\\2">#{ast}\\2</sup>#{Mx[:nbsp]}</a> } +  #note- endnote- -            %{\\1#{ast}\\2 <a href="#note_ref_astx\\2">#{Mx[:nbsp]}<sup id="note_astx\\2">#{ast}\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched) -          dob.obj.gsub!(/(#{Mx[:en_b_o]})[+](\d+)\s+(.+?)(#{Mx[:en_b_c]})/, -            %{#{Mx[:nbsp]}<a href="#note_plus\\2">#{Mx[:nbsp]}<sup id="note_ref_plus\\2">#{pls}\\2</sup>#{Mx[:nbsp]}</a> } +  #note- endnote- -            %{\\1#{pls}\\2 <a href="#note_ref_plus\\2">#{Mx[:nbsp]}<sup id="note_plus\\2">#{pls}\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched) # double-check there may here be a bug +          dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/, +              %{#{Mx[:nbsp]}<a href="#note\\2">#{Mx[:nbsp]}<sup id="note_ref\\2">\\2</sup>#{Mx[:nbsp]}</a> } +  #note- endnote- +              %{\\1\\2 <a href="#note_ref\\2">#{Mx[:nbsp]}<sup id="note\\2">\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched) +            gsub(/(#{Mx[:en_b_o]})[*](\d+)\s+(.+?)(#{Mx[:en_b_c]})/, +              %{#{Mx[:nbsp]}<a href="#note_astx\\2">#{Mx[:nbsp]}<sup id="note_ref_astx\\2">#{ast}\\2</sup>#{Mx[:nbsp]}</a> } +  #note- endnote- +              %{\\1#{ast}\\2 <a href="#note_ref_astx\\2">#{Mx[:nbsp]}<sup id="note_astx\\2">#{ast}\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched) +            gsub(/(#{Mx[:en_b_o]})[+](\d+)\s+(.+?)(#{Mx[:en_b_c]})/, +              %{#{Mx[:nbsp]}<a href="#note_plus\\2">#{Mx[:nbsp]}<sup id="note_ref_plus\\2">#{pls}\\2</sup>#{Mx[:nbsp]}</a> } +  #note- endnote- +              %{\\1#{pls}\\2 <a href="#note_ref_plus\\2">#{Mx[:nbsp]}<sup id="note_plus\\2">#{pls}\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched) # double-check there may here be a bug            if dob.obj =~/#{Mx[:en_a_o]}([*+]+)\s+.+?#{Mx[:en_a_c]}/              m=$1.length.to_i -            dob.obj.gsub!(/(#{Mx[:en_a_o]})[*]+\s+(.+?)(#{Mx[:en_a_c]})/, -              %{#{Mx[:nbsp]}<a href="#note#{a*m}">#{Mx[:nbsp]}<sup id="note_ref#{a*m}">#{ast*m}</sup>#{Mx[:nbsp]}</a> } +  #note- endnote- -              %{\\1#{ast*m} <a href="#note_ref#{a*m}">#{Mx[:nbsp]}<sup id="note#{a*m}">#{ast*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched) -            dob.obj.gsub!(/(#{Mx[:en_a_o]})([+]+)\s+(.+?)(#{Mx[:en_a_c]})/, -              %{#{Mx[:nbsp]}<a href="#note#{s*m}">#{Mx[:nbsp]}<sup id="note_ref#{s*m}">#{pls*m}</sup>#{Mx[:nbsp]}</a> } +  #note- endnote- -              %{\\1#{pls*m} <a href="#note_ref#{s*m}">#{Mx[:nbsp]}<sup id="note#{s*m}">#{pls*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched) +            dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]})[*]+\s+(.+?)(#{Mx[:en_a_c]})/, +                %{#{Mx[:nbsp]}<a href="#note#{a*m}">#{Mx[:nbsp]}<sup id="note_ref#{a*m}">#{ast*m}</sup>#{Mx[:nbsp]}</a> } +  #note- endnote- +                %{\\1#{ast*m} <a href="#note_ref#{a*m}">#{Mx[:nbsp]}<sup id="note#{a*m}">#{ast*m}</sup></a> \\2 \\3}). #endnote- note- (careful may have switched) +              gsub(/(#{Mx[:en_a_o]})([+]+)\s+(.+?)(#{Mx[:en_a_c]})/, +                %{#{Mx[:nbsp]}<a href="#note#{s*m}">#{Mx[:nbsp]}<sup id="note_ref#{s*m}">#{pls*m}</sup>#{Mx[:nbsp]}</a> } +  #note- endnote- +                %{\\1#{pls*m} <a href="#note_ref#{s*m}">#{Mx[:nbsp]}<sup id="note#{s*m}">#{pls*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched)            end          end          @tuned_file << dob @@ -401,8 +396,7 @@ module SiSU_EPUB_Tune        data=@data        @tuned_file=[]        data.each do |dob| -        dob.obj.strip! -        dob.obj.chomp! +        dob.obj=dob.obj.strip.chomp          @tuned_file << dob        end        @tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove diff --git a/lib/sisu/v3dv/harvest_authors.rb b/lib/sisu/v3dv/harvest_authors.rb index 3d3c2378..fa6934a5 100644 --- a/lib/sisu/v3dv/harvest_authors.rb +++ b/lib/sisu/v3dv/harvest_authors.rb @@ -139,7 +139,7 @@ module SiSU_Harvest_Authors        else          #p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}"        end -      idx_array[lang].flatten! +      idx_array[lang]=idx_array[lang].flatten        idx_array      end    end @@ -157,7 +157,7 @@ module SiSU_Harvest_Authors          @@the_idx_authors[lang] ||= {}          idx_array.each do |idx|            idx[:author][:last_first_format_a].each do |author| -            author.strip! +            author=author.strip              if @@the_idx_authors[lang][author].class==NilClass                @@the_idx_authors[lang][author]={ md: [] }              end diff --git a/lib/sisu/v3dv/harvest_topics.rb b/lib/sisu/v3dv/harvest_topics.rb index 6bdc7e12..504e0a4d 100644 --- a/lib/sisu/v3dv/harvest_topics.rb +++ b/lib/sisu/v3dv/harvest_topics.rb @@ -144,7 +144,7 @@ module SiSU_Harvest_Topics            g=@idx_list.scan(/[^;]+/)            idxl=[]            g.each do |i| -            i.strip! +            i=i.strip              idxl << { filename: filename, file: file, rough_idx: i, title: @fulltitle, author: creator, page: page, lang: lang  }            end            idxl @@ -153,7 +153,7 @@ module SiSU_Harvest_Topics        else          p "missing required field in #{@filename} - [title]: <<#{@title}>>; [author]: <<#{@author_format}>>; [idx]: <<#{@idx_list}>>" if @opt.cmd.inspect =~/[VM]/        end -      idx_array[lang].flatten! +      idx_array[lang]=idx_array[lang].flatten        idx_array      end    end diff --git a/lib/sisu/v3dv/html.rb b/lib/sisu/v3dv/html.rb index 6306975f..2c249348 100644 --- a/lib/sisu/v3dv/html.rb +++ b/lib/sisu/v3dv/html.rb @@ -239,12 +239,12 @@ module SiSU_HTML              toc=if dob_toc.is =='heading' \              or dob.is=='heading_insert'                toc=case dob_toc.ln -              when 1; Toc.new(@md,dob_toc).level_1 -              when 2; Toc.new(@md,dob_toc).level_2 -              when 3; Toc.new(@md,dob_toc).level_3 -              when 4; Toc.new(@md,dob_toc).level_4 -              when 5; Toc.new(@md,dob_toc).level_5 -              when 6; Toc.new(@md,dob_toc).level_6 +              when 1; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_1 +              when 2; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_2 +              when 3; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_3 +              when 4; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_4 +              when 5; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_5 +              when 6; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_6                else nil                end              end @@ -488,8 +488,8 @@ WOK        end        def level_crosslink          dob=@data -        if dob !~/^4~!/ -          dob.gsub!(/^4~!\s+(\S+)\s+(.+)/, +        dob=if dob !~/^4~!/ +          dob.gsub(/^4~!\s+(\S+)\s+(.+)/,              %{<table><tr><td width =\"80\"></td>    <td><a href="http://\\1" target="_top">      #{@png.crosslink_ext} @@ -498,7 +498,7 @@ WOK    </td></tr></table>  })          else -          dob.gsub!(/^4~!\s+(\S+)\s+(.+)/, +          dob.gsub(/^4~!\s+(\S+)\s+(.+)/,              %{<table><tr><td width ="80">    </td><td>      <a href="\\1" target="_top"> @@ -521,7 +521,7 @@ WOK          SiSU_Screen::Ansi.new(@md.opt.cmd,'Scroll & Segtoc').txt_grey if @md.opt.cmd =~/[MVv]/          format_head_toc=SiSU_HTML_Format::HeadToc.new(@md)          dochead=format_head_toc.head -        dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge +        dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge          ads=SiSU_HTML_Promo::Ad.new(@md)          toc_shared << dochead << ads.div.major          @segtoc << format_head_toc.head << ads.div.major @@ -584,8 +584,8 @@ WOK          @segtoc << @seg_toc_band_bottom          ads=SiSU_HTML_Promo::Ad.new(@md)          @segtoc << format_head_toc.seg_navigation_tail << ads.div.close << ads.display << format_head_toc.html_close -        @segtoc.flatten!.compact! -        Output.new(@segtoc,@md).segtoc +        @segtoc=@segtoc.flatten.compact #watch +        SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc          @segtoc=[]          @toc[:scr],@toc[:seg]=[],[]          toc_shared @@ -603,7 +603,7 @@ WOK          scroll=[]          hr='<center><hr width=90% /></center>'          scroll << @scr_toc << '<div class="scroll">' << hr << @scr_body << @scr_endnotes << hr << @scr_owner_details << '</div>' << @scr_tails -        scroll.flatten!.compact! +        scroll=scroll.flatten.compact #watch        end      end      class Seg < SiSU_HTML_Seg::Seg @@ -617,12 +617,12 @@ WOK          begin            @filename_html_scroll=@file.write_file.html_scroll            @data.each do |para| -            para.strip! -            para.gsub!(/<:.+?>/,'') -            para.gsub!(Xx[:html_relative2],@file.path_rel_links.html_scroll_2) -            para.gsub!(Xx[:html_relative1],@file.path_rel_links.html_scroll_1) -            #para.gsub!(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll) -            para.gsub!(/#{Rx[:mx_fa_clean]}/,'') +            para=para.strip. +              gsub(/<:.+?>/,''). +              gsub(Xx[:html_relative2],@file.path_rel_links.html_scroll_2). +              gsub(Xx[:html_relative1],@file.path_rel_links.html_scroll_1). +             #gsub(/#{Xx[:html_relative]}/,@file.path_rel_links.html_scroll). +              gsub(/#{Rx[:mx_fa_clean]}/,'')              unless para =~/\A\s*\Z/                @filename_html_scroll.puts para,"\n"              end @@ -635,10 +635,10 @@ WOK          begin            @filename_html_segtoc=@file.write_file.html_segtoc            @data.each do |para| -            para.strip! -            para.gsub!(/<!.+?!>/,'') -            para.gsub!(Xx[:html_relative2],@file.path_rel_links.html_seg_2) -            para.gsub!(Xx[:html_relative1],@file.path_rel_links.html_seg_1) +            para=para.strip. +              gsub(/<!.+?!>/,''). +              gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2). +              gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1)              unless para =~/\A\s*\Z/                @filename_html_segtoc.puts para,"\n"              end diff --git a/lib/sisu/v3dv/html_format.rb b/lib/sisu/v3dv/html_format.rb index 4267a2da..fdf7f568 100644 --- a/lib/sisu/v3dv/html_format.rb +++ b/lib/sisu/v3dv/html_format.rb @@ -75,14 +75,14 @@ module SiSU_HTML_Format        or @skin_no_ocn          ocn_class='ocn_off'          @ocn.gsub(/^(\d+|)$/, -        %{<label class="#{ocn_class}"> </label>}) +          %{<label class="#{ocn_class}"> </label>})        elsif @ocn.to_i==0          @ocn.gsub(/^(\d+|)$/, -        %{<label class="#{ocn_class}"><a name="#{@ocn}"> </a></label>}) +          %{<label class="#{ocn_class}"><a name="#{@ocn}"> </a></label>})        else          ocn_class='ocn'          @ocn.gsub(/^(\d+|)$/, -        %{<label class="#{ocn_class}"><a name="#{@ocn}" href="##{@ocn}" class="lnk#{ocn_class}">\\1</a></label>}) +          %{<label class="#{ocn_class}"><a name="#{@ocn}" href="##{@ocn}" class="lnk#{ocn_class}">\\1</a></label>})        end      end      def name @@ -112,7 +112,7 @@ module SiSU_HTML_Format      end      def doc_types #used in toc & seg_nav_band        scroll=seg='' -      wgt=Widget.new(@md) +      wgt=SiSU_HTML_Format::Widget.new(@md)        %{  <table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0">  <tr> @@ -350,7 +350,7 @@ WOK        end      end      def make_seg_scroll_pdf -      wgt=Widget.new(@md) +      wgt=SiSU_HTML_Format::Widget.new(@md)        scroll=%{<td align="center" bgcolor=#{@vz.color_band2}>    #{@vz.nav_txt_doc_link}  </td> @@ -363,7 +363,7 @@ WOK      end      def make_scroll_seg_pdf        manifest=scroll=seg='' -      wgt=Widget.new(@md) +      wgt=SiSU_HTML_Format::Widget.new(@md)        seg=%{<td align="center" bgcolor=#{@vz.color_band2}>    #{@vz.nav_txt_toc_link}  </td> @@ -377,7 +377,7 @@ WOK      end      def make_concordance        manifest=scroll=seg='' -      wgt=Widget.new(@md) +      wgt=SiSU_HTML_Format::Widget.new(@md)        %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0">  <tr>  <td align="center" bgcolor=#{@vz.color_band2}> @@ -653,7 +653,7 @@ WOK          @file=SiSU_Env::FileOp.new(@md) if @md          if @file.output_dir_structure.by_language_code? \          or @file.output_dir_structure.by_filetype? -          nxt.gsub!(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}") +          nxt=nxt.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}")          end        end        %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> @@ -715,7 +715,7 @@ WOK          @file=SiSU_Env::FileOp.new(@md) if @md          if @file.output_dir_structure.by_language_code? \          or @file.output_dir_structure.by_filetype? -          nxt.gsub!(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}") +          nxt=nxt.gsub(/sisu_manifest\.html/,"../../manifest/#{@file.base_filename.manifest}")          end        end        %{<table summary="segment navigation pre/next" border="0" cellpadding="3" cellspacing="0"> @@ -974,7 +974,7 @@ WOK        end        @headnamed= (@headname ? %{<a name="h#{@headname}" id="h#{@headname}"></a>} : nil)        if @txt and not @txt.empty? -        @txt.gsub!(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') +        @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'')        end        @p_num=ParagraphNumber.new(@md,@ocn)        @vz=SiSU_Env::GetInit.instance.skin @@ -1081,8 +1081,8 @@ WOK        para_form_css('p','norm')      end      def break -      @txt.gsub!(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />') -      @txt.gsub!(/#{Mx[:br_obj]}/,'<hr style="width:30%" /><br />') +      @txt=@txt.gsub(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />'). +        gsub(/#{Mx[:br_obj]}/,'<hr style="width:30%" /><br />')        para_form_css('p','norm')      end      def format(tag,attrib) @@ -1141,7 +1141,7 @@ WOK        ''      end      def seg_heading_sub(tag,attrib) -      @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') +      @txt=@txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')        %{  <div class="substance">    #{@p_num.ocn_display} @@ -1176,15 +1176,16 @@ WOK    </div>'      end      def gsub_body #fix -      case @txt +      @txt=case @txt        when /^\((i+|iv|v|vi+|ix|x|xi+)\)/ -        @txt.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>') +        @txt.gsub(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>')        when /^\(?(\d|[a-z])+\)/ -        @txt.gsub!(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>') +        @txt.gsub(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>')        when /^\s*\d{1,3}\.\s/ -        @txt.gsub!(/^\s*(\d+\.)/,'<b>\1</b>') +        @txt.gsub(/^\s*(\d+\.)/,'<b>\1</b>')        when /^\s*[A-Z]\.\s/ -        @txt.gsub!(/^\s*([A-Z]\.)/,'<b>\1</b>') +        @txt.gsub(/^\s*([A-Z]\.)/,'<b>\1</b>') +      else @txt        end      end      def bold_para @@ -1197,8 +1198,8 @@ WOK  #{@vz.table_close}}      end      def bold_heading -      @txt.gsub!(/[1-9]~(\S+)/,'<a name="\1"></a>') -      @txt.gsub!(/[1-9]~/,'') +      @txt=@txt.gsub(/[1-9]~(\S+)/,'<a name="\1"></a>'). +        gsub(/[1-9]~/,'')        %{<p class="bold">      #{@txt}    </p> @@ -1286,8 +1287,8 @@ WOK  }      end      def clean(txt) -      txt.gsub!(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'') -      txt.gsub!(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') +      txt=txt.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,''). +        gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'')        txt      end      def subtoc_lev(tag,attrib) @@ -1300,9 +1301,9 @@ WOK        note=''        if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end          note=$1 -        note.gsub!(/[\n\s]+/m,' ') -        txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') -        txt.gsub!(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+"> <sup>\d+<\/sup> /m,'') +        note=note.gsub(/[\n\s]+/m,' ') +        txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' '). +          gsub(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+"> <sup>\d+<\/sup> /m,'')        end        %{<#{tag} class="#{attrib}">      <a href="##{@ocn}"><i>#{txt}</i></a> #{note} @@ -1315,7 +1316,7 @@ WOK        subtoc_lev('h6','subtoc') if @txt      end      def heading_sub(tag,attrib) -      @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') +      @txt=@txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')        %{  <div class="substance">    #{@p_num.ocn_display} @@ -1407,7 +1408,7 @@ WOK        lev('h0','toc')      end      def strip_endnotes(txt) -      txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') +      txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')        txt      end      def mini_lev1 diff --git a/lib/sisu/v3dv/html_minitoc.rb b/lib/sisu/v3dv/html_minitoc.rb index 7f891a2e..d70fa7e1 100644 --- a/lib/sisu/v3dv/html_minitoc.rb +++ b/lib/sisu/v3dv/html_minitoc.rb @@ -75,17 +75,17 @@          @toc=[]          @data.each do |txt|            if (txt.is =='heading' or txt.is =='heading_insert') -            txt.obj.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,'') #remove endnotes from toc -            txt.obj.gsub!(/<a name="-\d+" href="#_\d+"> <sup>\d+<\/sup> <\/a>/,'') -            txt.obj.gsub!(@pat_strip_heading_name,'\1') -            txt.obj.gsub(/(.*?)<a name="(\d+)"><\/a>(.*)/,'\1') #2002w42 altered gsub! - problematic? - suspect +            txt.obj=txt.obj.gsub(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,''). #remove endnotes from toc +              gsub(/<a name="-\d+" href="#_\d+"> <sup>\d+<\/sup> <\/a>/,''). +              gsub(@pat_strip_heading_name,'\1') +              #gsub(/(.*?)<a name="(\d+)"><\/a>(.*)/,'\1') #2002w42 altered gsub - problematic? - suspect              toc=case txt.ln -            when 1; TocMini.new(@md,txt).level_1 -            when 2; TocMini.new(@md,txt).level_2 -            when 3; TocMini.new(@md,txt).level_3 -            when 4; TocMini.new(@md,txt).level_4 -            when 5; TocMini.new(@md,txt).level_5 -            when 6; TocMini.new(@md,txt).level_6 +            when 1; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_1 +            when 2; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_2 +            when 3; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_3 +            when 4; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_4 +            when 5; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_5 +            when 6; SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_6              else              end              @toc << toc @@ -110,7 +110,7 @@          txt=@data          if (txt.is =='heading' or txt.is =='heading_insert') \          and txt.ocn !=0 -          txt.obj.gsub!(@pat_strip_heading_name,'\1') +          txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')          end          title=unless txt.obj =~/Document Information/; txt.obj          else @@ -130,7 +130,7 @@          txt=@data          if (txt.is =='heading' or txt.is =='heading_insert') \          and txt.ocn !=0 -          txt.obj.gsub!(@pat_strip_heading_name,'\1') +          txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')          end          txt_obj={ txt: txt.obj }          format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) @@ -167,7 +167,7 @@          txt=@data          if (txt.is =='heading' or txt.is =='heading_insert') \          and txt.ocn !=0 -          txt.obj.gsub!(@pat_strip_heading_name,'\1') +          txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')          end          toc={}            lnk_n_txt=%{  <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}"> @@ -182,7 +182,7 @@          txt=@data          if (txt.is =='heading' or txt.is =='heading_insert') \          and txt.ocn !=0 -          txt.obj.gsub!(@pat_strip_heading_name,'\1') +          txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')          end          toc={}            lnk_n_txt=%{  <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}"> diff --git a/lib/sisu/v3dv/html_scroll.rb b/lib/sisu/v3dv/html_scroll.rb index ac57b585..89f88b04 100644 --- a/lib/sisu/v3dv/html_scroll.rb +++ b/lib/sisu/v3dv/html_scroll.rb @@ -68,8 +68,8 @@ module SiSU_HTML_Scroll      end      def songsheet        begin -        scr=Scroll.new(@md,@data,@endnotes).markup -        scr[:tails]=Scroll.new(@md).tails +        scr=SiSU_HTML_Scroll::Scroll.new(@md,@data,@endnotes).markup +        scr[:tails]=SiSU_HTML_Scroll::Scroll.new(@md).tails          scr        rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error        ensure @@ -81,14 +81,14 @@ module SiSU_HTML_Scroll        @rcdc=false        @scr={ body: [], metadata: [], owner_details: [] }        data.each do |dob| -        dob.obj.gsub!(/#{@md.file.output_path.html_seg.rel_image}/m,@md.file.output_path.html_scroll.rel_image) +        dob.obj=dob.obj.gsub(/#{@md.file.output_path.html_seg.rel_image}/m,@md.file.output_path.html_scroll.rel_image)          if defined? dob.name and dob.name =~/^meta/ \          and dob.obj =~/Document Information/ -          dob.obj.gsub!(/(Document Information(?: \(metadata\))?)/,'\1<a name="docinfo"></a>') +          dob.obj=dob.obj.gsub(/(Document Information(?: \(metadata\))?)/,'\1<a name="docinfo"></a>')          end          if dob.obj =~/^Metadata$/ \          and dob.lv =='B' -          dob.obj.gsub!(/Metadata/,'') +          dob.obj=dob.obj.gsub(/Metadata/,'')          end          if defined? dob.name \          and dob.name =~/^metadata/ \ @@ -96,11 +96,11 @@ module SiSU_HTML_Scroll          and dob.obj =~/SiSU Metadata, document information/            @rcdc=true          end -        dob.obj.gsub!(/href="[a-z0-9._-]+(#\S+?")/m,'href="\1') # internal document links -        dob.obj.gsub!(/href="#{Xx[:segment]}/m,'href="') -        dob.obj.gsub!(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'<p><hr width=90% /></p>') +        dob.obj=dob.obj.gsub(/href="[a-z0-9._-]+(#\S+?")/m,'href="\1'). # internal document links +          gsub(/href="#{Xx[:segment]}/m,'href="'). +          gsub(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'<p><hr width=90% /></p>')          if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]})/ -          unless dob.is =~/^code/; dob.obj.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') +          unless dob.is =~/^code/; dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')            end            if defined? dob.ocn              @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,dob.ocn) @@ -139,7 +139,7 @@ module SiSU_HTML_Scroll                sto.heading_body4                book_idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_html(@md.opt).html_idx                book_idx.each do |x| #takes book index prepared for segments and strips segment identifying info -                x.gsub!(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/,'<a href="#\1">\2</a>') +                x=x.gsub(/<a href="\S+?\.html#(\d+)">(\1(?:-\d+)?)<\/a>/,'<a href="#\1">\2</a>')                end                book_idx.join("\n")              #elsif dob.ln==4 \ diff --git a/lib/sisu/v3dv/html_segments.rb b/lib/sisu/v3dv/html_segments.rb index 75c9b90f..ba825ae4 100644 --- a/lib/sisu/v3dv/html_segments.rb +++ b/lib/sisu/v3dv/html_segments.rb @@ -61,7 +61,7 @@ module SiSU_HTML_Seg    require_relative 'html'                               # html.rb    require_relative 'html_promo'                         # html_promo.rb    require_relative 'shared_metadata'                    # shared_metadata.rb -  class SegOutput +  class Output      def initialize(md,outputfile,seg,minitoc,type='')        @md,@output_seg_file,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type        @title_banner_=SiSU_Env::CreateSite.new(@md.opt.cmd).html_seg_title_banner? @@ -106,12 +106,12 @@ module SiSU_HTML_Seg            filename_seg << @minitoc << @seg[:headings] << @seg[:main] << "\n</div>\n"          end          filename_seg << @seg[:tail] << @seg[:tocband_bannerless] << @seg[:credits] -        filename_seg.flatten!.compact! +        filename_seg=filename_seg.flatten.compact #watch          filename_seg.each do |str|            unless str =~/\A\s*\Z/ -            str.strip! -            str.gsub!(Xx[:html_relative2],@file.path_rel_links.html_seg_2) -            str.gsub!(Xx[:html_relative1],@file.path_rel_links.html_seg_1) +            str=str.strip. +              gsub(Xx[:html_relative2],@file.path_rel_links.html_seg_2). +              gsub(Xx[:html_relative1],@file.path_rel_links.html_seg_1)              @output_seg_file << str            end          end @@ -147,7 +147,7 @@ module SiSU_HTML_Seg          @minitoc=SiSU_HTML::Source::Toc.new(@md,@data).minitoc          data=get_subtoc_endnotes(@data)          data=articles(data) -        Seg.new.cleanup # (((( added )))) +        SiSU_HTML_Seg::Seg.new.cleanup # (((( added ))))          #### (((( END )))) ####        rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error        ensure @@ -234,7 +234,7 @@ module SiSU_HTML_Seg                  unless FileTest.directory?(@file.output_path.html_seg.dir)                    FileUtils::mkdir_p(@file.output_path.html_seg.dir) if File.writable?("#{@file.output_path.base.dir}/.")                  end -                Seg.new(@md).tail +                SiSU_HTML_Seg::Seg.new(@md).tail                  segfilename="#{@file.output_path.html_seg.dir}/#{@@seg_name_html[tracking-1]}#{@md.lang_code_insert}#{Sfx[:html]}"                  output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1]                  minitoc=(@env.html_minitoc?) \ @@ -242,27 +242,27 @@ module SiSU_HTML_Seg                  : ''                  if dob.is=='heading' \                  or @@seg_name_html[tracking-1] !~/endnotes|book_index|metadata/ -                  SegOutput.new(@md,output_seg_file,@@seg,minitoc).output +                  SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc).output                  elsif dob.is=='heading_insert'                    if @@seg_name_html[tracking-1]=='endnotes' -                    SegOutput.new(@md,output_seg_file,@@seg,minitoc,'endnotes').output +                    SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'endnotes').output                    elsif @@seg_name_html[tracking-1]=='book_index' -                    SegOutput.new(@md,output_seg_file,@@seg,minitoc,'idx').output +                    SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'idx').output                      @@seg[:idx]=[]                    elsif @@seg_name_html[tracking-1]=='metadata' -                    SegOutput.new(@md,output_seg_file,@@seg,minitoc,'metadata').output +                    SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'metadata').output                    else puts "#{__FILE__}::#{__LINE__}"                    end                  else puts "#{__FILE__}::#{__LINE__}"                  end -                Seg.new.reinitialise +                SiSU_HTML_Seg::Seg.new.reinitialise                  heading_art(dob)                  head(dob)                 #keep use for last segment, eg if metadata is last segment                 #if @@seg_name_html[tracking] =~/metadata/ # this is for metadata                 #  segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking]}#{@md.fnl[:mid]}#{Sfx[:html]}#{@md.fnl[:post]}"                 #  output_seg_file=File.new(segfilename,'w') -               #  SegOutput.new(@md,output_seg_file,@@seg,minitoc,'metadata').output +               #  SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'metadata').output                 #  Seg.new.reinitialise                 #end                end @@ -331,7 +331,7 @@ module SiSU_HTML_Seg          txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display }          format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)          @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') -        @@heading1.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') +        @@heading1=@@heading1.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'')        end        if @@is2==1          heading2=@@heading2 @@ -342,7 +342,7 @@ module SiSU_HTML_Seg          txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display }          format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)          @@seg[:headings] << format_seg.title_heading2.gsub(clean,'') -        @@heading2.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') +        @@heading2=@@heading2.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'')        end        if @@is3==1          heading3=@@heading3 @@ -353,7 +353,7 @@ module SiSU_HTML_Seg          txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display }          format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj)          @@seg[:headings] << format_seg.title_heading3.gsub(clean,'') -        @@heading3.gsub!(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'') +        @@heading3=@@heading3.gsub(/ <a name="-[\d*+]+" href="#_[\d*+]+"> <sup>[\d*+]+<\/sup> <\/a>/,'')        end        if @@is4==1          heading4=@@heading4 @@ -421,13 +421,13 @@ module SiSU_HTML_Seg            sto.break          end          if @md.flag_separate_endnotes -          dob.obj.gsub!(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">})       #endnote- twice #removed file type +          dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">})       #endnote- twice #removed file type          end          if dob.obj !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/            if dob.is =~/heading|para/ and (not dob.ocn or dob.ocn.to_s.empty?)              format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob)            end -          dob.obj.gsub!(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'')                   #potentially dagerous - removes all paragraphs with <!e_!> #?? workpoint +          dob.obj=dob.obj.gsub(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'')                   #potentially dagerous - removes all paragraphs with <!e_!> #?? workpoint            if dob.obj =~/<a name="_\d+" href="#-\d+"> <sup>/                #endnote- note-              format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob)              dob=format_seg.no_paranum @@ -471,7 +471,7 @@ module SiSU_HTML_Seg      end      def get_subtoc_endnotes(data) #get endnotes & sub-table of contents subtoc        data.each do |dob| -        dob.obj.gsub!(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1') +        dob.obj=dob.obj.gsub(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1')          if @md.flag_auto_endnotes            if (dob.is=='heading' or dob.is=='heading_insert') \            and dob.ln.to_s =~/^[1234]/ \ @@ -523,7 +523,7 @@ module SiSU_HTML_Seg              if dob.obj=~/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m                endnote_array << dob.obj.scan(/#{Mx[:en_b_o]}[+]\d+\s.+?#{Mx[:en_b_c]}/m)              end -            endnote_array.flatten!.compact! #check compacting +            endnote_array=endnote_array.flatten.compact #watch, check compacting              endnote_array.each do |note|                note_match=note.dup                note_match_seg=note.dup @@ -548,7 +548,7 @@ module SiSU_HTML_Seg                note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408                @@seg[:endnote_all] << note_match_all_seg              end -            dob.obj.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') +            dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')            end          end        end diff --git a/lib/sisu/v3dv/html_tune.rb b/lib/sisu/v3dv/html_tune.rb index 0161d5df..fab17b78 100644 --- a/lib/sisu/v3dv/html_tune.rb +++ b/lib/sisu/v3dv/html_tune.rb @@ -84,7 +84,7 @@ module SiSU_HTML_Tune        data=[]        @data.each do |x|          unless x.obj.empty? -          x.obj.strip! +          x.obj=x.obj.strip            data << x          end        end @@ -106,94 +106,93 @@ module SiSU_HTML_Tune          html        else html.obj        end -      str.gsub!(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;') -      str.gsub!(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;') -      str.gsub!(/¢/u,'¢')    # ¢ -      str.gsub!(/£/u,'£')   # £ -      str.gsub!(/¥/u,'¥')     # ¥ -      str.gsub!(/§/u,'§')    # § -      str.gsub!(/©/u,'©')    # © -      str.gsub!(/ª/u,'ª')    # ª -      str.gsub!(/«/u,'«')   # « -      str.gsub!(/®/u,'®')     # ® -      str.gsub!(/°/u,'°')     # ° -      str.gsub!(/±/u,'±')  # ± -      str.gsub!(/²/u,'²')    # ² -      str.gsub!(/³/u,'³')    # ³ -      str.gsub!(/µ/u,'µ')   # µ -      str.gsub!(/¶/u,'¶')    # ¶ -      str.gsub!(/¹/u,'¹')    # ¹ -      str.gsub!(/º/u,'º')    # º -      str.gsub!(/»/u,'»')   # » -      str.gsub!(/¼/u,'¼')  # ¼ -      str.gsub!(/½/u,'½')  # ½ -      str.gsub!(/¾/u,'¾')  # ¾ -      str.gsub!(/×/u,'×')   # × -      str.gsub!(/÷/u,'÷')  # ÷ -      str.gsub!(/¿/u,'¿')  # ¿ -      str.gsub!(/À/u,'À')  # À -      str.gsub!(/Á/u,'Á')  # Á -      str.gsub!(/Â/u,'Â')   #  -      str.gsub!(/Ã/u,'Ã')  # à -      str.gsub!(/Ä/u,'Ä')    # Ä -      str.gsub!(/Å/u,'Å')   # Å -      str.gsub!(/Æ/u,'Æ')   # Æ -      str.gsub!(/Ç/u,'Ç')  # Ç -      str.gsub!(/È/u,'È')  # È -      str.gsub!(/É/u,'É')  # É -      str.gsub!(/Ê/u,'Ê')   # Ê -      str.gsub!(/Ë/u,'Ë')    # Ë -      str.gsub!(/Ì/u,'Ì')  # Ì -      str.gsub!(/Í/u,'Í')  # Í -      str.gsub!(/Î/u,'Î')   # Î -      str.gsub!(/Ï/u,'Ï')    # Ï -      str.gsub!(/Ð/u,'Ð')     # Ð -      str.gsub!(/Ñ/u,'Ñ')  # Ñ -      str.gsub!(/Ò/u,'Ò')  # Ò -      str.gsub!(/Ó/u,'Ó')  # Ó -      str.gsub!(/Ô/u,'Ô')   # Ô -      str.gsub!(/Õ/u,'Õ')  # Õ -      str.gsub!(/Ö/u,'Ö')    # Ö -      str.gsub!(/Ø/u,'Ø')  # Ø -      str.gsub!(/Ù/u,'Ù')  # Ù -      str.gsub!(/Ú/u,'Ú')  # Ú -      str.gsub!(/Û/u,'Û')   # Û -      str.gsub!(/Ü/u,'Ü')    # Ü -      str.gsub!(/Ý/u,'Ý')  # Ý -      str.gsub!(/Þ/u,'Þ')   # Þ -      str.gsub!(/ß/u,'ß')   # ß -      str.gsub!(/à/u,'à')  # à -      str.gsub!(/á/u,'á')  # á -      str.gsub!(/â/u,'â')   # â -      str.gsub!(/ã/u,'ã')  # ã -      str.gsub!(/ä/u,'ä')    # ä -      str.gsub!(/å/u,'å')   # å -      str.gsub!(/æ/u,'æ')   # æ -      str.gsub!(/ç/u,'ç')  # ç -      str.gsub!(/è/u,'è')  # è -      str.gsub!(/é/u,'é')  # é -      str.gsub!(/ê/u,'ê')   # ê -      str.gsub!(/ë/u,'ë')    # ë -      str.gsub!(/ì/u,'ì')  # ì -      str.gsub!(/í/u,'í')  # í -      str.gsub!(/î/u,'î')   # î -      str.gsub!(/ï/u,'ï')    # ï -      str.gsub!(/ð/u,'ð')     # ð -      str.gsub!(/ñ/u,'ñ')  # ñ -      str.gsub!(/ò/u,'ò')  # ò -      str.gsub!(/ó/u,'ó')  # ó -      str.gsub!(/ô/u,'ô')   # ô -      str.gsub!(/õ/u,'õ')  # õ -      str.gsub!(/ö/u,'ö')    # ö -      str.gsub!(/ø/u,'ø')  # ø -      str.gsub!(/ù/u,'ù')  # ú -      str.gsub!(/ú/u,'ú')  # û -      str.gsub!(/û/u,'û')   # ü -      str.gsub!(/ü/u,'ü')    # ý -      str.gsub!(/þ/u,'þ')   # þ -      str.gsub!(/ÿ/u,'ÿ')    # ÿ -      str.gsub!(/ý/u,'ý') -      str +      str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). +        gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). +        gsub(/¢/u,'¢').    # ¢ +        gsub(/£/u,'£').   # £ +        gsub(/¥/u,'¥').     # ¥ +        gsub(/§/u,'§').    # § +        gsub(/©/u,'©').    # © +        gsub(/ª/u,'ª').    # ª +        gsub(/«/u,'«').   # « +        gsub(/®/u,'®').     # ® +        gsub(/°/u,'°').     # ° +        gsub(/±/u,'±').  # ± +        gsub(/²/u,'²').    # ² +        gsub(/³/u,'³').    # ³ +        gsub(/µ/u,'µ').   # µ +        gsub(/¶/u,'¶').    # ¶ +        gsub(/¹/u,'¹').    # ¹ +        gsub(/º/u,'º').    # º +        gsub(/»/u,'»').   # » +        gsub(/¼/u,'¼').  # ¼ +        gsub(/½/u,'½').  # ½ +        gsub(/¾/u,'¾').  # ¾ +        gsub(/×/u,'×').   # × +        gsub(/÷/u,'÷').  # ÷ +        gsub(/¿/u,'¿').  # ¿ +        gsub(/À/u,'À').  # À +        gsub(/Á/u,'Á').  # Á +        gsub(/Â/u,'Â').   #  +        gsub(/Ã/u,'Ã').  # à +        gsub(/Ä/u,'Ä').    # Ä +        gsub(/Å/u,'Å').   # Å +        gsub(/Æ/u,'Æ').   # Æ +        gsub(/Ç/u,'Ç').  # Ç +        gsub(/È/u,'È').  # È +        gsub(/É/u,'É').  # É +        gsub(/Ê/u,'Ê').   # Ê +        gsub(/Ë/u,'Ë').    # Ë +        gsub(/Ì/u,'Ì').  # Ì +        gsub(/Í/u,'Í').  # Í +        gsub(/Î/u,'Î').   # Î +        gsub(/Ï/u,'Ï').    # Ï +        gsub(/Ð/u,'Ð').     # Ð +        gsub(/Ñ/u,'Ñ').  # Ñ +        gsub(/Ò/u,'Ò').  # Ò +        gsub(/Ó/u,'Ó').  # Ó +        gsub(/Ô/u,'Ô').   # Ô +        gsub(/Õ/u,'Õ').  # Õ +        gsub(/Ö/u,'Ö').    # Ö +        gsub(/Ø/u,'Ø').  # Ø +        gsub(/Ù/u,'Ù').  # Ù +        gsub(/Ú/u,'Ú').  # Ú +        gsub(/Û/u,'Û').   # Û +        gsub(/Ü/u,'Ü').    # Ü +        gsub(/Ý/u,'Ý').  # Ý +        gsub(/Þ/u,'Þ').   # Þ +        gsub(/ß/u,'ß').   # ß +        gsub(/à/u,'à').  # à +        gsub(/á/u,'á').  # á +        gsub(/â/u,'â').   # â +        gsub(/ã/u,'ã').  # ã +        gsub(/ä/u,'ä').    # ä +        gsub(/å/u,'å').   # å +        gsub(/æ/u,'æ').   # æ +        gsub(/ç/u,'ç').  # ç +        gsub(/è/u,'è').  # è +        gsub(/é/u,'é').  # é +        gsub(/ê/u,'ê').   # ê +        gsub(/ë/u,'ë').    # ë +        gsub(/ì/u,'ì').  # ì +        gsub(/í/u,'í').  # í +        gsub(/î/u,'î').   # î +        gsub(/ï/u,'ï').    # ï +        gsub(/ð/u,'ð').     # ð +        gsub(/ñ/u,'ñ').  # ñ +        gsub(/ò/u,'ò').  # ò +        gsub(/ó/u,'ó').  # ó +        gsub(/ô/u,'ô').   # ô +        gsub(/õ/u,'õ').  # õ +        gsub(/ö/u,'ö').    # ö +        gsub(/ø/u,'ø').  # ø +        gsub(/ù/u,'ù').  # ú +        gsub(/ú/u,'ú').  # û +        gsub(/û/u,'û').   # ü +        gsub(/ü/u,'ü').    # ý +        gsub(/þ/u,'þ').   # þ +        gsub(/ÿ/u,'ÿ').    # ÿ +        gsub(/ý/u,'ý')      end    end    class Tune @@ -212,10 +211,10 @@ module SiSU_HTML_Tune          songsheet_array(@data)          #data=songsheet_array(@data)          if @md.opt.cmd =~/M/  #Hard Output Tune Optional on/off here -          data=Output.new(@data,@md).hard_output -          Output.new(@data,@md).marshal +          data=SiSU_HTML_Tune::Output.new(@data,@md).hard_output +          SiSU_HTML_Tune::Output.new(@data,@md).marshal          end -        tuned=Tune.new(@data,@md).output +        tuned=SiSU_HTML_Tune::Tune.new(@data,@md).output        rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error        ensure        end @@ -266,15 +265,15 @@ module SiSU_HTML_Tune                %{<a href="#{u}"><img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0"></a>#{caption}}              else %{<img src="#{image_path}/#{png}" #{w} #{h} naturalsizeflag="0" align="bottom" border="0">#{caption}}              end -            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins) +            word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)            else              link=m[/(.+)/m]              png=m.scan(/\S+/)[0].strip              link=link.strip -            u.gsub!(/(\S+)/,"#{Xx[:segment]}#\\1") if u !~/\// unless http_ #marker: in scroll remove; in seg replace +            u=u.gsub(/(\S+)/,"#{Xx[:segment]}#\\1") if u !~/\// unless http_ #marker: in scroll remove; in seg replace              ins=%{<a href="#{u}">#{link}</a>} -            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins) -            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins) +            word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins). +              gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)            end            word          else word @@ -288,82 +287,74 @@ module SiSU_HTML_Tune          if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/            @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)[()\[\]]*[,.;:!?'"]{0,2}|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu)            words=urls(@word_mode) -          dob.obj.gsub!(/.+/m,words) +          dob.obj=dob.obj.gsub(/.+/m,words)          end #consider change, do a while loop -        dob.obj.gsub!(/\\copyright/i,%{<sup>©</sup>}) +        dob.obj=dob.obj.gsub(/\\copyright/i,%{<sup>©</sup>})          if (dob.obj !~/\<:ad\s+\.\.\//) -          dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/, +          dob.obj=dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*!\>/,              %{\n<center><a href="http:\/\/\\1" target="external"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})          else -          dob.obj.gsub!(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/, +          dob.obj=dob.obj.gsub(/\<:ad\s+(\S+)?\s+(\S+\.png)\s+(.+)?\;\s+(.+)?\;\s*\>/,              %{\n<center><a href="\\1" target="_top"><img src="#{@env.url.images_local}/\\2" alt="\\3"></a></center>\n})          end -        dob.obj.gsub!(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_choice}" alt="stellar">}) -        dob.obj.gsub!(/!new/,%{ <img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_new}" alt="new">}) -        dob.obj.gsub!(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>') -        dob.obj.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> ') -        dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #http ftp matches escaped, no decoration -        dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}) -        dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration +        dob.obj=dob.obj.gsub(/!pick/,%{<img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_choice}" alt="stellar">}). +          gsub(/!new/,%{ <img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_new}" alt="new">}). +          gsub(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>'). +          gsub(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> '). +          gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration +          gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}). +          gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration          if dob.obj =~/#{Xx[:html_relative2]}\/\S+/ \          and dob.obj !~/(\"#{Xx[:html_relative2]}\/\S+?\"|>\s*#{Xx[:html_relative2]}\/\S+<)/ -          dob.obj.gsub!(/(#{Xx[:html_relative2]}\/\S+)/,'<a href="\1">\1</a>') +          dob.obj=dob.obj.gsub(/(#{Xx[:html_relative2]}\/\S+)/,'<a href="\1">\1</a>')          end          if dob.obj =~/..\/\S+/ \          and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ -          dob.obj.gsub!(/\.\.(\/\S+)/,%{<a href="#{Xx[:html_relative2]}\1">\1</a>}) +          dob.obj=dob.obj.gsub(/\.\.(\/\S+)/,%{<a href="#{Xx[:html_relative2]}\1">\1</a>})          end -        dob.obj.gsub!(/<a href=":/,%{<a href="#{@vz.url_site}/}) -        dob.obj.gsub!(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/}) -        dob.obj.gsub!(/<a href="#{Xx[:html_relative2]}\//,%{<a href="#{@vz.url_site}/}) +        dob.obj=dob.obj.gsub(/<a href=":/,%{<a href="#{@vz.url_site}/}). +          gsub(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/}). +          gsub(/<a href="#{Xx[:html_relative2]}\//,%{<a href="#{@vz.url_site}/})        else -        dob.obj.gsub!(/</m,'<'); dob.obj.gsub!(/>/m,'>') +        dob.obj=dob.obj.gsub(/</m,'<').gsub(/>/m,'>')        end        dob      end -    def para_numbers -      data=@data -      @tuned_file=[] -      data.each do |dob| -        dob.gsub!(/#{Mx[:lv_o]}\d:(\S?)#{Mx[:lv_c]}/,'\0<a name="H#\1">#\1.</a> ') #fix Mx[:lv_o] -        @tuned_file << dob -      end -    end      def angle_brackets(dob) -      dob.obj.gsub!(/<([a-z:\/]+)>/,"#{Dx[:lt_xml]}\\1#{Dx[:gt_xml]}") +      dob.obj=dob.obj.gsub(/<([a-z:\/]+)>/,"#{Dx[:lt_xml]}\\1#{Dx[:gt_xml]}")        dob      end      def endnotes_html(dob)        unless dob.is =~/^code/ -        dob.obj.gsub!(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/, -          ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- -          '\1\2 <a name="_\2" href="#-\2"> <sup>\2.</sup></a> \3 \4')   #endnote- note- (careful may have switched) -        dob.obj.gsub!(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/, -          ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- -          '\1\2 <a name="_\2" href="#-\2"> <sup>\2.</sup></a> \3 \4')   #endnote- note- (careful may have switched) -        dob.obj.gsub!(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/, -          ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- -          '\1\2 <a name="_\2" href="#-\2"> <sup>\2</sup></a> \3 \4')    #endnote- note- (careful may have switched) +        dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/, +            ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- +            '\1\2 <a name="_\2" href="#-\2"> <sup>\2.</sup></a> \3 \4').   #endnote- note- (careful may have switched) +          gsub(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/, +            ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- +            '\1\2 <a name="_\2" href="#-\2"> <sup>\2.</sup></a> \3 \4').   #endnote- note- (careful may have switched) +          gsub(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/, +            ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- +            '\1\2 <a name="_\2" href="#-\2"> <sup>\2</sup></a> \3 \4')    #endnote- note- (careful may have switched)        end        dob      end      def markup(dob) -      dob.obj.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;') -      dob.obj.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') -      dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table' -      dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') -      dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') -      dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') -      dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>') -      dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>') -      dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>') -      dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>') -      dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') -      dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>') # tt, kbd -      dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>') -      dob.obj.gsub!(/^#{Mx[:gl_bullet]}/m,'●  ') -      dob.obj.gsub!(/#{Mx[:nbsp]}/,' ') -      dob.obj.gsub!(/<(p|br)>/,'<\1 />') +      dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). +        gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') +      dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table' +      dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). +        gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). +        gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). +        gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>'). +        gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>'). +        gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>'). +        gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>'). +        gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>'). +        gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd +        gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>'). +        gsub(/^#{Mx[:gl_bullet]}/m,'●  '). +        gsub(/#{Mx[:nbsp]}/,' '). +        gsub(/<(p|br)>/,'<\1 />')        dob=SiSU_HTML_Tune::CleanHTML.new(dob).clean        dob      end @@ -371,8 +362,7 @@ module SiSU_HTML_Tune        data=@data        @tuned_file=[]        data.each do |dob| -        dob.obj.strip! -        dob.obj.chomp! +        dob.obj=dob.obj.strip.chomp          @tuned_file << dob        end        @tuned_file << "\n<EOF>" if (@md.fns =~/\.sst0/) #remove diff --git a/lib/sisu/v3dv/hub.rb b/lib/sisu/v3dv/hub.rb index dbcf3c8e..c2477267 100644 --- a/lib/sisu/v3dv/hub.rb +++ b/lib/sisu/v3dv/hub.rb @@ -233,7 +233,7 @@ module SiSU                else                 if @req !~/^conf$/ \                 and @opt.fns !~/http:\/\// -                  Operations.new(@opt).not_found +                  SiSU::Operations.new(@opt).not_found                  end                end              elsif FileTest.file?(put) @@ -250,14 +250,14 @@ module SiSU                  @n_do=@n_do+1                  SiSU_Screen::Ansi.new(@opt.cmd,@n_do,"#{@req.upcase} processed").files_processed if @opt.cmd =~/[MVv]/                end -            else Operations.new(@opt).not_found +            else SiSU::Operations.new(@opt).not_found              end            end          end        elsif @req =~/^dbi$/;            SiSU_DBI::SQL.new(@opt).connect    # -D -d        elsif @req=~/^sisupod_make$/;    SiSU_Doc::Source.new(@opt).read         # -S        end -      Operations.new.counter +      SiSU::Operations.new.counter      end    end    class Operations @@ -346,7 +346,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/        @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }      end      def op(req,msg) -      Op.new(@opt,req,msg).select if req and msg +      SiSU::Op.new(@opt,req,msg).select if req and msg      end      def actions        if @opt.cmd =~/E/ # re-assign character @@ -407,22 +407,22 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/            if @opt.cmd =~/R/              if @opt.mod.inspect =~/--init(?:ialize)?=site/ \              and @opt.cmd =~/RZ/ -              Operations.new(@opt).remote_put_base_site_rsync_match -            else Operations.new(@opt).remote_put_base_site_rsync +              SiSU::Operations.new(@opt).remote_put_base_site_rsync_match +            else SiSU::Operations.new(@opt).remote_put_base_site_rsync              end            elsif @opt.cmd =~/r/              if @opt.mod.inspect =~/--init(?:ialize)?=site/ \              and @opt.cmd =~/CCr/ -              Operations.new(@opt).remote_put_base_site_all -            else Operations.new(@opt).remote_put_base_site +              SiSU::Operations.new(@opt).remote_put_base_site_all +            else SiSU::Operations.new(@opt).remote_put_base_site              end            end          end          if @opt.act[:sample_search_form][:bool]                                #% --sample-search-form, -F cgi sample search form -          Operations.new(@opt).cgi +          SiSU::Operations.new(@opt).cgi          end          if @opt.act[:webrick][:bool]                                           #% --webrick, -W webrick -          Operations.new(@opt).webrick +          SiSU::Operations.new(@opt).webrick          end          if @opt.cmd =~/Z/                                                      #% -Z wipe previous output clean            op('zap','Zap, deletions') @@ -463,7 +463,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/              if @get_s.length > 0                                               #% remote markup file .sst                require_relative 'remote'                                        # remote.rb                SiSU_Remote::Get.new(@opt,@get_s).fns -              Operations.new.counter +              SiSU::Operations.new.counter              end              if @get_p.length > 0                                               #% remote sisupod                require_relative 'remote'                                        # remote.rb @@ -536,13 +536,14 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/              if FileTest.file?(fns)                @opt.fns=fns                case @opt.fns -              when /\.(termsheet.rb)$/;            Operations.new(@opt).termsheet +              when /\.(termsheet.rb)$/ +                SiSU::Operations.new(@opt).termsheet                else                                 #print "not processed --> ", fns, "\n"                end -            else Operations.new(@opt).not_found +            else SiSU::Operations.new(@opt).not_found              end            end -          Operations.new.counter +          SiSU::Operations.new.counter          end          if @opt.cmd =~/k/                                                      #% -T temporary tests            op('xml_scaffold','XML scaffold') @@ -632,7 +633,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/              and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/              elsif @opt.fns=~/\.ssi$/ \              and @opt.mod.inspect =~/--identify/ -            else Operations.new(@opt).not_recognised +            else SiSU::Operations.new(@opt).not_recognised              end            end            if @opt.fns =~/\.ssm\.sst$/ \ @@ -641,7 +642,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/              @tell.call.warn unless @opt.cmd =~/V/              File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER            end -        else                          #Operations.new(fns,'html').not_found +        else                          #SiSU::Operations.new(fns,'html').not_found          end        end      end @@ -665,7 +666,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/      home=ENV['HOME']      argv=$*      @opt=SiSU_Commandline::Options.new(argv) -    Processing.new(@opt).actions +    SiSU::Processing.new(@opt).actions    rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt,$!,$@,nil).rescue #fix    ensure      Dir.chdir(@@pwd_the) diff --git a/lib/sisu/v3dv/manifest.rb b/lib/sisu/v3dv/manifest.rb index 30e645b4..3310fa98 100644 --- a/lib/sisu/v3dv/manifest.rb +++ b/lib/sisu/v3dv/manifest.rb @@ -92,13 +92,13 @@ module SiSU_Manifest            SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i          end          data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions -        OutputInfo.new(@md).check_output(data) +        SiSU_Manifest::Source::Output.new(@md).check_output(data)        rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error        ensure        end      end      private -    class OutputInfo <Source +    class Output <Source        def initialize(md)          @manifest={ txt: [], html: [] }          @md,@fns=md,md.fns @@ -117,8 +117,8 @@ module SiSU_Manifest        def output          manifest=@f.write_file.manifest          @manifest[:html].each do |x| -          x.gsub!(Xx[:html_relative2],@f.path_rel_links.html_scroll_2) -          x.gsub!(Xx[:html_relative1],@f.path_rel_links.html_scroll_1) +          x=x.gsub(Xx[:html_relative2],@f.path_rel_links.html_scroll_2). +            gsub(Xx[:html_relative1],@f.path_rel_links.html_scroll_1)            manifest << x          end        end @@ -180,8 +180,7 @@ module SiSU_Manifest            end          end          manifests -        @m.uniq! -        @m +        @m=@m.uniq        end        def languages(id,file)          flv=published_manifests? @@ -201,7 +200,7 @@ module SiSU_Manifest          end        end        def metadata(id,info) -        info.to_s.gsub!(/#{Mx[:br_line]}/,'<br />') +        info=info.to_s.gsub(/#{Mx[:br_line]}/,'<br />')          @manifest[:html] << %{<tr><th class="left"><p class="bold_left">#{id}:</p></th><td><p class="left">#{info}</p></td></tr>\n}        end        def links(url,lnk,target) @@ -772,8 +771,8 @@ WOK            if @env.manifest_minitoc?              if @env.output_dir_structure.by_language_code? \              or @env.output_dir_structure.by_filetype? -              minitoc.gsub!(/<a href="(\S+?)"/m,%{<a href="../html/#{@md.fnb}/\\1"}) -              minitoc.gsub!(/<a href="\.\.\/html\/#{@md.fnb}\/(?:sisu_manifest\.html|#{@f.base_filename.manifest})"/m, +              minitoc=minitoc.gsub(/<a href="(\S+?)"/m,%{<a href="../html/#{@md.fnb}/\\1"}). +                gsub(/<a href="\.\.\/html\/#{@md.fnb}\/(?:sisu_manifest\.html|#{@f.base_filename.manifest})"/m,                %{<a href="#{@f.base_filename.manifest}"})              end              @manifest[:html] <<<<WOK diff --git a/lib/sisu/v3dv/manpage.rb b/lib/sisu/v3dv/manpage.rb index 90c31a3b..94416eb2 100644 --- a/lib/sisu/v3dv/manpage.rb +++ b/lib/sisu/v3dv/manpage.rb @@ -138,17 +138,17 @@ module SiSU_Manpage            else                              SiSU_TextUtils::Wrap.new(e.to_s,78,0,1)            end            wrap=util.line_wrap -          if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m -            wrap.gsub!(/(^| |#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*') #man page requires -            wrap.gsub!(/\s\.(\S+)/,' \\.\1') -            wrap.gsub!(/^\s*([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB +          wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m +            wrap.gsub(/(^| |#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*'). #man page requires +              gsub(/\s\.(\S+)/,' \\.\1'). +              gsub(/^\s*([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB  .TP  .BI \\1.  \\2  GSUB                        )            else -            wrap.gsub!(/^\s*(.+)\Z/m, <<GSUB +            wrap.gsub(/^\s*(.+)\Z/m, <<GSUB  \\1  GSUB                        ) @@ -220,7 +220,7 @@ WOK            else util=SiSU_TextUtils::Wrap.new(paragraph,78,0)            end            w=util.line_wrap -          w.gsub!(/^(\\\.)/,' \1') +          w=w.gsub(/^(\\\.)/,' \1')            w          end          if lv @@ -234,7 +234,7 @@ WOK            end          else            @manpage[:body] << if  wrapped =~/^\.BI\s/ # main text, contents, body KEEP -            '.TP' << @br << wrapped.gsub!(/^\.BI\s/,'.B ') # sleight ... simpler output +            '.TP' << @br << wrapped.gsub(/^\.BI\s/,'.B ') # sleight ... simpler output (check gsub!)            else              '.br' << @br << wrapped            end @@ -263,76 +263,76 @@ WOK            or dob.is=='heading_insert'              dob.obj=''            end -          dob.obj.gsub!(/.+?<-#>/,'')                                           # remove dummy headings (used by html) #check -          dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^') -          dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]') -          dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'++\1++') -          dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'--\1--') -          dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"') -          dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1') -          dob.obj.gsub!(/\A\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}#{Mx[:br_line]}([,.:!?](?: |$))?/m,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}") -          dob.obj.gsub!(/\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}([,.:!?](?: |$))?/m,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}") -          dob.obj.gsub!(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1\\2#{Mx[:br_line]}") -          dob.obj.gsub!(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.B \\1\\2#{Mx[:br_line]}") -          dob.obj.gsub!(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}") +          dob.obj=dob.obj.gsub(/.+?<-#>/,'').                                           # remove dummy headings (used by html) #check +            gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^'). +            gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]'). +            gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'++\1++'). +            gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'--\1--'). +            gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"'). +            gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1'). +            gsub(/\A\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}#{Mx[:br_line]}([,.:!?](?: |$))?/m,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}"). +            gsub(/\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}([,.:!?](?: |$))?/m,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}"). +            gsub(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1\\2#{Mx[:br_line]}"). +            gsub(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.B \\1\\2#{Mx[:br_line]}"). +            gsub(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}")            unless dob.is=='code' -            dob.obj.gsub!(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1 #{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3") -            dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1#{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3") +            dob.obj=dob.obj.gsub(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1 #{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3"). +              gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1#{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3")              @manpage[:endnotes]=extract_endnotes(dob.obj) -            dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]') # endnote marker marked up -            dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_b_c]}/m,'[^\1]') # endnote marker marked up -            dob.obj.gsub!(/#{Mx[:gl_o]}#amp#{Mx[:gl_c]}/,'&') ##{Mx[:gl_o]}#095#{Mx[:gl_c]} -            dob.obj.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') -            dob.obj.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') -            dob.obj.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') -            dob.obj.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') -            dob.obj.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\e') -            dob.obj.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') -            dob.obj.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') -            dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') -            dob.obj.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') -            dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') -            dob.obj.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©') +            dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]'). # endnote marker marked up +              gsub(/#{Mx[:en_b_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_b_c]}/m,'[^\1]'). # endnote marker marked up +              gsub(/#{Mx[:gl_o]}#amp#{Mx[:gl_c]}/,'&'). ##{Mx[:gl_o]}#095#{Mx[:gl_c]} +              gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!'). +              gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#'). +              gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*'). +              gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-'). +              gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\e'). +              gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/'). +              gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_'). +              gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'). +              gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}'). +              gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~'). +              gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')            else -            dob.obj.gsub!(/\\/,'\e') -            dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n")                                   # watch +            dob.obj=dob.obj.gsub(/\\/,'\e'). +              gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n")                                   # watch              #dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n")                                   # watch            end -          dob.obj.gsub!(/(^| |#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*') #man page requires -          dob.obj.gsub!(/┆/,'|') -          dob.obj.gsub!(/\s\.(\S+)/,' \\.\1') -          dob.obj.gsub!(/(\n\.)(\S\S\S+)/m,'\1\\.\2') -          dob.obj.gsub!(/-/,'\-') #manpages use this -          dob.obj.gsub!(/~/,'~') if dob.obj #manpages use this +          dob.obj=dob.obj.gsub(/(^| |#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*'). #man page requires +            gsub(/┆/,'|'). +            gsub(/\s\.(\S+)/,' \\.\1'). +            gsub(/(\n\.)(\S\S\S+)/m,'\1\\.\2'). +            gsub(/-/,'\-') #manpages use this +          dob.obj=dob.obj.gsub(/~/,'~') if dob.obj #manpages use this            if dob.is =~/block|group|verse|alt|code/              if dob.is =='code' -              dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _< -              dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_< -              dob.obj.gsub!(/\A(.+)?\Z/m,".nf\n\n\\1\n\n.fi") +              dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _< +                gsub(/(^|[^}])_([<>])/m,'\1\2'). # _<_< +                gsub(/\A(.+)?\Z/m,".nf\n\n\\1\n\n.fi")              end            end            #dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/m,"\n.br\n")                                   # watch -          dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/m,"\n\n")                                   # watch +          dob.obj=dob.obj.gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/m,"\n\n")                                   # watch            blit=dob.obj.scan(/\[[^\]]+\]|[^\[]+/)            blit_array=[]            blit.each do |x| -            if x =~/^\[/ -              x.gsub!(/\s+/,' \ ') #manpages use this +            x=if x =~/^\[/ +              x.gsub(/\s+/,' \ ') #manpages use this              else x              end              blit_array << x            end            dob.obj=blit_array.join -          dob.obj.gsub!(/#{Mx[:gl_o]}:name#\S+?#{Mx[:gl_c]}/mi,'') #added -          #dob.obj.gsub!(/\s\\\s+(#{Mx[:br_line]}|#{Mx[:br_nl]})/,'\1') #a messy solution -          dob.obj.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'')                                         # remove page breaks -          dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1\2') -          dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1') -          dob.obj.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'')                                     # remove name links -          dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ')                                          # decide on -          dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'    [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") -          dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,'    [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") -          dob.obj.gsub!(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]') +          dob.obj=dob.obj.gsub(/#{Mx[:gl_o]}:name#\S+?#{Mx[:gl_c]}/mi,''). #added +          #gsub(/\s\\\s+(#{Mx[:br_line]}|#{Mx[:br_nl]})/,'\1'). #a messy solution +            gsub(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'').                                         # remove page breaks +            gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1\2'). +            gsub(/<a href=".+?">(.+?)<\/a>/m,'\1'). +            gsub(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'').                                     # remove name links +            gsub(/ |#{Mx[:nbsp]}/,' ').                                          # decide on +            gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'    [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") +            gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,'    [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") +            gsub(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]')            wordlist=dob.obj.scan(/\S+/)            if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/              if dob.obj =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change @@ -362,14 +362,14 @@ WOK                dob.obj=''              end              if dob.obj -              dob.obj.gsub!(/\s(\[)/m,' \ \1') -              dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n")                                   # watch -              dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') -              dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') -              dob.obj.gsub!(/#{Mx[:pa_o]}\S+#{Mx[:pa_c]}/,' ') +              dob.obj=dob.obj.gsub(/\s(\[)/m,' \ \1'). +                gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n").                                   # watch +                gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~'). +                gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'). +                gsub(/#{Mx[:pa_o]}\S+#{Mx[:pa_c]}/,' ')                unless dob.is =='code' -                dob.obj.gsub!(/<!.+!>/,' ') -                dob.obj.gsub!(/<:\S+>/,' ') +                dob.obj=dob.obj.gsub(/<!.+!>/,' '). +                  gsub(/<:\S+>/,' ')                end              end              dob @@ -416,7 +416,7 @@ WOK            if para.class==Array \            and para.length > 0              para.each do |line| -              line.gsub!(/\s+$/m,'') +              line=line.gsub(/\s+$/m,'')                filename_manpage.puts line           #unix manpage              end            else filename_manpage.puts para          #unix manpage # /^([*=-]|\.){5}/ diff --git a/lib/sisu/v3dv/odf.rb b/lib/sisu/v3dv/odf.rb index 4b90c543..d58da74e 100644 --- a/lib/sisu/v3dv/odf.rb +++ b/lib/sisu/v3dv/odf.rb @@ -161,7 +161,7 @@ module SiSU_ODF          @@odf[:tail] << "\n</office:text></office:body></office:document-content>"        end        def heading(dob,p_num='') -        dob.obj.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check +        dob.obj=dob.obj.gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check          m=/#{$1}/          breakpage=''          if @md.fns \ @@ -232,29 +232,29 @@ module SiSU_ODF          end          if m; m.each do |i|              cont,url=i[1],i[2] -            cont.gsub!(/([)(\]\[])/,"\\\\\\1") -            cont.gsub!(/([+?])/,"\\\\\\1") # incorrect handling of + -            url.gsub!(/([+?])/,"\\\\\\1") -            dob.obj.sub!(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}image/m,image_odf(i)) -            dob.obj.sub!(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,image_odf(i)) -            dob.obj.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix +            cont=cont.gsub(/([)(\]\[])/,"\\\\\\1"). +              gsub(/([+?])/,"\\\\\\1") # incorrect handling of + +            url=url.gsub(/([+?])/,"\\\\\\1") +            dob.obj=dob.obj.sub(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}image/m,image_odf(i)). +              sub(/#{Mx[:lnk_o]}[ ]*#{cont}[ ]*#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,image_odf(i)). +              sub(/\\([)(\]\[?])/,'\1') #clumsy fix            end            m=nil          end          dob        end        def text_link_odf(txt,url,trail) -        txt.gsub!(/(\\\+)/,'+') #this is convoluted, and risky :-( -        url.gsub!(/(\\\+)/,'+') #this is convoluted, and risky :-( +        txt=txt.gsub(/(\\\+)/,'+') #this is convoluted, and risky :-( +        url=url.gsub(/(\\\+)/,'+') #this is convoluted, and risky :-(          map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map          t=case url          when /^https?:/            %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}          when /^:/                 # site same document collection html link -          url.gsub!(/^:/,"#{@env.url.root}/") +          url=url.gsub(/^:/,"#{@env.url.root}/")            %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}          when /^\.\.\//                 # site same document collection html link -          url.gsub!(/^\.\.\//,"#{@env.url.root}/") +          url=url.gsub(/^\.\.\//,"#{@env.url.root}/")            %{<text:a xlink:type="simple" xlink:href="#{url}">#{txt.strip}</text:a>#{trail}}          else                           # document internal link            if map_nametags[url] \ @@ -273,11 +273,11 @@ module SiSU_ODF          if m            m.each do |i|              txt,url,trail=i[1],i[2] -            txt.gsub!(/([)(\]\[])/,"\\\\\\1") -            txt.gsub!(/([+?*])/,"\\\\\\1") # problems with + -            url.gsub!(/([+?])/,"\\\\\\1") # problems with + -            dob.obj.gsub!(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url -            dob.obj.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix +            txt=txt.gsub(/([)(\]\[])/,"\\\\\\1"). +              gsub(/([+?*])/,"\\\\\\1") # problems with + +            url=url.gsub(/([+?])/,"\\\\\\1") # problems with + +            dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:url_o]}#{url}#{Mx[:url_c]}/m,text_link_odf(txt,url,trail)). #make sure trailing ']' are not caught in url +              gsub(/\\([)(\]\[?])/,'\1') #clumsy fix            end            m=nil          end @@ -288,23 +288,23 @@ module SiSU_ODF          if m            m.each do |i|              txt,url,trail=i[1],i[2] -            txt.gsub!(/([)(\]\[])/,"\\\\\\1") -            txt.gsub!(/([+?*])/,"\\\\\\1") # problems with + -            url.gsub!(/([+?])/,"\\\\\\1") # problems with + -            dob.obj.gsub!(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{url}#{Mx[:rel_c]}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url -            dob.obj.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix +            txt=txt.gsub(/([)(\]\[])/,"\\\\\\1"). +              gsub(/([+?*])/,"\\\\\\1") # problems with + +            url=url.gsub(/([+?])/,"\\\\\\1") # problems with + +            dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}[ ]*#{txt}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{url}#{Mx[:rel_c]}/m,text_link_odf(txt,url,trail)). #make sure trailing ']' are not caught in url +              gsub(/\\([)(\]\[?])/,'\1') #clumsy fix            end            m=nil          end          dob        end        def normal(dob,p_num='')                                                           #P1 - P3 -        dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, -          '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration -        dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, -          %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}) -        dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, -          %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration +        dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, +            '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration +          gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, +            %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}). +          gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, +            %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration          dob.obj= if dob.is=='para' \          and dob.indent.to_s =~/[0-9]/ \          and dob.indent == dob.hang @@ -320,7 +320,7 @@ module SiSU_ODF        def fontface(dob)        end        def footnote_urls(str) -        str.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, +        str=str.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,            %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}})          str=text_link(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/          str=text_link_relative(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/ @@ -334,11 +334,11 @@ module SiSU_ODF            @astx||=10000            @astxs||=20000            if str =~/#{Mx[:en_a_o]}\d+\s+/ -            str.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,'<text:note text:id="ftn\1" text:note-class="footnote"><text:note-citation>\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>') +            str=str.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,'<text:note text:id="ftn\1" text:note-class="footnote"><text:note-citation>\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>')            end            if str =~/#{Mx[:en_a_o]}([*]+)\s+/              a=$1.gsub(/([*])/,"\\\\\\1") -              str.gsub!(/#{Mx[:en_a_o]}([*]+)\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>}) +              str=str.gsub(/#{Mx[:en_a_o]}([*]+)\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})                @astxs+=1            end            if str=~/#{Mx[:en_a_o]}[*+]+\s/ @@ -347,7 +347,7 @@ module SiSU_ODF                a=x[0].gsub(/([*+])/,"\\\\\\1")                str=group_clean(str)                str=footnote_urls(str) -              str.gsub!(/#{Mx[:en_a_o]}(#{a})\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>}) +              str=str.gsub(/#{Mx[:en_a_o]}(#{a})\s+(.+?)#{Mx[:en_a_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})                @astx+=1              end            end @@ -357,7 +357,7 @@ module SiSU_ODF                a=x[0].gsub(/([*+])/,"\\\\\\1")                str=group_clean(str)                str=footnote_urls(str) -              str.gsub!(/#{Mx[:en_b_o]}(#{a})\s+(.+?)#{Mx[:en_b_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>}) +              str=str.gsub(/#{Mx[:en_b_o]}(#{a})\s+(.+?)#{Mx[:en_b_c]}/,%{<text:note text:id="ftn#{@astx.to_s}" text:note-class="footnote"><text:note-citation text:label="\\1">\\1</text:note-citation><text:note-body><text:p text:style-name="Footnote"> \\2</text:p><text:p text:style-name="Footnote"/></text:note-body></text:note>})                @astx+=1              end            end @@ -368,12 +368,11 @@ module SiSU_ODF          t_o        end        def group_clean(str) -        str.gsub!(/&nbsp;| |#{Mx[:nbsp]}/,' ') -        str.gsub!(/</,'<'); str.gsub!(/>/,'>') -        str.gsub!(/<(text:span text:style-name="Span_\S+?"|\/text:span)>/,'<\1>') #works, not ideal -        str.gsub!(/#{Mx[:br_line]}/,'<br />') -        str.gsub!(/<br(?:\s+\/)?>/,'<br />') -        str +        str=str.gsub(/&nbsp;| |#{Mx[:nbsp]}/,' '). +          gsub(/</,'<').gsub(/>/,'>'). +          gsub(/<(text:span text:style-name="Span_\S+?"|\/text:span)>/,'<\1>'). #works, not ideal +          gsub(/#{Mx[:br_line]}/,'<br />'). +          gsub(/<br(?:\s+\/)?>/,'<br />')        end        def poem(dob,p_num)                                                             #P4 #same as group          parray=[] @@ -388,19 +387,19 @@ module SiSU_ODF        end        def group(dob,p_num)                                                            #P4 #same as verse          parray=[] -        dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, -          '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration -        dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, -          %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}) -        dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, -          %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration +        dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, +            '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration +          gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, +            %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}). +          gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, +            %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration          dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|            parablock=group_clean(parablock) -          parablock.gsub!(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,'<text:a xlink:type="simple" xlink:href="\1">') -          parablock.gsub!(/<(\/text:a)>/,'<\1>') -          parablock.gsub!(/<(text:note text:id=.+?)>/,'<\1>') -          parablock.gsub!(/<(text:p text:style-name="Footnote")>/,'<\1>') -          parablock.gsub!(/<(\/?text:(?:note-citation|note-body|note|p))>/,'<\1>') +          parablock=parablock.gsub(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,'<text:a xlink:type="simple" xlink:href="\1">'). +            gsub(/<(\/text:a)>/,'<\1>'). +            gsub(/<(text:note text:id=.+?)>/,'<\1>'). +            gsub(/<(text:p text:style-name="Footnote")>/,'<\1>'). +            gsub(/<(\/?text:(?:note-citation|note-body|note|p))>/,'<\1>')            parablock=footnote(parablock)            parray << %{<text:p text:style-name="P_group">#{parablock}</text:p>} if parablock =~/\S+/          end @@ -411,19 +410,19 @@ module SiSU_ODF        end        def block(dob,p_num)                                                            #P4 #same as verse          parray=[] -        dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, -          '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration -        dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, -          %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}) -        dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, -          %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration +        dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, +            '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration +          gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, +            %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}). +          gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, +            %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration          dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|            parablock=group_clean(parablock) -          parablock.gsub!(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,'<text:a xlink:type="simple" xlink:href="\1">') -          parablock.gsub!(/<(\/text:a)>/,'<\1>') -          parablock.gsub!(/<(text:note text:id=.+?)>/,'<\1>') -          parablock.gsub!(/<(text:p text:style-name="Footnote")>/,'<\1>') -          parablock.gsub!(/<(\/?text:(?:note-citation|note-body|note|p))>/,'<\1>') +          parablock=parablock.gsub(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,'<text:a xlink:type="simple" xlink:href="\1">'). +            gsub(/<(\/text:a)>/,'<\1>'). +            gsub(/<(text:note text:id=.+?)>/,'<\1>'). +            gsub(/<(text:p text:style-name="Footnote")>/,'<\1>'). +            gsub(/<(\/?text:(?:note-citation|note-body|note|p))>/,'<\1>')            parablock=footnote(parablock)            parray << %{<text:p text:style-name="P_group">#{parablock}</text:p>} if parablock =~/\S+/          end @@ -434,13 +433,13 @@ module SiSU_ODF        end        def code(dob,p_num)                                                             #P5          if dob.is=='code' -          dob.obj.gsub!(/\s\s/,'  ') +          dob.obj=dob.obj.gsub(/\s\s/,'  ')            parray=[]            dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|              parablock=group_clean(parablock) -            parablock.gsub!(/^\s*$/,'<br />') -            parablock.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, -              '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration +            parablock=parablock.gsub(/^\s*$/,'<br />'). +              gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, +                '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration              parray << %{<text:p text:style-name="P_code">#{parablock}</text:p>} if parablock =~/\S+/            end            dob.obj=parray.join \ @@ -528,18 +527,18 @@ module SiSU_ODF            #p dob.obj if dob.obj =~safe_characters and @md.opt.cmd =~/V/ #KEEP            dob.obj='' if dob.obj =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/ #fix Mx[:lv_o]            para_array=[] -          dob.obj.gsub!(/</,'<'); dob.obj.gsub!(/>/,'>') +          dob.obj=dob.obj.gsub(/</,'<').gsub(/>/,'>')            word=dob.obj.scan(/\S+|\n/)            if word              word.each do |w| # _ - / # | : ! ^ ~                unless dob =~/^(?:#{Rx[:meta]}|%+ )/m -                w.gsub!(/&#(?:126|152);/,'~') #126 usual -                w.gsub!(/ /,' ') +                w=w.gsub(/&#(?:126|152);/,'~'). #126 usual +                  gsub(/ /,' ')                  if w !~/(?:&\S{2,7}?;)+/ -                  w.gsub!(/&/,'&') +                  w=w.gsub(/&/,'&')                  end                  if w !~/&\S{1,7}?;(?:&\S{1,7}?;)+/    #imperfect -                  w.gsub!(/(&\S{1,7};)+&/,'\1&') +                  w=w.gsub(/(&\S{1,7};)+&/,'\1&')                  end                end                para_array << w @@ -548,50 +547,50 @@ module SiSU_ODF              dob.obj=dob.obj.strip            end            if dob.is=='code' #{Mx[:gr_o]}code#{Mx[:gr_c]}/ #fix #code-block: angle brackets special characters #fix -            dob.obj.gsub!(/(^|[^}])_(?:<|<)/m,'\1<'); dob.obj.gsub!(/(^|[^}])_(?:>|>)/m,'\1>') -            dob.obj.gsub!(/(^|[^}])_(?:<|<)/m,'\1<'); dob.obj.gsub!(/(^|[^}])_(?:>|>)/m,'\1>') +            dob.obj=dob.obj.gsub(/(^|[^}])_(?:<|<)/m,'\1<').gsub(/(^|[^}])_(?:>|>)/m,'\1>'). +              gsub(/(^|[^}])_(?:<|<)/m,'\1<').gsub(/(^|[^}])_(?:>|>)/m,'\1>')            end            if dob.of=='block' -            dob.obj.gsub!(/#{Mx[:gl_bullet]}/,'● ') +            dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ')            end -          dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') -          dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>') -          dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>') -          dob.obj.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check -          dob.obj.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;') -          dob.obj.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') -          dob.obj.gsub!(/#{Mx[:mk_o]}[~-]##{Mx[:mk_c]}/,'') +          dob.obj=dob.obj.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>'). +            gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>'). +            gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>'). +            gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,''). #check +            gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). +            gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;'). +            gsub(/#{Mx[:mk_o]}[~-]##{Mx[:mk_c]}/,'')            if dob.is=='para' \            and dob.bullet_              dob.obj='<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ' +                dob.obj            end -          dob.obj.gsub!(/#{Mx[:br_line]}/,'<br />') -          dob.obj.gsub!(/©/,'©') #too arbitrary -          dob.obj.gsub!(/.+?<-#>/,'')                                           # remove dummy headings (used by html) #check -          dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, -            '<text:span text:style-name="Span_bold">\1</text:span>') -          dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/, -            '<text:span text:style-name="Span_italic">\1</text:span>') -          dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/, -            '<text:span text:style-name="Span_underscore">\1</text:span>') -          dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/, -            '<text:span text:style-name="Span_superscript">\1</text:span>') -          dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/, -            '<text:span text:style-name="Span_subscript">\1</text:span>') -          dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/, -            '<text:span text:style-name="Span_monospace">\1</text:span>') -          dob.obj.gsub!(//u,'-') -          dob.obj.gsub!(/ /u, ' ')       # space identify -          dob.obj.gsub!(/ /u, ' ')       # space identify -          dob.obj.gsub!(/·/u,'*') -          dob.obj.gsub!(/[–—]/u,'-')   #— – chk -          dob.obj.gsub!(/ < /i,'<') -          dob.obj.gsub!(/\\copy(?:right)?\b/,'©') -          dob.obj.gsub!(/\\trademark\b|\\tm\b/,'®') -          dob.obj.gsub!(/\44/,'$') #$ watch -          dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/,'\1') -          dob.obj.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'')                                       # remove name links +          dob.obj=dob.obj.gsub(/#{Mx[:br_line]}/,'<br />'). +            gsub(/©/,'©'). #too arbitrary +            gsub(/.+?<-#>/,'').                                           # remove dummy headings (used by html) #check +            gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, +              '<text:span text:style-name="Span_bold">\1</text:span>'). +            gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/, +              '<text:span text:style-name="Span_italic">\1</text:span>'). +            gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/, +              '<text:span text:style-name="Span_underscore">\1</text:span>'). +            gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/, +              '<text:span text:style-name="Span_superscript">\1</text:span>'). +            gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/, +              '<text:span text:style-name="Span_subscript">\1</text:span>'). +            gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/, +              '<text:span text:style-name="Span_monospace">\1</text:span>'). +            gsub(//u,'-'). +            gsub(/ /u, ' ').       # space identify +            gsub(/ /u, ' ').       # space identify +            gsub(/·/u,'*'). +            gsub(/[–—]/u,'-').   #— – chk +            gsub(/ < /i,'<'). +            gsub(/\\copy(?:right)?\b/,'©'). +            gsub(/\\trademark\b|\\tm\b/,'®'). +            gsub(/\44/,'$'). #$ watch +            gsub(/<a href=".+?">(.+?)<\/a>/,'\1'). +            gsub(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'')                                       # remove name links            wordlist=dob.obj.scan(/\S+/)            dob.obj=tidywords(wordlist).join(' ').strip            @rcdc=true if @rcdc==false \ @@ -603,9 +602,11 @@ module SiSU_ODF              if dob.is=~/heading|para|group|verse|code|table|break/ # extend, include other types                odf_structure(@md,dob)              end -            dob.obj.gsub!(/<!.+!>/,' ') if dob.obj ## Clean Prepared Text -            dob.obj.gsub!(/#{Mx[:tc_o]}.+?#{Mx[:tc_c]}/,' ') if dob.obj ## CHECK Clean Prepared Text -            dob.obj.gsub!(/<:\S+>/,' ') if dob.obj ## Clean Prepared Text +            if dob.obj ## Clean Prepared Text +              dob.obj=dob.obj.gsub(/<!.+!>/,' '). +                gsub(/#{Mx[:tc_o]}.+?#{Mx[:tc_c]}/,' '). +                gsub(/<:\S+>/,' ') +            end            end          end        end @@ -637,8 +638,8 @@ module SiSU_ODF    <style:style style:name="Table2.M" style:family="table-column"><style:table-column-properties style:column-width="1.307" style:rel-column-width="5041*"/></style:style>    <style:style style:name="Table2.N" style:family="table-column"><style:table-column-properties style:column-width="1.214cm" style:rel-column-width="4681*"/></style:style>  WOK -          x.strip! -          x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ +          x=x.strip +          x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/            x          else ''          end @@ -660,8 +661,8 @@ WOK      <office:forms form:automatic-focus="false" form:apply-design-mode="false"/>      <text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls>  WOK -        x.strip! -        x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ +        x=x.strip +        x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/          @@odf[:head] << x        end        def post @@ -675,7 +676,7 @@ WOK          content << @@odf[:body]          content << @@odf[:metadata]          content << @@odf[:tail] -        Output.new(content,@md,@env).odf +        SiSU_ODF::Source::Output.new(content,@md,@env).odf          @@odf[:head],@@odf[:body],@@odf[:tail],@@odf[:metadata]=[],[],[],[]        end      end diff --git a/lib/sisu/v3dv/odf_format.rb b/lib/sisu/v3dv/odf_format.rb index 9167fc5e..c6d4b504 100644 --- a/lib/sisu/v3dv/odf_format.rb +++ b/lib/sisu/v3dv/odf_format.rb @@ -84,7 +84,7 @@ module SiSU_ODF_Format          p caller        end        rgx=/#{Mx[:en_a_o]}\d+\s+(.+?)#{Mx[:en_a_c]}/ -      @txt.gsub!(rgx,'\1') if @txt =~rgx +      @txt=@txt.gsub(rgx,'\1') if @txt =~rgx        @vz=SiSU_Env::GetInit.instance.skin      end      def scr_endnote_body @@ -150,7 +150,7 @@ module SiSU_ODF_Format          'Table_Heading'        else 'P_table_cell'        end -      str.gsub!(/^~$/,'') # tilde / empty cell +      str=str.gsub(/^~$/,'') # tilde / empty cell        %{<table:table-cell office:value-type="string">#{@br}} +        %{<text:p text:style-name="#{txt_name_cell}">#{@br}} +        %{#{str}} + @@ -180,7 +180,7 @@ module SiSU_ODF_Format        row='' if row =~/^<!$/        m=row[/<!f(.+?)!>/,1]        @@tablefoot << m if m -      row.gsub!(/<!f.+?!>/,'') +      row=row.gsub(/<!f.+?!>/,'')        @cells=[]        row.split(/\s*#{Mx[:tc_p]}/).each do |cell|          @cells << table_tag_cell(cell,i) @@ -226,8 +226,8 @@ module SiSU_ODF_Format    </rdf:Description>  </rdf:RDF>  WOK -      x.strip! -      x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ +      x=x.strip +      x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/        x      end      def meta_inf_manifest_xml(md) @@ -256,8 +256,8 @@ WOK    <manifest:file-entry manifest:media-type="application/vnd.sun.xml.ui.configuration" manifest:full-path="Configurations2/"/>  </manifest:manifest>  WOK -      x.strip! -      x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ +      x=x.strip +      x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/        x      end      def meta_xml @@ -272,8 +272,8 @@ WOK    </office:meta>  </office:document-meta>  WOK -      x.strip! -      x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ +      x=x.strip +      x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/        x      end      def settings_xml @@ -375,8 +375,8 @@ WOK    </office:settings>  </office:document-settings>  WOK -      x.strip! -      x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ +      x=x.strip +      x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/        x      end      def styles_xml @@ -576,15 +576,15 @@ WOK    </office:master-styles>  </office:document-styles>  WOK -      x.strip! -      x.gsub!(/\n+/m,'') unless @md.opt.cmd=~/M/ +      x=x.strip +      x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/        x      end      def mimetype        x=<<WOK  application/vnd.oasis.opendocument.text  WOK -      x.strip! +      x=x.strip      end    end    class FormatObjBreak diff --git a/lib/sisu/v3dv/options.rb b/lib/sisu/v3dv/options.rb index 23f45136..4cd071ac 100644 --- a/lib/sisu/v3dv/options.rb +++ b/lib/sisu/v3dv/options.rb @@ -87,7 +87,8 @@ module SiSU_Commandline              x << Dir.glob("#{d}/*.ss[tm]")            end          end -        opt + x.flatten! +        x=x.flatten +        opt + x        end      end      def find_select(find_flag,opt) @@ -112,8 +113,8 @@ module SiSU_Commandline              end            end          end -        x.flatten! -     end +        x.flatten +      end      end      def sisu_glob_rules(a)        a=if a.inspect =~/"-[A-Za-z0-9]*[fG]/ \ @@ -140,7 +141,7 @@ module SiSU_Commandline            end          end          r=Px[:lng_lst].join('|') -        r.gsub!(/\|#{@lng_base}\|/,'|') +        r=r.gsub(/\|#{@lng_base}\|/,'|')          @lang_regx=%r{(?:#{r})}          z=if find_flag            (f.length > 0) \ @@ -188,7 +189,7 @@ module SiSU_Commandline          end          SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd +  ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/        end -#     @files.uniq! +#     @files=@files.uniq        @act=opt_act        @files        self @@ -229,7 +230,7 @@ module SiSU_Commandline              fn = (y[r_f,1]) \                ? y[r_f,1]                : y -            fn.gsub!(/\.((?:ssm\.)?sst)/,'.-\1') +            fn=fn.gsub(/\.((?:ssm\.)?sst)/,'.-\1')              fullname=Dir.pwd + '/' + fn              pt=Pathname.new(fullname)              pth << Dir.pwd @@ -388,7 +389,7 @@ module SiSU_Commandline        end        ca=[]        unless c.empty? -        c.gsub!(/-/,'') +        c=c.gsub(/-/,'')          c.scan(/CC|\S/) {|x| ca << x}          cmd= '-' + ca.uniq.join        end diff --git a/lib/sisu/v3dv/param.rb b/lib/sisu/v3dv/param.rb index d8c65e8c..fc2ac877 100644 --- a/lib/sisu/v3dv/param.rb +++ b/lib/sisu/v3dv/param.rb @@ -82,7 +82,7 @@ module SiSU_Param          opt.fns        else opt.fns.gsub(/\.ssm$/,'.ssm.sst')        end -      Instantiate.new.param_instantiate +      SiSU_Param::Instantiate.new.param_instantiate        @env=SiSU_Env::InfoEnv.new(@fns)        @pstorefile="#{@env.processing_path.dal}/#{@fns}.pstore"      end @@ -113,8 +113,8 @@ module SiSU_Param          else            param_msg='Parameters extracted'            fns_array=@env.read_source_file(@opt.fns) -          md=Instructions.new(fns_array,@opt) -          @md=Instructions.new(fns_array,@opt).extract +          md=SiSU_Param::Parameters::Instructions.new(fns_array,@opt) +          @md=SiSU_Param::Parameters::Instructions.new(fns_array,@opt).extract            @md          end          if defined? @md.title.main # on removal check problems with -U @@ -179,7 +179,7 @@ module SiSU_Param        end        def name_format(name)          if name -          name.strip! +          name=name.strip            @name_a_h=[]            authors=name.scan(/[^;]+/)            authors.each_with_index do |a,i| @@ -776,8 +776,8 @@ module SiSU_Param            m=@h['bold']            i=(m=~/\/i$/)? 'i' : ''            z=if m -            x=m.gsub(/^\/(.+?)\/i?/,'\1') -            x.gsub!(/\((?:\?:)?/,'(?:')                                         # avoid need to escape use of brackets within regex provided +            x=m.gsub(/^\/(.+?)\/i?/,'\1'). +              gsub(/\((?:\?:)?/,'(?:')                                         # avoid need to escape use of brackets within regex provided              rgx='\b(' + x + ')\b'              y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/))              { str: '\b(?:' + x + ')\b', regx: y, i: i } @@ -789,8 +789,8 @@ module SiSU_Param            m=@h['italics']            i=((m=~/\/i$/) ? 'i' : '')            z=if m -            x=m.gsub(/^\/(.+?)\/i?/,'\1') -            x.gsub!(/\((?:\?:)?/,'(?:')                                         # avoid need to escape use of brackets within regex provided +            x=m.gsub(/^\/(.+?)\/i?/,'\1'). +              gsub(/\((?:\?:)?/,'(?:')                                         # avoid need to escape use of brackets within regex provided              rgx='\b(' + x + ')\b'              y=((i =~/i/) ? (/#{rgx}/i) : (/#{rgx}/))              { str: '\b(?:' + x + ')\b', regx: y, i: i } @@ -863,16 +863,16 @@ module SiSU_Param              end            end            if manpage['name'] -            manpage['name']=manpage['name'].join("\n.br\n") -            manpage['name'].gsub!(/(-)/m,"\\\\\\1") -            manpage['name'].gsub!(/\A/,"\n.br\n.SH NAME\n.br\n") +            manpage['name']=manpage['name'].join("\n.br\n"). +              gsub(/(-)/m,"\\\\\\1"). +              gsub(/\A/,"\n.br\n.SH NAME\n.br\n")            else              manpage['name']='man page "name/whatis" information not provided, set in header @man: name=[whatis information]'            end            if manpage['synopsis'] -            manpage['synopsis']=manpage['synopsis'].join("\n\n.br\n") -            manpage['synopsis'].gsub!(/(-)/m,"\\\\\\1") -            manpage['synopsis'].gsub!(/\A/,"\n.br\n.SH SYNOPSIS\n.br\n") +            manpage['synopsis']=manpage['synopsis'].join("\n\n.br\n"). +              gsub(/(-)/m,"\\\\\\1"). +              gsub(/\A/,"\n.br\n.SH SYNOPSIS\n.br\n")            else              manpage['synopsis']=''            end @@ -1096,27 +1096,27 @@ module SiSU_Param            and not @code_flag #or para=~/^(?:1|:?A)~/              case para              when /^@title:(.+)/m                                               #% * header metadata - title -              @title=Md.new($1.strip,@opt,@env).title +              @title=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).title              when /^@creator:(.+)/m                                             #% * header metadata - creator -              @creator=Md.new($1.strip,@opt,@env).creator +              @creator=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).creator                @authorship=@author=@creator.author                @authors=@creator.author_detail              when /^@date:(.+)/m                                                #% * header metadata - date -              @date=Md.new($1.strip,@opt,@env).date +              @date=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).date              when /^@publisher:\s+(.+)/m                                        #% * header metadata - publisher -              @publisher=Md.new($1.strip,@opt,@env).current_publisher +              @publisher=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).current_publisher                @current_publisher=@publisher              when /^@rights:(.+)/m;                                             #% * header metadata - rights -              @rights=Md.new($1.strip,@opt,@env).rights +              @rights=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).rights              when /^@classify:(.+)/m; classify=$1                               #% * header metadata - classify -              @classify=Md.new($1.strip,@opt,@env).classify +              @classify=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).classify              when /^@original:(.+)/m                                            #% * header metadata - original (document) -              @original=Md.new($1.strip,@opt,@env).original +              @original=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).original                @source=@original.source              when /^@notes?:\s(.+)\Z/m                                          #% * header metadata - notes -              @notes=Md.new($1.strip,@opt,@env).notes +              @notes=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).notes              when /^@links:\s+(.+?)\Z/m                                         #% * header metadata - links -              doc_links=Md.new($1.strip,@opt,@env).links +              doc_links=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).links                count=1                @links=[]                doc_links.each do |doc_link| @@ -1128,7 +1128,7 @@ module SiSU_Param                end                @lnk=@links              when /^@make:(.+)/m                                                #% * header processing - make -              @make=Md.new($1.strip,@opt,@env).make +              @make=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).make                if defined? @make.breaks \                and @make.breaks[:page_new]                  #clearpage                  @pagenew=@make.breaks[:page_new] @@ -1223,7 +1223,7 @@ module SiSU_Param                if not defined? @title.full.nil?                  tf=para[/^:A~\S*(.+)$/m,1]                  tf="@title: #{tf}" -                @title=Md.new(tf.strip,@opt,@env).title +                @title=SiSU_Param::Parameters::Md.new(tf.strip,@opt,@env).title                end                @html_title=@title.full.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'')                SiSU_Screen::Ansi.new(@opt.cmd,'Parameters',@html_title).txt_grey if @opt.cmd =~/v/ @@ -1272,7 +1272,7 @@ module SiSU_Param                end              end            end -          para.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image')                                                           # embedded symbol (image) +          para=para.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image')                                                           # embedded symbol (image)            if para !~/^%+\s/ \            and para =~@rgx_image              @ec[:image] << para.scan(@rgx_image).uniq @@ -1284,22 +1284,21 @@ module SiSU_Param            end          end                                                                    #% here endeth the document loop          if @ec[:image].length > 0 -          @ec[:image].flatten! -          @ec[:image].uniq! +          @ec[:image]=@ec[:image].flatten.uniq            @ec[:image].delete_if {|x| x =~/https?:\/\// } -          @ec[:image].sort! +          @ec[:image]=@ec[:image].sort          end -        @ec[:audio].uniq!; @ec[:audio].flatten!; @ec[:audio].sort! -        @ec[:multimedia].uniq!; @ec[:multimedia].flatten!; @ec[:multimedia].sort! +        @ec[:audio]=@ec[:audio].uniq.flatten.sort +        @ec[:multimedia]=@ec[:multimedia].uniq.flatten.sort          unless @rights            if defined? @creator.author \            and @creator.author \            and defined? @date.published \            and @date.published -            @rights=MdDefault.new.rights(@creator.author,@date.published) +            @rights=SiSU_Param::Parameters::MdDefault.new.rights(@creator.author,@date.published)            elsif defined? @creator.author \            and @creator.author -            @rights=MdDefault.new.rights("[#{@creator.author}]",'') +            @rights=SiSU_Param::Parameters::MdDefault.new.rights("[#{@creator.author}]",'')            end          end          if defined? @classify.topic_register \ @@ -1315,10 +1314,10 @@ module SiSU_Param               m[-1]=m[-1].scan(/[^|]+/) if m[-1] =~/[|]/               @topic_register_array << m             end -           @topic_register_array.sort! +           @topic_register_array=@topic_register_array.sort          end          if @i18n -          @i18n.uniq! +          @i18n=@i18n.uniq            @i18n << 'en' unless @i18n.find_index("en")          else            @i18n=[ 'en' ] @@ -1335,6 +1334,13 @@ module SiSU_Param                translate.gsub!(/:?C/,'3')                translate.gsub!(/:?B/,'2')                translate.gsub!(/:?A/,'1') +              # looks like an ok substituion for the above but is not, causes problems, check why +              #translate=translate.gsub(/3/,'6'). +              #  gsub(/2/,'5'). +              #  gsub(/1/,'4'). +              #  gsub(/:?C/,'3'). +              #  gsub(/:?B/,'2'). +              #  gsub(/:?A/,'1')                translate=if translate =~/^\d+$/; translate.to_i                else translate                end @@ -1342,10 +1348,10 @@ module SiSU_Param              end            end            @pagenew,@pagebreak,@num_top,@toc_lev_limit=translated -          @markup.gsub!(/page_new\s*=\s*([\dA-C])/,"page_new=#{@pagenew}") -          @markup.gsub!(/page_break\s*=\s*([\dA-C])/,"page_break=#{@pagebreak}") -          @markup.gsub!(/num_top\s*=\s*([\dA-C])/,"num_top=#{@num_top}") -          @markup.gsub!(/toc_lev_limit\s*=\s*([\dA-C])/,"toc_lev_limit=#{@toc_lev_limit}") +          @markup=@markup.gsub(/page_new\s*=\s*([\dA-C])/,"page_new=#{@pagenew}"). +            gsub(/page_break\s*=\s*([\dA-C])/,"page_break=#{@pagebreak}"). +            gsub(/num_top\s*=\s*([\dA-C])/,"num_top=#{@num_top}"). +            gsub(/toc_lev_limit\s*=\s*([\dA-C])/,"toc_lev_limit=#{@toc_lev_limit}")          end          if @opt.mod.inspect =~/--papersize[=-]\S+|--pdf[=-]\S+/ \          or  @opt.mod.inspect =~/--(?:a4|letter|legal|book|a5|b5)\b/i #command line config/header override @@ -1394,7 +1400,7 @@ module SiSU_Param  #         end  #         @lang << [lang[:n],"#{c[:a]}sisu_manifest#{c[:b]}.html#{c[:c]}"]  #       end if @flv -        @lang.uniq! +        @lang=@lang.uniq          @fn=SiSU_Env::EnvCall.new(@fns).lang(fn_set_lang[:c])          @identifier="#{@env.url.root}/#{@fnb}/#{@fn[:toc]}" #DC note constructed dc identifier          if @en[:note] > 0 \ @@ -1423,7 +1429,7 @@ module SiSU_Param          if @author !~/[\S]/            if @fns =~/\.ssm$/ \            and  @opt.inspect =~/P/ -            #@creator=Md.new('Text Insert',@opt,@env).creator +            #@creator=SiSU_Param::Md.new('Text Insert',@opt,@env).creator            else              SiSU_Screen::Ansi.new(@opt.cmd,'Warning Document Author missing','please provide @creator: :author:').warn unless @opt.cmd =~/q/            end diff --git a/lib/sisu/v3dv/plaintext.rb b/lib/sisu/v3dv/plaintext.rb index 9bef2c09..ba1cc48a 100644 --- a/lib/sisu/v3dv/plaintext.rb +++ b/lib/sisu/v3dv/plaintext.rb @@ -155,13 +155,13 @@ module SiSU_Plaintext            ? (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,4,1))            : (SiSU_TextUtils::Wrap.new(e.to_s,@wrap_width,1,1))            wrap=util.line_wrap -          if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m -            wrap.gsub!(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB +          wrap=if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m +            wrap.gsub(/^(\s*)([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB  \\1[\\2]: \\3  GSUB                        )            else -            wrap.gsub!(/^(.+)\Z/m, <<GSUB +            wrap.gsub(/^(.+)\Z/m, <<GSUB  \\1  GSUB                        ) @@ -279,66 +279,66 @@ WOK          table_message='[table omitted, see other document formats]'          fix=[]          data.each do |dob| -          dob.obj.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}") #fix -          dob.obj.gsub!(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,'')                              # remove dummy headings (used by html) #check also [~-]# -          dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, -            "#{Px[:bold_o]}\\1#{Px[:bold_c]}") -          dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/, -            "#{Px[:italics_o]}\\1#{Px[:italics_c]}") -          dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/, -            "#{Px[:underscore_o]}\\1#{Px[:underscore_c]}") -          dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/, -            "#{Px[:subscript_o]}\\1#{Px[:subscript_c]}") -          dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/, -            "#{Px[:superscript_o]}\\1#{Px[:superscript_c]}") -          dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/, -            "#{Px[:insert_o]}\\1#{Px[:insert_c]}") -          dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/, -            "#{Px[:cite_o]}\\1#{Px[:cite_c]}") -          dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/, -            "#{Px[:strike_o]}\\1#{Px[:strike_c]}") -          dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/, -            "#{Px[:monospace_o]}\\1#{Px[:monospace_c]}") +          dob.obj=dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}"). #fix +            gsub(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,'').                              # remove dummy headings (used by html) #check also [~-]# +            gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, +              "#{Px[:bold_o]}\\1#{Px[:bold_c]}"). +            gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/, +              "#{Px[:italics_o]}\\1#{Px[:italics_c]}"). +            gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/, +              "#{Px[:underscore_o]}\\1#{Px[:underscore_c]}"). +            gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/, +              "#{Px[:subscript_o]}\\1#{Px[:subscript_c]}"). +            gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/, +              "#{Px[:superscript_o]}\\1#{Px[:superscript_c]}"). +            gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/, +              "#{Px[:insert_o]}\\1#{Px[:insert_c]}"). +            gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/, +              "#{Px[:cite_o]}\\1#{Px[:cite_c]}"). +            gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/, +              "#{Px[:strike_o]}\\1#{Px[:strike_c]}"). +            gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/, +              "#{Px[:monospace_o]}\\1#{Px[:monospace_c]}")            unless dob.is=='code' -            dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1') -            dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') -            dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]') -            dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]') -            dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}") +            dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1'). +              gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). +              gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). +              gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). +              gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}")              extract_endnotes(dob) -            dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]') # endnote marker marked up -            dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]') # endnote marker marked up -            dob.obj.gsub!(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<') -            dob.obj.gsub!(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>') -            dob.obj.gsub!(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&') -            dob.obj.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') -            dob.obj.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') -            dob.obj.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') -            dob.obj.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') -            dob.obj.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') -            dob.obj.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') -            dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') -            dob.obj.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') -            dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') -            dob.obj.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©') -            dob.obj.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\') +            dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'[^\1]'). # endnote marker marked up +              gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'[^\1]'). # endnote marker marked up +              gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<'). +              gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>'). +              gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&'). +              gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!'). +              gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#'). +              gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*'). +              gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-'). +              gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/'). +              gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_'). +              gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'). +              gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}'). +              gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~'). +              gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©'). +              gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\')            end -          if dob.of=='block'                                   # watch -            dob.obj.gsub!(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* ") -            dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n") -          else dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n") +          dob.obj=if dob.of=='block'                                   # watch +            dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* "). +              gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n") +          else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n")            end            if dob.is=='code' -            dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _< -            dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_< +            dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _< +              gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<            end -          dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') -          dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1') -          dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'')                       # remove name links -          dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ')                                       # decide on -          dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'    [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") -          dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,'    [ \1 ]') -          dob.obj.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') +          dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). +            gsub(/<a href=".+?">(.+?)<\/a>/m,'\1'). +            gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'').                       # remove name links +            gsub(/ |#{Mx[:nbsp]}/,' ').                                       # decide on +            gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'    [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") +            gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,'    [ \1 ]'). +            gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')            wordlist=dob.obj.scan(/\S+/)            if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/              #if defined? dob.ocn and dob.ocn.to_s =~/\d+/ @@ -372,9 +372,11 @@ WOK                end # following empty line (@br) missing, fix              end              dob='' if (dob.obj =~/<a name="n\d+">/ \ -            and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote -            dob.obj.gsub!(/<!.+!>/,' ') if dob ## Clean Prepared Text -            dob.obj.gsub!(/<:\S+>/,' ') if dob ## Clean Prepared Text +              and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote +            if dob ## Clean Prepared Text +              dob.obj=dob.obj.gsub(/<!.+!>/,' '). +                gsub(/<:\S+>/,' ') +            end            end          end          @plaintext diff --git a/lib/sisu/v3dv/plaintext_format.rb b/lib/sisu/v3dv/plaintext_format.rb index 7aec6da6..f7956070 100644 --- a/lib/sisu/v3dv/plaintext_format.rb +++ b/lib/sisu/v3dv/plaintext_format.rb @@ -86,9 +86,9 @@ module SiSU_PlaintextFormat          p caller        end        rgx=/^#{Rx[:lv]}/ -      @txt.gsub!(rgx,'') if @txt =~rgx +      @txt=@txt.gsub(rgx,'') if @txt =~rgx        rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:en_a_c]}/ -      @txt.gsub!(rgx,'\1') if @txt =~rgx +      @txt=@txt.gsub(rgx,'\1') if @txt =~rgx        @vz=SiSU_Env::GetInit.instance.skin      end      def scr_endnote_body diff --git a/lib/sisu/v3dv/po4a.rb b/lib/sisu/v3dv/po4a.rb index a622aac9..945b07b8 100644 --- a/lib/sisu/v3dv/po4a.rb +++ b/lib/sisu/v3dv/po4a.rb @@ -74,7 +74,7 @@ module SiSU_Po4a        #  puts "#{@opt.fns} not a processed file type"        #end        r=Px[:lng_lst].join('|') -      r.gsub!(/\|en\|/,'|') +      r=r.gsub(/\|en\|/,'|')        @lang_regx=%r{(?:#{r})}        if opt.fns =~/\S+?~#{@lang_regx}\.ss[mti]/ \        and opt.f_pth[:lng]!=opt.lng_base @@ -187,9 +187,9 @@ module SiSU_Po4a          @n=[]          notes_a.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider            n=n.dup.to_s -          n.gsub!(/^([\d]+)\s+/,'^~\1 ') -          #n.gsub!(/^([\d*+]+)\s+/,'^~\1 ') -          n.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>') +          n=n.gsub(/^([\d]+)\s+/,'^~\1 '). +           #gsub(/^([\d*+]+)\s+/,'^~\1 '). +            gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>')            @n << n          end          notes_a=@n.flatten @@ -219,13 +219,13 @@ module SiSU_Po4a            end            util=pot_structure(desc,orig,trans)            wrap=util.line_wrap -          if wrap =~ /^\s*\^~[\d*+]+\s+.+?\s*\Z/m -            wrap.gsub!(/^\s*(\^~[\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB +          wrap=if wrap =~ /^\s*\^~[\d*+]+\s+.+?\s*\Z/m +            wrap.gsub(/^\s*(\^~[\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB  \\1 \\2  GSUB                        )            else -            wrap.gsub!(/^(.+)\Z/m, <<GSUB +            wrap.gsub(/^(.+)\Z/m, <<GSUB  \\1  GSUB                        ) @@ -681,9 +681,9 @@ GSUB          end          desc="#{d}#{s_mark}#{instruct}"          orig=dob_src.obj -        orig.gsub!(/#{Mx[:tc_c]}/,"\n") +        orig=orig.gsub(/#{Mx[:tc_c]}/,"\n")          trans=(dob_trn=='') ? '' : dob_trn.obj -        trans.gsub!(/#{Mx[:tc_c]}/,"\n") +        trans=trans.gsub(/#{Mx[:tc_c]}/,"\n")          util=pot_structure(desc,orig,trans)          unwrapped=util.no_line_wrap_block          @pot[:body] << unwrapped << @br @@ -829,79 +829,81 @@ GSUB            end            dob_src='' if (dob_src.obj =~/<a name="n\d+">/ \            and dob_src.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote -          dob_src.obj.gsub!(/<!.+!>/,' ') if dob_src ## Clean Prepared Text -          dob_src.obj.gsub!(/<:\S+>/,' ') if dob_src ## Clean Prepared Text +          if dob_src ## Clean Prepared Text +            dob_src.obj=dob_src.obj.gsub(/<!.+!>/,' '). +              gsub(/<:\S+>/,' ') if dob_src ## Clean Prepared Text +          end          end          #[dob_src,dob_trn]        end        def markup(dob)                                     # Used for major markup instructions          dir=SiSU_Env::InfoEnv.new(@md.fns)          fix=[] -          dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, -            "#{Px[:po_bold_o]}\\1#{Px[:po_bold_c]}") -          dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/, -            "#{Px[:po_italics_o]}\\1#{Px[:po_italics_c]}") -          dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/, -            "#{Px[:po_underscore_o]}\\1#{Px[:po_underscore_c]}") -          dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/, -            "#{Px[:po_subscript_o]}\\1#{Px[:po_subscript_c]}") -          dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/, -            "#{Px[:po_superscript_o]}\\1#{Px[:po_superscript_c]}") -          dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/, -            "#{Px[:po_insert_o]}\\1#{Px[:po_insert_c]}") -          dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/, -            "#{Px[:po_cite_o]}\\1#{Px[:po_cite_c]}") -          dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/, -            "#{Px[:po_strike_o]}\\1#{Px[:po_strike_c]}") -          dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/, -            "#{Px[:po_monospace_o]}\\1#{Px[:po_monospace_c]}") +          dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, +              "#{Px[:po_bold_o]}\\1#{Px[:po_bold_c]}"). +            gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/, +              "#{Px[:po_italics_o]}\\1#{Px[:po_italics_c]}"). +            gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/, +              "#{Px[:po_underscore_o]}\\1#{Px[:po_underscore_c]}"). +            gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/, +              "#{Px[:po_subscript_o]}\\1#{Px[:po_subscript_c]}"). +            gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/, +              "#{Px[:po_superscript_o]}\\1#{Px[:po_superscript_c]}"). +            gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/, +              "#{Px[:po_insert_o]}\\1#{Px[:po_insert_c]}"). +            gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/, +              "#{Px[:po_cite_o]}\\1#{Px[:po_cite_c]}"). +            gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/, +              "#{Px[:po_strike_o]}\\1#{Px[:po_strike_c]}"). +            gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/, +              "#{Px[:po_monospace_o]}\\1#{Px[:po_monospace_c]}")            notes=''            unless dob.is=='code' -            dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1') -            dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') -            dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]') -            dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]') -            dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1') +            dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1'). +              gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). +              gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). +              gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]'). +              gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1')              #dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}")              notes=extract_endnotes(dob)              #% ### footnotes current state - extracted -            dob.obj.gsub!(/#{Mx[:en_a_o]}([\d]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'~^')   # endnote marker marked up +            dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'~^').   # endnote marker marked up              #% ### footnotes current state - keep inline              #dob.obj.gsub!(/#{Mx[:en_a_o]}[\d]+\s+(.+?)#{Mx[:en_a_c]}/,'~{ \1 }~')     # inline endnote with marker marked up -            dob.obj.gsub!(/#{Mx[:en_b_o]}[\d]+\s+(.+?)#{Mx[:en_b_c]}/,'~[ \1 ]~')     # inline endnote with marker marked up -            dob.obj.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,'~{\1 \2 }~') # inline endnote with marker marked up -            dob.obj.gsub!(/#{Mx[:en_b_o]}([*+]+)\s+(.+?)#{Mx[:en_b_c]}/,'~[\1 \2 ]~') # inline endnote with marker marked up -            dob.obj.gsub!(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<') -            dob.obj.gsub!(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>') -            dob.obj.gsub!(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&') -            dob.obj.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') -            dob.obj.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') -            dob.obj.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') -            dob.obj.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') -            dob.obj.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') -            dob.obj.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') -            dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') -            dob.obj.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') -            dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') -            dob.obj.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©') +              gsub(/#{Mx[:en_b_o]}[\d]+\s+(.+?)#{Mx[:en_b_c]}/,'~[ \1 ]~').     # inline endnote with marker marked up +              gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,'~{\1 \2 }~'). # inline endnote with marker marked up +              gsub(/#{Mx[:en_b_o]}([*+]+)\s+(.+?)#{Mx[:en_b_c]}/,'~[\1 \2 ]~'). # inline endnote with marker marked up +              gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<'). +              gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>'). +              gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&'). +              gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!'). +              gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#'). +              gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*'). +              gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-'). +              gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/'). +              gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_'). +              gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'). +              gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}'). +              gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~'). +              gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')            end -          if dob.of=='block'                                   # watch -            dob.obj.gsub!(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* ") -            dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n") -          else dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n") +          dob.obj=if dob.of=='block'                                   # watch +            dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* "). +              gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n") +          else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n")            end            if dob.is=='code' -            dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _< -            dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_< +            dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _< +              gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<            end -          dob.obj.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'')                     # remove page breaks -          dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') -          dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1') -          dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'')                       # remove name links -          dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ')                                       # decide on -          dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'    [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") -          dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,'    [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") -          dob.obj.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') +          dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'').                     # remove page breaks +            gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). +            gsub(/<a href=".+?">(.+?)<\/a>/m,'\1'). +            gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'').                       # remove name links +            gsub(/ |#{Mx[:nbsp]}/,' ').                                       # decide on +            gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,'    [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") +            gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,'    [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]") +            gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')          [dob,notes]        end        def publish(fn,pot) @@ -934,8 +936,8 @@ GSUB            and para.length > 0              para.each do |line|                if line -                line.gsub!(/\s+$/m,'') -                line.gsub!(/^\A[ ]*\Z/m,'') +                line=line.gsub(/\s+$/m,''). +                  gsub(/^\A[ ]*\Z/m,'')                  if line=~/^\A[ ]*\Z/m                    emptyline+=1                  else emptyline=0 diff --git a/lib/sisu/v3dv/po4a_set.rb b/lib/sisu/v3dv/po4a_set.rb index e536a464..6335fb8c 100644 --- a/lib/sisu/v3dv/po4a_set.rb +++ b/lib/sisu/v3dv/po4a_set.rb @@ -76,8 +76,8 @@ module SiSU_Po4aUtils          out=[]          out[line]=''          @oldword='' #REMOVE @oldword -        pa.gsub!(/<br>/,' <br> ') -        pa.gsub!(/#{Mx[:br_nl]}/,"\n\n") +        pa=pa.gsub(/<br>/,' <br> '). +          gsub(/#{Mx[:br_nl]}/,"\n\n")          words=pa.scan(/\n\n|<br>|\S+/m)          while words != ''            word=words.shift @@ -109,7 +109,7 @@ module SiSU_Po4aUtils          x=out.join(spaces_indent).gsub(/\A\n+/m,'').insert(0,spaces_hang)          z=[]          x.split(/\n/).each do |y| -          y.gsub!(/"/,'\"') +          y=y.gsub(/"/,'\"')            y=%{"#{y}"}            z << y          end @@ -134,7 +134,7 @@ WOK        pot_array.each do |pa|          z=[]          pa.split(/\n\n/).each do |y| -          y.gsub!(/"/,'\"') +          y=y.gsub(/"/,'\"')            y=%{"#{y}"}            z << y if not y.empty?          end diff --git a/lib/sisu/v3dv/qrcode.rb b/lib/sisu/v3dv/qrcode.rb index b25504b0..49ef8ee3 100644 --- a/lib/sisu/v3dv/qrcode.rb +++ b/lib/sisu/v3dv/qrcode.rb @@ -215,7 +215,7 @@ WOK          #  "#{url}/sisu_manifest.#{lc}.html"          #end          manifests -        @m.uniq! +        @m=@m.uniq          @m        end        def languages(id,file) @@ -232,11 +232,11 @@ WOK          end        end        def metadata(id,info) -        info.to_s.gsub!(/#{Mx[:br_line]}/,"\n") +        info=info.to_s.gsub(/#{Mx[:br_line]}/,"\n")          @manifest[:txt] << %{#{id}: #{info}\n}        end        def md_title_info(id,info) -        info.to_s.gsub!(/#{Mx[:br_line]}/,"\n") +        info=info.to_s.gsub(/#{Mx[:br_line]}/,"\n")          @manifest[:txt_title] << %{#{info}\n}        end        def links(url,lnk,target) diff --git a/lib/sisu/v3dv/remote.rb b/lib/sisu/v3dv/remote.rb index 39e929cc..4004e5f8 100644 --- a/lib/sisu/v3dv/remote.rb +++ b/lib/sisu/v3dv/remote.rb @@ -143,10 +143,9 @@ module SiSU_Remote              end              if images \              and images.length > 1 -              images.flatten! -              images.uniq! +              images=images.flatten.uniq                images.delete_if {|x| x =~/https?:\/\// } -              images.sort! +              images=images.sort                @msg,@msgs='downloading images:', [ images.join(',') ]                @tell.call.warn unless @opt.cmd =~/q/                image_info=image_download_url + images diff --git a/lib/sisu/v3dv/shared_html_lite.rb b/lib/sisu/v3dv/shared_html_lite.rb index 5fd0a408..94413c69 100644 --- a/lib/sisu/v3dv/shared_html_lite.rb +++ b/lib/sisu/v3dv/shared_html_lite.rb @@ -109,16 +109,16 @@ module SiSU_FormatShared                %{<a href="#{u}">[#{png}]</a>#{caption}}              else %{[#{png}] #{caption}}              end -            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins) +            word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins)            else              u=case u              when /^https?:\/\//                u              when /^:/ -              u.gsub!(/^:/,'') +              u=u.gsub(/^:/,'')                "#{@env.url.root}/#{u}"              when /^\.\.\// # can remove -              u.gsub!(/^\.\.\//,'') +              u=u.gsub(/^\.\.\//,'')                "#{@env.url.root}/#{u}"              else                "#{@env.url.root}/#{@md.fnb}/#{map_nametags[u][:segname]}#{Sfx[:html]}##{u}" @@ -127,8 +127,8 @@ module SiSU_FormatShared              png=m.scan(/\S+/)[0].strip              link=link.strip              ins=%{<a href="#{u}">#{link}</a>} -            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins) -            word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins) +            word=word.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,ins). +              gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,ins)              word            end            word @@ -140,32 +140,32 @@ module SiSU_FormatShared      end      def markup_generic(s)        s=s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') -      s=s.gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') -      s=s.gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') -      s=s.gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"') -      s=s.gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+') -      s=s.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-') -      s=s.gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>') -      s=s.gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>') -      s=s.gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>') # tt, kbd -      s=s.gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~') +        gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). +        gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). +        gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"'). +        gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+'). +        gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-'). +        gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>'). +        gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>'). +        gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd +        gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')      end      def markup_object(t_o)        s=t_o.obj -      if t_o.is !='code' +      s=if t_o.is !='code'          s=markup_generic(s)          if s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/            wm=s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)|\S+/)            words=urls(wm) -          s.gsub!(/.+/m,words) +          s=s.gsub(/.+/m,words)          end -        s.gsub!(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;') -        s.gsub!(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;') -        s.gsub!(/#{Mx[:url_o]}[_\\](\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #http ftp matches escaped, no decoration -        s.gsub!(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>') #special case \{ e.g. \}http://url -        s.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{\\1#{@brace_url.xml_open}<a href="\\2" target="_top">\\2</a>#{@brace_url.xml_close}\\3}) #http ftp matches with decoration +        s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). +          gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). +          gsub(/#{Mx[:url_o]}[_\\](\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration +          gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>'). #special case \{ e.g. \}http://url +          gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{\\1#{@brace_url.xml_open}<a href="\\2" target="_top">\\2</a>#{@brace_url.xml_close}\\3}) #http ftp matches with decoration        else -        s.gsub!(/</m,'<'); s.gsub!(/>/m,'>') +        s.gsub(/</m,'<'); s.gsub!(/>/m,'>')        end        s      end @@ -176,11 +176,11 @@ module SiSU_FormatShared          words=urls(wm)          s=s.gsub(/.+/m,words)        end -      s=s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;') -      s=s.gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;') -      s=s.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration -      s=s.gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>') #special case \{ e.g. \}http://url -      s=s.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration +      s=s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). +        gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). +        gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>\2'). #http ftp matches escaped, no decoration +        gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>'). #special case \{ e.g. \}http://url +        gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@brace_url.xml_close}}) #http ftp matches with decoration      end      def paragraph        %{<p class="h#{@lv}" type="substantive" header="#{@hname}">#{@txt}</p>\n} # << "\n" @@ -252,39 +252,39 @@ GSUB        @txt.split(/\n/).each do |parablock|          m=parablock[/<!f(.+?)!>/,1]          @@tablefoot << m if m -        parablock.gsub!(/<!f.+?!>/,'') +        parablock=parablock.gsub(/<!f.+?!>/,'')          @@tablehead=1 if parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u -        parablock.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+)#{Mx[:gr_c]}/, -           %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">}) +        parablock=parablock.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+)#{Mx[:gr_c]}/, +          %{<table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">})          if parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/            tablefoot=[]            @@tablefoot.each {|x| tablefoot << %{<p align="center"><font size=2><i>#{x}</i></font></p>\n}}            @@tablefoot=[] -          parablock.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/, +          parablock=parablock.gsub(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,              %{#{@vz.table_close}\n}) # +          end          if @@tablehead==1            if parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u -            parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, -              %{\n<tr>} + -              %{\n<td width="\\1%" valign="top">} + -              %{#{para_table}<b>}) -            parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, -              %{</b></td><td width="\\1%" valign="top">} + -              %{#{para_table}<b>}) -            parablock.gsub!(/#{Mx[:tc_c]}/, '</b></td></tr>') +            parablock=parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, +                %{\n<tr>} + +                %{\n<td width="\\1%" valign="top">} + +                %{#{para_table}<b>}). +              gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, +                %{</b></td><td width="\\1%" valign="top">} + +                %{#{para_table}<b>}). +              gsub(/#{Mx[:tc_c]}/, '</b></td></tr>')              @@tablehead=0            end            parablock          else -          parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, -            %{\n<tr>} + -            %{\n<td width="\\1%" valign="top">} + -            %{#{para_table}}) -          parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, -            %{</td><td width="\\1%" valign="top">} + -            %{#{para_table}}) -          parablock.gsub!(/#{Mx[:tc_c]}/, '</td></tr>') +          parablock=parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, +              %{\n<tr>} + +              %{\n<td width="\\1%" valign="top">} + +              %{#{para_table}}). +            gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, +              %{</td><td width="\\1%" valign="top">} + +              %{#{para_table}}). +            gsub(/#{Mx[:tc_c]}/, '</td></tr>')            parablock          end          @new_content << parablock diff --git a/lib/sisu/v3dv/shared_markup_alt.rb b/lib/sisu/v3dv/shared_markup_alt.rb index 27092050..9719dd3e 100644 --- a/lib/sisu/v3dv/shared_markup_alt.rb +++ b/lib/sisu/v3dv/shared_markup_alt.rb @@ -68,61 +68,61 @@ module SiSU_TextRepresentation      def strip_clean_of_extra_spaces                                              # dal output tuned        @s=@s.dup        @s=@s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless @s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ -      @s=@s.gsub(/ [ ]+/,' ') -      @s=@s.gsub(/^ [ ]+/,'') -      @s=@s.gsub(/ [ ]+$/,'') -      @s=@s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') -      @s=@s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') +      @s=@s.gsub(/ [ ]+/,' '). +        gsub(/^ [ ]+/,''). +        gsub(/ [ ]+$/,''). +        gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2'). +        gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')      end      def strip_clean_of_markup                                                  # text form used in sql db search, used for digest, define rules, make same as in db clean        @s=@s.dup                                                                  #% same as db clean --> -      @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') -      @s=@s.gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') -      @s=@s.gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') -      @s=@s.gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1') -      @s=@s.gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1') -      @s=@s.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'\1') -      @s=@s.gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]') -      @s=@s.gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') -      @s=@s.gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1') -      @s=@s.gsub(/#{Mx[:fa_hilite_o]}(.+?)#{Mx[:fa_hilite_c]}/,'\1') -      @s=@s.gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~') -      @s=@s.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'') # endnote removed -      @s=@s.gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'') # endnote removed -      @s=@s.gsub(/(?:#{Mx[:nbsp]})+/,' ') -      @s=@s.gsub(/(?:#{Mx[:br_nl]})+/,"\n") -      @s=@s.gsub(/(?:#{Mx[:br_paragraph]})+/,"\n") -      @s=@s.gsub(/(?:#{Mx[:br_line]})+/,"\n") -      @s=@s.gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<') -      @s=@s.gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>') -      @s=@s.gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&') -      @s=@s.gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') -      @s=@s.gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') -      @s=@s.gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') -      @s=@s.gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') -      @s=@s.gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') -      @s=@s.gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') -      @s=@s.gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') -      @s=@s.gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') -      @s=@s.gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') -      @s=@s.gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©') -      @s=@s.gsub(/\s\s+/,' ') -      @s=@s.gsub(/\s\s+/,' ') -      @s=@s.strip +      @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1'). +        gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1'). +        gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1'). +        gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1'). +        gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1'). +        gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'\1'). +        gsub(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]'). +        gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1'). +        gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1'). +        gsub(/#{Mx[:fa_hilite_o]}(.+?)#{Mx[:fa_hilite_c]}/,'\1'). +        gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~'). +        gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,''). # endnote removed +        gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,''). # endnote removed +        gsub(/(?:#{Mx[:nbsp]})+/,' '). +        gsub(/(?:#{Mx[:br_nl]})+/,"\n"). +        gsub(/(?:#{Mx[:br_paragraph]})+/,"\n"). +        gsub(/(?:#{Mx[:br_line]})+/,"\n"). +        gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<'). +        gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>'). +        gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&'). +        gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!'). +        gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#'). +        gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*'). +        gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-'). +        gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/'). +        gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_'). +        gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'). +        gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}'). +        gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~'). +        gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©'). +        gsub(/\s\s+/,' '). +        gsub(/\s\s+/,' '). +        strip      end      def semi_revert_markup                                             # used for digest, define rules, make same as in db clean        if @t_o -        @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*{\1}*') -        @s=@s.gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/{\1}/') -        @s=@s.gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_{\1}_') -        @s=@s.gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"{\1}"') -        @s=@s.gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+') -        @s=@s.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-') -        @s=@s.gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^{\1}^') -        @s=@s.gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,',{\1},') -        @s=@s.gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~') -        @s=@s.gsub(/#{Mx[:en_a_o]}([\d*+]+\s+.+?)#{Mx[:en_a_c]}/,'~{\1}~') # endnote marker marked up -        @s=@s.gsub(/#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/,'~[\1]~') # endnote marker marked up +        @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*{\1}*'). +          gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/{\1}/'). +          gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_{\1}_'). +          gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"{\1}"'). +          gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+'). +          gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-'). +          gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^{\1}^'). +          gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,',{\1},'). +          gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~'). +          gsub(/#{Mx[:en_a_o]}([\d*+]+\s+.+?)#{Mx[:en_a_c]}/,'~{\1}~'). # endnote marker marked up +          gsub(/#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/,'~[\1]~') # endnote marker marked up          if @t_o.is=='heading' or @t_o.is=='para'            @s=@s.gsub(/ [ ]+/,' ')            @s=@s.gsub(/(?:#{Mx[:nbsp]})+/,' ') @@ -153,28 +153,28 @@ module SiSU_TextRepresentation      end      def html_lite #test whether eventually can be used in db_import replacing shared_html_lite (search for SiSU_FormatShared)        if @t_o -        @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') -        @s=@s.gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') -        @s=@s.gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') -        @s=@s.gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"') -        @s=@s.gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+') -        @s=@s.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-') -        @s=@s.gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>') -        @s=@s.gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>') -        @s=@s.gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~') +        @s=@s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). +          gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). +          gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). +          gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"'). +          gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+{\1}+'). +          gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strke_c]}/,'-{\1}-'). +          gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>'). +          gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>'). +          gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')          if @t_o.is !='code'            if @s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/              wm=@s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)|\S+/)              words=urls(wm)              @s=@s.gsub(/.+/m,words)            end -          @s=@s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;') -          @s=@s.gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;') -          @s=@s.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #http ftp matches escaped, no decoration -          @s=@s.gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url -          @s=@s.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@url_brace.xml_open}<a href="\\1" target="_top">\\1</a>#{@url_brace.xml_close}}) #http ftp matches with decoration +          @s=@s.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). +            gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). +            gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>'). #http ftp matches escaped, no decoration +            gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1<a href="\2" target="_top">\2</a>\3'). #special case \{ e.g. \}http://url +            gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@url_brace.xml_open}<a href="\\1" target="_top">\\1</a>#{@url_brace.xml_close}}) #http ftp matches with decoration          else -          @s=@s.gsub(/</m,'<'); @s.gsub(/>/m,'>') +          @s=@s.gsub(/</m,'<').gsub(/>/m,'>')          end          if @t_o.is=='paragraph'            if @t_o.bullet_ diff --git a/lib/sisu/v3dv/shared_metadata.rb b/lib/sisu/v3dv/shared_metadata.rb index f3834059..56856116 100644 --- a/lib/sisu/v3dv/shared_metadata.rb +++ b/lib/sisu/v3dv/shared_metadata.rb @@ -434,7 +434,7 @@ module SiSU_Metadata              @md.creator.author_detail.each do |n|                x += "#{n[:the]}, #{n[:others]}; "              end -            x.gsub!(/;\s*$/,'') +            x=x.gsub(/;\s*$/,'')              ' :author: ' + x            else nil            end @@ -446,7 +446,7 @@ module SiSU_Metadata              @md.creator.contributor_detail.each do |n|                x += "#{n[:the]}, #{n[:others]}; "              end -            x.gsub!(/;\s*$/,'') +            x=x.gsub(/;\s*$/,'')              ' :contributor: ' + x            else nil            end @@ -458,7 +458,7 @@ module SiSU_Metadata              @md.creator.illustrator_detail.each do |n|                x += "#{n[:the]}, #{n[:others]}; "              end -            x.gsub!(/;\s*$/,'') +            x=x.gsub(/;\s*$/,'')              ' :illustrator: ' + x            else nil            end @@ -470,7 +470,7 @@ module SiSU_Metadata              @md.creator.photographer_detail.each do |n|                x += "#{n[:the]}, #{n[:others]}; "              end -            x.gsub!(/;\s*$/,'') +            x=x.gsub(/;\s*$/,'')              ' :photographer: ' + x            else nil            end @@ -482,7 +482,7 @@ module SiSU_Metadata              @md.creator.translator_detail.each do |n|                x += "#{n[:the]}, #{n[:others]}; "              end -            x.gsub!(/;\s*$/,'') +            x=x.gsub(/;\s*$/,'')              ' :translator: ' + x            else nil            end @@ -494,7 +494,7 @@ module SiSU_Metadata              @md.creator.audio_detail.each do |n|                x += "#{n[:the]}, #{n[:others]}; "              end -            x.gsub!(/;\s*$/,'') +            x=x.gsub(/;\s*$/,'')              ' :audio: ' + x            else nil            end @@ -506,7 +506,7 @@ module SiSU_Metadata              @md.creator.digitized_by_detail.each do |n|                x += "#{n[:the]}, #{n[:others]}; "              end -            x.gsub!(/;\s*$/,'') +            x=x.gsub(/;\s*$/,'')              ' :digitized_by: ' + x            else nil            end @@ -518,7 +518,7 @@ module SiSU_Metadata              @md.creator.prepared_by_detail.each do |n|                x += "#{n[:the]}, #{n[:others]}; "              end -            x.gsub!(/;\s*$/,'') +            x=x.gsub(/;\s*$/,'')              ' :prepared_by: ' + x            else nil            end @@ -736,107 +736,107 @@ module SiSU_Metadata        def utf8          if @s \          and @s.class==String -          @s.gsub!(/<br(?: \/)?>/u,Mx[:br_paragraph]) -          @s.gsub!(/</um,'<') # '<'   # < -          @s.gsub!(/</um,'<') # '<'   # < -          @s.gsub!(/>/um,'>') # '>'   # > -          @s.gsub!(/¢/um,'¢') # '¢'   # ¢ -          @s.gsub!(/£/um,'£') # '£'  # £ -          @s.gsub!(/¥/um,'¥') # '¥'    # ¥ -          @s.gsub!(/§/um,'§') # '§'   # § -          @s.gsub!(/©/um,'©') # '©'   # © -          @s.gsub!(/ª/um,'ª') # 'ª'   # ª -          @s.gsub!(/«/um,'«') # '«'  # « -          @s.gsub!(/®/um,'®') # '®'    # ® -          @s.gsub!(/°/um,'°') # '°'    # ° -          @s.gsub!(/±/um,'±') # '±' # ± -          @s.gsub!(/²/um,'²') # '²'   # ² -          @s.gsub!(/³/um,'³') # '³'   # ³ -          @s.gsub!(/µ/um,'µ') # 'µ'  # µ -          @s.gsub!(/¶/um,'¶') # '¶'   # ¶ -          @s.gsub!(/¹/um,'¹') # '¹'   # ¹ -          @s.gsub!(/º/um,'º') # 'º'   # º -          @s.gsub!(/»/um,'»') # '»'  # » -          @s.gsub!(/¼/um,'¼') # '¼' # ¼ -          @s.gsub!(/½/um,'½') # '½' # ½ -          @s.gsub!(/¾/um,'¾') # '¾' # ¾ -          @s.gsub!(/×/um,'×') # '×'  # × -          @s.gsub!(/÷/um,'÷') # '÷' # ÷ -          @s.gsub!(/¿/um,'¿') # '¿' # ¿ -          @s.gsub!(/À/um,'À') # 'À' # À -          @s.gsub!(/Á/um,'Á') # 'Á' # Á -          @s.gsub!(/Â/um,'Â') # 'Â'  #  -          @s.gsub!(/Ã/um,'Ã') # 'Ã' # à -          @s.gsub!(/Ä/um,'Ä') # 'Ä'   # Ä -          @s.gsub!(/Å/um,'Å') # 'Å'  # Å -          @s.gsub!(/Æ/um,'Æ') # 'Æ'  # Æ -          @s.gsub!(/Ç/um,'Ç') # 'Ç' # Ç -          @s.gsub!(/È/um,'È') # 'È' # È -          @s.gsub!(/É/um,'É') # 'É' # É -          @s.gsub!(/Ê/um,'Ê') # 'Ê'  # Ê -          @s.gsub!(/Ë/um,'Ë') # 'Ë'   # Ë -          @s.gsub!(/Ì/um,'Ì') # 'Ì' # Ì -          @s.gsub!(/Í/um,'Í') # 'Í' # Í -          @s.gsub!(/Î/um,'Î') # 'Î'  # Î -          @s.gsub!(/Ï/um,'Ï') # 'Ï'   # Ï -          @s.gsub!(/Ð/um,'Ð') # 'Ð'    # Ð -          @s.gsub!(/Ñ/um,'Ñ') # 'Ñ' # Ñ -          @s.gsub!(/Ò/um,'Ò') # 'Ò' # Ò -          @s.gsub!(/Ó/um,'Ó') # 'Ó' # Ó -          @s.gsub!(/Ô/um,'Ô') # 'Ô'  # Ô -          @s.gsub!(/Õ/um,'Õ') # 'Õ' # Õ -          @s.gsub!(/Ö/um,'Ö') # 'Ö'   # Ö -          @s.gsub!(/Ø/um,'Ø') # 'Ø' # Ø -          @s.gsub!(/Ù/um,'Ù') # 'Ù' # Ù -          @s.gsub!(/Ú/um,'Ú') # 'Ú' # Ú -          @s.gsub!(/Û/um,'Û') # 'Û'  # Û -          @s.gsub!(/Ü/um,'Ü') # 'Ü'   # Ü -          @s.gsub!(/Ý/um,'Ý') # 'Ý' # Ý -          @s.gsub!(/Þ/um,'Þ') # 'Þ'  # Þ -          @s.gsub!(/ß/um,'ß') # 'ß'  # ß -          @s.gsub!(/à/um,'à') # 'à' # à -          @s.gsub!(/á/um,'á') # 'á' # á -          @s.gsub!(/â/um,'â') # 'â'  # â -          @s.gsub!(/ã/um,'ã') # 'ã' # ã -          @s.gsub!(/ä/um,'ä') # 'ä'   # ä -          @s.gsub!(/å/um,'å') # 'å'  # å -          @s.gsub!(/æ/um,'æ') # 'æ'  # æ -          @s.gsub!(/ç/um,'ç') # 'ç' # ç -          @s.gsub!(/è/um,'è') # 'è' # è -          @s.gsub!(/é/um,'é') # '´'  # é -          @s.gsub!(/ê/um,'ê') # 'ˆ'   # ê -          @s.gsub!(/ë/um,'ë') # 'ë'   # ë -          @s.gsub!(/ì/um,'ì') # 'ì' # ì -          @s.gsub!(/í/um,'í') # '´'  # í -          @s.gsub!(/î/um,'î') # 'î'  # î -          @s.gsub!(/ï/um,'ï') # 'ï'   # ï -          @s.gsub!(/ð/um,'ð') # 'ð'    # ð -          @s.gsub!(/ñ/um,'ñ') # 'ñ' # ñ -          @s.gsub!(/ò/um,'ò') # 'ò' # ò -          @s.gsub!(/ó/um,'ó') # 'ó' # ó -          @s.gsub!(/ô/um,'ô') # 'ô'  # ô -          @s.gsub!(/õ/um,'õ') # 'õ' # õ -          @s.gsub!(/ö/um,'ö') # 'ö'   # ö -          @s.gsub!(/ø/um,'ø') # 'ø' # ø -          @s.gsub!(/ù/um,'ú') # 'ù' # ú -          @s.gsub!(/ú/um,'û') # 'ú' # û -          @s.gsub!(/û/um,'ü') # 'û'  # ü -          @s.gsub!(/ü/um,'ý') # 'ü'   # ý -          @s.gsub!(/þ/um,'þ') # 'þ'  # þ -          @s.gsub!(/ÿ/um,'ÿ') # 'ÿ'   # ÿ -          @s.gsub!(/‘/um,'‘') # '‘' # ‘ -          @s.gsub!(/’/um,'’') # '’' # ’ -          @s.gsub!(/“/um,'“') # “   # “ -          @s.gsub!(/”/um,'”') # ”   # ” -          @s.gsub!(/–/um,'–') # –   # – -          @s.gsub!(/—/um,'—') # —   # — -          @s.gsub!(/∝/um,'∝') # ∝    # ∝ -          @s.gsub!(/∞/um,'∞') # ∞   # ∞ -          @s.gsub!(/™/um,'™') # ™   # ™ -          @s.gsub!(/✠/um,'✠') # ✗  # ✠ -          @s.gsub!(/ /um,' ')       # space identify -          @s.gsub!(/ /um,' ')       # space identify -          @s.gsub!(/#{Mx[:br_paragraph]}/u,'<br />') +          @s=@s.gsub(/<br(?: \/)?>/u,Mx[:br_paragraph]). +            gsub(/</um,'<'). # '<'   # < +            gsub(/</um,'<'). # '<'   # < +            gsub(/>/um,'>'). # '>'   # > +            gsub(/¢/um,'¢'). # '¢'   # ¢ +            gsub(/£/um,'£'). # '£'  # £ +            gsub(/¥/um,'¥'). # '¥'    # ¥ +            gsub(/§/um,'§'). # '§'   # § +            gsub(/©/um,'©'). # '©'   # © +            gsub(/ª/um,'ª'). # 'ª'   # ª +            gsub(/«/um,'«'). # '«'  # « +            gsub(/®/um,'®'). # '®'    # ® +            gsub(/°/um,'°'). # '°'    # ° +            gsub(/±/um,'±'). # '±' # ± +            gsub(/²/um,'²'). # '²'   # ² +            gsub(/³/um,'³'). # '³'   # ³ +            gsub(/µ/um,'µ'). # 'µ'  # µ +            gsub(/¶/um,'¶'). # '¶'   # ¶ +            gsub(/¹/um,'¹'). # '¹'   # ¹ +            gsub(/º/um,'º'). # 'º'   # º +            gsub(/»/um,'»'). # '»'  # » +            gsub(/¼/um,'¼'). # '¼' # ¼ +            gsub(/½/um,'½'). # '½' # ½ +            gsub(/¾/um,'¾'). # '¾' # ¾ +            gsub(/×/um,'×'). # '×'  # × +            gsub(/÷/um,'÷'). # '÷' # ÷ +            gsub(/¿/um,'¿'). # '¿' # ¿ +            gsub(/À/um,'À'). # 'À' # À +            gsub(/Á/um,'Á'). # 'Á' # Á +            gsub(/Â/um,'Â'). # 'Â'  #  +            gsub(/Ã/um,'Ã'). # 'Ã' # à +            gsub(/Ä/um,'Ä'). # 'Ä'   # Ä +            gsub(/Å/um,'Å'). # 'Å'  # Å +            gsub(/Æ/um,'Æ'). # 'Æ'  # Æ +            gsub(/Ç/um,'Ç'). # 'Ç' # Ç +            gsub(/È/um,'È'). # 'È' # È +            gsub(/É/um,'É'). # 'É' # É +            gsub(/Ê/um,'Ê'). # 'Ê'  # Ê +            gsub(/Ë/um,'Ë'). # 'Ë'   # Ë +            gsub(/Ì/um,'Ì'). # 'Ì' # Ì +            gsub(/Í/um,'Í'). # 'Í' # Í +            gsub(/Î/um,'Î'). # 'Î'  # Î +            gsub(/Ï/um,'Ï'). # 'Ï'   # Ï +            gsub(/Ð/um,'Ð'). # 'Ð'    # Ð +            gsub(/Ñ/um,'Ñ'). # 'Ñ' # Ñ +            gsub(/Ò/um,'Ò'). # 'Ò' # Ò +            gsub(/Ó/um,'Ó'). # 'Ó' # Ó +            gsub(/Ô/um,'Ô'). # 'Ô'  # Ô +            gsub(/Õ/um,'Õ'). # 'Õ' # Õ +            gsub(/Ö/um,'Ö'). # 'Ö'   # Ö +            gsub(/Ø/um,'Ø'). # 'Ø' # Ø +            gsub(/Ù/um,'Ù'). # 'Ù' # Ù +            gsub(/Ú/um,'Ú'). # 'Ú' # Ú +            gsub(/Û/um,'Û'). # 'Û'  # Û +            gsub(/Ü/um,'Ü'). # 'Ü'   # Ü +            gsub(/Ý/um,'Ý'). # 'Ý' # Ý +            gsub(/Þ/um,'Þ'). # 'Þ'  # Þ +            gsub(/ß/um,'ß'). # 'ß'  # ß +            gsub(/à/um,'à'). # 'à' # à +            gsub(/á/um,'á'). # 'á' # á +            gsub(/â/um,'â'). # 'â'  # â +            gsub(/ã/um,'ã'). # 'ã' # ã +            gsub(/ä/um,'ä'). # 'ä'   # ä +            gsub(/å/um,'å'). # 'å'  # å +            gsub(/æ/um,'æ'). # 'æ'  # æ +            gsub(/ç/um,'ç'). # 'ç' # ç +            gsub(/è/um,'è'). # 'è' # è +            gsub(/é/um,'é'). # '´'  # é +            gsub(/ê/um,'ê'). # 'ˆ'   # ê +            gsub(/ë/um,'ë'). # 'ë'   # ë +            gsub(/ì/um,'ì'). # 'ì' # ì +            gsub(/í/um,'í'). # '´'  # í +            gsub(/î/um,'î'). # 'î'  # î +            gsub(/ï/um,'ï'). # 'ï'   # ï +            gsub(/ð/um,'ð'). # 'ð'    # ð +            gsub(/ñ/um,'ñ'). # 'ñ' # ñ +            gsub(/ò/um,'ò'). # 'ò' # ò +            gsub(/ó/um,'ó'). # 'ó' # ó +            gsub(/ô/um,'ô'). # 'ô'  # ô +            gsub(/õ/um,'õ'). # 'õ' # õ +            gsub(/ö/um,'ö'). # 'ö'   # ö +            gsub(/ø/um,'ø'). # 'ø' # ø +            gsub(/ù/um,'ú'). # 'ù' # ú +            gsub(/ú/um,'û'). # 'ú' # û +            gsub(/û/um,'ü'). # 'û'  # ü +            gsub(/ü/um,'ý'). # 'ü'   # ý +            gsub(/þ/um,'þ'). # 'þ'  # þ +            gsub(/ÿ/um,'ÿ'). # 'ÿ'   # ÿ +            gsub(/‘/um,'‘'). # '‘' # ‘ +            gsub(/’/um,'’'). # '’' # ’ +            gsub(/“/um,'“'). # “   # “ +            gsub(/”/um,'”'). # ”   # ” +            gsub(/–/um,'–'). # –   # – +            gsub(/—/um,'—'). # —   # — +            gsub(/∝/um,'∝'). # ∝    # ∝ +            gsub(/∞/um,'∞'). # ∞   # ∞ +            gsub(/™/um,'™'). # ™   # ™ +            gsub(/✠/um,'✠'). # ✗  # ✠ +            gsub(/ /um,' ').       # space identify +            gsub(/ /um,' ').       # space identify +            gsub(/#{Mx[:br_paragraph]}/u,'<br />')          end          @s        end @@ -910,32 +910,32 @@ WOK        def meta_para          url_brace=SiSU_Viz::Skin.new.url_decoration          if @inf.class==String -          @inf.gsub!(/</,'<'); @inf.gsub!(/>/,'>') -          @inf.gsub!(/<br(?: \/)?>/,'<br />') +          @inf=@inf.gsub(/</,'<').gsub(/>/,'>'). +            gsub(/<br(?: \/)?>/,'<br />')            if @inf =~/&/              inf_array=[]              word=@inf.scan(/\S+|\n/)              word.each do |w| # _ - / # | : ! ^ ~ -              w.gsub!(/ /,' ') +              w=w.gsub(/ /,' ')                if w !~/&\S{2,7}?;/ -                w.gsub!(/&/,'&') +                w=w.gsub(/&/,'&')                end                inf_array << w              end              @inf=inf_array.join(' ')            end -          @inf.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, -            '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration -          @inf.gsub!(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, -            '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>') #special case \{ e.g. \}http://url -          if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/ -            @inf.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, +          @inf=@inf.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, +              '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration +            gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, +              '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>') #special case \{ e.g. \}http://url +          @inf=if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/ +            @inf.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,                %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration            else -            @inf.gsub!(/(https?:\/\/[^<>()'"\s]+)/, +            @inf.gsub(/(https?:\/\/[^<>()'"\s]+)/,                %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration            end -          @inf.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, +          @inf=@inf.gsub(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,              %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol          end          <<WOK diff --git a/lib/sisu/v3dv/shared_txt.rb b/lib/sisu/v3dv/shared_txt.rb index c59e1866..4afddc05 100644 --- a/lib/sisu/v3dv/shared_txt.rb +++ b/lib/sisu/v3dv/shared_txt.rb @@ -70,8 +70,8 @@ module SiSU_TextUtils        line=0        out=[]        out[line]='' -      @para.gsub!(/<br>/,' <br> ') -      @para.gsub!(/#{Mx[:br_nl]}/,"\n\n") +      @para=@para.gsub(/<br>/,' <br> '). +        gsub(/#{Mx[:br_nl]}/,"\n\n")        words=@para.scan(/\n\n|<br>|\S+/m)        while words != ''          word=words.shift diff --git a/lib/sisu/v3dv/shared_xml.rb b/lib/sisu/v3dv/shared_xml.rb index 78611ccc..dbaed6d8 100644 --- a/lib/sisu/v3dv/shared_xml.rb +++ b/lib/sisu/v3dv/shared_xml.rb @@ -116,399 +116,404 @@ module SiSU_XML_Munge            if str              #¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûü              #¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷ -            str.gsub!(/</um,'<')    # '<'     # < -            str.gsub!(/>/um,'>')    # '>'     # > -            str.gsub!(/¢/um,'¢')   # '¢'   # ¢ -            str.gsub!(/£/um,'£')   # '£'  # £ -            str.gsub!(/¥/um,'¥')   # '¥'    # ¥ -            str.gsub!(/§/um,'§')   # '§'   # § -            str.gsub!(/©/um,'©')   # '©'   # © -            str.gsub!(/ª/um,'ª')   # 'ª'   # ª -            str.gsub!(/«/um,'«')   # '«'  # « -            str.gsub!(/®/um,'®')   # '®'    # ® -            str.gsub!(/°/um,'°')   # '°'    # ° -            str.gsub!(/±/um,'±')   # '±' # ± -            str.gsub!(/²/um,'²')   # '²'   # ² -            str.gsub!(/³/um,'³')   # '³'   # ³ -            str.gsub!(/µ/um,'µ')   # 'µ'  # µ -            str.gsub!(/¶/um,'¶')   # '¶'   # ¶ -            str.gsub!(/¹/um,'¹')   # '¹'   # ¹ -            str.gsub!(/º/um,'º')   # 'º'   # º -            str.gsub!(/»/um,'»')   # '»'  # » -            str.gsub!(/¼/um,'¼')   # '¼' # ¼ -            str.gsub!(/½/um,'½')   # '½' # ½ -            str.gsub!(/¾/um,'¾')   # '¾' # ¾ -            str.gsub!(/×/um,'×')   # '×'  # × -            str.gsub!(/÷/um,'÷')   # '÷' # ÷ -            str.gsub!(/¿/um,'¿')   # '¿' # ¿ -            str.gsub!(/À/um,'À')   # 'À' # À -            str.gsub!(/Á/um,'Á')   # 'Á' # Á -            str.gsub!(/Â/um,'Â')   # 'Â'  #  -            str.gsub!(/Ã/um,'Ã')   # 'Ã' # à -            str.gsub!(/Ä/um,'Ä')   # 'Ä'   # Ä -            str.gsub!(/Å/um,'Å')   # 'Å'  # Å -            str.gsub!(/Æ/um,'Æ')   # 'Æ'  # Æ -            str.gsub!(/Ç/um,'Ç')   # 'Ç' # Ç -            str.gsub!(/È/um,'È')   # 'È' # È -            str.gsub!(/É/um,'É')   # 'É' # É -            str.gsub!(/Ê/um,'Ê')   # 'Ê'  # Ê -            str.gsub!(/Ë/um,'Ë')   # 'Ë'   # Ë -            str.gsub!(/Ì/um,'Ì')   # 'Ì' # Ì -            str.gsub!(/Í/um,'Í')   # 'Í' # Í -            str.gsub!(/Î/um,'Î')   # 'Î'  # Î -            str.gsub!(/Ï/um,'Ï')   # 'Ï'   # Ï -            str.gsub!(/Ð/um,'Ð')   # 'Ð'    # Ð -            str.gsub!(/Ñ/um,'Ñ')   # 'Ñ' # Ñ -            str.gsub!(/Ò/um,'Ò')   # 'Ò' # Ò -            str.gsub!(/Ó/um,'Ó')   # 'Ó' # Ó -            str.gsub!(/Ô/um,'Ô')   # 'Ô'  # Ô -            str.gsub!(/Õ/um,'Õ')   # 'Õ' # Õ -            str.gsub!(/Ö/um,'Ö')   # 'Ö'   # Ö -            str.gsub!(/Ø/um,'Ø')   # 'Ø' # Ø -            str.gsub!(/Ù/um,'Ù')   # 'Ù' # Ù -            str.gsub!(/Ú/um,'Ú')   # 'Ú' # Ú -            str.gsub!(/Û/um,'Û')   # 'Û'  # Û -            str.gsub!(/Ü/um,'Ü')   # 'Ü'   # Ü -            str.gsub!(/Ý/um,'Ý')   # 'Ý' # Ý -            str.gsub!(/Þ/um,'Þ')   # 'Þ'  # Þ -            str.gsub!(/ß/um,'ß')   # 'ß'  # ß -            str.gsub!(/à/um,'à')   # 'à' # à -            str.gsub!(/á/um,'á')   # 'á' # á -            str.gsub!(/â/um,'â')   # 'â'  # â -            str.gsub!(/ã/um,'ã')   # 'ã' # ã -            str.gsub!(/ä/um,'ä')   # 'ä'   # ä -            str.gsub!(/å/um,'å')   # 'å'  # å -            str.gsub!(/æ/um,'æ')   # 'æ'  # æ -            str.gsub!(/ç/um,'ç')   # 'ç' # ç -            str.gsub!(/è/um,'è')   # 'è' # è -            str.gsub!(/é/um,'é')   # '´'  # é -            str.gsub!(/ê/um,'ê')   # 'ˆ'   # ê -            str.gsub!(/ë/um,'ë')   # 'ë'   # ë -            str.gsub!(/ì/um,'ì')   # 'ì' # ì -            str.gsub!(/í/um,'í')   # '´'  # í -            str.gsub!(/î/um,'î')   # 'î'  # î -            str.gsub!(/ï/um,'ï')   # 'ï'   # ï -            str.gsub!(/ð/um,'ð')   # 'ð'    # ð -            str.gsub!(/ñ/um,'ñ')   # 'ñ' # ñ -            str.gsub!(/ò/um,'ò')   # 'ò' # ò -            str.gsub!(/ó/um,'ó')   # 'ó' # ó -            str.gsub!(/ô/um,'ô')   # 'ô'  # ô -            str.gsub!(/õ/um,'õ')   # 'õ' # õ -            str.gsub!(/ö/um,'ö')   # 'ö'   # ö -            str.gsub!(/ø/um,'ø')   # 'ø' # ø -            str.gsub!(/ù/um,'ú')   # 'ù' # ú -            str.gsub!(/ú/um,'û')   # 'ú' # û -            str.gsub!(/û/um,'ü')   # 'û'  # ü -            str.gsub!(/ü/um,'ý')   # 'ü'   # ý -            str.gsub!(/þ/um,'þ')   # 'þ'  # þ -            str.gsub!(/ÿ/um,'ÿ')   # 'ÿ'   # ÿ -            str.gsub!(/‘/um,'‘')  # '‘'  # ‘ -            str.gsub!(/’/um,'’')  # '’'  # ’ -            str.gsub!(/“/um,'“')  # “    # “ -            str.gsub!(/”/um,'”')  # ”    # ” -            str.gsub!(/–/um,'–')  # –    # – -            str.gsub!(/—/um,'—')  # —    # — -            str.gsub!(/∝/um,'∝')  # ∝     # ∝ -            str.gsub!(/∞/um,'∞')  # ∞    # ∞ -            str.gsub!(/™/um,'™')  # ™    # ™ -            str.gsub!(/✠/um,'✠') # ✗    # ✠ -            str.gsub!(/ /um,' ')       # space identify -            str.gsub!(/ /um,' ')       # space identify +            str=str.gsub(/</um,'<').    # '<'     # < +              gsub(/>/um,'>').    # '>'     # > +              gsub(/¢/um,'¢').   # '¢'   # ¢ +              gsub(/£/um,'£').   # '£'  # £ +              gsub(/¥/um,'¥').   # '¥'    # ¥ +              gsub(/§/um,'§').   # '§'   # § +              gsub(/©/um,'©').   # '©'   # © +              gsub(/ª/um,'ª').   # 'ª'   # ª +              gsub(/«/um,'«').   # '«'  # « +              gsub(/®/um,'®').   # '®'    # ® +              gsub(/°/um,'°').   # '°'    # ° +              gsub(/±/um,'±').   # '±' # ± +              gsub(/²/um,'²').   # '²'   # ² +              gsub(/³/um,'³').   # '³'   # ³ +              gsub(/µ/um,'µ').   # 'µ'  # µ +              gsub(/¶/um,'¶').   # '¶'   # ¶ +              gsub(/¹/um,'¹').   # '¹'   # ¹ +              gsub(/º/um,'º').   # 'º'   # º +              gsub(/»/um,'»').   # '»'  # » +              gsub(/¼/um,'¼').   # '¼' # ¼ +              gsub(/½/um,'½').   # '½' # ½ +              gsub(/¾/um,'¾').   # '¾' # ¾ +              gsub(/×/um,'×').   # '×'  # × +              gsub(/÷/um,'÷').   # '÷' # ÷ +              gsub(/¿/um,'¿').   # '¿' # ¿ +              gsub(/À/um,'À').   # 'À' # À +              gsub(/Á/um,'Á').   # 'Á' # Á +              gsub(/Â/um,'Â').   # 'Â'  #  +              gsub(/Ã/um,'Ã').   # 'Ã' # à +              gsub(/Ä/um,'Ä').   # 'Ä'   # Ä +              gsub(/Å/um,'Å').   # 'Å'  # Å +              gsub(/Æ/um,'Æ').   # 'Æ'  # Æ +              gsub(/Ç/um,'Ç').   # 'Ç' # Ç +              gsub(/È/um,'È').   # 'È' # È +              gsub(/É/um,'É').   # 'É' # É +              gsub(/Ê/um,'Ê').   # 'Ê'  # Ê +              gsub(/Ë/um,'Ë').   # 'Ë'   # Ë +              gsub(/Ì/um,'Ì').   # 'Ì' # Ì +              gsub(/Í/um,'Í').   # 'Í' # Í +              gsub(/Î/um,'Î').   # 'Î'  # Î +              gsub(/Ï/um,'Ï').   # 'Ï'   # Ï +              gsub(/Ð/um,'Ð').   # 'Ð'    # Ð +              gsub(/Ñ/um,'Ñ').   # 'Ñ' # Ñ +              gsub(/Ò/um,'Ò').   # 'Ò' # Ò +              gsub(/Ó/um,'Ó').   # 'Ó' # Ó +              gsub(/Ô/um,'Ô').   # 'Ô'  # Ô +              gsub(/Õ/um,'Õ').   # 'Õ' # Õ +              gsub(/Ö/um,'Ö').   # 'Ö'   # Ö +              gsub(/Ø/um,'Ø').   # 'Ø' # Ø +              gsub(/Ù/um,'Ù').   # 'Ù' # Ù +              gsub(/Ú/um,'Ú').   # 'Ú' # Ú +              gsub(/Û/um,'Û').   # 'Û'  # Û +              gsub(/Ü/um,'Ü').   # 'Ü'   # Ü +              gsub(/Ý/um,'Ý').   # 'Ý' # Ý +              gsub(/Þ/um,'Þ').   # 'Þ'  # Þ +              gsub(/ß/um,'ß').   # 'ß'  # ß +              gsub(/à/um,'à').   # 'à' # à +              gsub(/á/um,'á').   # 'á' # á +              gsub(/â/um,'â').   # 'â'  # â +              gsub(/ã/um,'ã').   # 'ã' # ã +              gsub(/ä/um,'ä').   # 'ä'   # ä +              gsub(/å/um,'å').   # 'å'  # å +              gsub(/æ/um,'æ').   # 'æ'  # æ +              gsub(/ç/um,'ç').   # 'ç' # ç +              gsub(/è/um,'è').   # 'è' # è +              gsub(/é/um,'é').   # '´'  # é +              gsub(/ê/um,'ê').   # 'ˆ'   # ê +              gsub(/ë/um,'ë').   # 'ë'   # ë +              gsub(/ì/um,'ì').   # 'ì' # ì +              gsub(/í/um,'í').   # '´'  # í +              gsub(/î/um,'î').   # 'î'  # î +              gsub(/ï/um,'ï').   # 'ï'   # ï +              gsub(/ð/um,'ð').   # 'ð'    # ð +              gsub(/ñ/um,'ñ').   # 'ñ' # ñ +              gsub(/ò/um,'ò').   # 'ò' # ò +              gsub(/ó/um,'ó').   # 'ó' # ó +              gsub(/ô/um,'ô').   # 'ô'  # ô +              gsub(/õ/um,'õ').   # 'õ' # õ +              gsub(/ö/um,'ö').   # 'ö'   # ö +              gsub(/ø/um,'ø').   # 'ø' # ø +              gsub(/ù/um,'ú').   # 'ù' # ú +              gsub(/ú/um,'û').   # 'ú' # û +              gsub(/û/um,'ü').   # 'û'  # ü +              gsub(/ü/um,'ý').   # 'ü'   # ý +              gsub(/þ/um,'þ').   # 'þ'  # þ +              gsub(/ÿ/um,'ÿ').   # 'ÿ'   # ÿ +              gsub(/‘/um,'‘').  # '‘'  # ‘ +              gsub(/’/um,'’').  # '’'  # ’ +              gsub(/“/um,'“').  # “    # “ +              gsub(/”/um,'”').  # ”    # ” +              gsub(/–/um,'–').  # –    # – +              gsub(/—/um,'—').  # —    # — +              gsub(/∝/um,'∝').  # ∝     # ∝ +              gsub(/∞/um,'∞').  # ∞    # ∞ +              gsub(/™/um,'™').  # ™    # ™ +              gsub(/✠/um,'✠'). # ✗    # ✠ +              gsub(/ /um,' ').       # space identify +              gsub(/ /um,' ')       # space identify            end            dob=if defined? dob.obj              dob.obj=str              dob -          elsif dob.class==String; dob +          elsif dob.class==String +            str            end            dob          end        end        def html(dob='')          if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn -          dob.obj.gsub!(/ /u,' ')           # space identify -          dob.obj.gsub!(/ /u,' ')           # space identify +          dob.obj=dob.obj.gsub(/ /u,' ').           # space identify +            gsub(/ /u,' ')           # space identify          else -          dob.obj.gsub!(/¢/u,'¢')      # ¢ -          dob.obj.gsub!(/£/u,'£')     # £ -          dob.obj.gsub!(/¥/u,'¥')       # ¥ -          dob.obj.gsub!(/§/u,'§')      # § -          dob.obj.gsub!(/©/u,'©')      # © -          dob.obj.gsub!(/ª/u,'ª')      # ª -          dob.obj.gsub!(/«/u,'«')     # « -          dob.obj.gsub!(/®/u,'®')       # ® -          dob.obj.gsub!(/°/u,'°')       # ° -          dob.obj.gsub!(/±/u,'±')    # ± -          dob.obj.gsub!(/²/u,'²')      # ² -          dob.obj.gsub!(/³/u,'³')      # ³ -          dob.obj.gsub!(/µ/u,'µ')     # µ -          dob.obj.gsub!(/¶/u,'¶')      # ¶ -          dob.obj.gsub!(/¹/u,'¹')      # ¹ -          dob.obj.gsub!(/º/u,'º')      # º -          dob.obj.gsub!(/»/u,'»')     # » -          dob.obj.gsub!(/¼/u,'¼')    # ¼ -          dob.obj.gsub!(/½/u,'½')    # ½ -          dob.obj.gsub!(/¾/u,'¾')    # ¾ -          dob.obj.gsub!(/×/u,'×')     # × -          dob.obj.gsub!(/÷/u,'÷')    # ÷ -          dob.obj.gsub!(/¿/u,'¿')    # ¿ -          dob.obj.gsub!(/À/u,'À')    # À -          dob.obj.gsub!(/Á/u,'Á')    # Á -          dob.obj.gsub!(/Â/u,'Â')     #  -          dob.obj.gsub!(/Ã/u,'Ã')    # à -          dob.obj.gsub!(/Ä/u,'Ä')      # Ä -          dob.obj.gsub!(/Å/u,'Å')     # Å -          dob.obj.gsub!(/Æ/u,'Æ')     # Æ -          dob.obj.gsub!(/Ç/u,'Ç')    # Ç -          dob.obj.gsub!(/È/u,'È')    # È -          dob.obj.gsub!(/É/u,'É')    # É -          dob.obj.gsub!(/Ê/u,'Ê')     # Ê -          dob.obj.gsub!(/Ë/u,'Ë')      # Ë -          dob.obj.gsub!(/Ì/u,'Ì')    # Ì -          dob.obj.gsub!(/Í/u,'Í')    # Í -          dob.obj.gsub!(/Î/u,'Î')     # Î -          dob.obj.gsub!(/Ï/u,'Ï')      # Ï -          dob.obj.gsub!(/Ð/u,'Ð')       # Ð -          dob.obj.gsub!(/Ñ/u,'Ñ')    # Ñ -          dob.obj.gsub!(/Ò/u,'Ò')    # Ò -          dob.obj.gsub!(/Ó/u,'Ó')    # Ó -          dob.obj.gsub!(/Ô/u,'Ô')     # Ô -          dob.obj.gsub!(/Õ/u,'Õ')    # Õ -          dob.obj.gsub!(/Ö/u,'Ö')      # Ö -          dob.obj.gsub!(/Ø/u,'Ø')    # Ø -          dob.obj.gsub!(/Ù/u,'Ù')    # Ù -          dob.obj.gsub!(/Ú/u,'Ú')    # Ú -          dob.obj.gsub!(/Û/u,'Û')     # Û -          dob.obj.gsub!(/Ü/u,'Ü')      # Ü -          dob.obj.gsub!(/Ý/u,'Ý')    # Ý -          dob.obj.gsub!(/Þ/u,'Þ')     # Þ -          dob.obj.gsub!(/ß/u,'ß')     # ß -          dob.obj.gsub!(/à/u,'à')    # à -          dob.obj.gsub!(/á/u,'á')    # á -          dob.obj.gsub!(/â/u,'â')     # â -          dob.obj.gsub!(/ã/u,'ã')    # ã -          dob.obj.gsub!(/ä/u,'ä')      # ä -          dob.obj.gsub!(/å/u,'å')     # å -          dob.obj.gsub!(/æ/u,'æ')     # æ -          dob.obj.gsub!(/ç/u,'ç')    # ç -          dob.obj.gsub!(/è/u,'è')    # è -          dob.obj.gsub!(/é/u,'´')     # é -          dob.obj.gsub!(/ê/u,'ˆ')      # ê -          dob.obj.gsub!(/ë/u,'ë')      # ë -          dob.obj.gsub!(/ì/u,'ì')    # ì -          dob.obj.gsub!(/í/u,'´')     # í -          dob.obj.gsub!(/î/u,'î')     # î -          dob.obj.gsub!(/ï/u,'ï')      # ï -          dob.obj.gsub!(/ð/u,'ð')       # ð -          dob.obj.gsub!(/ñ/u,'ñ')    # ñ -          dob.obj.gsub!(/ò/u,'ò')    # ò -          dob.obj.gsub!(/ó/u,'ó')    # ó -          dob.obj.gsub!(/ô/u,'ô')     # ô -          dob.obj.gsub!(/õ/u,'õ')    # õ -          dob.obj.gsub!(/ö/u,'ö')      # ö -          dob.obj.gsub!(/ø/u,'ø')    # ø -          dob.obj.gsub!(/ù/u,'ù')    # ú -          dob.obj.gsub!(/ú/u,'ú')    # û -          dob.obj.gsub!(/û/u,'û')     # ü -          dob.obj.gsub!(/ü/u,'ü')      # ý -          dob.obj.gsub!(/þ/u,'þ')     # þ -          dob.obj.gsub!(/ÿ/u,'ÿ')      # ÿ -          dob.obj.gsub!(/‘/u,'&#lsquo;')    # ‘  # ‘ -          dob.obj.gsub!(/’/u,'&#rsquo;')    # ’  # ’ -          dob.obj.gsub!(/“/u,'“')     # “  # “ -          dob.obj.gsub!(/”/u,'”')     # ”  # ” -          dob.obj.gsub!(/–/u,'–')     # –  # – -          dob.obj.gsub!(/—/u,'—')     # —  # — -          dob.obj.gsub!(/∝/u,'∝')      # ∝   # ∝ -          dob.obj.gsub!(/∞/u,'∞')     # ∞  # ∞ -          dob.obj.gsub!(/™/u,'™')     # ™  # ™ -          dob.obj.gsub!(/✠/u,'✠')    # ✠ -          #par.obja.gsub!(/✠/u '†')    # † # † incorrect replacement † -          dob.obj.gsub!(/ /u,' ')           # space identify -          dob.obj.gsub!(/ /u,' ')           # space identify +          dob.obj=dob.obj.gsub(/¢/u,'¢').      # ¢ +            gsub(/£/u,'£').     # £ +            gsub(/¥/u,'¥').       # ¥ +            gsub(/§/u,'§').      # § +            gsub(/©/u,'©').      # © +            gsub(/ª/u,'ª').      # ª +            gsub(/«/u,'«').     # « +            gsub(/®/u,'®').       # ® +            gsub(/°/u,'°').       # ° +            gsub(/±/u,'±').    # ± +            gsub(/²/u,'²').      # ² +            gsub(/³/u,'³').      # ³ +            gsub(/µ/u,'µ').     # µ +            gsub(/¶/u,'¶').      # ¶ +            gsub(/¹/u,'¹').      # ¹ +            gsub(/º/u,'º').      # º +            gsub(/»/u,'»').     # » +            gsub(/¼/u,'¼').    # ¼ +            gsub(/½/u,'½').    # ½ +            gsub(/¾/u,'¾').    # ¾ +            gsub(/×/u,'×').     # × +            gsub(/÷/u,'÷').    # ÷ +            gsub(/¿/u,'¿').    # ¿ +            gsub(/À/u,'À').    # À +            gsub(/Á/u,'Á').    # Á +            gsub(/Â/u,'Â').     #  +            gsub(/Ã/u,'Ã').    # à +            gsub(/Ä/u,'Ä').      # Ä +            gsub(/Å/u,'Å').     # Å +            gsub(/Æ/u,'Æ').     # Æ +            gsub(/Ç/u,'Ç').    # Ç +            gsub(/È/u,'È').    # È +            gsub(/É/u,'É').    # É +            gsub(/Ê/u,'Ê').     # Ê +            gsub(/Ë/u,'Ë').      # Ë +            gsub(/Ì/u,'Ì').    # Ì +            gsub(/Í/u,'Í').    # Í +            gsub(/Î/u,'Î').     # Î +            gsub(/Ï/u,'Ï').      # Ï +            gsub(/Ð/u,'Ð').       # Ð +            gsub(/Ñ/u,'Ñ').    # Ñ +            gsub(/Ò/u,'Ò').    # Ò +            gsub(/Ó/u,'Ó').    # Ó +            gsub(/Ô/u,'Ô').     # Ô +            gsub(/Õ/u,'Õ').    # Õ +            gsub(/Ö/u,'Ö').      # Ö +            gsub(/Ø/u,'Ø').    # Ø +            gsub(/Ù/u,'Ù').    # Ù +            gsub(/Ú/u,'Ú').    # Ú +            gsub(/Û/u,'Û').     # Û +            gsub(/Ü/u,'Ü').      # Ü +            gsub(/Ý/u,'Ý').    # Ý +            gsub(/Þ/u,'Þ').     # Þ +            gsub(/ß/u,'ß').     # ß +            gsub(/à/u,'à').    # à +            gsub(/á/u,'á').    # á +            gsub(/â/u,'â').     # â +            gsub(/ã/u,'ã').    # ã +            gsub(/ä/u,'ä').      # ä +            gsub(/å/u,'å').     # å +            gsub(/æ/u,'æ').     # æ +            gsub(/ç/u,'ç').    # ç +            gsub(/è/u,'è').    # è +            gsub(/é/u,'´').     # é +            gsub(/ê/u,'ˆ').      # ê +            gsub(/ë/u,'ë').      # ë +            gsub(/ì/u,'ì').    # ì +            gsub(/í/u,'´').     # í +            gsub(/î/u,'î').     # î +            gsub(/ï/u,'ï').      # ï +            gsub(/ð/u,'ð').       # ð +            gsub(/ñ/u,'ñ').    # ñ +            gsub(/ò/u,'ò').    # ò +            gsub(/ó/u,'ó').    # ó +            gsub(/ô/u,'ô').     # ô +            gsub(/õ/u,'õ').    # õ +            gsub(/ö/u,'ö').      # ö +            gsub(/ø/u,'ø').    # ø +            gsub(/ù/u,'ù').    # ú +            gsub(/ú/u,'ú').    # û +            gsub(/û/u,'û').     # ü +            gsub(/ü/u,'ü').      # ý +            gsub(/þ/u,'þ').     # þ +            gsub(/ÿ/u,'ÿ').      # ÿ +            gsub(/‘/u,'&#lsquo;').    # ‘  # ‘ +            gsub(/’/u,'&#rsquo;').    # ’  # ’ +            gsub(/“/u,'“').     # “  # “ +            gsub(/”/u,'”').     # ”  # ” +            gsub(/–/u,'–').     # –  # – +            gsub(/—/u,'—').     # —  # — +            gsub(/∝/u,'∝').      # ∝   # ∝ +            gsub(/∞/u,'∞').     # ∞  # ∞ +            gsub(/™/u,'™').     # ™  # ™ +            gsub(/✠/u,'✠').    # ✠ +            #gsub(/✠/u '†').    # † # † incorrect replacement † +            gsub(/ /u,' ').           # space identify +            gsub(/ /u,' ')           # space identify          end        end        self      end      def tidywords(wordlist) +      wordlist_new=[]        wordlist.each do |x|          #imperfect solution will not catch all possible cases -        x.gsub!(/&/,'&') unless x =~/&\S+;/ -        x.gsub!(/&([A-Z])/,'&\1') +        x=x.gsub(/&/,'&') unless x =~/&\S+;/ +        x=x.gsub(/&([A-Z])/,'&\1') +        wordlist_new << x        end +      wordlist_new      end      def markup(dob='')        wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17        dob.obj=tidywords(wordlist).join(' ').strip        unless dob.is=='table' -        dob.obj.gsub!(/#{Mx[:br_line]}/u,'<br />') -        dob.obj.gsub!(/#{Mx[:br_paragraph]}/u,'<br />') -        dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') -      end -      dob.obj.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') -      dob.obj.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;') -      dob.obj.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+)<\s+/,'\1< '); dob.obj.gsub!(/\s+>(\s+|$)/,' >\1') -      #dob.obj.gsub!(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphasis_c]}/,'<em>\1</em>') #reinstate -      dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'<b>\1</b>') -      dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'<i>\1</i>') -      dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') -      dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>') -      dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>') -      dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>') -      dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>') -      dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') -      dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>') -      dob.obj.gsub!(/<:pb>\s*/,'') #Fix -      dob.obj.gsub!(/<+[-~]#>+/,'') +        dob.obj=dob.obj.gsub(/#{Mx[:br_line]}/u,'<br />'). +          gsub(/#{Mx[:br_paragraph]}/u,'<br />'). +          gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') +      end +      dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,''). +        gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). +        gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;'). +        gsub(/(^|#{Mx[:gl_c]}|\s+)<\s+/,'\1< ').gsub(/\s+>(\s+|$)/,' >\1'). +        #gsub(/#{Mx[:fa_emphasis_o]}(.+?)#{Mx[:fa_emphasis_c]}/,'<em>\1</em>'). #reinstate +        gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'<b>\1</b>'). +        gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'<i>\1</i>'). +        gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). +        gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>'). +        gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>'). +        gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>'). +        gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>'). +        gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>'). +        gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). +        gsub(/<:pb>\s*/,''). #Fix +        gsub(/<+[-~]#>+/,'')        if dob.is !~/^code/          #embeds a red-bullet image --> -        dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') -        dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>') -        dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>') -        dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') -        dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table' -        dob.obj.gsub!(/#{Mx[:br_page]}\s*/,'') -        dob.obj.gsub!(/#{Mx[:br_page_new]}\s*/,'') -        dob.obj.gsub!(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''); dob.obj.gsub!(/<[-~]#>/,'') -        dob.obj.gsub!(/href="#{Xx[:segment]}/m,'href="') -        dob.obj.gsub!(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\.\.\/\S+?)#{Mx[:rel_c]}/, -          '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>') -        dob.obj.gsub!(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/, -          '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="../\2">\1</link>') -        dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/, -          '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="#\2">\1</link>') -        dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, -          %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}) -        dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, -          %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}) -        dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/, -          %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}) -        dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/, -          %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}) -        dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, -          '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>') #watch, compare html_tune -        dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, -          %{#{@brace_url.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\1">\\1</link>#{@brace_url.xml_close}}) -        dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, -          '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>') #escaped urls not linked, deal with later +        dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). +          gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). +          gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). +          gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') +        dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table' +        dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*/,''). +          gsub(/#{Mx[:br_page_new]}\s*/,''). +          gsub(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''). +          gsub(/<[-~]#>/,''). +          gsub(/href="#{Xx[:segment]}/m,'href="'). +          gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\.\.\/\S+?)#{Mx[:rel_c]}/, +            '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>'). +          gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/, +            '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="../\2">\1</link>'). +          gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/, +            '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="#\2">\1</link>'). +          gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, +            %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}). +          gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, +            %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}). +          gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/, +            %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1" width="\\2" height="\\3" />[\\1] \\4}). +          gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/, +            %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@md.file.output_path.xml.rel_image}/\\1"/>\\1}). +          gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, +            '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\2">\1</link>'). #watch, compare html_tune +          gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, +            %{#{@brace_url.xml_open}<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\\1">\\1</link>#{@brace_url.xml_close}}). +          gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, +            '<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\1">\1</link>') #escaped urls not linked, deal with later        else -        dob.obj.gsub!(/</m,'<'); dob.obj.gsub!(/>/m,'>') +        dob.obj=dob.obj.gsub(/</m,'<').gsub(/>/m,'>')        end        if dob.of=='block' -        dob.obj.gsub!(/#{Mx[:gl_bullet]}/,'● ') +        dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ')        end -      dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, -        %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) -      dob.obj.gsub!(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}") -      dob.obj.gsub!(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}") -      dob.obj.gsub!(/ |#{Mx[:nbsp]}/m,' ') +      dob.obj=dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, +          %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). +        gsub(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}"). +        gsub(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}"). +        gsub(/ |#{Mx[:nbsp]}/m,' ')        dob      end      def markup_light(dob='') -      dob.obj.gsub!(/\/\{(.+?)\}\//,'<i>\1</i>') -      dob.obj.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>') -      dob.obj.gsub!(/_\{(.+?)\}_/,'<u>\1</u>') -      dob.obj.gsub!(/-\{(.+?)\}-/,'<del>\1</del>') -      dob.obj.gsub!(/<br(\s*\/)?>/,'<br />') -      dob.obj.gsub!(/<:pb>\s*/,'') -      dob.obj.gsub!(/<[-~]#>/,'') -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort -      dob.obj.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax -      dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, -        "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>") -      dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ') +      dob.obj=dob.obj.gsub(/\/\{(.+?)\}\//,'<i>\1</i>'). +        gsub(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>'). +        gsub(/_\{(.+?)\}_/,'<u>\1</u>'). +        gsub(/-\{(.+?)\}-/,'<del>\1</del>'). +        gsub(/<br(\s*\/)?>/,'<br />'). +        gsub(/<:pb>\s*/,''). +        gsub(/<[-~]#>/,''). +        gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& '). #sort +        gsub(/&([^;]{1,5})/,'&\1'). #sort, rough estimate, revisit #WATCH found in node not sax +        gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, +          "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>"). +        gsub(/ |#{Mx[:nbsp]}/,' ')        wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17        dob.obj=tidywords(wordlist).join(' ').strip        dob      end      def markup_fictionbook(dob='') -      dob.obj.gsub!(/~\{([\d*+]+).+?\}~/,'[\1]') -      dob.obj.gsub!(/\/\{(.+?)\}\//,'<i>\1</i>') -      dob.obj.gsub!(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>') -      dob.obj.gsub!(/_\{(.+?)\}_/,'<u>\1</u>') -      dob.obj.gsub!(/-\{(.+?)\}-/,'<del>\1</del>') -      dob.obj.gsub!(/<br(?:\s*\/)?>/,'<br />') -      dob.obj.gsub!(/<:pb>\s*/,'') -      dob.obj.gsub!(/<[-~]#>/,'') -      #temporary --> -      dob.obj.gsub!(/<:\S+?>/,'') -      #<-- temporary -      dob.obj.gsub!(/<[-~]#>/,'') -      dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort -      dob.obj.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax -      dob.obj.gsub!(/(#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, -        "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>") -      dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ') +      dob.obj.gsub(/~\{([\d*+]+).+?\}~/,'[\1]'). +        gsub(/\/\{(.+?)\}\//,'<i>\1</i>'). +        gsub(/[*!]\{(.+?)\}[*!]/,'<b>\1</b>'). +        gsub(/_\{(.+?)\}_/,'<u>\1</u>'). +        gsub(/-\{(.+?)\}-/,'<del>\1</del>'). +        gsub(/<br(?:\s*\/)?>/,'<br />'). +        gsub(/<:pb>\s*/,''). +        gsub(/<[-~]#>/,''). +        #temporary --> +        gsub(/<:\S+?>/,''). +        #<-- temporary +        gsub(/<[-~]#>/,''). +        gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& '). #sort +        gsub(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax +        gsub(/(#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, +          "<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>"). +        gsub(/ |#{Mx[:nbsp]}/,' ')        wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17        dob.obj=tidywords(wordlist).join(' ').strip        dob      end      def markup_group(dob='') -      dob.obj.gsub!(/</,'<'); dob.obj.gsub!(/>/,'>') -      dob.obj.gsub!(/<:?br(?:\s+\/)?>/,'<br />') -      dob.obj.gsub!(/<(link xmlns:xlink=".+?")>/,'<\1>') -      dob.obj.gsub!(/<(\/link)>/,'<\1>') -      dob.obj.gsub!(/<(\/?en)>/,'<\1>') +      dob.obj=dob.obj.gsub(/</,'<').gsub(/>/,'>'). +        gsub(/<:?br(?:\s+\/)?>/,'<br />'). +        gsub(/<(link xmlns:xlink=".+?")>/,'<\1>'). +        gsub(/<(\/link)>/,'<\1>'). +        gsub(/<(\/?en)>/,'<\1>')        dob      end      def markup_block(dob='') -      dob.obj.gsub!(/</,'<'); dob.obj.gsub!(/>/,'>') -      dob.obj.gsub!(/<:?br(?:\s+\/)?>/,'<br />') -      dob.obj.gsub!(/<(link xmlns:xlink=".+?")>/,'<\1>') -      dob.obj.gsub!(/<(\/link)>/,'<\1>') -      dob.obj.gsub!(/<(\/?en)>/,'<\1>') +      dob.obj=dob.obj.gsub(/</,'<').gsub(/>/,'>'). +        gsub(/<:?br(?:\s+\/)?>/,'<br />'). +        gsub(/<(link xmlns:xlink=".+?")>/,'<\1>'). +        gsub(/<(\/link)>/,'<\1>'). +        gsub(/<(\/?en)>/,'<\1>')        dob      end      def xml_sem_block_paired(matched) # colon depth: many, recurs -      matched.gsub!(/\b(au):\{(.+?)\}:\1\b/m,  %{<sem:#{@ab[:au]} depth="many">\\2</sem:#{@ab[:au]}>}) -      matched.gsub!(/\b(vol):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:vol]} depth="many">\\2</sem:#{@ab[:vol]}>}) -      matched.gsub!(/\b(pub):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:pub]} depth="many">\\2</sem:#{@ab[:pub]}>}) -      matched.gsub!(/\b(ref):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ref]} depth="many">\\2</sem:#{@ab[:ref]}>}) -      matched.gsub!(/\b(desc):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:desc]} depth="many">\\2</sem:#{@ab[:desc]}>}) -      matched.gsub!(/\b(conv):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:conv]} depth="many">\\2</sem:#{@ab[:conv]}>}) -      matched.gsub!(/\b(ct):\{(.+?)\}:\1\b/m,  %{<sem:#{@ab[:ct]} depth="many">\\2</sem:#{@ab[:ct]}>}) -      matched.gsub!(/\b(cty):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:cty]} depth="many">\\2</sem:#{@ab[:cty]}>}) -      matched.gsub!(/\b(org):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:org]} depth="many">\\2</sem:#{@ab[:org]}>}) -      matched.gsub!(/\b(dt):\{(.+?)\}:\1\b/m,  %{<sem:#{@ab[:dt]} depth="many">\\2</sem:#{@ab[:dt]}>}) -      matched.gsub!(/\b(n):\{(.+?)\}:\1\b/m,   %{<sem:#{@ab[:n]} depth="many">\\2</sem:#{@ab[:n]}>}) -      matched.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'<sem:\1 depth="many">\2</sem:\1>') +      matched=matched.gsub(/\b(au):\{(.+?)\}:\1\b/m,  %{<sem:#{@ab[:au]} depth="many">\\2</sem:#{@ab[:au]}>}). +        gsub(/\b(vol):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:vol]} depth="many">\\2</sem:#{@ab[:vol]}>}). +        gsub(/\b(pub):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:pub]} depth="many">\\2</sem:#{@ab[:pub]}>}). +        gsub(/\b(ref):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:ref]} depth="many">\\2</sem:#{@ab[:ref]}>}). +        gsub(/\b(desc):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:desc]} depth="many">\\2</sem:#{@ab[:desc]}>}). +        gsub(/\b(conv):\{(.+?)\}:\1\b/m,%{<sem:#{@ab[:conv]} depth="many">\\2</sem:#{@ab[:conv]}>}). +        gsub(/\b(ct):\{(.+?)\}:\1\b/m,  %{<sem:#{@ab[:ct]} depth="many">\\2</sem:#{@ab[:ct]}>}). +        gsub(/\b(cty):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:cty]} depth="many">\\2</sem:#{@ab[:cty]}>}). +        gsub(/\b(org):\{(.+?)\}:\1\b/m, %{<sem:#{@ab[:org]} depth="many">\\2</sem:#{@ab[:org]}>}). +        gsub(/\b(dt):\{(.+?)\}:\1\b/m,  %{<sem:#{@ab[:dt]} depth="many">\\2</sem:#{@ab[:dt]}>}). +        gsub(/\b(n):\{(.+?)\}:\1\b/m,   %{<sem:#{@ab[:n]} depth="many">\\2</sem:#{@ab[:n]}>}). +        gsub(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m,'<sem:\1 depth="many">\2</sem:\1>')      end      def xml_semantic_tags(dob)        if @md.sem_tag          dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }          dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) }          dob.obj.gsub!(/([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\1)/m) {|c| xml_sem_block_paired(c) } -        dob.obj.gsub!(/:\{(.+?)\}:au\b/m,             %{<sem:#{@ab[:au]} depth="one">\\1</sem:#{@ab[:au]}>}) -        dob.obj.gsub!(/:\{(.+?)\}:n\b/m,              %{<sem:#{@ab[:n]} depth="one">\\1</sem:#{@ab[:n]}>}) -        dob.obj.gsub!(/:\{(.+?)\}:ti\b/m,             %{<sem:#{@ab[:ti]} depth="one">\\1</sem:#{@ab[:ti]}>}) -        dob.obj.gsub!(/:\{(.+?)\}:ref\b/m,            %{<sem:#{@ab[:ref]} depth="one">\\1</sem:#{@ab[:ref]}>}) -        dob.obj.gsub!(/:\{(.+?)\}:desc\b/m,           %{<sem:#{@ab[:desc]} depth="one">\\1</sem:#{@ab[:desc]}>}) -        dob.obj.gsub!(/:\{(.+?)\}:cty\b/m,            %{<sem:#{@ab[:cty]} depth="one">\\1</sem:#{@ab[:cty]}>}) -        dob.obj.gsub!(/:\{(.+?)\}:org\b/m,            %{<sem:#{@ab[:org]} depth="one">\\1</sem:#{@ab[:org]}>}) -        dob.obj.gsub!(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="one">\1</sem:\2>') -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};ti\b/m,    %{<sem:#{@ab[:ti]} depth="zero">\\1</sem:#{@ab[:ti]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};qt\b/m,    %{<sem:#{@ab[:qt]} depth="zero">\\1</sem:#{@ab[:qt]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};ref\b/m,   %{<sem:#{@ab[:ref]} depth="zero">\\1</sem:#{@ab[:ref]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};ed\b/m,    %{<sem:#{@ab[:ed]} depth="zero">\\1</sem:#{@ab[:ed]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};v\b/m,     %{<sem:#{@ab[:v]} depth="zero">\\1</sem:#{@ab[:v]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};desc\b/m,  %{<sem:#{@ab[:desc]} depth="zero">\\1</sem:#{@ab[:desc]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};def\b/m,   %{<sem:#{@ab[:def]} depth="zero">\\1</sem:#{@ab[:def]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};trans\b/m, %{<sem:#{@ab[:trans]} depth="zero">\\1</sem:#{@ab[:trans]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};y\b/m,     %{<sem:#{@ab[:y]} depth="zero">\\1</sem:#{@ab[:y]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};ab\b/m,    %{<sem:#{@ab[:ab]} depth="zero">\\1</sem:#{@ab[:ab]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};pg\b/m,    %{<sem:#{@ab[:pg]} depth="zero">\\1</sem:#{@ab[:pg]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};fn?\b/m,   %{<sem:#{@ab[:fn]} depth="zero">\\1</sem:#{@ab[:fn]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};mn?\b/m,   %{<sem:#{@ab[:mn]} depth="zero">\\1</sem:#{@ab[:mn]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};ln?\b/m,   %{<sem:#{@ab[:ln]} depth="zero">\\1</sem:#{@ab[:ln]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};in\b/m,    %{<sem:#{@ab[:in]} depth="zero">\\1</sem:#{@ab[:in]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};uni\b/m,   %{<sem:#{@ab[:uni]} depth="zero">\\1</sem:#{@ab[:uni]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};fac\b/m,   %{<sem:#{@ab[:fac]} depth="zero">\\1</sem:#{@ab[:fac]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};inst\b/m,  %{<sem:#{@ab[:inst]} depth="zero">\\1</sem:#{@ab[:inst]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};dept\b/m,  %{<sem:#{@ab[:dpt]} depth="zero">\\1</sem:#{@ab[:dept]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};org\b/m,   %{<sem:#{@ab[:org]} depth="zero">\\1</sem:#{@ab[:org]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};com?\b/m,  %{<sem:#{@ab[:com]} depth="zero">\\1</sem:#{@ab[:com]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};cty\b/m,   %{<sem:#{@ab[:cty]} depth="zero">\\1</sem:#{@ab[:cty]}>}) -        dob.obj.gsub!(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="zero">\1</sem:\2>') +        dob.obj=dob.obj.gsub(/:\{(.+?)\}:au\b/m,             %{<sem:#{@ab[:au]} depth="one">\\1</sem:#{@ab[:au]}>}). +          gsub(/:\{(.+?)\}:n\b/m,              %{<sem:#{@ab[:n]} depth="one">\\1</sem:#{@ab[:n]}>}). +          gsub(/:\{(.+?)\}:ti\b/m,             %{<sem:#{@ab[:ti]} depth="one">\\1</sem:#{@ab[:ti]}>}). +          gsub(/:\{(.+?)\}:ref\b/m,            %{<sem:#{@ab[:ref]} depth="one">\\1</sem:#{@ab[:ref]}>}). +          gsub(/:\{(.+?)\}:desc\b/m,           %{<sem:#{@ab[:desc]} depth="one">\\1</sem:#{@ab[:desc]}>}). +          gsub(/:\{(.+?)\}:cty\b/m,            %{<sem:#{@ab[:cty]} depth="one">\\1</sem:#{@ab[:cty]}>}). +          gsub(/:\{(.+?)\}:org\b/m,            %{<sem:#{@ab[:org]} depth="one">\\1</sem:#{@ab[:org]}>}). +          gsub(/:\{(.+?)\}:([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="one">\1</sem:\2>'). +          gsub(/;\{([^}]+(?![;]))\};ti\b/m,    %{<sem:#{@ab[:ti]} depth="zero">\\1</sem:#{@ab[:ti]}>}). +          gsub(/;\{([^}]+(?![;]))\};qt\b/m,    %{<sem:#{@ab[:qt]} depth="zero">\\1</sem:#{@ab[:qt]}>}). +          gsub(/;\{([^}]+(?![;]))\};ref\b/m,   %{<sem:#{@ab[:ref]} depth="zero">\\1</sem:#{@ab[:ref]}>}). +          gsub(/;\{([^}]+(?![;]))\};ed\b/m,    %{<sem:#{@ab[:ed]} depth="zero">\\1</sem:#{@ab[:ed]}>}). +          gsub(/;\{([^}]+(?![;]))\};v\b/m,     %{<sem:#{@ab[:v]} depth="zero">\\1</sem:#{@ab[:v]}>}). +          gsub(/;\{([^}]+(?![;]))\};desc\b/m,  %{<sem:#{@ab[:desc]} depth="zero">\\1</sem:#{@ab[:desc]}>}). +          gsub(/;\{([^}]+(?![;]))\};def\b/m,   %{<sem:#{@ab[:def]} depth="zero">\\1</sem:#{@ab[:def]}>}). +          gsub(/;\{([^}]+(?![;]))\};trans\b/m, %{<sem:#{@ab[:trans]} depth="zero">\\1</sem:#{@ab[:trans]}>}). +          gsub(/;\{([^}]+(?![;]))\};y\b/m,     %{<sem:#{@ab[:y]} depth="zero">\\1</sem:#{@ab[:y]}>}). +          gsub(/;\{([^}]+(?![;]))\};ab\b/m,    %{<sem:#{@ab[:ab]} depth="zero">\\1</sem:#{@ab[:ab]}>}). +          gsub(/;\{([^}]+(?![;]))\};pg\b/m,    %{<sem:#{@ab[:pg]} depth="zero">\\1</sem:#{@ab[:pg]}>}). +          gsub(/;\{([^}]+(?![;]))\};fn?\b/m,   %{<sem:#{@ab[:fn]} depth="zero">\\1</sem:#{@ab[:fn]}>}). +          gsub(/;\{([^}]+(?![;]))\};mn?\b/m,   %{<sem:#{@ab[:mn]} depth="zero">\\1</sem:#{@ab[:mn]}>}). +          gsub(/;\{([^}]+(?![;]))\};ln?\b/m,   %{<sem:#{@ab[:ln]} depth="zero">\\1</sem:#{@ab[:ln]}>}). +          gsub(/;\{([^}]+(?![;]))\};in\b/m,    %{<sem:#{@ab[:in]} depth="zero">\\1</sem:#{@ab[:in]}>}). +          gsub(/;\{([^}]+(?![;]))\};uni\b/m,   %{<sem:#{@ab[:uni]} depth="zero">\\1</sem:#{@ab[:uni]}>}). +          gsub(/;\{([^}]+(?![;]))\};fac\b/m,   %{<sem:#{@ab[:fac]} depth="zero">\\1</sem:#{@ab[:fac]}>}). +          gsub(/;\{([^}]+(?![;]))\};inst\b/m,  %{<sem:#{@ab[:inst]} depth="zero">\\1</sem:#{@ab[:inst]}>}). +          gsub(/;\{([^}]+(?![;]))\};dept\b/m,  %{<sem:#{@ab[:dpt]} depth="zero">\\1</sem:#{@ab[:dept]}>}). +          gsub(/;\{([^}]+(?![;]))\};org\b/m,   %{<sem:#{@ab[:org]} depth="zero">\\1</sem:#{@ab[:org]}>}). +          gsub(/;\{([^}]+(?![;]))\};com?\b/m,  %{<sem:#{@ab[:com]} depth="zero">\\1</sem:#{@ab[:com]}>}). +          gsub(/;\{([^}]+(?![;]))\};cty\b/m,   %{<sem:#{@ab[:cty]} depth="zero">\\1</sem:#{@ab[:cty]}>}). +          gsub(/;\{([^}]+(?![;]))\};([a-z]+(?:[_:.][a-z]+)*)/m,'<sem:\2 depth="zero">\1</sem:\2>')        end        dob      end @@ -647,7 +652,7 @@ module SiSU_XML_Tags #Format      def meta_content_clean(content='')        content        unless content.nil? -        content.tr!('"',"'") +        content=content.tr('"',"'")          content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content)        end        content diff --git a/lib/sisu/v3dv/sisupod_make.rb b/lib/sisu/v3dv/sisupod_make.rb index 5fe93429..4b1a5ef9 100644 --- a/lib/sisu/v3dv/sisupod_make.rb +++ b/lib/sisu/v3dv/sisupod_make.rb @@ -183,7 +183,7 @@ module SiSU_Doc        file_array.each do |f|                                                   #% work area          if f !~/^%+\s/            skin << f.scan(@rgx_skin).uniq.flatten if f =~@rgx_skin -          f.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image')                                                           # embedded symbol (image) +          f=f.gsub(/<:=(\S+?)>/,'{ c_\1.png 14x14 }image')                                                           # embedded symbol (image)            if f !~/^%+\s/ \            and f =~@rgx_image              images=images_extract(f,images) @@ -238,10 +238,9 @@ module SiSU_Doc        #2. need images used by skin, scan skin??        if images \        and images.length > 1 -        images.flatten! -        images.uniq! +        images=images.flatten.uniq          images.delete_if {|x| x =~/https?:\/\// } -        #images.sort! +        #images=images.sort          path_pod="#{@env.processing_path.processing}/sisupod"          path_pod_conf="#{@env.processing_path.processing}/sisupod/_sisu"          images_path_pod="#{path_pod}/image" diff --git a/lib/sisu/v3dv/spell.rb b/lib/sisu/v3dv/spell.rb index 1a8dc35b..58b86af3 100644 --- a/lib/sisu/v3dv/spell.rb +++ b/lib/sisu/v3dv/spell.rb @@ -70,23 +70,23 @@ module SiSU_SpellUtility      end      def check        @input.each do |data| -        data.gsub!(/(https?|www|ftp|gopher|png|jpg|gif|html|htm)\S+/i,' ') -        data.gsub!(/( |#{Mx[:nbsp]})/i,' ') -        data.gsub!(/<\/?(table|tr|td|b|p|href).*?>/i,' ') -        data.gsub!(/(<==.+|<:\S+>|<!.+?!>|^@\S+?:.+|\{\{\{|~)/,' ') -        data.gsub!(/(["|<>)(\n'`'.;&_-]|\=)/,' ') -        data.gsub!(/\b(altExternal| -          target|externalimg| -          srcimagebext| -          img|src|toc|pdf| -          cd|org| -          helvetica|roman -          )\b/i,' ') -        data.gsub!(/EOF/,'') +        data=data.gsub(/(https?|www|ftp|gopher|png|jpg|gif|html|htm)\S+/i,' '). +          gsub(/( |#{Mx[:nbsp]})/i,' '). +          gsub(/<\/?(table|tr|td|b|p|href).*?>/i,' '). +          gsub(/(<==.+|<:\S+>|<!.+?!>|^@\S+?:.+|\{\{\{|~)/,' '). +          gsub(/(["|<>)(\n'`'.;&_-]|\=)/,' '). +          gsub(/\b(altExternal| +            target|externalimg| +            srcimagebext| +            img|src|toc|pdf| +            cd|org| +            helvetica|roman +            )\b/i,' '). +          gsub(/EOF/,'')          @words=data.scan(/\S+/)          @words.each { |y| @allwords << y }        end -      @allwords.uniq! +      @allwords=@allwords.uniq        if @flg =~ /S/          File.open('/home/ralph/spell_error','a+') do |file| #fix            file.puts %{\n\n<<#{@filename}>>} diff --git a/lib/sisu/v3dv/sysenv.rb b/lib/sisu/v3dv/sysenv.rb index a5658ee1..1b1a5857 100644 --- a/lib/sisu/v3dv/sysenv.rb +++ b/lib/sisu/v3dv/sysenv.rb @@ -472,7 +472,7 @@ module SiSU_Env            @fn[:t]=filename[m,2]          end        end -      lng_base=InfoEnv.new.language_default_set +      lng_base=SiSU_Env::InfoEnv.new.language_default_set        lang=SiSU_Env::StandardiseLanguage.new        langs=lang.codes        x=[] @@ -544,8 +544,7 @@ module SiSU_Env            @m << { m: fn[:manifest], l: lng }          end        end -      @m.uniq! -      @m +      @m=@m.uniq      end      def filename(code,name,suffix)        #d=SiSU_Env::InfoEnv.new(@fns) @@ -612,7 +611,7 @@ module SiSU_Env        @sys=InfoSystem.instance      end      def program_found?(program) -      found=`whereis #{program}` +      found=`which #{program}` #`whereis #{program}`        (found =~/bin\/#{program}\b/) ? true : false      end      def locale                                                                 #locales utf8 or other @@ -623,10 +622,10 @@ module SiSU_Env      end      def file_encoding(filename,cmd='')                                         #file encoding        program='file' -      fnsp=InfoEnv.new(filename).source_file_with_path +      fnsp=SiSU_Env::InfoEnv.new(filename).source_file_with_path        if program_found?(program)          encoding=%x{file -L #{fnsp}}.strip -        encoding.gsub!(/#{fnsp}:(\s+|$)/,'') +        encoding=encoding.gsub(/#{fnsp}:(\s+|$)/,'')          encoding=if encoding \          and not encoding.empty?            encoding @@ -850,7 +849,7 @@ module SiSU_Env      require_relative 'i18n'                  # i18n.rb      def initialize(l='')        @language=(l.nil? || l.empty?) \ -      ? InfoEnv.new.language_default_set +      ? SiSU_Env::InfoEnv.new.language_default_set        : l        @r=%{(?:#{Px[:lng_lst].join('|')})}        @lang_info=SiSU_i18n::Languages.new @@ -972,7 +971,7 @@ module SiSU_Env      def initialize(fns='',md=nil)        super() #you may not want to re-execute this static info so frequently!        @fns,@md=fns,md -      @env=EnvCall.new(fns) if fns +      @env=SiSU_Env::EnvCall.new(fns) if fns        fnb=if @md \        and defined? @md.fnb          @md.fnb @@ -1116,10 +1115,9 @@ module SiSU_Env          FileUtils::rm_rf(spp)        end        paths=[] -      flv=EnvCall.new(opt.fns).document_language_versions_found +      flv=SiSU_Env::EnvCall.new(opt.fns).document_language_versions_found        flv[:f].each {|l| lng_dirs << l[:l] } -      lng_dirs.uniq! -      lng_dirs.each do |lng| +      lng_dirs.uniq.each do |lng|          paths << "#{spp}/doc/#{lng}"        end        paths \ @@ -2740,11 +2738,13 @@ WOK        include FileUtils::Verbose      def initialize(opt)        @opt=opt -      z=FileMap.new(@opt) +      z=SiSU_Env::FileMap.new(@opt)        @zap=z.local_sisu_source        if @opt.cmd =~ /[hH]/          @zap=Dir.glob(@zap).join(' ') -        if @opt.cmd !~ /w/; @zap.gsub!(/#{@source_path}\/concordance.html/,'') +        @zap=if @opt.cmd !~ /w/ +          @zap.gsub(/#{@source_path}\/concordance.html/,'') +        else @zap          end        end        @env=SiSU_Env::InfoEnv.new @@ -2901,15 +2901,15 @@ WOK            and remote_gen !~/\/\//) \            and @@flag_remote==true \            and @opt.cmd !~/U/ -            SystemCall.new(local_gen,remote_gen).scp +            SiSU_Env::SystemCall.new(local_gen,remote_gen).scp              if FileTest.file?("#{local_src}/#{src_txt}") -              SystemCall.new("#{local_src}/#{src_txt}",remote_src).scp +              SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src).scp              end              if FileTest.file?("#{local_pod}/#{src_pod}") -              SystemCall.new("#{local_src}/#{src_pod}",remote_pod).scp +              SiSU_Env::SystemCall.new("#{local_src}/#{src_pod}",remote_pod).scp              end              if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub") -              SystemCall.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp +              SiSU_Env::SystemCall.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp              end            elsif  @opt.cmd =~/U/              puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ @@ -2936,7 +2936,7 @@ WOK            and @@flag_remote==true \            and @opt.cmd !~/U/              puts "begin scp_base: #{local} -> #{remote}" -            SystemCall.new("#{local}/#{@env.path.style}/",remote).scp +            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp            elsif @opt.cmd =~/U/              puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/              puts "begin scp_base: #{local} -> #{remote}" @@ -2954,9 +2954,9 @@ WOK            and @@flag_remote==true \            and @opt.cmd !~/U/              puts "begin scp_base_all: #{local} -> #{remote}" -            SystemCall.new("#{local}/_sisu/image_sys/",remote).scp -            SystemCall.new("#{local}/_sisu/image/",remote).scp -            SystemCall.new("#{local}/#{@env.path.style}/",remote).scp +            SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).scp +            SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).scp +            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp            elsif @opt.cmd =~/U/              puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/              puts "scp_base_all: #{local} -> #{remote}" @@ -2970,7 +2970,7 @@ WOK        self      end      def images_from_skin -      skin=InfoSkin.new(@md).select +      skin=SiSU_Env::InfoSkin.new(@md).select        skin_array=nil        skin_images_array=[]        if skin @@ -3001,7 +3001,7 @@ WOK            and remote_gen !~/\/\//) \            and @@flag_remote==true \            and @opt.cmd !~/U/ -#           SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync +#           SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync              delete_extra_files='--delete' # '--delete-after'              inp=[]              if (@opt.cmd =~/h/ \ @@ -3108,13 +3108,13 @@ WOK                ##create file structure without copying files?:                ##rsync -av -f"+ */" -f"- *" @f.output_path.base.dir remote:./path/.                #local_dirs=%{-f"+ */" -f"- *" #{@f.output_path.base.dir}/*} -              #SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync +              #SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync                local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css -              SystemCall.new(local,remote_rel,@opt.cmd).rsync('--relative',@f.output_path.base.dir) +              SiSU_Env::SystemCall.new(local,remote_rel,@opt.cmd).rsync('--relative',@f.output_path.base.dir)              rescue                p __LINE__.to_s + ':' + __FILE__                local_dirs=%{--include='*/' --exclude='*' #{@f.output_path.base.dir}} -              SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync +              SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync              end            elsif @opt.cmd =~/U/              puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ @@ -3141,9 +3141,9 @@ WOK            and @rc['permission_set']['remote_base_site'] \            and @@flag_remote==true \            and @opt.cmd !~/U/ -            SystemCall.new("#{image_sys}","#{remote_conf}").rsync -            SystemCall.new("#{images}","#{remote_conf}").rsync -            SystemCall.new("#{ldest}","#{remote}").rsync +            SiSU_Env::SystemCall.new("#{image_sys}","#{remote_conf}").rsync +            SiSU_Env::SystemCall.new("#{images}","#{remote_conf}").rsync +            SiSU_Env::SystemCall.new("#{ldest}","#{remote}").rsync            elsif @opt.cmd =~/U/              puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/              puts "rsync_base: #{local} -> #{remote}" @@ -3164,9 +3164,9 @@ WOK            and @opt.cmd !~/U/              delete_extra_files='--delete' # '--delete-after'              puts "begin rsync_base_sync: #{local} -> #{remote}" -            SystemCall.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files) -            SystemCall.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files) -            SystemCall.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files) +            SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files) +            SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files) +            SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files)            elsif @opt.cmd =~/U/              puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/              puts "rsync_base_sync: #{local} -> #{remote}" @@ -3185,7 +3185,7 @@ WOK          remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."          if @@flag_remote            delete_extra_files='--delete' # '--delete-after' -          SystemCall.new(local,remote).rsync(delete_extra_files) +          SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files)          elsif @opt.cmd =~/U/            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/            puts "rsync_sitemaps: #{local} -> #{remote}" @@ -3199,7 +3199,7 @@ WOK          remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."          if @@flag_remote            delete_extra_files='--delete' # '--delete-after' -          SystemCall.new(local,remote).rsync(delete_extra_files) +          SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files)          elsif @opt.cmd =~/U/            puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/            puts "rsync_sitemaps: #{local} -> #{remote}" @@ -4838,7 +4838,7 @@ WOK      end      def param_instantiate        @cX||=SiSU_Screen::Ansi.new(@cmd) -      @@date=InfoDate.new +      @@date=SiSU_Env::InfoDate.new        @@proc=@@filename_txt=@@filename_texinfo=@@filename_lout_portrait=@@filename_lout_landscape=@@filename_html_scroll=@@filename_html_index=@@filename_html_segtoc=@@filename_semantic=@@filename_rss=@@newfile=@@drr=@@yaml=@@yamladdr=nil        @@publisher='SiSU scribe'      end @@ -4856,7 +4856,7 @@ WOK        u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/        @pwd_stub=pt.realpath.to_s[u,1]        @rc=@@rc ||=GetInit.instance.sisu_yaml.rc -      @defaults=InfoEnv.new.defaults +      @defaults=SiSU_Env::InfoEnv.new.defaults      end      def share_source?        ((defined? @rc['db']['share_source']) \ @@ -5053,7 +5053,7 @@ WOK          "#{@md.doc_css}_html.css"        elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html.css")          "#{@env.path.stub_pwd}_html.css" -      else CSS_Default.new.html +      else SiSU_Env::CSS_Default.new.html        end      end      def html_tables @@ -5062,7 +5062,7 @@ WOK          "#{@md.doc_css}_html_tables.css"        elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html_tables.css")          "#{@env.path.stub_pwd}_html_tables.css" -      else CSS_Default.new.html_tables +      else SiSU_Env::CSS_Default.new.html_tables        end      end      def xhtml @@ -5071,7 +5071,7 @@ WOK          "#{@md.doc_css}_xhtml.css"        elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xhtml.css")          "#{@env.path.stub_pwd}_xhtml.css" -      else CSS_Default.new.xhtml +      else SiSU_Env::CSS_Default.new.xhtml        end      end      def xml_sax @@ -5080,7 +5080,7 @@ WOK          "#{@md.doc_css}_xml_sax.css"        elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_sax.css")          "#{@env.path.stub_pwd}_xml_sax.css" -      else CSS_Default.new.xml_sax +      else SiSU_Env::CSS_Default.new.xml_sax        end      end      def xml_dom @@ -5089,7 +5089,7 @@ WOK          "#{@md.doc_css}_xml_dom.css"        elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_dom.css")          "#{@env.path.stub_pwd}_xml_dom.css" -      else CSS_Default.new.xml_dom +      else SiSU_Env::CSS_Default.new.xml_dom        end      end      def docbook_xml @@ -5098,7 +5098,7 @@ WOK          "#{@md.doc_css}_xml_dom.css"        elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_docbook.css")          "#{@env.path.stub_pwd}_docbook.css" -      else CSS_Default.new.docbook_xml +      else SiSU_Env::CSS_Default.new.docbook_xml        end      end      def homepage @@ -5107,14 +5107,14 @@ WOK          "#{@md.doc_css}_homepage.css"        elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_homepage.css")          "#{@env.path.stub_pwd}_homepage.css" -      else CSS_Default.new.homepage +      else SiSU_Env::CSS_Default.new.homepage        end      end    end    class CSS_Stylesheet      def initialize(md)        @md=md -      @css=CSS_Select.new(@md) +      @css=SiSU_Env::CSS_Select.new(@md)        @env=SiSU_Env::InfoEnv.new        @file=SiSU_Env::FileOp.new(@md)      end diff --git a/lib/sisu/v3dv/texinfo.rb b/lib/sisu/v3dv/texinfo.rb index 45af0550..121cf1ae 100644 --- a/lib/sisu/v3dv/texinfo.rb +++ b/lib/sisu/v3dv/texinfo.rb @@ -156,24 +156,24 @@ module SiSU_TexInfo          if dob.is =='table'            @@flag['tables']='y' # KLUDGE get from param          end -        dob.obj.gsub!(/<:p[bn]>/,'') -        dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1(\2 [linked to:] \3)') -        dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)') +        dob.obj=dob.obj.gsub(/<:p[bn]>/,''). +          gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1(\2 [linked to:] \3)'). +          gsub(/(^|#{Mx[:gl_c]}|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)')          do_mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob)          dob.obj=do_mono.spec_char(dob.obj)        end        data      end      def endnote -      data=@data +      data,data_new=@data,[]        data.each do |dob|          if dob.of=~/para|block/ -          dob.obj.gsub!(/\s*#{Mx[:en_a_o]}(?:\d+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} ') -          dob.obj.gsub!(/\s*#{Mx[:en_a_o]}(\*+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} ') +          dob.obj=dob.obj.gsub(/\s*#{Mx[:en_a_o]}(?:\d+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} '). +            gsub(/\s*#{Mx[:en_a_o]}(\*+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} ')          end -        dob +        data_new << dob        end -      data +      data_new      end      def poem        data=@data @@ -216,16 +216,17 @@ module SiSU_TexInfo        end      end      def code_lines -      data=@data +      data,data_new=@data,[]        data.each do |line|          if line =~ /\S/ \          and line !~ /#{Mx[:gr_o]}(code|verse).+/ #fix -          if @@flag['code'] -            line.gsub!(/^\s*(.+)/m,"\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\") +          line=if @@flag['code'] +            line.gsub(/^\s*(.+)/m,"\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\")              @@counting+=1 if @@flag['code'] -          else line.gsub!(/(.+)/m,'\noindent\1') +          else line.gsub(/(.+)/m,'\noindent\1')            end          end +        data_new << line        end      end      def tables @@ -275,10 +276,10 @@ module SiSU_TexInfo              @subsubmenu[n_submenu] << toc.menu            end          else -          dob.obj.gsub!(/\s*(?:<:?br>|<br \/>)\s*/,"\n\n") +          dob.obj=dob.obj.gsub(/\s*(?:<:?br>|<br \/>)\s*/,"\n\n")          end        end -      texinfo_menu.compact! +      texinfo_menu=texinfo_menu.compact        texinfo_menu << "* Dublin Core::"        @tex_file << texinfo_menu        @tex_file << "* Index::\n" + @@ -326,7 +327,7 @@ module SiSU_TexInfo            end          end          #%case with endnotes -        dob.obj.gsub!(/\s*[0-8]\\+(\S+)?\s+/,' ') if dob.obj +        dob.obj=dob.obj.gsub(/\s*[0-8]\\+(\S+)?\s+/,' ') if dob.obj          @tex_file << dob.obj if dob.obj and dob.is !~/structure|comment/ #sort exceptions        end        data=@tex_file @@ -343,13 +344,13 @@ module SiSU_TexInfo          and dob.obj !~ /#{Rx[:meta]}/            if dob.obj =~ /^[1-6]\\+(?:~\S+)?\s*<!h-.+?-!>/ \            and dob.obj !~ /<:\d-endnotes>/ -            header=dob.obj[/<!h-(.+?)-!>/m, 1].gsub!(/-/m,'.') -            dob.obj.gsub!(/^(?:[1-6]\\+(?:~\S+)|<:([12356]|4-.+?-)>)\s*<!h-.+?-!>/, +            header=dob.obj[/<!h-(.+?)-!>/m, 1].gsub(/-/m,'.') +            dob.obj=dob.obj.gsub(/^(?:[1-6]\\+(?:~\S+)|<:([12356]|4-.+?-)>)\s*<!h-.+?-!>/,                "\\1 #{header} ")            end          elsif dob.obj=~ /<!h!>|<!h\d!>|<!h.+?!>|<!!h.+?!>/            if dob.obj=~ /<!h-.+?-!>/ -            dob.obj.gsub!(/<!h-(.+?)-!>/,'\1 ') +            dob.obj=dob.obj.gsub(/<!h-(.+?)-!>/,'\1 ')            end          end          @tex_file << dob.obj @@ -363,8 +364,7 @@ module SiSU_TexInfo        data << tex.tail      end      def output -      data=@data -      data.compact! +      data=@data.compact        filename_texinfo=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo}        file_texinfo=File.new(filename_texinfo,'w+')        puts filename_texinfo if @md.opt.cmd =~/M/ diff --git a/lib/sisu/v3dv/texinfo_format.rb b/lib/sisu/v3dv/texinfo_format.rb index fc7ffde2..30d40e20 100644 --- a/lib/sisu/v3dv/texinfo_format.rb +++ b/lib/sisu/v3dv/texinfo_format.rb @@ -81,20 +81,20 @@ module SiSU_TexInfoFormat        year=t.year        filename=%{#{@md.fns}}[/(.+?)\.\w\w\d\d$/,1]        title=spec_char(@md.title.full) -      title=title.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ") -      title.gsub!(/\$/,"\\$") -      title.gsub!(/[,]\s*/,' - ') +      title=title.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} "). +        gsub(/\$/,"\\$"). +        gsub(/[,]\s*/,' - ')        if @md.title.sub          subtitle=spec_char(@md.title.sub) -        subtitle=subtitle.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ") -        subtitle.gsub!(/\$/,"\\$") -        subtitle.gsub!(/[,]\s*/,' - ') +        subtitle=subtitle.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} "). +          gsub(/\$/,"\\$"). +          gsub(/[,]\s*/,' - ')          subtitle="@subtitle @value{VERSION}, @value{UPDATED}\n" #bugwatch        end        subtitle ||=''        author=@md.author if @md.author        author ||='' -      author.gsub!(/[\*]/,'') #if author +      author=author.gsub(/[\*]/,'') #if author        v=SiSU_Env::InfoVersion.instance.get_version        head =<<WOK  \\input texinfo   @c -*-texinfo-*- @@ -151,9 +151,9 @@ WOK      end      def topnode(txt)        txt=spec_char(txt) -      txt=txt.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ") -      txt.gsub!(/\$/,"\\$") -      txt.gsub!(/[,]\s*/,' - ') +      txt=txt.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} "). +        gsub(/\$/,"\\$"). +        gsub(/[,]\s*/,' - ')        "@c %% 4\n" +          "@ifnottex\n" +          "@node Top\n" + @@ -298,15 +298,14 @@ WOK        and dob.obj !~/##{dob.ocn}/          dob.obj="#{dob.obj} ##{dob.ocn}"        end -      dob.obj.gsub!(/<:#>/,'') -      dob.obj.strip! +      dob.obj=dob.obj.gsub(/<:#>/,'').strip        dob      end      def menu        dob=clean(@dob)        m=dob.obj -      m.gsub!(/[:,]\s*/,' - ') -      m.gsub!(/@footnote\{.+?\}\s+/,'') +      m=m.gsub(/[:,]\s*/,' - '). +        gsub(/@footnote\{.+?\}\s+/,'')        m="* #{m}::"      end      def level1 @@ -347,80 +346,79 @@ WOK      end      def submenu        @dob.obj=@dob.obj.join("\n") -      @dob.obj.gsub!(/[5]\\+~\S+/,'') +      @dob.obj=@dob.obj.gsub(/[5]\\+~\S+/,'')        dob=clean(@dob)        dob.obj="@menu\n#{dob.obj}\n@end menu\n\n" -      dob.obj.gsub!(/.+/m,"#{dob.obj}") +      dob.obj=dob.obj.gsub(/.+/m,"#{dob.obj}")      end      def subsubmenu        @dob.obj=@dob.obj.join("\n") -      @dob.obj.gsub!(/[6]\\+~\S+/,'') +      @dob.obj=@dob.obj.gsub(/[6]\\+~\S+/,'')        dob=clean(@dob)        dob.obj="@menu\n#{dob.obj}\n@end menu\n\n" -      dob.obj.gsub!(/.+/m,"#{dob.obj}") +      dob.obj=dob.obj.gsub(/.+/m,"#{dob.obj}")      end      def indent1 -      @dob.obj.gsub!(/<:i1>(.*)/,'\1') +      @dob.obj=@dob.obj.gsub(/<:i1>(.*)/,'\1')      end      def indent2 -      @dob.obj.gsub!(/<:i2>(.*)/,'\1') +      @dob.obj=@dob.obj.gsub(/<:i2>(.*)/,'\1')      end      def spec_char(txt) # special characters -      txt.gsub!(/#{Mx[:br_eof]}/i,'') -      txt.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'(c)') -      txt.gsub!(/#{Mx[:gl_o]}#(?:lt|060)#{Mx[:gl_c]}/,'<'); txt.gsub!(/#{Mx[:gl_o]}(gt|#062)#{Mx[:gl_c]}/,'>') -      txt.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'); txt.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') -      txt.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~') -      txt.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') -      txt.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') -      txt.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') -      txt.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') -      txt.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') -      txt.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\') -      txt.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n")                                   # watch -      txt.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ') -      #txt.gsub!(/\\/,'\\backslash ') -      txt.gsub!(/<:pb>/,'\\newpage') -      txt.gsub!(/\\backslash copyright/,'\\copyright ') -      txt.gsub!(/\^/,'\\wedge ') -      txt.gsub!(/(\$)/,"\\$") -      txt.gsub!(/\~/,'\\~') -      txt.gsub!(/#{Mx[:url_o]}(https?:\S+?)#{Mx[:url_c]}/,'<\1>') -      txt.gsub!(/#{Mx[:url_o]}_(https?:\S+?)#{Mx[:url_c]}/,'\1') -      txt.gsub!(/§/i,'\S') -      txt.gsub!(/£/i,'\pounds') -      txt.gsub!(/å/,'\aa'); txt.gsub!(/Å/,'\AA') -      txt.gsub!(/æ/,'\ae'); txt.gsub!(/Æ/,'\AE') -      txt.gsub!(/ø/,'\o'); txt.gsub!(/Ø/,'\O') -      txt.gsub!(/<a href=".+?">/i,' ') -      txt.gsub!(/<\/a>/i,' ') -      txt.gsub!(/<!>/i,' ') -      txt.gsub!(/#{Mx[:br_paragrph]}/i,'') #watch -      txt.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*\1*') -      txt.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/\1/') -      txt.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_\1_') -      txt.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]') -      txt.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^') -      txt.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+\1+') -      txt.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"') -      txt.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'-\1-') -      txt.gsub!(/@/i,'@@') -      txt.gsub!(/\{/,'@{'); txt.gsub!(/\}/,'@}') -      txt.gsub!(/(?: |#{Mx[:nbsp]})+/,' ')        # ~ character for hardspace -      txt.gsub!(/&(\S+?);/,' ') -      txt.gsub!(/&/,'<=and>') -      txt.gsub!(/(\s+&\s+)/,' and ') -      txt.gsub!(/(\&)/,"\\&") -      txt.gsub!(/"(.+?)"/,"`\\1'")                                        # open & close " -      txt.gsub!(/\s+"/," `")                                              # open " -      txt.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*"/,'\1`')       # open " -      txt.gsub!(/"(\s|\.|,|:|;)/,"'\\1")                                  # close " -      txt.gsub!(/"([1-6-]\\+(?:~\S+)?|<.+?>)?\s*$/,"'\\1")       # close " -      txt.gsub!(/"(\.|,)/,"'")                                            # close " -      txt.gsub!(/\s+'/," `")                                              # open ' -      txt.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*'/,'\1`')       # open ' -      txt.gsub!(/(<font.*?>|<\/font>)/,'') -      txt +      txt=txt.gsub(/#{Mx[:br_eof]}/i,''). +        gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'(c)'). +        gsub(/#{Mx[:gl_o]}#(?:lt|060)#{Mx[:gl_c]}/,'<').gsub(/#{Mx[:gl_o]}(gt|#062)#{Mx[:gl_c]}/,'>'). +        gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}'). +        gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~'). +        gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!'). +        gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#'). +        gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*'). +        gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/'). +        gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_'). +        gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\'). +        gsub(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n").                                   # watch +        gsub(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' '). +        #gsub(/\\/,'\\backslash '). +        gsub(/<:pb>/,'\\newpage'). +        gsub(/\\backslash copyright/,'\\copyright '). +        gsub(/\^/,'\\wedge '). +        gsub(/(\$)/,"\\$"). +        gsub(/\~/,'\\~'). +        gsub(/#{Mx[:url_o]}(https?:\S+?)#{Mx[:url_c]}/,'<\1>'). +        gsub(/#{Mx[:url_o]}_(https?:\S+?)#{Mx[:url_c]}/,'\1'). +        gsub(/§/i,'\S'). +        gsub(/£/i,'\pounds'). +        gsub(/å/,'\aa').gsub(/Å/,'\AA'). +        gsub(/æ/,'\ae').gsub(/Æ/,'\AE'). +        gsub(/ø/,'\o').gsub(/Ø/,'\O'). +        gsub(/<a href=".+?">/i,' '). +        gsub(/<\/a>/i,' '). +        gsub(/<!>/i,' '). +        gsub(/#{Mx[:br_paragrph]}/i,''). #watch +        gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*\1*'). +        gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/\1/'). +        gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_\1_'). +        gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]'). +        gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^'). +        gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+\1+'). +        gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"'). +        gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'-\1-'). +        gsub(/@/i,'@@'). +        gsub(/\{/,'@{').gsub(/\}/,'@}'). +        gsub(/(?: |#{Mx[:nbsp]})+/,' ').        # ~ character for hardspace +        gsub(/&(\S+?);/,' '). +        gsub(/&/,'<=and>'). +        gsub(/(\s+&\s+)/,' and '). +        gsub(/(\&)/,"\\&"). +        gsub(/"(.+?)"/,"`\\1'").                                        # open & close " +        gsub(/\s+"/," `").                                              # open " +        gsub(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*"/,'\1`').       # open " +        gsub(/"(\s|\.|,|:|;)/,"'\\1").                                  # close " +        gsub(/"([1-6-]\\+(?:~\S+)?|<.+?>)?\s*$/,"'\\1").       # close " +        gsub(/"(\.|,)/,"'").                                            # close " +        gsub(/\s+'/," `").                                              # open ' +        gsub(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*'/,'\1`').       # open ' +        gsub(/(<font.*?>|<\/font>)/,'')      end      def longtable        @end_table="\\end{longtable}" @@ -440,28 +438,28 @@ WOK          @colW=@colW.join          @@start_table="\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" +            "\\begin{longtable}[hb]#{@colW}\n" -        @dob.obj.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") #fix +        @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") #fix        end        if @dob =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ #fix -        @dob.obj.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #{@end_table}") #fix +        @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #{@end_table}") #fix        end -      @dob.obj.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') +      @dob.obj=@dob.obj.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')        if @@tableheader==1          if @dob =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u            tablefoot=para[/\<!f(.+?)!\>/,1] -          @dob.obj.gsub!(/\<!f(.+?)!\>/,'') -          @dob.obj.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u, -          "{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&") -          @dob.obj.gsub!(/&>\s*$/, -          " #{@row_break} \\hline\\endhead #{@row_break}") +          @dob.obj=@dob.obj.gsub(/\<!f(.+?)!\>/,''). +            gsub(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u, +              "{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&"). +            gsub(/&>\s*$/, +              " #{@row_break} \\hline\\endhead #{@row_break}")            @dob="#{@dob} \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot            @@tableheader=0            @@number_of_cols=0          end        else          if @dob =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u -          @dob.obj.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&") -          @dob.obj.gsub!(/&>\s*$/," #{@row_break}") +          @dob.obj=@dob.obj.gsub(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&"). +            gsub(/&>\s*$/," #{@row_break}")          end        end        @dob @@ -482,10 +480,10 @@ WOK            @colW << "p{#{col_w}cm}" if col_w          end          @@start_table="\\begin{tabular}{#{@colW}}\n" -        @dob.obj.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") #fix +        @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") #fix        end        if @dob =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ #fix -        @dob.obj.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#{@end_table}") #fix +        @dob.obj=@dob.obj.gsub(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#{@end_table}") #fix          @@table_pg_break_counter=1        end        if @dob =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u @@ -496,21 +494,21 @@ WOK              "#{@@start_table}\n"            @@table_pg_break_counter=1          else -          @dob.obj.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') +          @dob.obj=@dob.obj.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')            @@table_pg_break_counter+=1            tablefoot=@dob[/\<!f(.+?)!\>/] -          @dob.obj.gsub!(/\<!f(.+?)!\>/,'') +          @dob.obj=@dob.obj.gsub(/\<!f(.+?)!\>/,'')          end        end        if @dob =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u -      @dob.obj.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&") -      @dob.obj.gsub!(/&>\s*$/,"#{@row_break}") +        @dob.obj=@dob.obj.gsub(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&"). +          gsub(/&>\s*$/,"#{@row_break}")        end        @dob      end      def graphics        dir=SiSU_Env::InfoEnv.new(@md.fns) -      @dob.obj.gsub!(/<::\s+(\S+?)\s+>/i, #watch +      @dob.obj=@dob.obj.gsub(/<::\s+(\S+?)\s+>/i, #watch          "\\includegraphics*[width=11pt]{#{dir.path.image_source_include}/c_\\1.png}")      end      def image @@ -518,17 +516,17 @@ WOK        width="100"        width=@dob[/<:image.+?width=``(\d+)''.+?>/im,1]        width=width.to_i*0.4 -      @dob.obj.gsub!(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/i, -        "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_include}/\\2}}") -      @dob.obj.gsub!(/<:image\s+(\S+)\s+.+\s+?>/i, -        "\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_include}/\\1}") +      @dob.obj=@dob.obj.gsub(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/i, +          "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_include}/\\2}}"). +        gsub(/<:image\s+(\S+)\s+.+\s+?>/i, +          "\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_include}/\\1}")      end      def png        # very messy clean up ! - work area, testing        z=@dob[/\\\{(.+?)\}(?:image|png)/,1] # match operator for z \\ fragile !        image,w,x,y=z.scan(/\S+/) -      image.gsub!(/\\/,'') -      @dob.obj.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"<image #{image} not available>")  # fragile match operator\\ fragile ! +      image=image.gsub(/\\/,'') +      @dob.obj=@dob.obj.gsub(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"<image #{image} not available>")  # fragile match operator\\ fragile !      end      def http        # very messy clean up ! - work area, testing @@ -536,7 +534,7 @@ WOK        url=@dob[/((?:https?|file|ftp):\S+)/im,1]        if @dob =~/\.(png|jpg|gif)/          image,w,x,y=z.scan(/\S+/) -        image.gsub!(/\\/,'') +        image=image.gsub(/\\/,'')          width=200          width=z[/w=(\d+)/im,1] if z =~/w=(\d+)/          width=width.to_i*0.8 @@ -546,11 +544,11 @@ WOK        end        if image          dir=SiSU_Env::InfoEnv.new(@md.fns) -        @dob.obj.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/, # fragile match operator\\ fragile ! +        @dob.obj=@dob.obj.gsub(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/, # fragile match operator\\ fragile !            "\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_include}/#{image}}}#{caption}")        else          link=z[/(.+?)\\/im,1] -        @dob.obj.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+#{Mx[:url_c]}/,"\n\\noindent\\href{#{url}}{#{link}}")  # fragile match operator\\ fragile ! +        @dob.obj=@dob.obj.gsub(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+#{Mx[:url_c]}/,"\n\\noindent\\href{#{url}}{#{link}}")  # fragile match operator\\ fragile !        end      end    end @@ -563,23 +561,21 @@ WOK        and txt !~/##{dob.ocn}/          txt="#{dob.obj} ##{dob.ocn}"        end -      txt.gsub!(/<:#>/,'') -      txt.strip! -      txt +      txt=txt.gsub(/<:#>/,'').strip      end      def submenu        txt=@txt.join("\n") -      txt.gsub!(/[5]\\+~\S+/,'') +      txt=txt.gsub(/[5]\\+~\S+/,'')        txt=clean(@dob,txt)        txt="@menu\n#{txt}\n@end menu\n\n" -      txt.gsub!(/.+/m,"#{txt}") +      txt=txt.gsub(/.+/m,"#{txt}")      end      def subsubmenu        txt=@txt.join("\n") -      txt.gsub!(/[6]\\+~\S+/,'') +      txt=txt.gsub(/[6]\\+~\S+/,'')        txt=clean(@dob,txt)        txt="@menu\n#{dob.obj}\n@end menu\n\n" -      txt.gsub!(/.+/m,"#{txt}") +      txt=txt.gsub(/.+/m,"#{txt}")      end    end  end diff --git a/lib/sisu/v3dv/texpdf.rb b/lib/sisu/v3dv/texpdf.rb index ee623cec..f8010511 100644 --- a/lib/sisu/v3dv/texpdf.rb +++ b/lib/sisu/v3dv/texpdf.rb @@ -208,8 +208,8 @@ module SiSU_TeX                  when /\.(?:-|ssm\.)?sst$/                    if FileTest.directory?(@env.processing_path.tex)==true                      Dir.chdir(@env.processing_path.tex) -                    texfile=@md.fns.gsub(/$/,".#{ps}.tex") -                    texfile=texfile.gsub(/~/,'-') +                    texfile=@md.fns.gsub(/$/,".#{ps}.tex"). +                      gsub(/~/,'-')                      if File.exist?(texfile) \                      and File.size(texfile) > 0                        @tex_f_no+=1 @@ -347,7 +347,7 @@ module SiSU_TeX            dob.tmp=dob.obj #.dup            if dob.is=='para' \            or dob.is=='heading' -            dob.tmp.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') +            dob.tmp=dob.tmp.gsub(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')              dob.tmp=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters              if dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/                dob.tmp=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob.tmp).url_str_internal(dob.tmp) @@ -374,9 +374,9 @@ module SiSU_TeX          data.each do |dob|            # EMBEDDED FOOTNOTES / ENDNOTES should be straightforward but not quite a synch.            if dob.tmp =~/#{Mx[:en_a_o]}[\d*+]+\s|#{Mx[:en_b_o]}([*+]\d+)\s/ -            dob.tmp.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\footnote[\\1]{%\n \\2} ") -            dob.tmp.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ") -            dob.tmp.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ") +            dob.tmp=dob.tmp.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\footnote[\\1]{%\n \\2} "). +              gsub(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/m,"\\FootnoteA{\\1}{%\n \\2} "). +              gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/m,"\\FootnoteA{\\1}{%\n \\2} ")            end          end          data @@ -416,14 +416,14 @@ module SiSU_TeX        def box_boites(dob,ocn)          sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp,dob.is)          dob.tmp=sp_char.special_characters_safe -        dob.tmp.gsub!(/(#{Mx[:nbsp]})/m,'{\color{mywhite}\1}') -        #dob.tmp.gsub!(/#{Mx[:nbsp]}/m,'{~}') # dob.tmp.gsub!(/#{Mx[:nbsp]}\s*/m,'{~}') -        dob.tmp.gsub!(/#{Mx[:vline]}/m,'\vline') -        dob.tmp.gsub!(/ \\( |#{Mx[:br_nl]})/,' {\textbackslash}\1') -        dob.tmp.gsub!(/#{Mx[:br_nl]}\s*\Z/m,'') -        dob.tmp.gsub!(/#{Mx[:br_nl]}{2}/,'\newline \\\\\\ ') -        dob.tmp.gsub!(/#{Mx[:br_nl]}/,' \\\\\\ ') -        dob.tmp.gsub!(/\n\n\n/m," \\newline\n\n") +        dob.tmp=dob.tmp.gsub(/(#{Mx[:nbsp]})/m,'{\color{mywhite}\1}'). +        #dob.tmp.gsub(/#{Mx[:nbsp]}/m,'{~}') # dob.tmp.gsub(/#{Mx[:nbsp]}\s*/m,'{~}') +          gsub(/#{Mx[:vline]}/m,'\vline'). +          gsub(/ \\( |#{Mx[:br_nl]})/,' {\textbackslash}\1'). +          gsub(/#{Mx[:br_nl]}\s*\Z/m,''). +          gsub(/#{Mx[:br_nl]}{2}/,'\newline \\\\\\ '). +          gsub(/#{Mx[:br_nl]}/,' \\\\\\ '). +          gsub(/\n\n\n/m," \\newline\n\n")          ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob)          dob.tmp = ocn \          + @tex_ml.paraskip_small \ @@ -439,11 +439,11 @@ module SiSU_TeX        def box_listings(dob,ocn)          sp_char=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp,dob.is)          dob.tmp=sp_char.characters_code_listings -        dob.tmp.gsub!(/^\s+/m,'') #bug, fix earlier, should be made unecessary -        dob.tmp.gsub!(/#{Mx[:nbsp]}/m,' ') -        dob.tmp.gsub!(/#{Mx[:vline]}/m,'|') -        dob.tmp.gsub!(/#{Mx[:br_nl]}(?:\s?\n)?/m,"\n") -        dob.tmp.gsub!(/\n\n\n/m," \n\n") +        dob.tmp=dob.tmp.gsub(/^\s+/m,''). #bug, fix earlier, should be made unecessary +          gsub(/#{Mx[:nbsp]}/m,' '). +          gsub(/#{Mx[:vline]}/m,'|'). +          gsub(/#{Mx[:br_nl]}(?:\s?\n)?/m,"\n"). +          gsub(/\n\n\n/m," \n\n")          ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob)          dob.tmp = ocn \          + @tex_ml.paraskip_small \ @@ -466,9 +466,9 @@ module SiSU_TeX          if dob.of=='block'            @lineone=case dob.is            when /block|group|alt|verse/ -            dob.tmp.gsub!(/#{Mx[:nbsp]}/m,'{~}') -            dob.tmp.gsub!(/#{Mx[:gl_bullet]}/m,'$\txtbullet$\hspace{\enspace}') #Bullet environment not used for grouped text, ∴ no hanging indent here -            dob.tmp.gsub!(/#{Mx[:br_nl]}+/m,"\n\n") #match not ideal, but currently not inserting extra newlines anyway +            dob.tmp=dob.tmp.gsub(/#{Mx[:nbsp]}/m,'{~}'). +              gsub(/#{Mx[:gl_bullet]}/m,'$\txtbullet$\hspace{\enspace}'). #Bullet environment not used for grouped text, ∴ no hanging indent here +              gsub(/#{Mx[:br_nl]}+/m,"\n\n") #match not ideal, but currently not inserting extra newlines anyway              ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob)              dob.tmp=if dob.is=='group' \              or dob.is=='block' \ @@ -568,16 +568,16 @@ module SiSU_TeX              and (dob.indent != dob.hang or dob.indent =~/[1-9]/)                dob.tmp=tst.hang              else -              dob.tmp.strip! +              dob.tmp=dob.tmp.strip                dob=enclose(dob) unless dob.tmp =~/^$/              end            else -            dob.tmp.strip! unless dob.is=='code' +            dob.tmp=dob.tmp.strip unless dob.is=='code'              dob=enclose(dob) unless dob.tmp =~/^$/            end            if dob.class==String -            dob.tmp.gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \newline ')   #% tread with care -            dob.tmp.gsub!(/(\.#{Tex[:tilde]}\S*\s*|<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ')   #% tread with care +            dob.tmp=dob.tmp.gsub(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \newline ').   #% tread with care +              gsub(/(\.#{Tex[:tilde]}\S*\s*|<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ')   #% tread with care            end            dob          end @@ -872,12 +872,16 @@ WOK          ps,h,fn=o[:ps],o[:h],o[:filename]          if h[ps] \          and (h[ps][:p] and h[ps][:l]) -          h[ps][:p].gsub!(/[ ]+$/m,'') if h[ps][:p] -          h[ps][:l].gsub!(/[ ]+$/m,'') if h[ps][:l] -          #h[ps][:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:p] -          #h[ps][:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:l] -          h[ps][:p].gsub!(/\n\n\n+/m,"\n\n") if h[ps][:p] -          h[ps][:l].gsub!(/\n\n\n+/m,"\n\n") if h[ps][:l] +          if h[ps][:p] +            h[ps][:p]=h[ps][:p].gsub(/[ ]+$/m,''). +              gsub(/\n\n\n+/m,"\n\n") +          end +          if h[ps][:l] +            h[ps][:l]=h[ps][:l].gsub(/[ ]+$/m,''). +              gsub(/\n\n\n+/m,"\n\n") +          end +            #h[ps][:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:p] +            #h[ps][:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[ps][:l]            if h[ps][:p] !~/\A\s*\Z/              fn[:portrait].puts h[ps][:p],"\n"            end @@ -885,12 +889,16 @@ WOK              fn[:landscape].puts h[ps][:l],"\n"            end          elsif (h[:p] and h[:l]) -          h[:p].gsub!(/[ ]+$/m,'') if h[:p] -          h[:l].gsub!(/[ ]+$/m,'') if h[:l] -          #h[:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:p] -          #h[:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:l] -          h[:p].gsub!(/\n\n\n+/m,"\n\n") if h[:p] -          h[:l].gsub!(/\n\n\n+/m,"\n\n") if h[:l] +          if h[:p] +            h[:p]=h[:p].gsub(/[ ]+$/m,''). +              gsub(/\n\n\n+/m,"\n\n") +          end +          if h[:l] +            h[:l]=h[:l].gsub(/[ ]+$/m,''). +              gsub(/\n\n\n+/m,"\n\n") +          end +            #h[:p].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:p] +            #h[:l].gsub!(/(?:^[ ]+|[ ]+$)/m,'') if h[:l]            if h[:p] !~/\A\s*\Z/              fn[:portrait].puts h[:p],"\n"            end @@ -901,9 +909,7 @@ WOK          end        end        def output(array) -        array.flatten! -        array.compact! -        @array=array +        @array=array=array.flatten.compact          fns_l=@md.fns.gsub(/~/,'-') #this is a sorry fix, but necessary as it appears latex programs like not ~          @md.papersize_array.each do |ps|            file={ @@ -924,7 +930,7 @@ WOK              and morph.tmp.class==String                if morph.is !='code' \                && morph.of !='block' -                morph.tmp.gsub!(/^\s+/,'') +                morph.tmp=morph.tmp.gsub(/^\s+/,'')                else morph.tmp                end                if morph.tmp !~/\A\s*\Z/ \ diff --git a/lib/sisu/v3dv/texpdf_format.rb b/lib/sisu/v3dv/texpdf_format.rb index d059934d..2eddf72c 100644 --- a/lib/sisu/v3dv/texpdf_format.rb +++ b/lib/sisu/v3dv/texpdf_format.rb @@ -65,17 +65,17 @@ module SiSU_TeX_Pdf        @brace_url=SiSU_Viz::Skin.new.url_decoration      end      def bare_urls -      @dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, -        "#{@brace_url.tex_open}\\1</a>#{@brace_url.tex_close}") -      @dob.tmp.gsub!(/(^|[^\\])_/m,'\1\_') #watch may not work -      @dob.tmp.gsub!(/(^|[^#{Mx[:lnk_c]}])#{Mx[:url_o]}_?(?:\\?_)?(\S+?)#{Mx[:url_c]}/m, -        "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}") +      @dob.obj=@dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, +          "#{@brace_url.tex_open}\\1</a>#{@brace_url.tex_close}") +      @dob.tmp=@dob.tmp.gsub(/(^|[^\\])_/m,'\1\_'). #watch may not work +        gsub(/(^|[^#{Mx[:lnk_c]}])#{Mx[:url_o]}_?(?:\\?_)?(\S+?)#{Mx[:url_c]}/m, +          "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}")        @dob      end      def bare_urls_in_code -      @dob.tmp.gsub!(/(^|[^\\])_/m,'\1\_') #watch may not work -      @dob.tmp.gsub!(/(https?:\/\/\S+?)([{]|[.,;)\]]?(?: |$))/m, -        '\begin{scriptsize}\url{\1}\end{scriptsize}\2') +      @dob.tmp=@dob.tmp.gsub(/(^|[^\\])_/m,'\1\_'). #watch may not work +        gsub(/(https?:\/\/\S+?)([{]|[.,;)\]]?(?: |$))/m, +          '\begin{scriptsize}\url{\1}\end{scriptsize}\2')        @dob      end    end @@ -109,17 +109,16 @@ module SiSU_TeX_Pdf        "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{dob.ocn}}\\end{tiny}}}" #ocn object citation numbering      end      def table_special_characters(r) -      r.gsub!(/#{Mx[:tc_p]}|$/u,'&') -      r.gsub!(/%/,'\%') -      r.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}') -      r.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}') -      r.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem -      r.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK -      r.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem -      r.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem -      r.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$") -      r.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$") -      r +      r=r.gsub(/#{Mx[:tc_p]}|$/u,'&'). +        gsub(/%/,'\%'). +        gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}'). +        gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}'). +        gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}'). # ulem +        gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''"). # quote #CHECK +        gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}'). # ulem +        gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}'). # ulem +        gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$"). +        gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$")      end      def longtable_landscape        end_table='\end{longtable}' @@ -147,19 +146,21 @@ module SiSU_TeX_Pdf            "\\begin{tiny}\n\\begin{longtable}#{colW}\n"          rows=@dob.obj.split(/#{Mx[:br_nl]}/)          if @dob.head_ #result imperfect, check on -          rows[0].gsub!(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&') -          rows[0].gsub!(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}") +          rows[0]=rows[0].gsub(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&'). +            gsub(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")          end +        rows_new=[]          rows.each do |r|            r=table_special_characters(r) -          r.gsub!(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/ +          r=r.gsub(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/            if r=~/\<!f(.+?)!\>/ # not tested table footer if any              tablefoot=$1 -            r.gsub!(/\<!f(.+?)!\>/,'') +            r=r.gsub(/\<!f(.+?)!\>/,'')              r="#{r} \\multicolumn{#{@dob.cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n"            end +          rows_new << r          end -        table=rows.join #@dob[:dal].obj=rows.join +        table=rows_new.join #@dob[:dal].obj=rows.join          ocn_display(@dob) + start_table + table + " #{end_table}\n\\end{tiny}"        else ''        end @@ -190,19 +191,21 @@ module SiSU_TeX_Pdf            "\\begin{tiny}\n\\begin{longtable}#{colW}\n"          rows=@dob.obj.split(/#{Mx[:br_nl]}/)          if @dob.head_ -          rows[0].gsub!(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&') -          rows[0].gsub!(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}") +          rows[0]=rows[0].gsub(/(^|.+?)(?:#{Mx[:tc_p]}|$)/u,'\bfseries \1&'). +            gsub(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")          end +        rows_new=[]          rows.each do |r|            r=table_special_characters(r) -          r.gsub!(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/ +          r=r.gsub(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/            if r=~/\<!f(.+?)!\>/ # not tested table footer if any              tablefoot=$1 -            r.gsub!(/\<!f(.+?)!\>/,'') +            r=r.gsub(/\<!f(.+?)!\>/,'')              r="#{r} \\multicolumn{#{@dob.cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n"            end +          rows_new << r          end -        table=rows.join #@dob[:dal].obj=rows.join +        table=rows_new.join #@dob[:dal].obj=rows.join          ocn_display(@dob) + start_table + table + " #{end_table}\n\\end{tiny}"        else ''        end @@ -210,17 +213,17 @@ module SiSU_TeX_Pdf      def heading_major        dob=@dob        title=@md.title.full -      dob.tmp.strip! if dob.tmp -      dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2') +      dob.tmp=dob.tmp.strip if dob.tmp +      dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')        cont_ln=dob.tmp.dup -      cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2') -      cont_ln.gsub!(@@tex_pattern_margin_number,'') +      cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2'). +        gsub(@@tex_pattern_margin_number,'')        clearp=(dob.lv =~/B/ && dob.obj =='Metadata') ? "\\clearpage\n" : ''        if dob.tmp =~/\\[Ff]ootnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings! -        cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ') -        cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') +        cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' '). +          gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')        end -      dob.tmp.gsub!(/^(.*)\n?$/m, +      dob.tmp=dob.tmp.gsub(/^(.*)\n?$/m,          "#{clearp}\\part*{\\1}  \\addcontentsline{toc}{section}{#{cont_ln}}  \\markboth{#{title}}\n") @@ -228,23 +231,23 @@ module SiSU_TeX_Pdf      end      def level4        dob=@dob -      dob.tmp.strip! if dob.tmp -      dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2') +      dob.tmp=dob.tmp.strip if dob.tmp +      dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')        cont_ln=dob.tmp.dup -      cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2') -      cont_ln.gsub!(@@tex_pattern_margin_number,'') -      cont_ln.gsub!(/#{Tex[:backslash]*2}/,"#{Tex[:backslash]*4}") # added w42 -      cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 -      cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 +      cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2'). +        gsub(@@tex_pattern_margin_number,''). +        gsub(/#{Tex[:backslash]*2}/,"#{Tex[:backslash]*4}"). # added w42 +        gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 +        gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22        title=@md.title.full        if dob.name =~/endnotes/ -        dob.tmp.gsub!(/.+/m,'') +        dob.tmp=dob.tmp.gsub(/.+/m,'')        end        if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings! -        cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ') -        cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') +        cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' '). +          gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')        end -      dob.tmp.gsub!(/^(.*)?\n?$/m,"\\subsubsection*{\\1} +      dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,"\\subsubsection*{\\1}  \\addcontentsline{toc}{subsection}{#{cont_ln}}  \\markright{#{title}}")        dob @@ -252,19 +255,19 @@ module SiSU_TeX_Pdf      def level5        dob=@dob        # there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\@txt*, same for next section 2002w46 -      dob.tmp.strip! if dob.tmp -      dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2') +      dob.tmp=dob.tmp.strip if dob.tmp +      dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')        cont_ln=dob.tmp.dup -      cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2') -      cont_ln.gsub!(@@tex_pattern_margin_number,'') -      cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 -      cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 -      cont_ln.gsub!(/\\\&/,' and ') #revisit: tmp bugfix 200507, substitutes & with 'and' in toc, needed e.g. for AT&T, see ffa +      cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2'). +        gsub(@@tex_pattern_margin_number,''). +        gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 +        gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 +        gsub(/\\\&/,' and ') #revisit: tmp bugfix 200507, substitutes & with 'and' in toc, needed e.g. for AT&T, see ffa        if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings! -        cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ') -        cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') +        cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' '). +          gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')        end -      dob.tmp.gsub!(/^(.*)?\n?$/m, +      dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,          "\\subsubsection*{\\1}  \\addcontentsline{toc}{subsubsection}{#{cont_ln} \\\\  }") @@ -273,22 +276,22 @@ module SiSU_TeX_Pdf      def level6        dob=@dob        # there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\sub@txt*, same for previous section 2002w46 -      dob.tmp.strip! if dob.tmp -      dob.tmp.gsub!(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2') +      dob.tmp=dob.tmp.strip if dob.tmp +      dob.tmp=dob.tmp.gsub(/\\begin\{(bfseries|itshape)\}(.+?)\\end\{\1\}/m,'\2')        cont_ln=dob.tmp.dup -      cont_ln.gsub!(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2') -      cont_ln.gsub!(@@tex_pattern_margin_number,'') -      cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 -      cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 +      cont_ln=cont_ln.gsub(/\\begin\{(monosp)\}(.+?)\\end\{\1\}/m,'\2'). +        gsub(@@tex_pattern_margin_number,''). +        gsub(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,''). #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 +        gsub(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22        if dob.tmp =~/\\footnote/ #and dob =~/^[1-6]#{Tex[:tilde]}/ # removing footnotes from headings! -        cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ') -        cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') +        cont_ln=cont_ln.gsub(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' '). +          gsub(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ')        end -      dob.tmp.gsub!(/^(.*)?\n?$/m, +      dob.tmp=dob.tmp.gsub(/^(.*)?\n?$/m,          "\\subsubsection*{\\1}  \\addcontentsline{toc}{subsubsection}{~~~~#{cont_ln} \\\\  }") -      #dob.tmp.gsub!(/^(.*)?\n?$/m, +      #dob.tmp.gsub(/^(.*)?\n?$/m,        #  '\subsubsection*{\1}')        dob      end @@ -569,8 +572,7 @@ module SiSU_TeX_Pdf          #? (str.sub!(rgx_url_internal,"\\hyperlink{#{url}}{#{link}}")) \          #: (str.sub!(rgx_url_internal,"#{@brace_rel.tex_open}\\hyperlink{#{url}}{#{link}}#{@brace_rel.tex_close}"))        end -      str.gsub!(/#{Xx[:protect]}/,'') -      str +      str=str.gsub(/#{Xx[:protect]}/,'')      end      def url_str(str)        rgx_url_generic=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m @@ -582,7 +584,7 @@ module SiSU_TeX_Pdf            link=z.strip            link.gsub!(/&/,"#{Xx[:protect]}&")            str.sub!(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}") -          str.gsub!(/#{Xx[:protect]}/,'') +          str=str.gsub(/#{Xx[:protect]}/,'')            str          else str          end @@ -607,6 +609,8 @@ module SiSU_TeX_Pdf            link.gsub!(/&/,"#{Xx[:protect]}&")            dob.tmp.sub!(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}#{punctuate}")            dob.tmp.gsub!(/#{Xx[:protect]}/,'') +          #dob.tmp=dob.tmp.sub(rgx_url_generic,"#{@brace_rel.tex_open}\\href{#{url}}{#{link}}#{@brace_rel.tex_close}#{punctuate}"). +          #  gsub(/#{Xx[:protect]}/,'')            dob          else dob          end @@ -797,7 +801,7 @@ module SiSU_TeX_Pdf        end        if lang_char_arr.length > 0          lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.list[ch][:xlp] } -        otherlang.uniq! +        otherlang=otherlang.uniq        end        otherlang=otherlang.join(',')        { mainlang: mainlang, otherlang: otherlang } @@ -1182,11 +1186,11 @@ WOK        para_array=[]        str=if word          word.each do |w| # _ - / # | : ! ^ ~ -          w.gsub!(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<'); w.gsub!(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>') -          w.gsub!(/[\\]?~/,'~') -          w.gsub!(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,"\n") #watch -          w.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'~') #126 usual -          w.gsub!(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') #unless is=='code' #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX +          w=w.gsub(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<').gsub(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>'). +            gsub(/[\\]?~/,'~'). +            gsub(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,"\n"). #watch +            gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'~'). #126 usual +            gsub(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|') #unless is=='code' #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX            para_array << w          end          str=para_array.join(' ') @@ -1194,34 +1198,33 @@ WOK          str        else ''        end -      str.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ') -      str.gsub!(/.+?<-#>/,'') -      str.gsub!(/#{Mx[:br_eof]}/,'') -      str.gsub!(/#{Mx[:br_endnotes]}/,'') +      str=str.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' '). +        gsub(/.+?<-#>/,''). +        gsub(/#{Mx[:br_eof]}/,''). +        gsub(/#{Mx[:br_endnotes]}/,'').        #problem sequence -> -      str.gsub!(/&(?:lt|#060);/,'<')                                         # < SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'>')                   # > SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')                   # { SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')                  # } SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'~')             # ~ SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')                           # # SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')                            # ! SiSU not really special sisu character but done, also LaTeX -      #str.gsub!(/(^|\s)\*\s/,'\1\asterisk ')                                   # * should you wish to escape astrisk e.g. describing \*{bold}* -      str.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')                           # * should you wish to escape astrisk e.g. describing \*{bold}* -      str.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-')                            # - SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+')                            # + SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',')                            # + SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'&') #unless @txt=~/<:code>/  # / SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')                       # / SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\')               # \ SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')                # _ SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|')                            # | SiSU not really special sisu character but done, also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':')                            # : SiSU not really special sisu character but done, also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'^')                    # ^ SiSU not really special sisu character but done, also LaTeX +        gsub(/&(?:lt|#060);/,'<').                                         # < SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'>').                   # > SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').                   # { SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').                  # } SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'~').             # ~ SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').                           # # SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').                            # ! SiSU not really special sisu character but done, also LaTeX +       #gsub(/(^|\s)\*\s/,'\1\asterisk ').                                   # * should you wish to escape astrisk e.g. describing \*{bold}* +        gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').                           # * should you wish to escape astrisk e.g. describing \*{bold}* +        gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').                            # - SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+').                            # + SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',').                            # + SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'&'). #unless @txt=~/<:code>/  # / SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').                       # / SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\').               # \ SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').                # _ SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|').                            # | SiSU not really special sisu character but done, also LaTeX +        gsub(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':').                            # : SiSU not really special sisu character but done, also LaTeX +        gsub(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'^').                    # ^ SiSU not really special sisu character but done, also LaTeX        ##watch placement, problem sequence ^ -      str.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ') -      str.gsub!(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript -      str +        gsub(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' '). +        gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript      end      def xetex_special_characters_1(str,is='')                                  # ~ ^ $ & % _ { }  #LaTeX special characters - KEEP list        #str=Iconv.conv('ISO-8859-1', 'UTF-8', @txt) # `require': iconv will be deprecated in the future, use String#encode instead. @@ -1232,16 +1235,16 @@ WOK            if w !~/https?:/ \            and w=~/\/\S+?\// \            and w.length > 6 -            w.gsub!(/([_.\/])/,'\1\-') +            w=w.gsub(/([_.\/])/,'\1\-')            end -          w.gsub!(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<'); w.gsub!(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>') -          w.gsub!(/[\\]?~/,'<=tilde>') -          w.gsub!(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,' \newline ') #watch -          w.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') #126 usual -          w.gsub!(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'\pipe') #unless is=='code' #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX +          w=w.gsub(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<').gsub(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>'). +            gsub(/[\\]?~/,'<=tilde>'). +            gsub(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,' \newline '). #watch +            gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>'). #126 usual +            gsub(/\\?\||#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'\pipe') #unless is=='code' #unless w=~/<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ # | SiSU not really special sisu character but done, also LaTeX            if w !~/#{Mx[:rel_o]}/ \            and w !~/#{Mx[:gl_o]}#/ -            w.gsub!(/\#/,'<=hash>') +            w=w.gsub(/\#/,'<=hash>')            end            para_array << w          end @@ -1250,129 +1253,132 @@ WOK          str        else ''        end -      str.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' ') -      str.gsub!(/.+?<-#>/,'') -      str.gsub!(/#{Mx[:br_eof]}/,'') -      str.gsub!(/#{Mx[:br_endnotes]}/,'') +      str=str.gsub(/\s*#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}\s*/,' '). +        gsub(/.+?<-#>/,''). +        gsub(/#{Mx[:br_eof]}/,''). +        gsub(/#{Mx[:br_endnotes]}/,'')        #problem sequence -> -      str.gsub!(/&(?:nbsp);|#{Mx[:nbsp]}/,'\hardspace') unless is=='code'      # < SiSU special character also LaTeX -      str.gsub!(/&(?:lt|#060);/,'\lt')                                         # < SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'\gt')                   # > SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'\curlyopen')                   # { SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'\curlyclose')                  # } SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>')             # ~ SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'\#')                           # # SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')                            # ! SiSU not really special sisu character but done, also LaTeX -      str.gsub!(/(^|\s)\*\s/,'\1\asterisk ')                                   # * should you wish to escape astrisk e.g. describing \*{bold}* -      str.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'\*')                           # * should you wish to escape astrisk e.g. describing \*{bold}* -      str.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-')                            # - SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+')                            # + SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',')                            # + SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>') #unless @txt=~/<:code>/  # / SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'\slash')                       # / SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\textbackslash')               # \ SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>')                # _ SiSU special character also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|')                            # | SiSU not really special sisu character but done, also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':')                            # : SiSU not really special sisu character but done, also LaTeX -      str.gsub!(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'\caret')                    # ^ SiSU not really special sisu character but done, also LaTeX +      str=str.gsub(/&(?:nbsp);|#{Mx[:nbsp]}/,'\hardspace') unless is=='code'      # < SiSU special character also LaTeX +      str=str.gsub(/&(?:lt|#060);/,'\lt').                                         # < SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'\gt').                   # > SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'\curlyopen').                   # { SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'\curlyclose').                  # } SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>').             # ~ SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'\#').                           # # SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').                            # ! SiSU not really special sisu character but done, also LaTeX +        gsub(/(^|\s)\*\s/,'\1\asterisk ').                                   # * should you wish to escape astrisk e.g. describing \*{bold}* +        gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'\*').                           # * should you wish to escape astrisk e.g. describing \*{bold}* +        gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').                            # - SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+').                            # + SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',').                            # + SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>'). #unless @txt=~/<:code>/  # / SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'\slash').                       # / SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\textbackslash').               # \ SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>').                # _ SiSU special character also LaTeX +        gsub(/#{Mx[:gl_o]}#124#{Mx[:gl_c]}/,'|').                            # | SiSU not really special sisu character but done, also LaTeX +        gsub(/#{Mx[:gl_o]}#058#{Mx[:gl_c]}/,':').                            # : SiSU not really special sisu character but done, also LaTeX +        gsub(/#{Mx[:gl_o]}#094#{Mx[:gl_c]}|\^/,'\caret').                    # ^ SiSU not really special sisu character but done, also LaTeX        ##watch placement, problem sequence ^ -      str.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ') -      str.gsub!(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript -      str +        gsub(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' '). +        gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript      end      def xetex_special_characters_2(str,is='') -      str.gsub!(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe ') -      str.gsub!(/\$/,'\$') -      str.gsub!(/\#/,'\#') -      str.gsub!(/\%/,'\%') -      str.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes +      str=str.gsub(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe '). +        gsub(/\$/,'\$'). +        gsub(/\#/,'\#'). +        gsub(/\%/,'\%'). +        gsub(/\~/,'\~') #revist, should not be necessary to mark remaining tildes        if str !~/^\s*#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\s/ -        str.gsub!(/_/,'\_') +        str=str.gsub(/_/,'\_')        end -      str.gsub!(/\{/,'\{') -      str.gsub!(/\}/,'\}') -      if is=='code' -        str.gsub!(/&/,'{\\\&}') -        str.gsub!(/\\~(\\\{)/,'{$\tilde$}\1') -        str.gsub!(/(\\\})\\~/,'\1{$\tilde$}') -        str.gsub!(/\\~(\[)/,'{$\tilde$}\1') -        str.gsub!(/(\])\\~/,'\1{$\tilde$}') -        str.gsub!(/<=tilde>/,'{$\tilde$}') -        str.gsub!(/<=hash>/,'{\#}') +      str=str.gsub(/\{/,'\{'). +        gsub(/\}/,'\}') +      str=if is=='code' +        str.gsub(/&/,'{\\\&}'). +          gsub(/\\~(\\\{)/,'{$\tilde$}\1'). +          gsub(/(\\\})\\~/,'\1{$\tilde$}'). +          gsub(/\\~(\[)/,'{$\tilde$}\1'). +          gsub(/(\])\\~/,'\1{$\tilde$}'). +          gsub(/<=tilde>/,'{$\tilde$}'). +          gsub(/<=hash>/,'{\#}')        else -        str.gsub!(/ |#{Mx[:nbsp]}/,'~') # ~ character for hardspace -        str.gsub!(/&/,'<=amp>') +        str.gsub(/ |#{Mx[:nbsp]}/,'~'). # ~ character for hardspace +          gsub(/&/,'<=amp>')        end -      str.gsub!(/&\S+?;/,' ') -      str.gsub!(/§/u,'\S') #latex: space between next character not preserved? #str.gsub!(/§ /,'\S ') -      str.gsub!(/£/u,'\pounds') -      str.gsub!(/<a href=".+?">/,' ') -      str.gsub!(/<\/a>/,' ') -      str.gsub!(/((?:^|\s)#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, -        '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url -      str.gsub!(/#{Mx[:url_o]}\\_(\S+?)#{Mx[:url_c]}/, -        '\begin{scriptsize}\url{\1}\end{scriptsize}') #special case \{ e.g. \}http://url -      str.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, -        '\begin{scriptsize}\\url{\1}\end{scriptsize}') #specially escaped url no decoration +      str=str.gsub(/&\S+?;/,' '). +        gsub(/§/u,'\S'). #latex: space between next character not preserved? #str.gsub(/§ /,'\S ') +        gsub(/£/u,'\pounds'). +        gsub(/<a href=".+?">/,' '). +        gsub(/<\/a>/,' '). +        gsub(/((?:^|\s)#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, +          '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3'). #special case \{ e.g. \}http://url +        gsub(/#{Mx[:url_o]}\\_(\S+?)#{Mx[:url_c]}/, +          '\begin{scriptsize}\url{\1}\end{scriptsize}'). #special case \{ e.g. \}http://url +        gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, +          '\begin{scriptsize}\\url{\1}\end{scriptsize}') #specially escaped url no decoration        unless is=='code' -        str.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/, +        str=str.gsub(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/,            "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start -      else #code-block: angle brackets special characters, note _ already escaped -        str.gsub!(/\\_</m,'{\UseTextSymbol{OML}{<}}') -        str.gsub!(/\\_>/m,'{\UseTextSymbol{OML}{>}}')        end -      str.gsub!(/<:ee>/,'') -      str.gsub!(/<!>/,' ') +      str=str.gsub(/<:ee>/,''). +        gsub(/<!>/,' ').        #proposed change, insert, but may be redundant -      str.gsub!(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} ") # Work Area -      str.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}') -      str.gsub!(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}') -      str.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}') -      str.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem -      str.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK -      str.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem -      str.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem -      str.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$") -      str.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$") -      str.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\begin{monosp}\1\end{monosp}') +        gsub(/<(br|p)>|<\/\s*(br|p)>|<(br|p)\s*\/>/," #{Tex[:backslash]*2} "). # Work Area +        gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}'). +        gsub(/<h\d+>(.+?)<\/h\d+>/,'\begin{bfseries}\1 \end{bfseries}'). +        gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}'). +        gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}'). # ulem +        gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''"). # quote #CHECK +        gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}'). # ulem +        gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}'). # ulem +        gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$"). +        gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$"). +        gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\begin{monosp}\1\end{monosp}')        unless is=='code' -        str.gsub!(/"(.+?)"/,'“\1”')  # quote marks / quotations open & close " need condition exclude for code -        str.gsub!(/\s+"/,' “')                                # open " -        str.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“') #fix Mx[:lv_o] # open " -        str.gsub!(/"(\s|\.|,|:|;)/,'”\1')                     # close " -        str.gsub!(/"(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*$/,'”\1') #fix Mx[:lv_o] # close " -        str.gsub!(/"(\.|,)/,'”')                              # close " -        str.gsub!(/\s+'/,' `')                                # open ' -        str.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`') #fix Mx[:lv_o] # open ' +        str=str.gsub(/"(.+?)"/,'“\1”').  # quote marks / quotations open & close " need condition exclude for code +          gsub(/\s+"/,' “').                                # open " +          gsub(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“'). #fix Mx[:lv_o] # open " +          gsub(/"(\s|\.|,|:|;)/,'”\1').                     # close " +          gsub(/"(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*$/,'”\1'). #fix Mx[:lv_o] # close " +          gsub(/"(\.|,)/,'”').                              # close " +          gsub(/\s+'/,' `').                                # open ' +          gsub(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`') #fix Mx[:lv_o] # open '        end -      str.gsub!(/(<font.*?>|<\/font>)/,'') -      str.gsub!(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1') +      str=str.gsub(/(<font.*?>|<\/font>)/,''). +        gsub(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1')        str      end      def xetex_special_characters_3(str) -      str.gsub!(/<br(\s*[^\/][^>])/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder -      str.gsub!(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder +      str=str.gsub(/<br(\s*[^\/][^>])/,'\1'). # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder +        gsub(/([^<][^b][^r]\s+)\/>/,'\1') # clean up, incredibly messy :-( footnote indents, problems if match exists in ordinary paragraphs? check! Work Area 200501 a bit tricky as must be able to match multiple times, and to clean remainder        while str =~/(https?:\/\/\S+?)(?:<=tilde>\S+)+/ #tilde in urls \href treated differently from text #FIX -        str.gsub!(/(https?:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2') +        str=str.gsub(/(https?:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2')        end -      str.gsub!(/<=tilde>/,'{$\tilde$}') -      str.gsub!(/(https?:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2') #hash in urls \href treated differently from text #FIX -      str.gsub!(/<=hash>/,'{\#}') +      str=str.gsub(/<=tilde>/,'{$\tilde$}'). +        gsub(/(https?:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2'). #hash in urls \href treated differently from text #FIX +        gsub(/<=hash>/,'{\#}')        while str =~/(https?:\/\/\S+?)(?:<=amp>\S+)+/ #amp in urls \href treated differently from text #FIX -        str.gsub!(/(https?:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2') +        str=str.gsub(/(https?:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2')        end -      str.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005 -      str.gsub!(/<=copymark>\s*(.+)/, -        '^\copyright \textnormal{\1} \2') # watch likely to be problematic +      str=str.gsub(/<=amp>/,'{\\\&}'). #changed ... 2005 +        gsub(/<=copymark>\s*(.+)/, +          '^\copyright \textnormal{\1} \2') # watch likely to be problematic        str      end +    def special_characters_safe_close(str) +      str=str.gsub(/<=tilde>/,'{$\tilde$}'). +        gsub(/<=hash>/,'{\#}'). +        gsub(/<=amp>/,'{\\\&}'). #changed ... 2005 +        gsub(/<=copymark>\s*(.+)/, +          '^\copyright \textnormal{\1} \2') # watch likely to be problematic +    end      def special_characters_code_fix(str) -      str.gsub!(/<=tilde>/,'{$\tilde$}') +      str=str.gsub(/<=tilde>/,'{$\tilde$}')        str      end      def special_characters_unsafe_1(str) #depreciated, make obsolete        # some substitutions are sequence sensitive, rearrange with care. -      str.gsub!(/\\textbackslash (copyright|clearpage|newpage)/,"\\\\\\1")  #kludge bad solution, find out where tail is sent through specChar ! +      str=str.gsub(/\\textbackslash (copyright|clearpage|newpage)/,"\\\\\\1")  #kludge bad solution, find out where tail is sent through specChar !        str      end      def special_characters                                                     #special characters - some substitutions are sequence sensitive, rearrange with care. @@ -1385,8 +1391,8 @@ WOK      end      def special_word_break_points        str=@txt -      str.gsub!(/([_,.;:\/|=])/,'\1\-') -      str.gsub!(/(--)(\S{4,})/,'\1\-\2') +      str=str.gsub(/([_,.;:\/|=])/,'\1\-'). +        gsub(/(--)(\S{4,})/,'\1\-\2')        @txt=str      end      def special_number_break_points @@ -1398,6 +1404,7 @@ WOK        str,is=@txt,@is        str=xetex_special_characters_1(str,is) unless str.nil?        str=xetex_special_characters_2(str,is) unless str.nil? # remove this to start with, causes issues +      str=special_characters_safe_close(str) unless str.nil?        @txt=str      end      def characters_code_listings                                   #special characters - some substitutions are sequence sensitive, rearrange with care. @@ -1407,7 +1414,7 @@ WOK      end      def special_characters_code        str=@txt -      str.gsub!(/ \\\\([ #{Mx[:br_nl]}]+|$)/,' \textbackslash\textbackslash\hardspace\1') +      str=str.gsub(/ \\\\([ #{Mx[:br_nl]}]+|$)/,' \textbackslash\textbackslash\hardspace\1')        str      end    end diff --git a/lib/sisu/v3dv/urls.rb b/lib/sisu/v3dv/urls.rb index 6d334295..39156dff 100644 --- a/lib/sisu/v3dv/urls.rb +++ b/lib/sisu/v3dv/urls.rb @@ -266,7 +266,7 @@ module SiSU_Urls          if x=~/^o/ \          and @opt.cmd=~/o/ \          and x=~/^[#{@opt.cmd}]/ -          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.odf}/content.xml").maintenance #not implemented +          SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.text_editor} #{@env.processing_path.odf}/#{@opt.fns}/odt/content.xml").maintenance          end        end      end diff --git a/lib/sisu/v3dv/xhtml.rb b/lib/sisu/v3dv/xhtml.rb index f444323a..bf1c964a 100644 --- a/lib/sisu/v3dv/xhtml.rb +++ b/lib/sisu/v3dv/xhtml.rb @@ -135,12 +135,12 @@ module SiSU_XHTML        end      protected        def embedded_endnotes(dob='') -        dob.obj.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/, -          '<endnote><number>\1</number><note>\2</note></endnote> ') -        dob.obj.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/, -          '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') -        dob.obj.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/, -          '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') +        dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/, +            '<endnote><number>\1</number><note>\2</note></endnote> '). +          gsub(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/, +            '<endnote><symbol>\1</symbol><note>\2</note></endnote> '). +          gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/, +            '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')        end        def extract_endnotes(dob='')          notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) @@ -148,26 +148,26 @@ module SiSU_XHTML            s=e.to_s            util=SiSU_TextUtils::Wrap.new(s,70)            wrap=util.line_wrap -          wrap.gsub!(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK +          wrap=wrap.gsub(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK  #{Ax[:tab]*1}<endnote notenumber="\\1">  #{Ax[:tab]*2}\\1. \\2  #{Ax[:tab]*1}</endnote>  WOK -) -          wrap.gsub!(/^([*+]\d+)\s+(.+?)\s*\Z/m, <<WOK +). +            gsub(/^([*+]\d+)\s+(.+?)\s*\Z/m, <<WOK  #{Ax[:tab]*1}<endnote symbol="\\1">  #{Ax[:tab]*2}\\1 \\2  #{Ax[:tab]*1}</endnote>  WOK -) -          wrap.gsub!(/^([*+]+)\s+(.+?)\s*\Z/m, <<WOK +). +            gsub(/^([*+]+)\s+(.+?)\s*\Z/m, <<WOK  #{Ax[:tab]*1}<endnote symbol="\\1.length">  #{Ax[:tab]*2}\\1 \\2  #{Ax[:tab]*1}</endnote>  WOK  )  #KEEP alternative presentation of endnotes -#        wrap.gsub!(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK +#        wrap=wrap.gsub(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK  ##{Ax[:tab]*1}<p class="endnote" notenumber="\\1">  ##{Ax[:tab]*2}\\1. \\2  ##{Ax[:tab]*1}</p> @@ -200,8 +200,8 @@ WOK            else lv=nil            end            extract_endnotes(dob) -          dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean -          dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean +          dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean +            gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean            util=SiSU_TextUtils::Wrap.new(dob.obj,70)            wrapped=util.line_wrap            @@xml[:body] << if defined? dob.ocn @@ -219,9 +219,9 @@ WOK        def block_structure(dob)          named=name_tags(dob)          dob=@trans.markup_block(dob) -        dob.obj.strip! -        dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean -        dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean +        dob.obj=dob.obj.strip. +          gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean +          gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean          @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}          @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}          @@xml[:body] << %{#{Ax[:tab]*1}<text class="block">#{named}#{Ax[:tab]*1}} @@ -232,9 +232,9 @@ WOK        def group_structure(dob)          named=name_tags(dob)          dob=@trans.markup_group(dob) -        dob.obj.strip! -        dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean -        dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean +        dob.obj=dob.obj.strip. +          gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean +          gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean          @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}          @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}          @@xml[:body] << %{#{Ax[:tab]*1}<text class="group">#{named}#{Ax[:tab]*1}} @@ -245,7 +245,7 @@ WOK        def poem_structure(dob)          named=name_tags(dob)          dob=@trans.markup_group(dob) -        dob.obj.strip! +        dob.obj=dob.obj.strip          @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}          @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}          @@xml[:body] << %{#{Ax[:tab]*1}<text class="verse">#{named}#{Ax[:tab]*1}} @@ -256,8 +256,7 @@ WOK        def code_structure(dob)          named=name_tags(dob)          dob=@trans.markup_group(dob) -        dob.obj.gsub!(/\s\s/,'  ') -        dob.obj.strip! +        dob.obj=dob.obj.gsub(/\s\s/,'  ').strip          @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}          @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}          @@xml[:body] << %{#{Ax[:tab]*1}<text class="code">#{named}#{Ax[:tab]*1}} @@ -342,7 +341,7 @@ WOK                end              else #              end -            dob.obj.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj +            dob.obj=dob.obj.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj            end          end          6.downto(4) do |x| @@ -379,7 +378,7 @@ WOK          content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]          content << @@xml[:owner_details] if @md.stmp =~/\w\w/          content << @@xml[:tail] << @@xml[:close] -        content.flatten!.compact! +        content=content.flatten.compact          Output.new(content,@md).xhtml          @@xml={}        end @@ -393,7 +392,7 @@ WOK          SiSU_Env::FileOp.new(@md).mkdir          filename_xml=@file.write_file.xhtml          @data.each do |str| -          str.gsub!(/\A\s+\Z/m,'') #str.gsub!(/^\s+$/,'') +          str=str.gsub(/\A\s+\Z/m,'') #str.gsub(/^\s+$/,'')            filename_xml.puts str unless str.empty?          end          filename_xml.close diff --git a/lib/sisu/v3dv/xhtml_table.rb b/lib/sisu/v3dv/xhtml_table.rb index e06cdaae..cea438a2 100644 --- a/lib/sisu/v3dv/xhtml_table.rb +++ b/lib/sisu/v3dv/xhtml_table.rb @@ -78,8 +78,8 @@ module SiSU_XHTML_Table          table_row_with_columns=table_row.split(Mx[:tc_p])          trc,nc=[],0          table_row_with_columns.each do |c| -          c.gsub!(/^~$/,'') # tilde / empty cell -          c.gsub!(/<:br>/,'<br />') +          c=c.gsub(/^~$/,''). # tilde / empty cell +            gsub(/<:br>/,'<br />')            trc <<= if table_obj.head_ and nr==0; %{<th width="#{table_obj.widths[nc]}%">#{c}</th>}            else %{<td width="#{table_obj.widths[nc]}%">#{c}</td>}            end diff --git a/lib/sisu/v3dv/xml.rb b/lib/sisu/v3dv/xml.rb index a0755375..776c0376 100644 --- a/lib/sisu/v3dv/xml.rb +++ b/lib/sisu/v3dv/xml.rb @@ -134,12 +134,12 @@ module SiSU_XML_SAX        end      protected        def embedded_endnotes(dob='') -        dob.obj.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/, -          '<endnote><number>\1</number><note>\2</note></endnote> ') -        dob.obj.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/, -          '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') -        dob.obj.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/, -          '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') +        dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/, +            '<endnote><number>\1</number><note>\2</note></endnote> '). +          gsub(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/, +            '<endnote><symbol>\1</symbol><note>\2</note></endnote> '). +          gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/, +            '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')        end        def extract_endnotes(dob='')          notes=dob.obj.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/) @@ -147,7 +147,7 @@ module SiSU_XML_SAX            s=e.to_s            util=SiSU_TextUtils::Wrap.new(s,70)            wrap=util.line_wrap -          wrap.gsub!(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK +          wrap=wrap.gsub(/^(\d+)\s+(.+?)\s*\Z/m, <<WOK  #{Ax[:tab]*1}<endnote notenumber="\\1">  #{Ax[:tab]*2}<number>\\1</number>  #{Ax[:tab]*2}<note> @@ -155,8 +155,8 @@ module SiSU_XML_SAX  #{Ax[:tab]*2}</note>  #{Ax[:tab]*1}</endnote>  WOK -) -          wrap.gsub!(/^([*+]\d+)\s+(.+?)\s*\Z/m, <<WOK +). +            gsub(/^([*+]\d+)\s+(.+?)\s*\Z/m, <<WOK  #{Ax[:tab]*1}<endnote symbol="\\1">  #{Ax[:tab]*2}<symbol>\\1</symbol>  #{Ax[:tab]*2}<note> @@ -164,8 +164,8 @@ WOK  #{Ax[:tab]*2}</note>  #{Ax[:tab]*1}</endnote>  WOK -) -          wrap.gsub!(/^([*+]+)\s+(.+?)\s*\Z/m, <<WOK +). +            gsub(/^([*+]+)\s+(.+?)\s*\Z/m, <<WOK  #{Ax[:tab]*1}<endnote symbol="\\1.length">  #{Ax[:tab]*2}<symbol>\\1</symbol>  #{Ax[:tab]*2}<note> @@ -211,8 +211,8 @@ WOK          else lv=nil          end          extract_endnotes(dob) -        dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean -        dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean +        dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean +          gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean          #if defined? dob.obj          #t_ograph="#{dob.obj}"          util=SiSU_TextUtils::Wrap.new(dob.obj,70) @@ -232,10 +232,10 @@ WOK        end        def block_structure(dob='')          extract_endnotes(dob) -        dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean -        dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean +        dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean +          gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean          dob=@trans.markup_block(dob) -        dob.obj.strip! +        dob.obj=dob.obj.strip          @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}          @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}          @@xml[:body] << %{#{Ax[:tab]*1}<text class="block">#{Ax[:tab]*1}} @@ -247,10 +247,10 @@ WOK        end        def group_structure(dob='')          extract_endnotes(dob) -        dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>') #footnote/endnote clean -        dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean +        dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'<en>\1</en>'). #footnote/endnote clean +          gsub(/#{Mx[:en_b_o]}([\d*+]+)\s+(?:.+?)#{Mx[:en_b_c]}/,'<en>\1</en>') #footnote/endnote clean          dob=@trans.markup_group(dob) -        dob.obj.strip! +        dob.obj=dob.obj.strip          @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}          @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}          @@xml[:body] << %{#{Ax[:tab]*1}<text class="group">#{Ax[:tab]*1}} @@ -262,8 +262,8 @@ WOK        end        def poem_structure(dob='')          dob=@trans.markup_group(dob) -        #dob.obj.gsub!(/\s\s/,'  ') -        dob.obj.strip! +        #dob.obj.gsub(/\s\s/,'  ') +        dob.obj=dob.obj.strip          @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}          @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}          @@xml[:body] << %{#{Ax[:tab]*1}<text class="verse">#{Ax[:tab]*1}} @@ -273,8 +273,7 @@ WOK        end        def code_structure(dob='')          dob=@trans.markup_group(dob) -        dob.obj.gsub!(/\s\s/,'  ') -        dob.obj.strip! +        dob.obj=dob.obj.gsub(/\s\s/,'  ').strip          @@xml[:body] << %{#{Ax[:tab]*0}<object id="#{dob.ocn}">}          @@xml[:body] << %{#{Ax[:tab]*1}<ocn>#{dob.ocn}</ocn>}          @@xml[:body] << %{#{Ax[:tab]*1}<text class="code">#{Ax[:tab]*1}} @@ -380,7 +379,7 @@ WOK                end              else #              end -            dob.obj.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj +            dob.obj=dob.obj.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj            end          end          6.downto(4) do |x| @@ -421,7 +420,7 @@ WOK          content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]          content << @@xml[:owner_details] if @md.stmp =~/\w\w/          content << @@xml[:tail] << @@xml[:close] -        content.flatten!.compact! +        content=content.flatten.compact          Output.new(content,@md).xml          @@xml={}        end @@ -435,7 +434,7 @@ WOK          SiSU_Env::FileOp.new(@md).mkdir          filename_xml=@file.write_file.xml_sax          @data.each do |str| -          str.gsub!(/\A\s+\Z/m,'') #str.gsub!(/^\s+$/,'') +          str=str.gsub(/\A\s+\Z/m,'')            filename_xml.puts str unless str.empty?          end          filename_xml.close diff --git a/lib/sisu/v3dv/xml_dom.rb b/lib/sisu/v3dv/xml_dom.rb index dd4dcd44..ae45100d 100644 --- a/lib/sisu/v3dv/xml_dom.rb +++ b/lib/sisu/v3dv/xml_dom.rb @@ -130,12 +130,12 @@ module SiSU_XML_DOM        end      protected        def xml_markup(dob='') -        dob.obj.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/, -          '<endnote><number>\1</number><note>\2</note></endnote> ') -        dob.obj.gsub!(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/, -          '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') -        dob.obj.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/, -          '<endnote><symbol>\1</symbol><note>\2</note></endnote> ') +        dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/, +            '<endnote><number>\1</number><note>\2</note></endnote> '). +          gsub(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/, +            '<endnote><symbol>\1</symbol><note>\2</note></endnote> '). +          gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/, +            '<endnote><symbol>\1</symbol><note>\2</note></endnote> ')        end        def xml_head          metadata=SiSU_Metadata::Summary.new(@md).xml_dom.metadata @@ -309,27 +309,24 @@ WOK        end        def block_structure(dob)          dob=@trans.markup_block(dob) #decide check & FIX -        dob.obj.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m, -          '<endnote><number>\1</number><note>\2</note></endnote> ') -        dob.obj.strip! +        dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m, +          '<endnote><number>\1</number><note>\2</note></endnote> ').strip          dob        end        def group_structure(dob)          dob=@trans.markup_group(dob) #decide check & FIX -        dob.obj.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m, -          '<endnote><number>\1</number><note>\2</note></endnote> ') -        dob.obj.strip! +        dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m, +          '<endnote><number>\1</number><note>\2</note></endnote> ').strip          dob        end        def poem_structure(dob)          dob=@trans.markup_group(dob) #decide check & FIX -        dob.obj.strip! +        dob.obj=dob.obj.strip          dob        end        def code_structure(dob)          dob=@trans.markup_group(dob) #decide check & FIX -        dob.obj.gsub!(/\s\s/,'  ') -        dob.obj.strip! +        dob.obj=dob.obj.gsub(/\s\s/,'  ').strip          dob        end        def table_structure(dob) #tables @@ -450,7 +447,7 @@ WOK                end              else #              end -            dob.obj.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj +            dob.obj=dob.obj.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if dob.obj            end          end          @content_flag=true @@ -497,7 +494,7 @@ WOK          content << @@xml[:open] << @@xml[:head] << @@xml[:body] << @@xml[:metadata]          content << @@xml[:owner_details] if @md.stmp =~/\w\w/          content << @@xml[:tail] << @@xml[:close] -        content.flatten!.compact! +        content=content.flatten.compact          Output.new(content,@md).xml          @@xml[:head],@@xml[:body],@@xml[:tail]=[],[],[] # check whether should be nil        end @@ -512,7 +509,7 @@ WOK          SiSU_Env::FileOp.new(@md).mkdir          filename_xml=@file.write_file.xml_dom          @data.each do |str| -          str.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') +          str=str.gsub(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'')            filename_xml.puts str unless str.empty?          end          filename_xml.close diff --git a/lib/sisu/v3dv/xml_fictionbook.rb b/lib/sisu/v3dv/xml_fictionbook.rb index 8a0819eb..8fe1e7c1 100644 --- a/lib/sisu/v3dv/xml_fictionbook.rb +++ b/lib/sisu/v3dv/xml_fictionbook.rb @@ -151,11 +151,11 @@ WOK          @data.each do |para|            @endnotes << para.scan(/~\{(.+?)\}~/m)          end -        @endnotes.flatten! +        @endnotes=@endnotes.flatten        end        def endnotes          @endnotes.each do |endnote| -          endnote.strip! +          endnote=endnote.strip            endnote=@trans.markup_fictionbook(endnote)            endnote="<p>#{endnote}</p>"            util=SiSU_TextUtils::Wrap.new(endnote,80,10) @@ -171,7 +171,7 @@ WOK          put(tail)        end        def markup(para,type='') -        para.strip! +        para=para.strip          para=@trans.markup_fictionbook(para)          para=if type.empty?; "<p>#{para}</p>"          else "<#{type}><p>#{para}</p></#{type}>" diff --git a/lib/sisu/v3dv/xml_format.rb b/lib/sisu/v3dv/xml_format.rb index e3e4b380..db3e8f25 100644 --- a/lib/sisu/v3dv/xml_format.rb +++ b/lib/sisu/v3dv/xml_format.rb @@ -1372,17 +1372,18 @@ WOK      end      def gsub_body  #fix -      case @txt +      @txt=case @txt        when /^\s*\((i+|iv|v|vi+|ix|x|xi+)\)/ -        @txt.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>') -        @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>') +        @txt.gsub(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>'). +          gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>')        when /^\s*\(?(\d|[a-z])+\)/ -        @txt.gsub!(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>') -        @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>') +        @txt.gsub(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>'). +          gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>')        when /^\s*\d{1,3}\.\s/ -        @txt.gsub!(/^\s*(\d+\.)/,'<b>\1</b>') +        @txt.gsub(/^\s*(\d+\.)/,'<b>\1</b>')        when /^\s*[A-Z]\.\s/ -        @txt.gsub!(/^\s*([A-Z]\.)/,'<b>\1</b>') +        @txt.gsub(/^\s*([A-Z]\.)/,'<b>\1</b>') +      else @txt        end      end      def bold_para @@ -1395,8 +1396,8 @@ WOK  #{@vz.table_close}}      end      def bold_header -      @txt.gsub!(/[1-9]~(\S+)/,'<a name="\1"></a>') -      @txt.gsub!(/[1-9]~/,'') +      @txt=@txt.gsub(/[1-9]~(\S+)/,'<a name="\1"></a>'). +        gsub(/[1-9]~/,'')        %{<p class="bold">      #{@txt}    </p> @@ -1492,9 +1493,9 @@ WOK        note=''        if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}\s*)/m          note=$1 -        note.gsub!(/[\n\s]+/m,' ') -        txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') -        txt.gsub!(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+"> <sup>\d+<\/sup> /m,'') +        note=note.gsub(/[\n\s]+/m,' ') +        txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' '). +          gsub(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+"> <sup>\d+<\/sup> /m,'')        end        %{<#{tag} class="#{attrib}">      <a href="##{@ocn}"><i>#{txt}</i></a> #{note} @@ -1508,7 +1509,7 @@ WOK      end      #% para sisu      def header_sub(tag,attrib) -      @txt.gsub!(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') +      @txt=@txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')        %{  <div class="substance">    #{@p_num.ocn_display} diff --git a/lib/sisu/v3dv/xml_md_oai_pmh_dc.rb b/lib/sisu/v3dv/xml_md_oai_pmh_dc.rb index 8397b15a..eb2bb09c 100644 --- a/lib/sisu/v3dv/xml_md_oai_pmh_dc.rb +++ b/lib/sisu/v3dv/xml_md_oai_pmh_dc.rb @@ -184,7 +184,7 @@ WOK      end      def meta_content_clean(content='')        unless content.nil? -        content.tr!('"',"'") +        content=content.tr('"',"'")        end        content      end diff --git a/lib/sisu/v3dv/xml_tables.rb b/lib/sisu/v3dv/xml_tables.rb index 7782bb88..5457a2fc 100644 --- a/lib/sisu/v3dv/xml_tables.rb +++ b/lib/sisu/v3dv/xml_tables.rb @@ -83,10 +83,10 @@ module SiSU_Tables      def table        m=@parablock[/<!f(.+?)!>/,1]        @@tablefoot << m if m -      @parablock.gsub!(/<!f.+?!>/,'') +      @parablock=@parablock.gsub(/<!f.+?!>/,'')        @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u        if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u -        @parablock.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u, +        @parablock=@parablock.gsub(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u,            %{\n<ocn>#{@ocn}</ocn><table summary="normal text css" width="100%" border="0" bgcolor="white" cellpadding="2" align="center">})        end        if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ @@ -96,28 +96,28 @@ module SiSU_Tables        end        if @@tablehead==1          if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u -          @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, +          @parablock=@parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,              %{<tr>    <td width="\\1%" valign="top"> -    #{@vz.paragraph_table_xml}<b>}) -          @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, -            %{</b></td><td width="\\1%" valign="top"> -  #{@vz.paragraph_table_xml}<b>}) -          @parablock.gsub!(/#{Mx[:tc_c]}/,"</b>\n</td>\n</tr>") +    #{@vz.paragraph_table_xml}<b>}). +            gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, +              %{</b></td><td width="\\1%" valign="top"> +  #{@vz.paragraph_table_xml}<b>}). +            gsub(/#{Mx[:tc_c]}/,"</b>\n</td>\n</tr>")            @@tablehead=0          end          @parablock        else -        @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, +        @parablock=@parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,            %{<tr>    <td width="\\1%" valign="top"> -    #{@vz.paragraph_table_xml}}) -        @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, -          %{ +    #{@vz.paragraph_table_xml}}). +          gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u, +            %{    </td>    <td width="\\1%" valign="top"> -    #{@vz.paragraph_table_xml}}) -        @parablock.gsub!(/#{Mx[:tc_c]}/,"\n</td>\n</tr>\n") +    #{@vz.paragraph_table_xml}}). +          gsub(/#{Mx[:tc_c]}/,"\n</td>\n</tr>\n")        end        @parablock      end @@ -159,7 +159,7 @@ module SiSU_Tables      def table        m=@parablock[/<!f(.+?)!>/,1]        @@tablefoot << m if m -      @parablock.gsub!(/<!f.+?!>/,'') +      @parablock=@parablock.gsub(/<!f.+?!>/,'')        @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u        if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~(\d+);\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head($1)        end @@ -173,26 +173,26 @@ module SiSU_Tables        if @@tablehead==1          if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u            if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u -            @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true)) +            @parablock=@parablock.gsub(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true))            end            if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u -            @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true)) +            @parablock=@parablock.gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true))            end            if @parablock =~/#{Mx[:tc_c]}/ -            @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close(true)) +            @parablock=@parablock.gsub(/#{Mx[:tc_c]}/,table_row_close(true))            end            @@tablehead=0          end          @parablock        else          if @parablock =~/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u -          @parablock.gsub!(/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1)) +          @parablock=@parablock.gsub(/^#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1))          end          if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u -          @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1)) +          @parablock=@parablock.gsub(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1))          end          if @parablock =~/#{Mx[:tc_c]}/ -          @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close) +          @parablock=@parablock.gsub(/#{Mx[:tc_c]}/,table_row_close)          end          @parablock        end | 
