From 6be61200c529f7f61a89aac6158eb63026d7a44b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 15 Jun 2007 12:05:07 +0100 Subject: cgi search script fix, related to highlighting matches, changelog update, rest removal of hanging whitespace --- lib/sisu/v0/cgi_sql_common.rb | 23 +++++++++++++++++++---- lib/sisu/v0/db_load_tuple.rb | 4 ++-- lib/sisu/v0/shared_html_lite.rb | 1 + lib/sisu/v0/texpdf.rb | 12 ++++++------ 4 files changed, 28 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/cgi_sql_common.rb b/lib/sisu/v0/cgi_sql_common.rb index 13f9c2a3..a71d5412 100644 --- a/lib/sisu/v0/cgi_sql_common.rb +++ b/lib/sisu/v0/cgi_sql_common.rb @@ -111,6 +111,8 @@ module SiSU_CGI_sql @@limit,@@offset=1000,0 @base="#@hosturl_db/cgi-bin/#@version.cgi" @@canned_search_url=@base + @color_heading='#DDFFAA' + @color_match='#ffff48' class Form def initialize(base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can='') search_note='' if checked_searched !~/\S/ @@ -658,7 +660,7 @@ module SiSU_CGI_sql end #metadata_found_body if c['tid'].to_i != oldtid.to_i - title=%{#{c['title']} by #{c['creator']} pdf portraitpdf landscape manifest ?
} if file_suffix=~/s/ #hmm watch file_suffix + title=%{#{c['title']} by #{c['creator']} pdf portraitpdf landscape manifest ?
} if file_suffix=~/s/ #hmm watch file_suffix if @text_search_flag; title='

'+title else title='
'+title end @@ -689,7 +691,13 @@ module SiSU_CGI_sql end else nil end - matched_para=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) ? (c['body'].gsub(/(#@search_regx)/,'\1')) : c['body'] #check + matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) + matched=if c['body'] =~/\\1})) + end + matched + else c['body'] + end %{

ocn #{c['ocn']}:

#{matched_para}} elsif c['suffix'] =~/1/ #doc %{#{title}

ocn #{c['ocn']}:#{c['body']}} @@ -738,14 +746,21 @@ module SiSU_CGI_sql #metadata_found_endnotes if @text_search_flag if e['metadata_tid'].to_i != oldtid.to_i - title=%{


#{e['title']} by #{e['creator']} pdf portraitpdf landscape manifest ?
} if file_suffix=~/s/ + title=%{

#{e['title']} by #{e['creator']} pdf portraitpdf landscape manifest ?
} 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=(@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) ? (e['body'].to_s.gsub(/(#@search_regx)/,'\1')) : e['body'] #check + matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) + matched=if e['body'] =~/\\1}) + #e['body'] + end + matched + else e['body'] + end output=%{#{title}
note
#{e['nr']} referred to from ocn #{e['ocn']}: #{matched_endnote}} elsif cgi['view']=~/index/ #% idx endnotes @counter_endn_ocn+=1 diff --git a/lib/sisu/v0/db_load_tuple.rb b/lib/sisu/v0/db_load_tuple.rb index 9d513fda..30d8389e 100644 --- a/lib/sisu/v0/db_load_tuple.rb +++ b/lib/sisu/v0/db_load_tuple.rb @@ -60,12 +60,12 @@ module SiSU_DB_tuple def tuple #% import line begin if @col[:en_a] - #puts.inspect "#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}'" + #puts "#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}'" @conn.execute(%{ INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}'); }) else - #puts.inspect "#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}'" + #puts "#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}'" @conn.execute(%{ INSERT INTO documents (lid, metadata_tid, lev, clean, body, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, digest_clean, digest_all) VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}'); }) diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index 3c0e9ce1..75137148 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -94,6 +94,7 @@ module SiSU_Format_Shared png=m.scan(/\S+/)[0].strip link=link.strip ins=%{#{link}#{d}} + #ins=%{#{link} [link]#{d}} word.gsub!(/\{.+?\}(?:https?|ftp)\S+/,ins) end word diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index aec45b58..a5db4c77 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -283,12 +283,12 @@ module SiSU_TeX else para end if para.class == String - @md.flag_tables=true if para =~// or @@flag_group==true if para =~/<:(code|alt|verse|group)>/ - @lineone=case para - when /<:(alt|verse|group)>/; para + @lineone=case para + when /<:(alt|verse|group)>/; para when /<:code>/; "#{@tex.paraskip_small} \\begin{footnotesize} \\begin{ttfamily} " + para else 'error' #should never occur end @@ -440,9 +440,9 @@ WOK elsif @@flag_group==true; @group_collect << para #<< "\n\n" end if x =~/(?:code|alt|verse|group)-end/ - regx=/(\\+marginpar\{\\+begin\{tiny\}\d+\\+end\{tiny\}\})/ + regx=/(\\+marginpar\{\\+begin\{tiny\}\d+\\+end\{tiny\}\})/ y=if para =~regx - regx.match(para)[1] + regx.match(para)[1] else '' end para.gsub!(regx,'') -- cgit v1.2.3