From 84957a4260170c3b81a690853ba5b865f59e1217 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 19 Oct 2014 21:05:55 -0400 Subject: v5 v6: html, remove trailing backslash for empty linebreak & paragraph,

--- lib/sisu/v5/cgi_sql_common.rb | 110 +++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'lib/sisu/v5/cgi_sql_common.rb') diff --git a/lib/sisu/v5/cgi_sql_common.rb b/lib/sisu/v5/cgi_sql_common.rb index d6f99342..eb8ce0ab 100644 --- a/lib/sisu/v5/cgi_sql_common.rb +++ b/lib/sisu/v5/cgi_sql_common.rb @@ -134,7 +134,7 @@ module SiSU_CGI_SQL search_field='' if checked_echo !~/\S/ @base,@search_field,@selected_db,@result_type,@checked_sql_limit,@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=base,search_field,selected_db,result_type,checked_sql_limit,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 @tip=if checked_tip =~/\S/ - 'text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; editor:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;
' + 'text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; editor:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;
' else '' end end @@ -161,10 +161,10 @@ module SiSU_CGI_SQL @@ -193,7 +193,7 @@ module SiSU_CGI_SQL to search: select which database to search (drop-down menu below); enter your search query (in the form above); and click on the search button (below) -
+
1,000 2,500 -
+
echo query result stats search url searched available fields sql statement -
+
checks: default selected @@ -483,14 +483,14 @@ module SiSU_CGI_SQL page=(sql_offset.to_i + sql_match_limit.to_i)/sql_match_limit.to_i if beyond_limit if page.to_s =~ /^1$/ - %{
+ %{
pg. #{page.to_s}  >>
} elsif page.to_s =~ /^2$/ - %{
+ %{
<<  @@ -500,7 +500,7 @@ module SiSU_CGI_SQL
} else - %{
+ %{
|<  @@ -516,14 +516,14 @@ module SiSU_CGI_SQL else if page.to_s =~ /^1$/ then '' elsif page.to_s =~ /^2$/ - %{
+ %{
<<  pg. #{page.to_s}
} else - %{
+ %{
|<  @@ -542,16 +542,16 @@ module SiSU_CGI_SQL <<-WOK_SQL def tail <<-'WOK' -


+


-
+
SiSU -
+
git
@@ -562,14 +562,14 @@ module SiSU_CGI_SQL

Generated by #{v[:project]} #{v[:version]} #{v[:date]} (#{v[:date_stamp]}) -
+
#{v[:project]} © Ralph Amissah 1993, current 2014. All Rights Reserved. -
+
#{v[:project]} is software for document structuring, publishing and search, -
+
www.jus.uio.no/sisu @@ -581,17 +581,17 @@ module SiSU_CGI_SQL git.sisudoc.org -
+
w3 since October 3 1993 ralph@amissah.com -
+
mailing list subscription http://lists.sisudoc.org/listinfo/sisu -
+
sisu@lists.sisudoc.org @@ -599,10 +599,10 @@ module SiSU_CGI_SQL

-
+
SiSU -
+
git

#{v[:project]} using: -
Standard SiSU markup syntax, -
Standard SiSU meta-markup syntax, and the -
Standard SiSU object citation numbering and system, (object/text identifying/locating system) -
+
Standard SiSU markup syntax, +
Standard SiSU meta-markup syntax, and the +
Standard SiSU object citation numbering and system, (object/text identifying/locating system) +
© Ralph Amissah 1997, current 2014. All Rights Reserved.

@@ -767,39 +767,39 @@ module SiSU_CGI_SQL end green=%{} canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) - the_can=%{#{canned_note} #{canned_search_url_txt}
} + the_can=%{#{canned_note} #{canned_search_url_txt}
} p_text=p_fulltext=p_keywords=p_title=p_author=p_topic_register=p_subject=p_description=p_publisher=p_editor=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='' - p_filename=%{filename: #{green}#{@search_for.filename}

} if @search_for.filename =~/\S+/ - p_text=%{text: #{green}#{@search_for.text1}
} if @search_for.text1 =~/\S+/ - p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}
} if @search_for.fulltext =~/\S+/ - p_title=%{title: #{green}#{@search_for.title}
} if @search_for.title =~/\S+/ - p_author=%{author: #{green}#{@search_for.author}
} if @search_for.author =~/\S+/ - p_editor=%{editor: #{green}#{@search_for.editor}
} if @search_for.editor=~/\S+/ - p_contributor=%{contributor: #{green}#{@search_for.contributor}
} if @search_for.contributor =~/\S+/ - p_date=%{date: #{green}#{@search_for.date}
} if @search_for.date =~/\S+/ - p_rights=%{rights: #{green}#{@search_for.rights}
} if @search_for.rights =~/\S+/ - p_topic_register=%{topic_register: #{green}#{@search_for.topic_register}
} if @search_for.topic_register =~/\S+/ - p_subject=%{subject: #{green}#{@search_for.subject}
} if @search_for.subject =~/\S+/ - p_keywords=%{keywords: #{green}#{@search_for.keywords}
} if @search_for.keywords =~/\S+/ - p_identifier=%{identifier: #{green}#{@search_for.identifier}
} if @search_for.identifier =~/\S+/ - p_type=%{type: #{green}#{@search_for.type}
} if @search_for.type =~/\S+/ - p_format=%{format: #{green}#{@search_for.format}
} if @search_for.format =~/\S+/ - p_relation=%{relation: #{green}#{@search_for.relation}
} if @search_for.relation =~/\S+/ - p_coverage=%{coverage: #{green}#{@search_for.coverage}
} if @search_for.coverage =~/\S+/ - p_description=%{description: #{green}#{@search_for.description}
} if @search_for.description =~/\S+/ - p_abstract=%{abstract: #{green}#{@search_for.abstract}
} if @search_for.abstract =~/\S+/ - p_comment=%{comment: #{green}#{@search_for.comment}
} if @search_for.comment =~/\S+/ - p_publisher=%{publisher: #{green}#{@search_for.publisher}
} if @search_for.publisher =~/\S+/ - p_source=%{source: #{green}#{@search_for.source}
} if @search_for.source =~/\S+/ - p_language=%{language: #{green}#{@search_for.language}
} if @search_for.language =~/\S+/ + p_filename=%{filename: #{green}#{@search_for.filename}
} if @search_for.filename =~/\S+/ + p_text=%{text: #{green}#{@search_for.text1}
} if @search_for.text1 =~/\S+/ + p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}
} if @search_for.fulltext =~/\S+/ + p_title=%{title: #{green}#{@search_for.title}
} if @search_for.title =~/\S+/ + p_author=%{author: #{green}#{@search_for.author}
} if @search_for.author =~/\S+/ + p_editor=%{editor: #{green}#{@search_for.editor}
} if @search_for.editor=~/\S+/ + p_contributor=%{contributor: #{green}#{@search_for.contributor}
} if @search_for.contributor =~/\S+/ + p_date=%{date: #{green}#{@search_for.date}
} if @search_for.date =~/\S+/ + p_rights=%{rights: #{green}#{@search_for.rights}
} if @search_for.rights =~/\S+/ + p_topic_register=%{topic_register: #{green}#{@search_for.topic_register}
} if @search_for.topic_register =~/\S+/ + p_subject=%{subject: #{green}#{@search_for.subject}
} if @search_for.subject =~/\S+/ + p_keywords=%{keywords: #{green}#{@search_for.keywords}
} if @search_for.keywords =~/\S+/ + p_identifier=%{identifier: #{green}#{@search_for.identifier}
} if @search_for.identifier =~/\S+/ + p_type=%{type: #{green}#{@search_for.type}
} if @search_for.type =~/\S+/ + p_format=%{format: #{green}#{@search_for.format}
} if @search_for.format =~/\S+/ + p_relation=%{relation: #{green}#{@search_for.relation}
} if @search_for.relation =~/\S+/ + p_coverage=%{coverage: #{green}#{@search_for.coverage}
} if @search_for.coverage =~/\S+/ + p_description=%{description: #{green}#{@search_for.description}
} if @search_for.description =~/\S+/ + p_abstract=%{abstract: #{green}#{@search_for.abstract}
} if @search_for.abstract =~/\S+/ + p_comment=%{comment: #{green}#{@search_for.comment}
} if @search_for.comment =~/\S+/ + p_publisher=%{publisher: #{green}#{@search_for.publisher}
} if @search_for.publisher =~/\S+/ + p_source=%{source: #{green}#{@search_for.source}
} if @search_for.source =~/\S+/ + p_language=%{language: #{green}#{@search_for.language}
} if @search_for.language =~/\S+/ search_note=<<-WOK database: #{green}#{@db}; selected view: #{green}#{cgi['view']} - search string: "#{green}#{analyze_format}"
+ search string: "#{green}#{analyze_format}"
#{p_text} #{p_fulltext} #{p_keywords} #{p_title} #{p_author} #{p_topic_register} #{p_subject} #{p_description} #{p_publisher} #{p_editor} #{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} WOK - #eg = %{canned search e.g.:
#{url}
find: #{analyze}
database: #{database}} + #eg = %{canned search e.g.:
#{url}
find: #{analyze}
database: #{database}} #% dbi_canning @header=Form.new(@base,search_field,selected_db,result_type,checked_sql_limit,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/ @@ -928,10 +928,10 @@ module SiSU_CGI_SQL can_txt_srch=(cgi['view']=~/index/) \ ? %{search } : %{search } - title=%{toc html #{ti} [#{c['language_document_char']}] by #{c['creator_author']} manifest #{can_txt_srch}
} if file_suffix=~/s/ #hmm watch file_suffix + title=%{toc html #{ti} [#{c['language_document_char']}] by #{c['creator_author']} manifest #{can_txt_srch}
} if file_suffix=~/s/ #hmm watch file_suffix title=@text_search_flag \ - ? '

'+title - : '
'+title + ? '

'+title + : '
'+title @counter_txt_doc+=1 oldtid=c['tid'].to_i else title='' @@ -996,7 +996,7 @@ module SiSU_CGI_SQL @@lt_t=(@counter_txt_ocn==dbi_statement.sql_match_limit.to_i) ? true : false start=(@@offset.to_i+1).to_s range=(@@offset.to_i+@counter_txt_ocn.to_i).to_s - %{
Found #{@counter_txt_ocn} times in the main body of #{@counter_txt_doc} documents [ matches #{start} to #{range} ]
} + %{
Found #{@counter_txt_ocn} times in the main body of #{@counter_txt_doc} documents [ matches #{start} to #{range} ]
} else '' end else '' -- cgit v1.2.3 From 18ee3095eb3c7119c6d10a4b9e107d907c7aac19 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 19 Oct 2014 21:17:49 -0400 Subject: v5 v6: cgi, sample search form, find & display endnotes from parent text object * remove dedicated endnote search section (as endnotes found & listed from reference text field) * cleaner search results --- lib/sisu/v5/cgi_sql_common.rb | 99 +++---------------------------------------- 1 file changed, 6 insertions(+), 93 deletions(-) (limited to 'lib/sisu/v5/cgi_sql_common.rb') diff --git a/lib/sisu/v5/cgi_sql_common.rb b/lib/sisu/v5/cgi_sql_common.rb index eb8ce0ab..4d2304ba 100644 --- a/lib/sisu/v5/cgi_sql_common.rb +++ b/lib/sisu/v5/cgi_sql_common.rb @@ -331,7 +331,7 @@ module SiSU_CGI_SQL def search_statement_common <<-'WOK_SQL' class DBI_SearchStatement - attr_reader :text_search_flag,:sql_select_body_format,:sql_select_endnotes_format,:sql_offset,:sql_limit + attr_reader :text_search_flag,:sql_select_body_format,:sql_offset,:sql_limit def initialize(conn,search_for,q,c) @conn=conn @text_search_flag=false @@ -345,107 +345,86 @@ module SiSU_CGI_SQL @text_search_flag=st[:flag] if st[:flag] search[:text] << st[:search] - search[:endnotes] << se[:search] end st=DBI_SearchString.new('metadata_and_text.fulltext',search_for.fulltext,q['ft'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.title',search_for.title,q['ti'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.creator_author',search_for.author,q['au'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.classify_topic_register',search_for.topic_register,q['tr'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.classify_subject',search_for.subject,q['sj'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.classify_keywords',search_for.keywords,q['key'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.notes_description',search_for.description,q['dsc'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.publisher',search_for.publisher,q['pb'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.creator_editor',search_for.editor,q['cntr'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.creator_contributor',search_for.contributor,q['cntr'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.date_published',search_for.date,q['dt'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.notes_type',search_for.type,q['ty'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.original_source',search_for.source,q['src'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.language_document_char',search_for.language,q['lang'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.notes_relation',search_for.relation,q['rel'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.notes_coverage',search_for.coverage,q['cov'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.rights_all',search_for.rights,q['cr'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.notes_comment',search_for.comment,q['co'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.notes_abstract',search_for.abstract,q['ab'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end st=DBI_SearchString.new('metadata_and_text.src_filename',search_for.filename,q['fns'],cse).string if st[:flag] search[:text] << st[:search] - search[:endnotes] << st[:search] end @@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000 @@offset=q['off'] if q['off']=~/\d+/ # 0 @@ -648,7 +627,7 @@ module SiSU_CGI_SQL <<-'WOK_SQL' @tail=tail @counter_txt_doc,@counter_txt_ocn,@counter_endn_doc,@counter_endn_ocn=0,0,0,0 - @counters_txt,@counters_endn,@sql_select_body,@sql_select_endnotes='','','','' + @counters_txt,@counters_endn,@sql_select_body='','','' FCGI.each_cgi do |cgi| begin # all code goes in begin section @search={ text: [], endnotes: [] } @@ -739,10 +718,8 @@ module SiSU_CGI_SQL @canned_base_url="#{@base}?#{mod}&db=#{cgi['db']}" if checked_case=~/\S/ @search[:text][1]=%{doc_objects.clean~'#{@search_for.text1}'} #s1 - @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1 else @search[:text][1]=%{doc_objects.clean~*'#{@search_for.text1}'} #s1 - @search[:endnotes][1]=%{endnotes.clean~*'#{@search_for.text1}'} #s1 end canned_note='search url:' else @@ -811,28 +788,23 @@ module SiSU_CGI_SQL : 'Unavailable' if checked_case=~/\S/ @search[:text]<<%{doc_objects.clean~'#{CGI.unescape(s1)}'} - @search[:endnotes]<<%{endnotes.clean~'#{CGI.unescape(s1)}'} else @search[:text]<<%{doc_objects.clean~*'#{CGI.unescape(s1)}'} - @search[:endnotes]<<%{endnotes.clean~*'#{CGI.unescape(s1)}'} end #% dbi_request dbi_statement=DBI_SearchStatement.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='','' + @body_main='' @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='','' + else sql_select_body='' end - @body_main << '



Main Text:
' << sql_select_body - @endnotes << '



Endnotes:
' << sql_select_endnotes + @body_main << sql_select_body else end @hostpath="#{@hosturl_files}/#{@stub}" @@ -884,16 +856,6 @@ module SiSU_CGI_SQL "#{path_html_seg(fn,ln)}/#{seg}.html" end end - def path_endnotes(fn,ln=nil) - if @output_dir_structure_by =='filename' \ - or @output_dir_structure_by =='filetype' - @lingual =='mono' \ - ? "#{path_html_seg(fn,ln)}/endnotes.html" - : "#{path_html_seg(fn,ln)}/endnotes.#{ln}.html" - else - "#{path_html_seg(fn,ln)}/endnotes.html" - end - end def path_html_doc(fn,ln=nil) case @output_dir_structure_by when 'filename' @@ -1003,56 +965,7 @@ module SiSU_CGI_SQL end @body_main << output #+ details end - #text_objects_endnote oldtid = 0 - s_endnotes.each do |e| #% endnotes - location=e['src_filename'][/(.+?)\.(?:ssm\.sst|sst)$/,1] - file_suffix=e['src_filename'][/.+?\.(ssm\.sst|sst)$/,1] - lang=if location =~ /\S+?~(\S\S\S?)$/ - l=location[/\S+?~(\S\S\S?)$/,1] - location=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=e['title'] - can_txt_srch=(cgi['view']=~/index/) \ - ? %{search } - : %{search } - title=%{

toc html #{ti} [#{e['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}toc html manifest
} if file_suffix=~/s/ - @counter_endn_doc+=1 - oldtid=e['metadata_tid'].to_i - else title = '' - end - if cgi['view']=~/text/ \ - or (cgi['view']!~/index/ and cgi['search'] !~/search db/) #% txt endnotes - @counter_endn_ocn+=1 - matched_endnote=(@search_regx.to_s.is_a?(String) \ - && @search_regx.to_s=~/\S\S+/) \ - ? (matched=e['body'].gsub(/(<\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{\\1})) - : e['body'] - output=%{#{title}
note #{e['nr']} referred to from ocn #{e['ocn']}: #{matched_endnote}} - else #elsif cgi['view']=~/index/ #doc #FIX #% idx endnotes - @counter_endn_ocn+=1 - output=%{#{title}#{e['nr']}#{e['ocn']}], } - end - @counters_endn=if @counter_endn_doc > 0 - if checked_stats =~/\S/ - @@lt_e=@counter_endn_ocn==dbi_statement.sql_match_limit.to_i \ - ? true - : false - start=(@@offset.to_i+1).to_s - range=(@@offset.to_i+@counter_endn_ocn.to_i).to_s - %{Found #{@counter_endn_ocn} times in the endnotes of #{@counter_endn_doc} documents [ matches #{start} to #{range} ]
} - else '' - end - end - @endnotes << output #+ details - else @endnotes='' #does not take out yet - end - end offset=dbi_statement.sql_offset.to_s limit=dbi_statement.sql_match_limit.to_s @@lt_t ||=false; @@lt_e ||=false @@ -1060,7 +973,7 @@ module SiSU_CGI_SQL ? dbi_statement.pre_next(true,@image_src).to_s : dbi_statement.pre_next(false,@image_src).to_s limit=dbi_statement.sql_match_limit.to_s - cgi.out{@header.force_encoding("UTF-8") + @counters_txt.force_encoding("UTF-8") + @counters_endn.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @body_main.force_encoding("UTF-8") + @endnotes.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @tail.force_encoding("UTF-8")} #% print cgi_output_header+counters+body+endnotes + cgi.out{@header.force_encoding("UTF-8") + @counters_txt.force_encoding("UTF-8") + @counters_endn.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @body_main.force_encoding("UTF-8") + canned.force_encoding("UTF-8") + @tail.force_encoding("UTF-8")} #% print cgi_output_header+counters+body end rescue Exception => e s='
' + CGI::escapeHTML(e.backtrace.reverse.join("\n"))
-- 
cgit v1.2.3