diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-10-19 21:19:47 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-10-19 21:19:47 -0400 |
commit | fa19bd4cdb7f9f9db99c99604250ceda77e527a8 (patch) | |
tree | 3689106b15c764c720d11fbe6da0d25418094d69 | |
parent | debian/changelog (5.7.0-1) (diff) | |
parent | v5 v6: cgi, sample search form, find & display endnotes from parent text object (diff) |
Merge tag 'sisu_5.7.1' into debian/sid
SiSU 5.7.1
-rw-r--r-- | data/doc/sisu/CHANGELOG_v5 | 21 | ||||
-rw-r--r-- | data/doc/sisu/CHANGELOG_v6 | 21 | ||||
-rw-r--r-- | data/sisu/v5/v/version.yml | 6 | ||||
-rw-r--r-- | data/sisu/v6/v/version.yml | 6 | ||||
-rw-r--r-- | lib/sisu/v5/ao_syntax.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v5/cgi_pgsql.rb | 18 | ||||
-rw-r--r-- | lib/sisu/v5/cgi_sql_common.rb | 209 | ||||
-rw-r--r-- | lib/sisu/v5/cgi_sqlite.rb | 18 | ||||
-rw-r--r-- | lib/sisu/v5/db_import.rb | 34 | ||||
-rw-r--r-- | lib/sisu/v5/db_sqltxt.rb | 38 | ||||
-rw-r--r-- | lib/sisu/v5/html_format.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v5/html_segments.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v5/html_tune.rb | 14 | ||||
-rw-r--r-- | lib/sisu/v6/ao_syntax.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v6/cgi_pgsql.rb | 18 | ||||
-rw-r--r-- | lib/sisu/v6/cgi_sql_common.rb | 209 | ||||
-rw-r--r-- | lib/sisu/v6/cgi_sqlite.rb | 18 | ||||
-rw-r--r-- | lib/sisu/v6/db_import.rb | 34 | ||||
-rw-r--r-- | lib/sisu/v6/db_sqltxt.rb | 38 | ||||
-rw-r--r-- | lib/sisu/v6/html_format.rb | 5 | ||||
-rw-r--r-- | lib/sisu/v6/html_segments.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v6/html_tune.rb | 14 | ||||
-rw-r--r-- | setup/sisu_version.rb | 4 |
23 files changed, 288 insertions, 457 deletions
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 6294f34a..dba95639 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -31,6 +31,27 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 5.7.1.orig.tar.xz (2014-10-19:41/7) +http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.7.1 +http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.7.1-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_5.7.1.orig.tar.xz + sisu_5.7.1.orig.tar.xz + sisu_5.7.1-1.dsc + +* html + * html_format, "id"s for objects & footnotes + * remove trailing backslash for empty linebreak & paragraph, <br> <p> + +* db, text search & display field, footnotes moved to end of text object + * cleaner, more useful search results + * cleaner text search field + * separate footnote fields redundant for search purposes + +* 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 + %% 5.7.0.orig.tar.xz (2014-10-12:40/7) http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.7.0 http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.7.0-1 diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index e1cac6f1..3dfdc850 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -21,6 +21,27 @@ v2 branch is removed; it is available in sisu =< 3.3.2 %% Reverse Chronological: +%% 6.3.1.orig.tar.xz (2014-10-19:41/7) +http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.3.1 +http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.3.1-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_6.3.1.orig.tar.xz + sisu_6.3.1.orig.tar.xz + sisu_6.3.1-1.dsc + +* html + * html_format, "id"s for objects & footnotes + * remove trailing backslash for empty linebreak & paragraph, <br> <p> + +* db, text search & display field, footnotes moved to end of text object + * cleaner, more useful search results + * cleaner text search field + * separate footnote fields redundant for search purposes + +* 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 + %% 6.3.0.orig.tar.xz (2014-10-12:40/7) http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.3.0 http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.3.0-1 diff --git a/data/sisu/v5/v/version.yml b/data/sisu/v5/v/version.yml index c65dce1b..225033c4 100644 --- a/data/sisu/v5/v/version.yml +++ b/data/sisu/v5/v/version.yml @@ -1,5 +1,5 @@ --- :project: SiSU -:version: 5.7.0 -:date_stamp: 2014w40/7 -:date: "2014-10-12" +:version: 5.7.1 +:date_stamp: 2014w41/7 +:date: "2014-10-19" diff --git a/data/sisu/v6/v/version.yml b/data/sisu/v6/v/version.yml index a94858c4..33916d04 100644 --- a/data/sisu/v6/v/version.yml +++ b/data/sisu/v6/v/version.yml @@ -1,5 +1,5 @@ --- :project: SiSU -:version: 6.3.0 -:date_stamp: 2014w40/7 -:date: "2014-10-12" +:version: 6.3.1 +:date_stamp: 2014w41/7 +:date: "2014-10-19" diff --git a/lib/sisu/v5/ao_syntax.rb b/lib/sisu/v5/ao_syntax.rb index be184a5e..f5608d97 100644 --- a/lib/sisu/v5/ao_syntax.rb +++ b/lib/sisu/v5/ao_syntax.rb @@ -518,7 +518,7 @@ module SiSU_AO_Syntax elsif dob.is ==:code 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 + gsub(/(^|#{Mx[:gl_c]}|\s)<(?:br(?: \/)?)>([\s,.]|$)/,'\1<br>\2') #convert <br> <br /> back, clumsy if dob.number_ codeline=[] ln=1 diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index 8b4210e0..3ae98ffe 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -233,11 +233,9 @@ module SiSU_CGI_PgSQL #% database building doc end def search_query1 <<-'WOK_SQL' - @search_text,@search_endnotes='','' + @search_text='' @search_text=search[:text].flatten.join(' AND ') @search_text=@search_text.gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)') - @search_endnotes=search[:endnotes].flatten.join(' AND ') - @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') end WOK_SQL end @@ -251,26 +249,12 @@ module SiSU_CGI_PgSQL #% database building doc select=@sql_statement[:body] + ' ' + @sql_statement[:range] select end - def sql_select_endnotes - limit ||=@@limit - offset ||=@@offset - @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE (#{@search_endnotes}) AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr} - @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} - select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] - select - end def sql_select_body_format %{<font color="#666666" size="2">#{sql_select_body}</font>} end - def sql_select_endnotes_format - %{<font color="#666666" size="2">#{sql_select_endnotes}</font>} - end def contents @conn.exec(sql_select_body) end - def endnotes - @conn.exec(sql_select_endnotes) - end end WOK_SQL end diff --git a/lib/sisu/v5/cgi_sql_common.rb b/lib/sisu/v5/cgi_sql_common.rb index d6f99342..4d2304ba 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/ - '<font size="2" color="#666666">text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; editor:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br />' + '<font size="2" color="#666666">text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; editor:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br>' else '' end end @@ -161,10 +161,10 @@ module SiSU_CGI_SQL <tr><td width="20%"> <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0"> <tr><td align="left"> - <br /><a href="http://sisudoc.org/" target="_top"> + <br><a href="http://sisudoc.org/" target="_top"> <b>SiSU</b> </a> - <br /><a href="http://git.sisudoc.org/" target="_top"> + <br><a href="http://git.sisudoc.org/" target="_top"> git </a> </td></tr> @@ -193,7 +193,7 @@ module SiSU_CGI_SQL <!input type="text" id="find" name="find" value="" /> <font size="2" color="#222222"> <b>to search:</b> select which database to search (drop-down menu below); enter your search query (in the form above); and <b>click on the search button</b> (below) - <br /> + <br> <select name="db" size="1"> #{@selected_db} WOK_SQL @@ -208,18 +208,18 @@ module SiSU_CGI_SQL end def buttons2 <<-'WOK_SQL' - <br /> + <br> match limit: <input type="radio" name="sql_match_limit" value="1000" #{@checked_sql_limit[:l1000]}> 1,000 <input type="radio" name="sql_match_limit" value="2500" #{@checked_sql_limit[:l2500]}> 2,500 - <br /> + <br> <input type="checkbox" name="echo" #{@checked_echo}> echo query <input type="checkbox" name="stats" #{@checked_stats}> result stats <input type="checkbox" name="url" #{@checked_url}> search url <input type="checkbox" name="searched" #{@checked_searched}> searched <input type="checkbox" name="tip" #{@checked_tip}> available fields <input type="checkbox" name="sql" #{@checked_sql}> sql statement - <br /> + <br> checks: <input type="radio" name="checks" value="check_default" #{@checked_default}> default <input type="radio" name="checks" value="check_selected" #{@checked_selected}> selected @@ -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 @@ -483,14 +462,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$/ - %{<br /><center> + %{<br><center> pg. #{page.to_s} <a href="#{can.next}"> <img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt=" >>" /> </a> </center>} elsif page.to_s =~ /^2$/ - %{<br /><center> + %{<br><center> <a href="#{can.previous}"> <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="<< " /> </a> @@ -500,7 +479,7 @@ module SiSU_CGI_SQL </a> </center>} else - %{<br /><center> + %{<br><center> <a href="#{can.start}"> <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|< " /> </a> @@ -516,14 +495,14 @@ module SiSU_CGI_SQL else if page.to_s =~ /^1$/ then '' elsif page.to_s =~ /^2$/ - %{<br /><center> + %{<br><center> <a href="#{can.previous}"> <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="<< " /> </a> pg. #{page.to_s} </center>} else - %{<br /><center> + %{<br><center> <a href="#{can.start}"> <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|< " /> </a> @@ -542,16 +521,16 @@ module SiSU_CGI_SQL <<-WOK_SQL def tail <<-'WOK' - <br /><hr /><br /> + <br><hr /><br> <table summary="SiSU summary" cellpadding="2" border="0"> <!-- widget sisu --> <tr><td valign="top" width="10%"> <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0"> <tr><td align="left"> - <br /><a href="http://sisudoc.org/" target="_top"> + <br><a href="http://sisudoc.org/" target="_top"> <b>SiSU</b> </a> - <br /><a href="http://git.sisudoc.org/" target="_top"> + <br><a href="http://git.sisudoc.org/" target="_top"> git </a> </td></tr> @@ -562,14 +541,14 @@ module SiSU_CGI_SQL <p class="tiny_left"><font color="#666666" size="2"> Generated by #{v[:project]} #{v[:version]} #{v[:date]} (#{v[:date_stamp]}) - <br /> + <br> <a href="http://www.sisudoc.org" > <b>#{v[:project]}</b></a> <sup>©</sup> Ralph Amissah 1993, current 2014. All Rights Reserved. - <br /> + <br> #{v[:project]} is software for document structuring, publishing and search, - <br /> + <br> <a href="http://www.jus.uio.no/sisu" > www.jus.uio.no/sisu </a> @@ -581,17 +560,17 @@ module SiSU_CGI_SQL <a href="http://git.sisudoc.org" > git.sisudoc.org </a> - <br /> + <br> <i>w3 since October 3 1993</i> <a href="mailto:ralph@amissah.com" > ralph@amissah.com </a> - <br /> + <br> mailing list subscription <a href="http://lists.sisudoc.org/listinfo/sisu" > http://lists.sisudoc.org/listinfo/sisu </a> - <br /> + <br> <a href="mailto:sisu@lists.sisudoc.org" > sisu@lists.sisudoc.org </a> @@ -599,10 +578,10 @@ module SiSU_CGI_SQL </td><td valign="top" width="45%"> <p class="tiny_left"><font color="#666666" size="2"> #{v[:project]} using: - <br />Standard SiSU markup syntax, - <br />Standard SiSU meta-markup syntax, and the - <br />Standard SiSU <u>object citation numbering</u> and system, (object/text identifying/locating system) - <br /> + <br>Standard SiSU markup syntax, + <br>Standard SiSU meta-markup syntax, and the + <br>Standard SiSU <u>object citation numbering</u> and system, (object/text identifying/locating system) + <br> <sup>©</sup> Ralph Amissah 1997, current 2014. All Rights Reserved. </font></p> @@ -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 @@ -767,39 +744,39 @@ module SiSU_CGI_SQL end green=%{<font size="2" color="#004000">} canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) - the_can=%{<font size="2" color="#666666">#{canned_note} <a href="#{@@canned_search_url}">#{canned_search_url_txt}</a></font><br />} + the_can=%{<font size="2" color="#666666">#{canned_note} <a href="#{@@canned_search_url}">#{canned_search_url_txt}</a></font><br>} 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}</font><br />} if @search_for.filename =~/\S+/ - p_text=%{text: #{green}#{@search_for.text1}</font><br />} if @search_for.text1 =~/\S+/ - p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}</font><br />} if @search_for.fulltext =~/\S+/ - p_title=%{title: #{green}#{@search_for.title}</font><br />} if @search_for.title =~/\S+/ - p_author=%{author: #{green}#{@search_for.author}</font><br />} if @search_for.author =~/\S+/ - p_editor=%{editor: #{green}#{@search_for.editor}</font><br />} if @search_for.editor=~/\S+/ - p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br />} if @search_for.contributor =~/\S+/ - p_date=%{date: #{green}#{@search_for.date}</font><br />} if @search_for.date =~/\S+/ - p_rights=%{rights: #{green}#{@search_for.rights}</font><br />} if @search_for.rights =~/\S+/ - p_topic_register=%{topic_register: #{green}#{@search_for.topic_register}</font><br />} if @search_for.topic_register =~/\S+/ - p_subject=%{subject: #{green}#{@search_for.subject}</font><br />} if @search_for.subject =~/\S+/ - p_keywords=%{keywords: #{green}#{@search_for.keywords}</font><br />} if @search_for.keywords =~/\S+/ - p_identifier=%{identifier: #{green}#{@search_for.identifier}</font><br />} if @search_for.identifier =~/\S+/ - p_type=%{type: #{green}#{@search_for.type}</font><br />} if @search_for.type =~/\S+/ - p_format=%{format: #{green}#{@search_for.format}</font><br />} if @search_for.format =~/\S+/ - p_relation=%{relation: #{green}#{@search_for.relation}</font><br />} if @search_for.relation =~/\S+/ - p_coverage=%{coverage: #{green}#{@search_for.coverage}</font><br />} if @search_for.coverage =~/\S+/ - p_description=%{description: #{green}#{@search_for.description}</font><br />} if @search_for.description =~/\S+/ - p_abstract=%{abstract: #{green}#{@search_for.abstract}</font><br />} if @search_for.abstract =~/\S+/ - p_comment=%{comment: #{green}#{@search_for.comment}</font><br />} if @search_for.comment =~/\S+/ - p_publisher=%{publisher: #{green}#{@search_for.publisher}</font><br />} if @search_for.publisher =~/\S+/ - p_source=%{source: #{green}#{@search_for.source}</font><br />} if @search_for.source =~/\S+/ - p_language=%{language: #{green}#{@search_for.language}</font><br />} if @search_for.language =~/\S+/ + p_filename=%{filename: #{green}#{@search_for.filename}</font><br>} if @search_for.filename =~/\S+/ + p_text=%{text: #{green}#{@search_for.text1}</font><br>} if @search_for.text1 =~/\S+/ + p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}</font><br>} if @search_for.fulltext =~/\S+/ + p_title=%{title: #{green}#{@search_for.title}</font><br>} if @search_for.title =~/\S+/ + p_author=%{author: #{green}#{@search_for.author}</font><br>} if @search_for.author =~/\S+/ + p_editor=%{editor: #{green}#{@search_for.editor}</font><br>} if @search_for.editor=~/\S+/ + p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br>} if @search_for.contributor =~/\S+/ + p_date=%{date: #{green}#{@search_for.date}</font><br>} if @search_for.date =~/\S+/ + p_rights=%{rights: #{green}#{@search_for.rights}</font><br>} if @search_for.rights =~/\S+/ + p_topic_register=%{topic_register: #{green}#{@search_for.topic_register}</font><br>} if @search_for.topic_register =~/\S+/ + p_subject=%{subject: #{green}#{@search_for.subject}</font><br>} if @search_for.subject =~/\S+/ + p_keywords=%{keywords: #{green}#{@search_for.keywords}</font><br>} if @search_for.keywords =~/\S+/ + p_identifier=%{identifier: #{green}#{@search_for.identifier}</font><br>} if @search_for.identifier =~/\S+/ + p_type=%{type: #{green}#{@search_for.type}</font><br>} if @search_for.type =~/\S+/ + p_format=%{format: #{green}#{@search_for.format}</font><br>} if @search_for.format =~/\S+/ + p_relation=%{relation: #{green}#{@search_for.relation}</font><br>} if @search_for.relation =~/\S+/ + p_coverage=%{coverage: #{green}#{@search_for.coverage}</font><br>} if @search_for.coverage =~/\S+/ + p_description=%{description: #{green}#{@search_for.description}</font><br>} if @search_for.description =~/\S+/ + p_abstract=%{abstract: #{green}#{@search_for.abstract}</font><br>} if @search_for.abstract =~/\S+/ + p_comment=%{comment: #{green}#{@search_for.comment}</font><br>} if @search_for.comment =~/\S+/ + p_publisher=%{publisher: #{green}#{@search_for.publisher}</font><br>} if @search_for.publisher =~/\S+/ + p_source=%{source: #{green}#{@search_for.source}</font><br>} if @search_for.source =~/\S+/ + p_language=%{language: #{green}#{@search_for.language}</font><br>} if @search_for.language =~/\S+/ search_note=<<-WOK <font size="2" color="#666666"> <b>database:</b> #{green}#{@db}</font>; <b>selected view:</b> #{green}#{cgi['view']}</font> - <b>search string:</b> "#{green}#{analyze_format}</font>"<br /> + <b>search string:</b> "#{green}#{analyze_format}</font>"<br> #{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} </font> WOK - #eg = %{canned search e.g.:<br /> <a href="#{url}">#{url}</a><br />find: #{analyze}<br />database: #{database}} + #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,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/ @@ -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 << '<p><hr><br /><b>Main Text:</b><br />' << sql_select_body - @endnotes << '<p><hr><br /><b>Endnotes:</b><br />' << 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' @@ -928,10 +890,10 @@ module SiSU_CGI_SQL can_txt_srch=(cgi['view']=~/index/) \ ? %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } : %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } - title=%{<span style="background-color: #{@color_heading}"><a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{c['language_document_char']}] by #{c['creator_author']} <a href="#{path_manifest(location,c['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a> #{can_txt_srch}<br />} if file_suffix=~/s/ #hmm watch file_suffix + title=%{<span style="background-color: #{@color_heading}"><a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{c['language_document_char']}] by #{c['creator_author']} <a href="#{path_manifest(location,c['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a> #{can_txt_srch}<br>} if file_suffix=~/s/ #hmm watch file_suffix title=@text_search_flag \ - ? '<br /><hr>'+title - : '<br />'+title + ? '<br><hr>'+title + : '<br>'+title @counter_txt_doc+=1 oldtid=c['tid'].to_i else title='' @@ -996,63 +958,14 @@ 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 - %{<hr /><font size="2" color="#666666">Found #{@counter_txt_ocn} times in the main body of #{@counter_txt_doc} documents [ matches #{start} to #{range} ]</font><br />} + %{<hr /><font size="2" color="#666666">Found #{@counter_txt_ocn} times in the main body of #{@counter_txt_doc} documents [ matches #{start} to #{range} ]</font><br>} else '' end else '' 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/) \ - ? %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } - : %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } - title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{path_toc(location,e['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{e['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}<a href="#{path_toc(location,e['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a> <a href="#{path_manifest(location,e['language_document_char'])}"><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/ \ - 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(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>})) - : e['body'] - output=%{#{title}<hr><font size="2">note <b><a href="#{path_endnotes(location,e['language_document_char'])}#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{path_html_doc(location,e['language_document_char'])}#o#{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} - else #elsif cgi['view']=~/index/ #doc #FIX #% idx endnotes - @counter_endn_ocn+=1 - output=%{#{title}<a href="#{path_endnotes(location,e['language_document_char'])}#_#{e['nr']}">#{e['nr']}</a> [§ <a href="#{path_html_doc(location,e['language_document_char'])}#o#{e['ocn']}">#{e['ocn']}</a>], } - 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 - %{<font size="2" color="#666666">Found #{@counter_endn_ocn} times in the endnotes of #{@counter_endn_doc} documents [ matches #{start} to #{range} ]</font><br />} - 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='<pre>' + CGI::escapeHTML(e.backtrace.reverse.join("\n")) diff --git a/lib/sisu/v5/cgi_sqlite.rb b/lib/sisu/v5/cgi_sqlite.rb index 2b4e668f..8f3f58eb 100644 --- a/lib/sisu/v5/cgi_sqlite.rb +++ b/lib/sisu/v5/cgi_sqlite.rb @@ -211,11 +211,9 @@ module SiSU_CGI_SQLite #% database building doc end def search_query1 <<-'WOK_SQL' - @search_text,@search_endnotes='','' + @search_text='' @search_text=search[:text].flatten.join(' AND ') @search_text=@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_endnotes=search[:endnotes].flatten.join(' AND ') - @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') end WOK_SQL end @@ -229,26 +227,12 @@ module SiSU_CGI_SQLite #% database building doc select=@sql_statement[:body] + ' ' + @sql_statement[:range] select end - def sql_select_endnotes - limit ||=@@limit - offset ||=@@offset - @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE #{@search_endnotes} AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr} - @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} - select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] - select - end def sql_select_body_format %{<font color="#666666" size="2">#{sql_select_body}</font>} end - def sql_select_endnotes_format - %{<font color="#666666" size="2">#{sql_select_endnotes}</font>} - end def contents @conn.execute(sql_select_body) end - def endnotes - @conn.execute(sql_select_endnotes) - end end WOK_SQL end diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb index 59cff28a..72fb3753 100644 --- a/lib/sisu/v5/db_import.rb +++ b/lib/sisu/v5/db_import.rb @@ -334,17 +334,17 @@ module SiSU_DbImport @en,@en_ast,@en_pls,@tuple_array=[],[],[],[] @col[:en_a],@col[:en_z]=nil,nil ao_array.each do |data| - data.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1') - data.obj.gsub!(/#{Mx[:gl_o]}(●)#{Mx[:gl_c]}\s*/,'\1 ') - data.obj.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check + data.obj=data.obj.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_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_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1'). + gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1'). + gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1'). + gsub(/#{Mx[:gl_o]}(●)#{Mx[:gl_c]}\s*/,'\1 '). + gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check @col[:seg]=@@seg if data.of ==:para \ || data.of ==:heading \ @@ -374,7 +374,7 @@ module SiSU_DbImport @col[:lid]+=1 txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_minus - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) @@ -425,7 +425,7 @@ module SiSU_DbImport @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) @@ -470,7 +470,7 @@ module SiSU_DbImport @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) @@ -501,7 +501,7 @@ module SiSU_DbImport @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) @@ -532,7 +532,7 @@ module SiSU_DbImport @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) @@ -603,7 +603,7 @@ module SiSU_DbImport else SiSU_FormatShared::CSS_Format.new(@md,data).norm end - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) diff --git a/lib/sisu/v5/db_sqltxt.rb b/lib/sisu/v5/db_sqltxt.rb index ffb5966b..3f6cf951 100644 --- a/lib/sisu/v5/db_sqltxt.rb +++ b/lib/sisu/v5/db_sqltxt.rb @@ -60,13 +60,13 @@ module SiSU_DbText class Prepare def special_character_escape(str) - str=str.gsub(/'/,"''"). #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'") + str=str.gsub(/'/m,"''"). #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'") gsub(/(\\)/m,'\1\1'). #ok but with warnings, double backslash on sqlite #str.gsub!(/[\\]/m,'\\x5C') #ok but with warnings, but not for sqlite #str.gsub!(/(\\)/m,'\1') #ok for sqlite not for pgsql - gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"<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') + gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/m,"<br>\n"). + gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/m,''). #check + gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/m,'[image: \1] \2'). + gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/m,'\1\2'). + gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m,'\1') end def clean_searchable_text_from_document_objects(arr) txt_arr,en=[],[] @@ -80,13 +80,29 @@ module SiSU_DbText gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m,''). gsub(/ \s+/m,' ') #p s if s =~/[^ \nA-Za-z0-9'"`?!#@$%^&*=+,.;:\[\]()<>{}‹›|\\\/~_-]/ - s + txt_arr << s end - txt_arr << arr << en - #txt_arr=txt_arr.flatten + txt_arr=txt_arr << en txt=txt_arr.flatten.join("\n") - txt=special_character_escape(txt) - txt + special_character_escape(txt) + end + def clean_document_objects_body(arr) + txt_arr,en,en_arr=[],[],[] + arr=(arr.is_a?(String)) ? [ arr ] : arr + arr.each do |s| + en << s.scan(/#{Mx[:en_a_o]}\s*(.+?)\s*#{Mx[:en_a_c]}/m) + s=s.gsub(/#{Mx[:en_a_o]}\s*(\d+).+?#{Mx[:en_a_c]}/m,'<sup>\1</sup>'). + gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m,''). + gsub(/ \s+/m,' ') + txt_arr << s + end + en.flatten.each do |e| + e=e.sub(/^(\d+)\s*/,'<sup>\1</sup> ') + en_arr << e + end + txt_arr=txt_arr << en_arr + txt=txt_arr.flatten.join("\n<br>") + special_character_escape(txt) end def clean_searchable_text_from_document_source(arr) txt_arr,en=[],[] diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index b0611508..78080878 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -71,10 +71,8 @@ module SiSU_HTML_Format if @ocn.to_i==0 \ or @ocn.empty? '' - elsif @make.build.html_strict? - %{<label class="ocn">#{@ocn}</label>} else - %{<label class="ocn"><a name="#{@ocn}" class="lnkocn">#{@ocn}</a></label>} + %{<label class="ocn">#{@ocn}</label>} end else '' diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb index 60cd51f1..06aac4e1 100644 --- a/lib/sisu/v5/html_segments.rb +++ b/lib/sisu/v5/html_segments.rb @@ -672,7 +672,7 @@ module SiSU_HTML_Seg @@seg_subtoc_array << subtoc end if @md.flag_auto_endnotes - if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="#{Mx[:note]}[\d*+]+"/) \ + if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+\s*<a href="##{Mx[:note_ref]}[\d*+]+"/) \ && dob.is !=:code # endnote- endnote_array=[] if dob.obj=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m @@ -689,7 +689,7 @@ module SiSU_HTML_Seg note_match=note.dup note_match_seg=note.dup e_n=note_match_seg[/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,1] - try=e_n.split(/<br \/>/) + try=e_n.split(/<br(?: \/)?>/) try.each do |e| txt_obj={ txt: e } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @@ -699,7 +699,7 @@ module SiSU_HTML_Seg end @@seg_endnotes_array << note_match end - try.join('<br \/>') + try.join('<br>') #% creation of separate end segment/page of all endnotes referenced back to reference segment m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(##{Mx[:note_ref]}[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi endnote_part_a=note_match_seg[m,1] diff --git a/lib/sisu/v5/html_tune.rb b/lib/sisu/v5/html_tune.rb index 7cd2a920..e241dcd3 100644 --- a/lib/sisu/v5/html_tune.rb +++ b/lib/sisu/v5/html_tune.rb @@ -263,14 +263,14 @@ module SiSU_HTML_Tune def endnotes_html(dob) unless dob.is ==:code 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="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2"> <sup>\\2</sup> </a> } + - %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2"> <sup>\\2.</sup></a> \\3 \\4}). + %{ <a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2"> <sup>\\2</sup> </note></a> } + + %{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2"> <sup>\\2.</sup></note></a> \\3 \\4}). gsub(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/, - %{ <a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2"> <sup>\\2</sup> </a> } + - %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2"> <sup>\\2.</sup></a> \\3 \\4}). + %{ <a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2"> <sup>\\2</sup> </note></a> } + + %{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2"> <sup>\\2.</sup></note></a> \\3 \\4}). gsub(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/, - %{ <a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2"> <sup>\\2</sup> </a> } + - %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2"> <sup>\\2</sup></a> \\3 \\4}) + %{ <a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2"> <sup>\\2</sup> </note></a> } + + %{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2"> <sup>\\2</sup></note></a> \\3 \\4}) end dob end @@ -290,7 +290,7 @@ module SiSU_HTML_Tune 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 />') + gsub(/<(p|br) \/>/,'<\1>') dob=SiSU_HTML_Tune::CleanHTML.new(dob).clean dob end diff --git a/lib/sisu/v6/ao_syntax.rb b/lib/sisu/v6/ao_syntax.rb index 2e771185..da1daddf 100644 --- a/lib/sisu/v6/ao_syntax.rb +++ b/lib/sisu/v6/ao_syntax.rb @@ -518,7 +518,7 @@ module SiSU_AO_Syntax elsif dob.is ==:code 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 + gsub(/(^|#{Mx[:gl_c]}|\s)<(?:br(?: \/)?)>([\s,.]|$)/,'\1<br>\2') #convert <br> <br /> back, clumsy if dob.number_ codeline=[] ln=1 diff --git a/lib/sisu/v6/cgi_pgsql.rb b/lib/sisu/v6/cgi_pgsql.rb index 9feffd40..49ab0e50 100644 --- a/lib/sisu/v6/cgi_pgsql.rb +++ b/lib/sisu/v6/cgi_pgsql.rb @@ -233,11 +233,9 @@ module SiSU_CGI_PgSQL #% database building doc end def search_query1 <<-'WOK_SQL' - @search_text,@search_endnotes='','' + @search_text='' @search_text=search[:text].flatten.join(' AND ') @search_text=@search_text.gsub(/(doc_objects\.clean~[*]?\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+doc_objects\.clean~[*]?\(\s*'[^']+'\s*\))+)/,'(\1)') - @search_endnotes=search[:endnotes].flatten.join(' AND ') - @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean~\(\s*'[^']+'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean~\(\s*'[^']+'\s*\))+)/,'(\1)') end WOK_SQL end @@ -251,26 +249,12 @@ module SiSU_CGI_PgSQL #% database building doc select=@sql_statement[:body] + ' ' + @sql_statement[:range] select end - def sql_select_endnotes - limit ||=@@limit - offset ||=@@offset - @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE (#{@search_endnotes}) AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr} - @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} - select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] - select - end def sql_select_body_format %{<font color="#666666" size="2">#{sql_select_body}</font>} end - def sql_select_endnotes_format - %{<font color="#666666" size="2">#{sql_select_endnotes}</font>} - end def contents @conn.exec(sql_select_body) end - def endnotes - @conn.exec(sql_select_endnotes) - end end WOK_SQL end diff --git a/lib/sisu/v6/cgi_sql_common.rb b/lib/sisu/v6/cgi_sql_common.rb index a05f8f53..6976e042 100644 --- a/lib/sisu/v6/cgi_sql_common.rb +++ b/lib/sisu/v6/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/ - '<font size="2" color="#666666">text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; editor:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br />' + '<font size="2" color="#666666">text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; editor:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br>' else '' end end @@ -161,10 +161,10 @@ module SiSU_CGI_SQL <tr><td width="20%"> <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0"> <tr><td align="left"> - <br /><a href="http://sisudoc.org/" target="_top"> + <br><a href="http://sisudoc.org/" target="_top"> <b>SiSU</b> </a> - <br /><a href="http://git.sisudoc.org/" target="_top"> + <br><a href="http://git.sisudoc.org/" target="_top"> git </a> </td></tr> @@ -193,7 +193,7 @@ module SiSU_CGI_SQL <!input type="text" id="find" name="find" value="" /> <font size="2" color="#222222"> <b>to search:</b> select which database to search (drop-down menu below); enter your search query (in the form above); and <b>click on the search button</b> (below) - <br /> + <br> <select name="db" size="1"> #{@selected_db} WOK_SQL @@ -208,18 +208,18 @@ module SiSU_CGI_SQL end def buttons2 <<-'WOK_SQL' - <br /> + <br> match limit: <input type="radio" name="sql_match_limit" value="1000" #{@checked_sql_limit[:l1000]}> 1,000 <input type="radio" name="sql_match_limit" value="2500" #{@checked_sql_limit[:l2500]}> 2,500 - <br /> + <br> <input type="checkbox" name="echo" #{@checked_echo}> echo query <input type="checkbox" name="stats" #{@checked_stats}> result stats <input type="checkbox" name="url" #{@checked_url}> search url <input type="checkbox" name="searched" #{@checked_searched}> searched <input type="checkbox" name="tip" #{@checked_tip}> available fields <input type="checkbox" name="sql" #{@checked_sql}> sql statement - <br /> + <br> checks: <input type="radio" name="checks" value="check_default" #{@checked_default}> default <input type="radio" name="checks" value="check_selected" #{@checked_selected}> selected @@ -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 @@ -483,14 +462,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$/ - %{<br /><center> + %{<br><center> pg. #{page.to_s} <a href="#{can.next}"> <img border="0" width="22" height="22" src="#{img}/arrow_next_red.png" alt=" >>" /> </a> </center>} elsif page.to_s =~ /^2$/ - %{<br /><center> + %{<br><center> <a href="#{can.previous}"> <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="<< " /> </a> @@ -500,7 +479,7 @@ module SiSU_CGI_SQL </a> </center>} else - %{<br /><center> + %{<br><center> <a href="#{can.start}"> <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|< " /> </a> @@ -516,14 +495,14 @@ module SiSU_CGI_SQL else if page.to_s =~ /^1$/ then '' elsif page.to_s =~ /^2$/ - %{<br /><center> + %{<br><center> <a href="#{can.previous}"> <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="<< " /> </a> pg. #{page.to_s} </center>} else - %{<br /><center> + %{<br><center> <a href="#{can.start}"> <img border="0" width="22" height="22" src="#{img}/arrow_prev_red.png" alt="|< " /> </a> @@ -542,16 +521,16 @@ module SiSU_CGI_SQL <<-WOK_SQL def tail <<-'WOK' - <br /><hr /><br /> + <br><hr /><br> <table summary="SiSU summary" cellpadding="2" border="0"> <!-- widget sisu --> <tr><td valign="top" width="10%"> <table summary="home button / home information" border="0" cellpadding="3" cellspacing="0"> <tr><td align="left"> - <br /><a href="http://sisudoc.org/" target="_top"> + <br><a href="http://sisudoc.org/" target="_top"> <b>SiSU</b> </a> - <br /><a href="http://git.sisudoc.org/" target="_top"> + <br><a href="http://git.sisudoc.org/" target="_top"> git </a> </td></tr> @@ -562,14 +541,14 @@ module SiSU_CGI_SQL <p class="tiny_left"><font color="#666666" size="2"> Generated by #{v[:project]} #{v[:version]} #{v[:date]} (#{v[:date_stamp]}) - <br /> + <br> <a href="http://www.sisudoc.org" > <b>#{v[:project]}</b></a> <sup>©</sup> Ralph Amissah 1993, current 2014. All Rights Reserved. - <br /> + <br> #{v[:project]} is software for document structuring, publishing and search, - <br /> + <br> <a href="http://www.jus.uio.no/sisu" > www.jus.uio.no/sisu </a> @@ -581,17 +560,17 @@ module SiSU_CGI_SQL <a href="http://git.sisudoc.org" > git.sisudoc.org </a> - <br /> + <br> <i>w3 since October 3 1993</i> <a href="mailto:ralph@amissah.com" > ralph@amissah.com </a> - <br /> + <br> mailing list subscription <a href="http://lists.sisudoc.org/listinfo/sisu" > http://lists.sisudoc.org/listinfo/sisu </a> - <br /> + <br> <a href="mailto:sisu@lists.sisudoc.org" > sisu@lists.sisudoc.org </a> @@ -599,10 +578,10 @@ module SiSU_CGI_SQL </td><td valign="top" width="45%"> <p class="tiny_left"><font color="#666666" size="2"> #{v[:project]} using: - <br />Standard SiSU markup syntax, - <br />Standard SiSU meta-markup syntax, and the - <br />Standard SiSU <u>object citation numbering</u> and system, (object/text identifying/locating system) - <br /> + <br>Standard SiSU markup syntax, + <br>Standard SiSU meta-markup syntax, and the + <br>Standard SiSU <u>object citation numbering</u> and system, (object/text identifying/locating system) + <br> <sup>©</sup> Ralph Amissah 1997, current 2014. All Rights Reserved. </font></p> @@ -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 @@ -767,39 +744,39 @@ module SiSU_CGI_SQL end green=%{<font size="2" color="#004000">} canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) - the_can=%{<font size="2" color="#666666">#{canned_note} <a href="#{@@canned_search_url}">#{canned_search_url_txt}</a></font><br />} + the_can=%{<font size="2" color="#666666">#{canned_note} <a href="#{@@canned_search_url}">#{canned_search_url_txt}</a></font><br>} 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}</font><br />} if @search_for.filename =~/\S+/ - p_text=%{text: #{green}#{@search_for.text1}</font><br />} if @search_for.text1 =~/\S+/ - p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}</font><br />} if @search_for.fulltext =~/\S+/ - p_title=%{title: #{green}#{@search_for.title}</font><br />} if @search_for.title =~/\S+/ - p_author=%{author: #{green}#{@search_for.author}</font><br />} if @search_for.author =~/\S+/ - p_editor=%{editor: #{green}#{@search_for.editor}</font><br />} if @search_for.editor=~/\S+/ - p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br />} if @search_for.contributor =~/\S+/ - p_date=%{date: #{green}#{@search_for.date}</font><br />} if @search_for.date =~/\S+/ - p_rights=%{rights: #{green}#{@search_for.rights}</font><br />} if @search_for.rights =~/\S+/ - p_topic_register=%{topic_register: #{green}#{@search_for.topic_register}</font><br />} if @search_for.topic_register =~/\S+/ - p_subject=%{subject: #{green}#{@search_for.subject}</font><br />} if @search_for.subject =~/\S+/ - p_keywords=%{keywords: #{green}#{@search_for.keywords}</font><br />} if @search_for.keywords =~/\S+/ - p_identifier=%{identifier: #{green}#{@search_for.identifier}</font><br />} if @search_for.identifier =~/\S+/ - p_type=%{type: #{green}#{@search_for.type}</font><br />} if @search_for.type =~/\S+/ - p_format=%{format: #{green}#{@search_for.format}</font><br />} if @search_for.format =~/\S+/ - p_relation=%{relation: #{green}#{@search_for.relation}</font><br />} if @search_for.relation =~/\S+/ - p_coverage=%{coverage: #{green}#{@search_for.coverage}</font><br />} if @search_for.coverage =~/\S+/ - p_description=%{description: #{green}#{@search_for.description}</font><br />} if @search_for.description =~/\S+/ - p_abstract=%{abstract: #{green}#{@search_for.abstract}</font><br />} if @search_for.abstract =~/\S+/ - p_comment=%{comment: #{green}#{@search_for.comment}</font><br />} if @search_for.comment =~/\S+/ - p_publisher=%{publisher: #{green}#{@search_for.publisher}</font><br />} if @search_for.publisher =~/\S+/ - p_source=%{source: #{green}#{@search_for.source}</font><br />} if @search_for.source =~/\S+/ - p_language=%{language: #{green}#{@search_for.language}</font><br />} if @search_for.language =~/\S+/ + p_filename=%{filename: #{green}#{@search_for.filename}</font><br>} if @search_for.filename =~/\S+/ + p_text=%{text: #{green}#{@search_for.text1}</font><br>} if @search_for.text1 =~/\S+/ + p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}</font><br>} if @search_for.fulltext =~/\S+/ + p_title=%{title: #{green}#{@search_for.title}</font><br>} if @search_for.title =~/\S+/ + p_author=%{author: #{green}#{@search_for.author}</font><br>} if @search_for.author =~/\S+/ + p_editor=%{editor: #{green}#{@search_for.editor}</font><br>} if @search_for.editor=~/\S+/ + p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br>} if @search_for.contributor =~/\S+/ + p_date=%{date: #{green}#{@search_for.date}</font><br>} if @search_for.date =~/\S+/ + p_rights=%{rights: #{green}#{@search_for.rights}</font><br>} if @search_for.rights =~/\S+/ + p_topic_register=%{topic_register: #{green}#{@search_for.topic_register}</font><br>} if @search_for.topic_register =~/\S+/ + p_subject=%{subject: #{green}#{@search_for.subject}</font><br>} if @search_for.subject =~/\S+/ + p_keywords=%{keywords: #{green}#{@search_for.keywords}</font><br>} if @search_for.keywords =~/\S+/ + p_identifier=%{identifier: #{green}#{@search_for.identifier}</font><br>} if @search_for.identifier =~/\S+/ + p_type=%{type: #{green}#{@search_for.type}</font><br>} if @search_for.type =~/\S+/ + p_format=%{format: #{green}#{@search_for.format}</font><br>} if @search_for.format =~/\S+/ + p_relation=%{relation: #{green}#{@search_for.relation}</font><br>} if @search_for.relation =~/\S+/ + p_coverage=%{coverage: #{green}#{@search_for.coverage}</font><br>} if @search_for.coverage =~/\S+/ + p_description=%{description: #{green}#{@search_for.description}</font><br>} if @search_for.description =~/\S+/ + p_abstract=%{abstract: #{green}#{@search_for.abstract}</font><br>} if @search_for.abstract =~/\S+/ + p_comment=%{comment: #{green}#{@search_for.comment}</font><br>} if @search_for.comment =~/\S+/ + p_publisher=%{publisher: #{green}#{@search_for.publisher}</font><br>} if @search_for.publisher =~/\S+/ + p_source=%{source: #{green}#{@search_for.source}</font><br>} if @search_for.source =~/\S+/ + p_language=%{language: #{green}#{@search_for.language}</font><br>} if @search_for.language =~/\S+/ search_note=<<-WOK <font size="2" color="#666666"> <b>database:</b> #{green}#{@db}</font>; <b>selected view:</b> #{green}#{cgi['view']}</font> - <b>search string:</b> "#{green}#{analyze_format}</font>"<br /> + <b>search string:</b> "#{green}#{analyze_format}</font>"<br> #{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} </font> WOK - #eg = %{canned search e.g.:<br /> <a href="#{url}">#{url}</a><br />find: #{analyze}<br />database: #{database}} + #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,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/ @@ -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 << '<p><hr><br /><b>Main Text:</b><br />' << sql_select_body - @endnotes << '<p><hr><br /><b>Endnotes:</b><br />' << 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' @@ -928,10 +890,10 @@ module SiSU_CGI_SQL can_txt_srch=(cgi['view']=~/index/) \ ? %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } : %{<a href="#{@canned_base_url}&fns=#{c['src_filename']}&lang=#{c['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } - title=%{<span style="background-color: #{@color_heading}"><a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{c['language_document_char']}] by #{c['creator_author']} <a href="#{path_manifest(location,c['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a> #{can_txt_srch}<br />} if file_suffix=~/s/ #hmm watch file_suffix + title=%{<span style="background-color: #{@color_heading}"><a href="#{path_toc(location,c['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{c['language_document_char']}] by #{c['creator_author']} <a href="#{path_manifest(location,c['language_document_char'])}"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a> #{can_txt_srch}<br>} if file_suffix=~/s/ #hmm watch file_suffix title=@text_search_flag \ - ? '<br /><hr>'+title - : '<br />'+title + ? '<br><hr>'+title + : '<br>'+title @counter_txt_doc+=1 oldtid=c['tid'].to_i else title='' @@ -996,63 +958,14 @@ 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 - %{<hr /><font size="2" color="#666666">Found #{@counter_txt_ocn} times in the main body of #{@counter_txt_doc} documents [ matches #{start} to #{range} ]</font><br />} + %{<hr /><font size="2" color="#666666">Found #{@counter_txt_ocn} times in the main body of #{@counter_txt_doc} documents [ matches #{start} to #{range} ]</font><br>} else '' end else '' 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/) \ - ? %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } - : %{<a href="#{@canned_base_url}&fns=#{e['src_filename']}&lang=#{e['language_document_char']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } - title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{path_toc(location,e['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> [#{e['language_document_char']}] by #{e['creator_author']} #{can_txt_srch}<a href="#{path_toc(location,e['language_document_char'])}"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a> <a href="#{path_manifest(location,e['language_document_char'])}"><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/ \ - 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(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>})) - : e['body'] - output=%{#{title}<hr><font size="2">note <b><a href="#{path_endnotes(location,e['language_document_char'])}#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{path_html_doc(location,e['language_document_char'])}#o#{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} - else #elsif cgi['view']=~/index/ #doc #FIX #% idx endnotes - @counter_endn_ocn+=1 - output=%{#{title}<a href="#{path_endnotes(location,e['language_document_char'])}#_#{e['nr']}">#{e['nr']}</a> [§ <a href="#{path_html_doc(location,e['language_document_char'])}#o#{e['ocn']}">#{e['ocn']}</a>], } - 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 - %{<font size="2" color="#666666">Found #{@counter_endn_ocn} times in the endnotes of #{@counter_endn_doc} documents [ matches #{start} to #{range} ]</font><br />} - 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='<pre>' + CGI::escapeHTML(e.backtrace.reverse.join("\n")) diff --git a/lib/sisu/v6/cgi_sqlite.rb b/lib/sisu/v6/cgi_sqlite.rb index d9b1559d..d11d4c30 100644 --- a/lib/sisu/v6/cgi_sqlite.rb +++ b/lib/sisu/v6/cgi_sqlite.rb @@ -211,11 +211,9 @@ module SiSU_CGI_SQLite #% database building doc end def search_query1 <<-'WOK_SQL' - @search_text,@search_endnotes='','' + @search_text='' @search_text=search[:text].flatten.join(' AND ') @search_text=@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_endnotes=search[:endnotes].flatten.join(' AND ') - @search_endnotes=@search_endnotes.gsub(/(endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\)\s+(?:(?:AND|OR)\s+endnotes\.clean\s+LIKE\s+\(\s*'%[^']+%'\s*\))+)/,'(\1)') end WOK_SQL end @@ -229,26 +227,12 @@ module SiSU_CGI_SQLite #% database building doc select=@sql_statement[:body] + ' ' + @sql_statement[:range] select end - def sql_select_endnotes - limit ||=@@limit - offset ||=@@offset - @sql_statement[:endnotes]=%{SELECT metadata_and_text.title, metadata_and_text.creator_author, metadata_and_text.src_filename, metadata_and_text.language_document_char, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata_and_text, endnotes WHERE #{@search_endnotes} AND metadata_and_text.tid = endnotes.metadata_tid ORDER BY metadata_and_text.language_document_char, metadata_and_text.title, metadata_and_text.src_filename, endnotes.nr} - @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} - select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] - select - end def sql_select_body_format %{<font color="#666666" size="2">#{sql_select_body}</font>} end - def sql_select_endnotes_format - %{<font color="#666666" size="2">#{sql_select_endnotes}</font>} - end def contents @conn.execute(sql_select_body) end - def endnotes - @conn.execute(sql_select_endnotes) - end end WOK_SQL end diff --git a/lib/sisu/v6/db_import.rb b/lib/sisu/v6/db_import.rb index 9473863d..5e159451 100644 --- a/lib/sisu/v6/db_import.rb +++ b/lib/sisu/v6/db_import.rb @@ -334,17 +334,17 @@ module SiSU_DbImport @en,@en_ast,@en_pls,@tuple_array=[],[],[],[] @col[:en_a],@col[:en_z]=nil,nil ao_array.each do |data| - data.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') - data.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1') - data.obj.gsub!(/#{Mx[:gl_o]}(●)#{Mx[:gl_c]}\s*/,'\1 ') - data.obj.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check + data.obj=data.obj.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_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_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1'). + gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1'). + gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1'). + gsub(/#{Mx[:gl_o]}(●)#{Mx[:gl_c]}\s*/,'\1 '). + gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check @col[:seg]=@@seg if data.of ==:para \ || data.of ==:heading \ @@ -374,7 +374,7 @@ module SiSU_DbImport @col[:lid]+=1 txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_minus - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) @@ -425,7 +425,7 @@ module SiSU_DbImport @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) @@ -470,7 +470,7 @@ module SiSU_DbImport @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) @@ -501,7 +501,7 @@ module SiSU_DbImport @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) @@ -532,7 +532,7 @@ module SiSU_DbImport @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_plus - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) @@ -603,7 +603,7 @@ module SiSU_DbImport else SiSU_FormatShared::CSS_Format.new(@md,data).norm end - @col[:body]=special_character_escape(body) + @col[:body]=clean_document_objects_body(body) plaintext=@col[:body].dup plaintext=strip_markup(plaintext) @col[:plaintext]=clean_searchable_text_from_document_objects(plaintext) diff --git a/lib/sisu/v6/db_sqltxt.rb b/lib/sisu/v6/db_sqltxt.rb index 7016c931..2375d5ca 100644 --- a/lib/sisu/v6/db_sqltxt.rb +++ b/lib/sisu/v6/db_sqltxt.rb @@ -60,13 +60,13 @@ module SiSU_DbText class Prepare def special_character_escape(str) - str=str.gsub(/'/,"''"). #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'") + str=str.gsub(/'/m,"''"). #string.gsub!(/'/,"\047") #string.gsub!(/'/,"\\'") gsub(/(\\)/m,'\1\1'). #ok but with warnings, double backslash on sqlite #str.gsub!(/[\\]/m,'\\x5C') #ok but with warnings, but not for sqlite #str.gsub!(/(\\)/m,'\1') #ok for sqlite not for pgsql - gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"<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') + gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/m,"<br>\n"). + gsub(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/m,''). #check + gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/m,'[image: \1] \2'). + gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/m,'\1\2'). + gsub(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/m,'\1') end def clean_searchable_text_from_document_objects(arr) txt_arr,en=[],[] @@ -80,13 +80,29 @@ module SiSU_DbText gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m,''). gsub(/ \s+/m,' ') #p s if s =~/[^ \nA-Za-z0-9'"`?!#@$%^&*=+,.;:\[\]()<>{}‹›|\\\/~_-]/ - s + txt_arr << s end - txt_arr << arr << en - #txt_arr=txt_arr.flatten + txt_arr=txt_arr << en txt=txt_arr.flatten.join("\n") - txt=special_character_escape(txt) - txt + special_character_escape(txt) + end + def clean_document_objects_body(arr) + txt_arr,en,en_arr=[],[],[] + arr=(arr.is_a?(String)) ? [ arr ] : arr + arr.each do |s| + en << s.scan(/#{Mx[:en_a_o]}\s*(.+?)\s*#{Mx[:en_a_c]}/m) + s=s.gsub(/#{Mx[:en_a_o]}\s*(\d+).+?#{Mx[:en_a_c]}/m,'<sup>\1</sup>'). + gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m,''). + gsub(/ \s+/m,' ') + txt_arr << s + end + en.flatten.each do |e| + e=e.sub(/^(\d+)\s*/,'<sup>\1</sup> ') + en_arr << e + end + txt_arr=txt_arr << en_arr + txt=txt_arr.flatten.join("\n<br>") + special_character_escape(txt) end def clean_searchable_text_from_document_source(arr) txt_arr,en=[],[] diff --git a/lib/sisu/v6/html_format.rb b/lib/sisu/v6/html_format.rb index f02a51e1..a84d079d 100644 --- a/lib/sisu/v6/html_format.rb +++ b/lib/sisu/v6/html_format.rb @@ -71,11 +71,8 @@ module SiSU_HTML_Format if @ocn.to_i==0 \ or @ocn.empty? '' - elsif @make.build.html_strict? - %{<label class="ocn">#{@ocn}</label>} else - %{<label class="ocn"><a name="#{@ocn}" class="lnkocn">#{@ocn}</a></label>} - #%{<label class="ocn" id="#{@ocn}">#{@ocn}</label>} + %{<label class="ocn">#{@ocn}</label>} end else '' diff --git a/lib/sisu/v6/html_segments.rb b/lib/sisu/v6/html_segments.rb index 907e79a5..060258d9 100644 --- a/lib/sisu/v6/html_segments.rb +++ b/lib/sisu/v6/html_segments.rb @@ -672,7 +672,7 @@ module SiSU_HTML_Seg @@seg_subtoc_array << subtoc end if @md.flag_auto_endnotes - if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="#{Mx[:note]}[\d*+]+"/) \ + if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+\s*<a href="##{Mx[:note_ref]}[\d*+]+"/) \ && dob.is !=:code # endnote- endnote_array=[] if dob.obj=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m @@ -689,7 +689,7 @@ module SiSU_HTML_Seg note_match=note.dup note_match_seg=note.dup e_n=note_match_seg[/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,1] - try=e_n.split(/<br \/>/) + try=e_n.split(/<br(?: \/)?>/) try.each do |e| txt_obj={ txt: e } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @@ -699,7 +699,7 @@ module SiSU_HTML_Seg end @@seg_endnotes_array << note_match end - try.join('<br \/>') + try.join('<br>') #% creation of separate end segment/page of all endnotes referenced back to reference segment m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(##{Mx[:note_ref]}[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi endnote_part_a=note_match_seg[m,1] diff --git a/lib/sisu/v6/html_tune.rb b/lib/sisu/v6/html_tune.rb index 48bce66e..09c771b6 100644 --- a/lib/sisu/v6/html_tune.rb +++ b/lib/sisu/v6/html_tune.rb @@ -263,14 +263,14 @@ module SiSU_HTML_Tune def endnotes_html(dob) unless dob.is ==:code 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="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2"> <sup>\\2</sup> </a> } + - %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2"> <sup>\\2.</sup></a> \\3 \\4}). + %{ <a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2"> <sup>\\2</sup> </note></a> } + + %{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2"> <sup>\\2.</sup></note></a> \\3 \\4}). gsub(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/, - %{ <a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2"> <sup>\\2</sup> </a> } + - %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2"> <sup>\\2.</sup></a> \\3 \\4}). + %{ <a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2"> <sup>\\2</sup> </note></a> } + + %{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2"> <sup>\\2.</sup></note></a> \\3 \\4}). gsub(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/, - %{ <a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2"> <sup>\\2</sup> </a> } + - %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2"> <sup>\\2</sup></a> \\3 \\4}) + %{ <a href="##{Mx[:note]}\\2"><note id="#{Mx[:note_ref]}\\2"> <sup>\\2</sup> </note></a> } + + %{\\1\\2 <a href="##{Mx[:note_ref]}\\2"><note id="#{Mx[:note]}\\2"> <sup>\\2</sup></note></a> \\3 \\4}) end dob end @@ -290,7 +290,7 @@ module SiSU_HTML_Tune 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 />') + gsub(/<(p|br) \/>/,'<\1>') dob=SiSU_HTML_Tune::CleanHTML.new(dob).clean dob end diff --git a/setup/sisu_version.rb b/setup/sisu_version.rb index 4e2e56ee..bc90bc71 100644 --- a/setup/sisu_version.rb +++ b/setup/sisu_version.rb @@ -1,7 +1,7 @@ #% constants module SiSUversion - SiSU_version_next_stable = '5.7.0' #% set version stable current - SiSU_version_next_unstable = '6.3.0' #% set version unstable dev + SiSU_version_next_stable = '5.7.1' #% set version stable current + SiSU_version_next_unstable = '6.3.1' #% set version unstable dev #% qi quick install file SiSU_version_generic_next_stable = '5.4.x' SiSU_version_generic_next_unstable = '6.0.x' |