diff options
| -rw-r--r-- | CHANGELOG | 12 | ||||
| -rw-r--r-- | conf/sisu/version.yml | 6 | ||||
| -rw-r--r-- | data/doc/sisu/CHANGELOG | 18 | ||||
| -rw-r--r-- | lib/sisu/v0/cgi_pgsql.rb | 2 | ||||
| -rw-r--r-- | lib/sisu/v0/cgi_sql_common.rb | 310 | ||||
| -rw-r--r-- | lib/sisu/v0/db_import.rb | 180 | ||||
| -rw-r--r-- | lib/sisu/v0/defaults.rb | 4 | ||||
| -rw-r--r-- | lib/sisu/v0/texpdf_format.rb | 2 | 
8 files changed, 276 insertions, 258 deletions
| @@ -6,6 +6,18 @@ Reverse Chronological:  %% STABLE MANIFEST +%% sisu_0.55.4.orig.tar.gz (2007-07-20:29/5) +http://www.jus.uio.no/sisu/pkg/src/sisu_0.55.4.orig.tar.gz +  sisu_0.55.4.orig.tar.gz +  sisu_0.55.4-1.dsc +  sisu_0.55.4-1.diff.gz + +  * db import, minor refactoring + +  * cgi fixes +    * search form pre/next +    * scope for matches in individual documents +  %% sisu_0.55.3.orig.tar.gz (2007-07-14:28/6)  http://www.jus.uio.no/sisu/pkg/src/sisu_0.55.3.orig.tar.gz    d540a4f656393449c5f4ad5b7a5b5245 1267096 sisu_0.55.3.orig.tar.gz diff --git a/conf/sisu/version.yml b/conf/sisu/version.yml index 61ff519d..88590b9c 100644 --- a/conf/sisu/version.yml +++ b/conf/sisu/version.yml @@ -1,5 +1,5 @@  ---  -:date_stamp: 2007w28/6 -:date: "2007-07-14" +:date_stamp: 2007w29/5 +:date: "2007-07-20"  :project: SiSU -:version: 0.55.3 +:version: 0.55.4 diff --git a/data/doc/sisu/CHANGELOG b/data/doc/sisu/CHANGELOG index 9c4cafd0..7e5a2289 100644 --- a/data/doc/sisu/CHANGELOG +++ b/data/doc/sisu/CHANGELOG @@ -6,11 +6,23 @@ Reverse Chronological:  %% STABLE MANIFEST +%% sisu_0.55.4.orig.tar.gz (2007-07-20:29/5) +http://www.jus.uio.no/sisu/pkg/src/sisu_0.55.4.orig.tar.gz +  sisu_0.55.4.orig.tar.gz +  sisu_0.55.4-1.dsc +  sisu_0.55.4-1.diff.gz + +  * db import, minor refactoring + +  * cgi fixes +    * search form pre/next +    * scope for matches in individual documents +  %% sisu_0.55.3.orig.tar.gz (2007-07-14:28/6)  http://www.jus.uio.no/sisu/pkg/src/sisu_0.55.3.orig.tar.gz -  sisu_0.55.3.orig.tar.gz -  sisu_0.55.3-1.dsc -  sisu_0.55.3-1.diff.gz +  d540a4f656393449c5f4ad5b7a5b5245 1267096 sisu_0.55.3.orig.tar.gz +  a0c2e3c6ab5e59c9e675ae48ed2582cb 606 sisu_0.55.3-1.dsc +  9e0ae70f83fa29c10aaf8a9626aaed8e 142063 sisu_0.55.3-1.diff.gz    * url      * matching improved diff --git a/lib/sisu/v0/cgi_pgsql.rb b/lib/sisu/v0/cgi_pgsql.rb index b3a7a82b..d4c620a5 100644 --- a/lib/sisu/v0/cgi_pgsql.rb +++ b/lib/sisu/v0/cgi_pgsql.rb @@ -173,7 +173,7 @@ module  SiSU_CGI_pgsql                                                                                   #%            search[:text].each{|x| @search_text << "#{x} AND " }            @search_text=@search_text.to_s.gsub!(/AND\s+$/,'') -          @search_text.gsub!(/(documents\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+documents\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') +          @search_text.gsub!(/(documents\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+documents\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)')            search[:endnotes].each{|x| @search_endnotes << "#{x} AND " }            @search_endnotes=@search_endnotes.to_s.gsub!(/AND\s+$/,'')            @search_endnotes.gsub!(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') diff --git a/lib/sisu/v0/cgi_sql_common.rb b/lib/sisu/v0/cgi_sql_common.rb index 50fce2fc..ac2958d1 100644 --- a/lib/sisu/v0/cgi_sql_common.rb +++ b/lib/sisu/v0/cgi_sql_common.rb @@ -488,7 +488,7 @@ module SiSU_CGI_sql              end            else              if page.to_s =~ /^1$/; '' -            elsif /^[2]$/ +            elsif page.to_s =~ /^2$/                %{<hr /><br /><center>                <a href="#{can.previous}">                  <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="<< " /> @@ -593,8 +593,8 @@ module SiSU_CGI_sql      software infrastructure,      with the usual GPL (or OSS) suspects.    <br /> -    Better - "performance, reliability, scalability, security & total cost of ownership" -    [not to mention flexibility & choice] +    Better - "adherence to standards, performance, reliability, scalability, security & total cost of ownership" +    [not to mention flexibility & choice] and it is software libre.    <br />      Get With the Future      <a href="http://www.jus.uio.no/sisu/"> @@ -701,7 +701,7 @@ module SiSU_CGI_sql              end              canned_note='search url:'            else -            @@canned_search_url="#@base?s1=United+Nations&db=documents&view=index" +            @@canned_search_url="#@base?db=#{@db}&view=index"              canned_note='search url example:'            end            if search_field =~/\S+/ @@ -749,178 +749,178 @@ module SiSU_CGI_sql        #{p_text} #{p_keywords} #{p_title} #{p_author} #{p_subject} #{p_description} #{p_publisher} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename}        </font>        WOK -          #eg = %{canned search e.g.:<br /> <a href="#{url}">#{url}</a><br />find: #{analyze}<br />database: #{database}} -          #dbi_canning -          @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can).submission_form #% form -          unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/ -            print "Content-type: text/html\n\n" -            puts (@header+@tail) -          else #% searches -            s1=if @search_for.text1 =~/\S/ -              @search_for.text1 -            else 'Unavailable' +        #eg = %{canned search e.g.:<br /> <a href="#{url}">#{url}</a><br />find: #{analyze}<br />database: #{database}} +        #dbi_canning +        @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can).submission_form #% form +        unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/ +          print "Content-type: text/html\n\n" +          puts (@header+@tail) +        else #% searches +          s1=if @search_for.text1 =~/\S/ +            @search_for.text1 +          else 'Unavailable' +          end +          if checked_case=~/\S/ +            @search[:text]<<%{documents.clean~'#{CGI.unescape(s1)}'} +            @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'} +          else +            @search[:text]<<%{documents.clean~*'#{CGI.unescape(s1)}'} +            @search[:endnotes]<<%{endnotes.clean~*'#{CGI.unescape(s1)}'} +          end +          #dbi_request +          dbi_statement=Dbi_search_statement.new(@conn,@search_for,q,checked_case) +          @text_search_flag=false +          @text_search_flag=dbi_statement.text_search_flag +          s_contents=dbi_statement.contents +          s_endnotes=dbi_statement.endnotes +          @body_main,@endnotes=[],[] +          @search_regx=nil +          oldtid=0 +          if @text_search_flag +            if checked_sql =~/\S/ +              sql_select_body=dbi_statement.sql_select_body_format +              sql_select_endnotes=dbi_statement.sql_select_endnotes_format +            else sql_select_body,sql_select_endnotes='',''              end -            if checked_case=~/\S/ -              @search[:text]<<%{documents.clean~'#{CGI.unescape(s1)}'} -              @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'} -            else -              @search[:text]<<%{documents.clean~*'#{CGI.unescape(s1)}'} -              @search[:endnotes]<<%{endnotes.clean~*'#{CGI.unescape(s1)}'} +            @body_main << '<p><hr><br /><b>Main Text:</b><br />' << sql_select_body +            @endnotes  << '<p><hr><br /><b>Endnotes:</b><br />'  << sql_select_endnotes +          else +          end +          #text_objects_body +          s_contents.each do |c|                                               #% text body +            location=c['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] +            file_suffix=c['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') +              l=".#{l}" +            else ''              end -          #dbi_request -            dbi_statement=Dbi_search_statement.new(@conn,@search_for,q,checked_case) -            @text_search_flag=false -            @text_search_flag=dbi_statement.text_search_flag -            s_contents=dbi_statement.contents -            s_endnotes=dbi_statement.endnotes -            @body_main,@endnotes=[],[] -            @search_regx=nil -            oldtid=0 -            if @text_search_flag -              if checked_sql =~/\S/ -                sql_select_body=dbi_statement.sql_select_body_format -                sql_select_endnotes=dbi_statement.sql_select_endnotes_format -              else sql_select_body,sql_select_endnotes='','' +          #metadata_found_body +            if c['tid'].to_i != oldtid.to_i +              ti=if c['subtitle'] =~/\S+/; "#{c['title']} - #{c['subtitle']}" +              else c['title']                end -              @body_main << '<p><hr><br /><b>Main Text:</b><br />' << sql_select_body -              @endnotes  << '<p><hr><br /><b>Endnotes:</b><br />'  << sql_select_endnotes -            else -            end -            #text_objects_body -            s_contents.each do |c|                                               #% text body -              location=c['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] -              file_suffix=c['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') -                l=".#{l}" -              else '' +              can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +              else %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> }                end -            #metadata_found_body -              if c['tid'].to_i != oldtid.to_i -                ti=if c['subtitle'] =~/\S+/; "#{c['title']} - #{c['subtitle']}" -                else c['title'] -                end -                can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } -                else %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } -                end -                title=%{<span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{c['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a> <a href="#@hosturl_files/#@stub/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/ #hmm watch file_suffix -                if @text_search_flag; title='<br /><hr>'+title -                else                  title='<br />'+title -                end -                @counter_txt_doc+=1 -                oldtid=c['tid'].to_i -              else                    title='' +              title=%{<span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{c['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a> <a href="#@hosturl_files/#@stub/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/ #hmm watch file_suffix +              if @text_search_flag; title='<br /><hr>'+title +              else                  title='<br />'+title                end -              if @text_search_flag -                if cgi['view']=~/text/                                         #% txt body -                  text=if c['suffix'] !~/1/ #seg -                    if @search_for.text1 =~/\S+/ or q['s1'] =~/\S+/                         #% only this branch is working !! -                      unescaped_search=if @search_for.text1 =~/\S+/; CGI.unescape(@search_for.text1) -                      elsif q['s1'] =~/\S+/;                         CGI.unescape(q['s1']) -                      else nil -                      end -                      @search_regx=if unescaped_search                                     #check -                        search_regex=[] -                        build=unescaped_search.scan(/\S+/).each do |g| -                           if g.to_s =~/(AND|OR)/ -                             search_regex << '|' -                           else search_regex << %{#{g.to_s}} -                           end -                        end -                        search_regex=search_regex.join(' ') -                        search_regex=search_regex.gsub(/\s*\|\s*/,'|') -                        Regexp.new(search_regex, Regexp::IGNORECASE) -                      else nil -                      end +              @counter_txt_doc+=1 +              oldtid=c['tid'].to_i +            else                    title='' +            end +            if @text_search_flag +              if cgi['view']=~/text/                                         #% txt body +                text=if c['suffix'] !~/1/ #seg +                  if @search_for.text1 =~/\S+/ or q['s1'] =~/\S+/                         #% only this branch is working !! +                    unescaped_search=if @search_for.text1 =~/\S+/; CGI.unescape(@search_for.text1) +                    elsif q['s1'] =~/\S+/;                         CGI.unescape(q['s1'])                      else nil                      end -                    matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) -                      matched=c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>}) -                    else c['body'] +                    @search_regx=if unescaped_search                                     #check +                      search_regex=[] +                      build=unescaped_search.scan(/\S+/).each do |g| +                         if g.to_s =~/(AND|OR)/ +                           search_regex << '|' +                         else search_regex << %{#{g.to_s}} +                         end +                      end +                      search_regex=search_regex.join(' ') +                      search_regex=search_regex.gsub(/\s*\|\s*/,'|') +                      Regexp.new(search_regex, Regexp::IGNORECASE) +                    else nil                      end -                    %{<hr><p><font size="2">ocn <b><a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} -                  elsif c['suffix'] =~/1/ #doc -                    %{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}} +                  else nil                    end -                  @counter_txt_ocn+=1 -                  output=if c['seg'] =~/\S+/; title+text -                  else                        text -                  end -                elsif cgi['view']=~/index/                                     #% idx body -                  if c['suffix'] !~/1/ #seg -                    index=%{<a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag -                  elsif c['suffix'] =~/1/ #doc -                    index=%{<a href="#@hosturl_files/#@stub/#{location}/doc#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } +                  matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) +                    matched=c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>}) +                  else c['body']                    end -                  if c['seg'] =~/\S+/ -                    if @text_search_flag -                      @counter_txt_ocn+=1 -                      output=title+index -                    end -                  else +                  %{<hr><p><font size="2">ocn <b><a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} +                elsif c['suffix'] =~/1/ #doc +                  %{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}} +                end +                @counter_txt_ocn+=1 +                output=if c['seg'] =~/\S+/; title+text +                else                        text +                end +              elsif cgi['view']=~/index/                                     #% idx body +                if c['suffix'] !~/1/ #seg +                  index=%{<a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag +                elsif c['suffix'] =~/1/ #doc +                  index=%{<a href="#@hosturl_files/#@stub/#{location}/doc#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } +                end +                if c['seg'] =~/\S+/ +                  if @text_search_flag                      @counter_txt_ocn+=1 -                    output=unless c['suffix'] =~/1/; title+index -                    else %{#{title}#{c['ocn'].sort}, } -                    end +                    output=title+index                    end -                end -              else output=title -              end -              @counters_txt=if @counter_txt_doc > 0 -                if checked_stats =~/\S/ -                  @@lt_t=if @counter_txt_ocn == dbi_statement.sql_limit.to_i -                    over='over' -                    true -                  else -                    over='' -                    false +                else +                  @counter_txt_ocn+=1 +                  output=unless c['suffix'] =~/1/; title+index +                  else %{#{title}#{c['ocn'].sort}, }                    end -                  %{<hr /><font size="2" color="#666666">Found in the main body of #@counter_txt_doc documents, and at #{over} #@counter_txt_ocn locations within.</font><br />} -                else ''                  end -              else ''                end -              @body_main << output #+ details +            else output=title              end -            #text_objects_endnote -            oldtid = 0 -            s_endnotes.each do |e|                                               #% endnotes -              location=e['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] -              file_suffix=e['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') -                l=".#{l}" +            @counters_txt=if @counter_txt_doc > 0 +              if checked_stats =~/\S/ +                @@lt_t=if @counter_txt_ocn == dbi_statement.sql_limit.to_i +                  over='over' +                  true +                else +                  over='' +                  false +                end +                %{<hr /><font size="2" color="#666666">Found in the main body of #@counter_txt_doc documents, and at #{over} #@counter_txt_ocn locations within.</font><br />}                else ''                end +            else '' +            end +            @body_main << output #+ details +          end +          #text_objects_endnote +          oldtid = 0 +          s_endnotes.each do |e|                                               #% endnotes +            location=e['filename'][/(.+?)\.(?:_?sst|ssm)$/,1] +            file_suffix=e['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') +              l=".#{l}" +            else '' +            end              #metadata_found_endnotes -              if @text_search_flag -                if e['metadata_tid'].to_i != oldtid.to_i -                  ti=if e['subtitle'] =~/\S+/; "#{e['title']} - #{e['subtitle']}" -                  else e['title'] -                  end -                  can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } -                  else %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } -                  end -                  title=%{<br /><hr><span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{e['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a><a href="#@hosturl_files/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/ -                  @counter_endn_doc+=1 -                  oldtid=e['metadata_tid'].to_i -                else title = '' +            if @text_search_flag +              if e['metadata_tid'].to_i != oldtid.to_i +                ti=if e['subtitle'] =~/\S+/; "#{e['title']} - #{e['subtitle']}" +                else e['title']                  end -                if cgi['view']=~/text/                                           #% txt endnotes -                  @counter_endn_ocn+=1 -                  matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) -                    matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>}) -                  else e['body'] -                  end -                  output=%{#{title}<hr><font size="2">note <b><a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} -                elsif cgi['view']=~/index/                                       #% idx endnotes -                  @counter_endn_ocn+=1 -                  output=%{#{title}<a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a> [§ <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>], } +                can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                else %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } +                end +                title=%{<br /><hr><span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{e['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a> <a href="#@hosturl_files/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />}  if file_suffix=~/s/ +                @counter_endn_doc+=1 +                oldtid=e['metadata_tid'].to_i +              else title = '' +              end +              if cgi['view']=~/text/                                           #% txt endnotes +                @counter_endn_ocn+=1 +                matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) +                  matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>}) +                else e['body']                  end -                @counters_endn=if @counter_endn_doc > 0 -                  if checked_stats =~/\S/ +                output=%{#{title}<hr><font size="2">note <b><a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} +              elsif cgi['view']=~/index/                                       #% idx endnotes +                @counter_endn_ocn+=1 +                output=%{#{title}<a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a> [§ <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>], } +              end +              @counters_endn=if @counter_endn_doc > 0 +                if checked_stats =~/\S/                    @@lt_e=if @counter_endn_ocn == dbi_statement.sql_limit.to_i                      over='over'                      true diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index b9528063..91360613 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -364,23 +364,15 @@ module SiSU_DB_import              if data[/^([123])~\s+(.+?)<~(\d+);((?:\w|[0-6]:)\d+);(\w\d+)><([0-9a-f]{#{@@dl}}):([0-9a-f]{#{@@dl}})>/]                @col[:lev],txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:digest_clean],@col[:digest_all]=$1,$2,$3,$4,$5,$6,$7                @col[:lid]+=1 -              if txt =~/~\{.+?\}~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en << txt.scan(/~\{(\d+).+?\}~/) -                txt.gsub!(/~\{(\d+).+?\}~/,'<sup>\1</sup>') -              end -              if txt =~/~\[\*.+?\]~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en_ast << txt.scan(/~\[[*](\d+).+?\]~/) -                txt.gsub!(/~\[([*]\d+).+?\]~/,'<sup>\1</sup>') -              end -              if txt =~/~\[\+.+?\]~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en_pls << txt.scan(/~\[[+](\d+).+?\]~/) -                txt.gsub!(/~\[([+]\d+).+?\]~/,'<sup>\1</sup>') +              if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/ +                endnotes(txt).range +                if txt =~/~\{.+?\}~/;   @en << endnotes(txt).standard +                end +                if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk +                end +                if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus +                end +                txt=endnotes(txt).clean_text                end                @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_minus                special_character_escape(@col[:body]) @@ -412,23 +404,15 @@ module SiSU_DB_import                end                @env=SiSU_Env::Info_env.new(@md.fns)                @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html" -              if txt =~ /~\{.+?\}~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en << txt.scan(/~\{(\d+).+?\}~/) -                txt.gsub!(/~\{(\d+).+?\}~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) -              end -              if txt =~/~\[\*.+?\]~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en_ast << txt.scan(/~\[[*](\d+).+?\]~/) -                txt.gsub!(/~\[([*]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) -              end -              if txt =~/~\[\+.+?\]~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en_pls << txt.scan(/~\[[+](\d+).+?\]~/) -                txt.gsub!(/~\[([+]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) +              if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/ +                endnotes(txt).range +                if txt =~ /~\{.+?\}~/;  @en << endnotes(txt).standard +                end +                if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk +                end +                if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus +                end +                txt=endnotes(txt).clean_text(@base_url)                end                @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_plus                special_character_escape(@col[:body]) @@ -458,23 +442,15 @@ module SiSU_DB_import                end                @env=SiSU_Env::Info_env.new(@md.fns)                @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html" -              if txt =~ /~\{.+?\}~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en << txt.scan(/~\{(\d+).+?\}~/) -                txt.gsub!(/~\{(\d+).+?\}~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) -              end -              if txt =~/~\[\*.+?\]~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en_ast << txt.scan(/~\[[*](\d+).+?\]~/) -                txt.gsub!(/~\[([*]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) -              end -              if txt =~/~\[\+.+?\]~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en_pls << txt.scan(/~\[[+](\d+).+?\]~/) -                txt.gsub!(/~\[([+]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) +              if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/ +                endnotes(txt).range +                if txt =~ /~\{.+?\}~/;  @en << endnotes(txt).standard +                end +                if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk +                end +                if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus +                end +                txt=endnotes(txt).clean_text(@base_url)                end                @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_plus                special_character_escape(@col[:body]) @@ -504,23 +480,15 @@ module SiSU_DB_import                end                @env=SiSU_Env::Info_env.new(@md.fns)                @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html" -              if txt =~ /~\{.+?\}~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en << txt.scan(/~\{(\d+).+?\}~/) -                txt.gsub!(/~\{(\d+).+?\}~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) -              end -              if txt =~/~\[\*.+?\]~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en_ast << txt.scan(/~\[[*](\d+).+?\]~/) -                txt.gsub!(/~\[([*]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) -              end -              if txt =~/~\[\+.+?\]~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en_pls << txt.scan(/~\[[+](\d+).+?\]~/) -                txt.gsub!(/~\[([+]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) +              if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/ +                endnotes(txt).range +                if txt =~ /~\{.+?\}~/;  @en << endnotes(txt).standard +                end +                if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk +                end +                if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus +                end +                txt=endnotes(txt).clean_text(@base_url)                end                @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_plus                special_character_escape(@col[:body]) @@ -545,24 +513,15 @@ module SiSU_DB_import                end                @env=SiSU_Env::Info_env.new(@md.fns)                @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html" -              if txt =~ /~\{.+?\}~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en << txt.scan(/~\{(\d+).+?\}~/) -                txt.gsub!(/~\{(\d+).+?\}~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) -                #txt.gsub!(/~\{(\d+).+?\}~/,'^[\1]') # remove endnote, keep endnote reference number, display as, e.g. [^1] -              end -              if txt =~/~\[\*.+?\]~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en_ast << txt.scan(/~\[[*](\d+).+?\]~/) -                txt.gsub!(/~\[([*]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) -              end -              if txt =~/~\[\+.+?\]~/ -                word_mode=txt.scan(/\S+/) -                endnote_range(word_mode) -                @en_pls << txt.scan(/~\[[+](\d+).+?\]~/) -                txt.gsub!(/~\[([+]\d+).+?\]~/,%{<sup><a href="#@base_url#_\\1" name="-\\1">\\1</a></sup>}) +              if txt =~/~[{\[][*+]?(\d+)\s+.+?[}\]]~/ +                endnotes(txt).range +                if txt =~ /~\{.+?\}~/;  @en << endnotes(txt).standard +                end +                if txt =~/~\[\*.+?\]~/; @en_ast << endnotes(txt).asterisk +                end +                if txt =~/~\[\+.+?\]~/; @en_pls << endnotes(txt).plus +                end +                txt=endnotes(txt).clean_text(@base_url)                end                if @sql_type=~/pg/ and txt.size > (document_clean - 1)             #% examine pg build & remove limitation                  puts "\n\nTOO LARGE (TXT - see error log)\n\n" @@ -688,15 +647,50 @@ module SiSU_DB_import        ensure        end      end -    def endnote_range(word_array) -      @col[:en_a]=@col[:en_z]=nil -      word_array.each do |w| -        if w[/~[{\[][*+]?(\d+)\s+.+?[}\]]~/]                                                # not tested since change 2003w31 -          @col[:en_a]=$1 unless @col[:en_a] -          @col[:en_z]=@col[:en_a].dup unless @col[:en_a] -          @col[:en_z]=$1 if @col[:en_a] +    def endnotes(txt) +      @txt=txt +      def standard +        x=if @txt =~ /~\{.+?\}~/; @txt.scan(/~\{(\d+).+?\}~/) +        else nil +        end +      end +      def asterisk +        x=if @txt =~/~\[\*.+?\]~/; @txt.scan(/~\[[*](\d+).+?\]~/) +        else nil +        end +      end +      def plus +        x=if @txt =~/~\[\+.+?\]~/; @txt.scan(/~\[[+](\d+).+?\]~/) +        else nil +        end +      end +      def clean_text(base_url=nil) +        if base_url +          @txt.gsub!(/~\{(\d+).+?\}~/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) +          @txt.gsub!(/~\[([*]\d+).+?\]~/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) +          @txt.gsub!(/~\[([+]\d+).+?\]~/,%{<sup><a href="#{base_url}#_\\1" name="-\\1">\\1</a></sup>}) +        else +          @txt.gsub!(/~\{(\d+).+?\}~/,'<sup>\1</sup>') +          @txt.gsub!(/~\[([*]\d+).+?\]~/,'<sup>\1</sup>') +          @txt.gsub!(/~\[([+]\d+).+?\]~/,'<sup>\1</sup>') +        end +        @txt +      end +      def range +        @col[:en_a]=@col[:en_z]=nil +        if @txt =~ /~\{.+?\}~|~\[([*]\d+).+?\]~|~\[([+]\d+).+?\]~/ +          word_array=@txt.scan(/\S+/) +          word_array.each do |w| +            if w[/~[{\[][*+]?(\d+)\s+.+?[}\]]~/]                                                # not tested since change 2003w31 +              @col[:en_a]=$1 unless @col[:en_a] +              @col[:en_z]=@col[:en_a].dup unless @col[:en_a] +              @col[:en_z]=$1 if @col[:en_a] +            end +          end          end +        @col        end +      self      end      def import_db_urls(dbi_unit,meta)                                           #% import documents OID - populate database        begin diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 6585e700..4963e882 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -1397,8 +1397,8 @@ WOK      software infrastructure,      with the usual GPL (or OSS) suspects.    <br /> -    Better - "performance, reliability, scalability, security & total cost of ownership" -    [not to mention flexibility & choice] +    Better - "adherence to standards, performance, reliability, scalability, security & total cost of ownership" +    [not to mention flexibility & choice] and it is software libre.    <br />      Get With the Future      <a href="http://www.jus.uio.no/sisu/"> diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 72cd3932..4a8d2cb5 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -947,7 +947,7 @@ WOK        lastdone="Last Generated on: #{Time.now}"        rubyv="Ruby version: #{@md.ruby_version}"        <<WOK -%% Sisu Sabaki (Linux & Ruby - \"better ways\") LaTeX output +%% SiSU (Linux & Ruby - \"better ways\") LaTeX output  %% #{generator}  %% #{rubyv}  %% LaTeX output | 
