From fdd1489c82a274615e46e3c67fc5707e3fb0465f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 9 Jul 2007 11:19:48 +0100 Subject: improved url matching, and texpdf tolerance and indentation levels set --- lib/sisu/v0/dal_syntax.rb | 8 +++++-- lib/sisu/v0/html_tune.rb | 18 ++++------------ lib/sisu/v0/odf.rb | 12 +++++++++-- lib/sisu/v0/plaintext.rb | 3 ++- lib/sisu/v0/shared_html_lite.rb | 17 +++------------ lib/sisu/v0/shared_xml.rb | 11 ++++++---- lib/sisu/v0/texinfo_format.rb | 7 ++++--- lib/sisu/v0/texpdf.rb | 1 + lib/sisu/v0/texpdf_format.rb | 46 ++++++++++++++++++++--------------------- 9 files changed, 59 insertions(+), 64 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index 42e911e5..a882a2c9 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -191,7 +191,7 @@ module Syntax # # #numbered (list) level 1 # _# #numbered (list) level 2 line=line.dup - unless line =~/^0~|<:codeline>|<:code-end>/ + if line !~/^0~|<:codeline>|<:code-end>/ #special characters: ~ { } < > - _ / also used : ^ ! # line_array=[] line.gsub!(/^%{1,4} .+/mi,'') #remove comments @@ -282,7 +282,9 @@ module Syntax if line =~/(<:(?:verse|group)>)/; line.gsub!(/(<:(?:verse|group)>)/i,"\\1\n") #cosmetic else line.gsub!(/(
)/i,"\\1\n") end - else + else #code blocks + line.gsub!(/(^|\s)(http:\/\/\S+)/,'\1_\2') #line.gsub!(/(^|\s)(http:\/\/\S+)/,"\\1\\\\\\2") #escape urls + line.gsub!(/(^|\s)<(http:\/\/\S+)>([\s,.]|$)/,'\1\2\3') #clean/unescape urls with decoration, re-apply decoration later line.gsub!(/<:codeline>/,"\n") end line @@ -337,3 +339,5 @@ module Syntax end end __END__ +NOTE: +downstream code blocks are not currently/yet honoured, e.g. stuff within angle brackets are removed diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 1fb282de..1d3461c3 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -196,6 +196,7 @@ module SiSU_Tune @sys=SiSU_Env::System_call.new @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern @env=SiSU_Env::Info_env.new(@md.fns) + @url_brace=SiSU_Viz::Skin.new.url_decoration #@utf8=SiSU_character_encode::UTF8 #.new end def songsheet @@ -324,20 +325,9 @@ module SiSU_Tune if (para =~/\b\S+\@\S+?\.\S+/ and para !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/) para.gsub!(/\b(\S+\@\S+?\.\S+)(\s)/,'<\1>\2') end - if (para !~/(\"\w+:\/\/\S+?\"|>\s*\w+:\/\/\w+?\S*<)/) #url markup http etc. - if para=~/\w+:\/\/\S+?\.\S+?[.,] / - para.gsub!(/(\w+:\/\/\S+?\.\S+?)([.,] )/,'<\1>\2') #full stops ! have been a bother - else - para.gsub!(/(\w+:\/\/\S+?\.\S+)/, '<\1>') - end - end - if (para =~/[ ^](?:https?|ftp):\/\/\S+/) #url markup http leftovers watch carefully may accept too much 2004w46 - if para=~/([ ^])((?:https?|ftp):\/\/\S+?)([\.,] )/ - para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+?)([\.,] )/,'\1<\2>\3') #full stops ! have been a bother - else - para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+)/,'\1<\2>') - end - end + para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') #http ftp matches escaped, no decoration + para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url + para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration if (para =~/..\/\S+/ and para !~/(\"..\/\S+?\"|>\s*..\/\S+<)/) para.gsub!(/(\.\.\/\S+)/,'\1') end diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index a5ed30a4..cff57888 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -295,8 +295,14 @@ module SiSU_ODF end def normal(para) #P1 - P3 para.gsub!(@serial,'') - para.gsub!(/(^|\s)(https?:\/\/[^'">< ]+?)([\.,]?(?: |$))/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) - para.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,%{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}}) + para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/, + %{\\1\\2\\3}) #http ftp matches escaped, no decoration + para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/, + %{\\1\\2\\3}) #special case \{ e.g. \}http://url + para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/, + %{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration + para.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, + %{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}}) para=case para when /^<:i([1-9])>\s/m m=$1 @@ -369,6 +375,8 @@ module SiSU_ODF parray=[] para.split(/<:?br(?: \/)?>/).each do |parablock| parablock=group_clean(parablock) + parablock.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/, + %{\\1\\2\\3}) #http ftp matches escaped, no decoration parray << %{#{parablock}} if parablock =~/\S+/ end para=parray.join + '' diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 4bff976a..f08a0871 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -327,7 +327,8 @@ WOK end para.gsub!(/<:p[bn]>/,'') # remove page breaks para.gsub!(/^\s*<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'') # remove empty lines - check - para.gsub!(/(^|\s)(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") + para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") + para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') para.gsub!(/(.+?)<\/a>/m,'\1') para.gsub!(/<:name#\S+?>/,'') # remove name links para.gsub!(/ /,' ') # decide on diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index ed622fb8..5285b6db 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -120,20 +120,9 @@ module SiSU_Format_Shared words=word_mode.join(' ') para.gsub!(/.+/,words) end - if (para !~/(\"\w+:\/\/\S+?\"|>\s*\w+:\/\/\w+?\S*<)/) #url markup http etc. - if para=~/\w+:\/\/\S+?\.\S+?[.,] / - para.gsub!(/(\w+:\/\/\S+?\.\S+?)([.,] )/,%{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}\\2}) #full stops ! have been a bother - else - para.gsub!(/(\w+:\/\/\S+?\.\S+)/,%{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}}) - end - end - if (para =~/[ ^](?:https?|ftp):\/\/\S+/) #url markup http leftovers watch carefully may accept too much 2004w46 - if para=~/([ ^])((?:https?|ftp):\/\/\S+?)([\.,] )/ - para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+?)([\.,] )/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) #full stops ! have been a bother - else - para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+)/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}}) - end - end + para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') #http ftp matches escaped, no decoration + para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url + para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration para end def paragraph diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index bcdf44f5..995044db 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -347,8 +347,7 @@ module SiSU_XML_munge def markup(para='') wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip - para.gsub!(/(^|\s+)<\s+/,'\1< ') - para.gsub!(/\s+>(\s+|$)/,' >\1') + para.gsub!(/(^|\s+)<\s+/,'\1< '); para.gsub!(/\s+>(\s+|$)/,' >\1') para.gsub!(/<:pb>\s*/,'') para.gsub!(/<+[-~]#>+/,'') para.gsub!(/<0;\w\d+;[um]\d+><#@dp:#@dp>/,'') @@ -357,8 +356,12 @@ module SiSU_XML_munge #para.gsub!(/^_\*\s+/,'* ') para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1[\\2] \\5}) para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1\\2}) - para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/,'\1\2\4') - para.gsub!(/(^|\s)(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) + para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/, + '\1\2\4') #watch, compare html_tune + para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/, + %{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) + para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') #escaped urls not linked, deal with later + #para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') #escaped urls not linked, deal with later para.gsub!(/ /,' ') #clean para end diff --git a/lib/sisu/v0/texinfo_format.rb b/lib/sisu/v0/texinfo_format.rb index 3184ee80..e4803d87 100644 --- a/lib/sisu/v0/texinfo_format.rb +++ b/lib/sisu/v0/texinfo_format.rb @@ -327,9 +327,10 @@ WOK @para.gsub!(/(\$)/,"\\$") @para.gsub!(/\~/,'\\~') @para.gsub!(/%/,"\\%") - if @para !~ /^\s*<:image|\}:image\s/ - @para.gsub!(/_/,'\_') - end + #if @para !~ /^\s*<:image|\}:image\s/ + # @para.gsub!(/_/,'\_') + #end + @para.gsub!(/_(http:\/\/)/,'\1') @para.gsub!(/§/i,'\S') @para.gsub!(/£/i,'\pounds') @para.gsub!(/å/i,'\aa') diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index 5eaf7311..6ac87240 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -358,6 +358,7 @@ module SiSU_TeX end @tex_file <<</,' ') @string.gsub!(/<\/a>/,' ') - if @string !~/^\s*<:image|\}image/ #watch carefully could introduce breaks ! removed \}http changed 0.1.1-4 200501 - if @string =~/(?:https?|ftp):\/\/\S+?<\/\S>/ #problems where have font attribute eg (change substitution sequence?) # [^\}>] added for escaped curly brace <=curlyclose> watch - @string.gsub!(/[^\}>]((?:https?|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{ \1 } \end{scriptsize}\2') - else # regular urls !! http:// href - if @string=~/(?:https?|ftp):\/\/\S+?[,.]? / - @string.gsub!(/(?:^|[^\}>])((?:https?|ftp):\/\/\S+?)([,.])? /," #{@url_brace.tex_open}\\begin{scriptsize}\\href{\\1}{ \\1}\\end{scriptsize}#{@url_brace.tex_close}\\2 ") #tamper - else @string.gsub!(/(?:^|[^\}>])((?:https?|ftp):\/\/\S+)/,' \begin{scriptsize}\href{ \1 }{\1} \end{scriptsize}') #should not be necessary, not checked - end - end - else #@string =~/\\~\\\{.+?\\\}\\~/ # \\~\\{1 - #@string.gsub!(/(?:\n)?(http:\/\/\S+)/," \\begin{scriptsize}\\href{\\1}{\\1} \\end{scriptsize}") #bug... - end + @string.gsub!(/[^\}>_]((?:https?|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case + @string.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url + @string.gsub!(/(^|\s)(?:\\_|\\)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #specially escaped url no decoration + @string.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration @string.gsub!(/<:ee>/,'') @string.gsub!(//,' ') #proposed change, insert, but may be redundant @@ -704,10 +696,20 @@ WOK #end BUGWATCH end def indent(lev) - @string.gsub!(/<:i#{lev}>(.*)/m, - "\\begin{ParagraphIndent}{0.0#{lev}\\columnwidth} \\1 -\\end{ParagraphIndent} -") + indent=case lev + when /1/; '0mm' + when /2/; '10mm' + when /3/; '20mm' + when /4/; '30mm' + when /5/; '40mm' + when /6/; '50mm' + when /7/; '60mm' + when /8/; '70mm' + when /9/; '80mm' + end + @string.gsub!(/<:i#{lev}>\s*(.*)/m, + "\\begin{ParagraphIndent}{#{indent}}\\1 +\\end{ParagraphIndent}}") end def symbol_graphic dir=SiSU_Env::Info_env.new(@md.fns) @@ -1192,21 +1194,17 @@ WOK def a4generic end def para_num - paranumber_display=if @md.mod.inspect =~/--no-ocn/; '' #!ocn no object citation numbering + paranumber_display=if @md.mod.inspect =~/--no-ocn/; '' #!ocn no object citation numbering else "\\begin{tiny}~\\end{tiny}{\\marginpar{\\begin{tiny}#@string1\\end{tiny}}}" #ocn object citation numbering end if @string !~/^([1-6a-z-]#{@@tilde}\S*|<:.+?>|#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6})/ @string.gsub!(/^\s*(.+)/m,"#{paranumber_display}\\1\n") #watch - in 1-6 is suspect else if (@string =~/^(?:[1-6a-z-]#{@@tilde}\S*|<:.+?>)/) #watch - in 1-6 is suspect - @string.gsub!(/^([1-6a-z-]#{@@tilde}\S*|<:.+?>)\s*(.+)/m,"\\1 #{paranumber_display} \\2\n") #watch - in 1-6 is suspect + @string.gsub!(/^([1-6a-z-]#{@@tilde}\S*)\s*(.+)/m,"\\1 #{paranumber_display} \\2\n") #watch - in 1-6 is suspect + @string.gsub!(/^(<:.+?>)\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") else - @string.gsub!(/(#{@md.lv1}.+)$/,"#{@md.lv1} #{paranumber_display}\\1\n") - @string.gsub!(/(#{@md.lv2}.+)$/,"#{@md.lv2} #{paranumber_display}\\1\n") - @string.gsub!(/(#{@md.lv3}.+)$/,"#{@md.lv3} #{paranumber_display}\\1\n") - @string.gsub!(/(#{@md.lv4}.+)$/,"#{@md.lv4} #{paranumber_display}\\1\n") - @string.gsub!(/(#{@md.lv5}.+)$/,"#{@md.lv5} #{paranumber_display}\\1\n") - @string.gsub!(/(#{@md.lv6}.+)$/,"#{@md.lv6} #{paranumber_display}\\1\n") + @string.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display}\\1\n") end end @string -- cgit v1.2.3 From 22fab950e51ba9fc551bea840925b3020ec381bc Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 10 Jul 2007 15:35:44 +0100 Subject: cgi search form worked on and presentation, (an info button added and used) * cgi, generated sample search form, rearranged presentation * editor syntax highlighting, kate, kwrite visited --- lib/sisu/v0/cgi_pgsql.rb | 5 +- lib/sisu/v0/cgi_sql_common.rb | 166 ++++++++++++++++++------------------------ lib/sisu/v0/cgi_sqlite.rb | 2 +- lib/sisu/v0/defaults.rb | 5 +- lib/sisu/v0/help.rb | 2 +- lib/sisu/v0/sysenv.rb | 4 - lib/sisu/v0/xml_scaffold.rb | 2 +- 7 files changed, 79 insertions(+), 107 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/cgi_pgsql.rb b/lib/sisu/v0/cgi_pgsql.rb index 0032a927..9a577337 100644 --- a/lib/sisu/v0/cgi_pgsql.rb +++ b/lib/sisu/v0/cgi_pgsql.rb @@ -92,7 +92,7 @@ module SiSU_CGI_pgsql f2 << " end\n" if FileTest.writable?('.') output=File.open('sisu_pgsql.cgi','w') - output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << buttons2_pgsql << buttons3 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2 + output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons1_pgsql << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << dbi_connect << @common.main2 a=%{ generated sisu_pgsql.cgi, BASED ON ALREADY EXISTING directories that could potentially be used to populate postgresql db, (-D) } @@ -213,9 +213,8 @@ module SiSU_CGI_pgsql end WOK_SQL end - def buttons2_pgsql + def buttons1_pgsql <<-'WOK_SQL' - case sensitive WOK_SQL end diff --git a/lib/sisu/v0/cgi_sql_common.rb b/lib/sisu/v0/cgi_sql_common.rb index 37ca67b8..fbb627db 100644 --- a/lib/sisu/v0/cgi_sql_common.rb +++ b/lib/sisu/v0/cgi_sql_common.rb @@ -131,13 +131,13 @@ module SiSU_CGI_sql @color_heading='#DDFFAA' @color_match='#ffff48' class Form - def initialize(base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can='') + def initialize(base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can='') search_note='' if checked_searched !~/\S/ the_can='' if checked_url !~/\S/ search_field='' if checked_echo !~/\S/ - @base,@search_field,@selected_db,@checked_index,@checked_text,@checked_tip,@checked_searched,@checked_url,@checked_case,@checked_echo,@checked_sql,@checked_all,@checked_none,@checked_ignore,@search_note,@the_can=base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can + @base,@search_field,@selected_db,@checked_index,@checked_text,@checked_tip,@checked_stats,@checked_searched,@checked_url,@checked_case,@checked_echo,@checked_sql,@checked_all,@checked_none,@checked_selected,@checked_default,@search_note,@the_can=base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can @tip=if checked_tip =~/\S/ - 'text:__; keywords:__; title:__; author:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;' + 'text:__; keywords:__; title:__; author:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;
' else '' end end @@ -171,62 +171,53 @@ module SiSU_CGI_sql end def header2 <<-'WOK_SQL' - -
-
- - - - select which database to search - -
- - - index - text / grep - -
+
- -
- WOK_SQL - end - def buttons2 - <<-'WOK_SQL' +
#@tip #@search_note #@the_can
-
+
+ + + + 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) +
+ + + index + text / grep WOK_SQL end - def buttons3 + def buttons2 <<-'WOK_SQL' -
- echo previous search - search result stats - url for search - available search fields - sql statement -
- checks: - selected - all - none -
- +
+ echo query + result stats + search url + searched + available fields + sql statement +
+ checks: + default + selected + all + none +
- + WOK end end @@ -601,23 +592,34 @@ module SiSU_CGI_sql @stub='sisu' 'SiSU_sisu' end - checked_url,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,selected_db='','','','','','','','','' + checked_url,checked_stats,checked_searched,checked_tip,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,selected_db='','','','','','','','','' if cgi['view']=~/text/; checked_index,checked_text='','checked' else checked_index,checked_text='checked','' end + checked_echo='checked' if cgi['echo'] =~/\S/ + checked_stats='checked' if cgi['stats'] =~/\S/ checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1 checked_searched='checked' if cgi['searched'] =~/\S/ checked_tip='checked' if cgi['tip'] =~/\S/ checked_case='checked' if cgi['casesense'] =~/\S/ - checked_echo='checked' if cgi['echo'] =~/\S/ checked_sql='checked' if cgi['sql'] =~/\S/ if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1 - checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='checked' + checked_all='checked' + checked_echo=checked_stats=checked_url=checked_searched=checked_tip=checked_sql='checked' checked_none='' - elsif cgi['checks'] =~/check_none/ #or cgi['a'].to_i==0 + elsif cgi['checks'] =~/check_none/ checked_none='checked' - checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='' - else checked_ignore='checked' + checked_all=checked_url=checked_stats=checked_searched=checked_tip=checked_echo=checked_sql='' + elsif cgi['checks'] =~/check_selected/ + checked_selected='checked' + elsif cgi['checks'] =~/check_default/ + checked_default='checked' + checked_echo=checked_stats=checked_url='checked' + checked_searched=checked_tip=checked_case=checked_sql='' + else + checked_selected='checked' + checked_echo=checked_stats=checked_url='checked' + checked_searched=checked_tip=checked_case=checked_sql='' end WOK_SQL end @@ -654,7 +656,7 @@ module SiSU_CGI_sql fns='&fns=' + CGI.escape(@search_for.filename) if @search_for.filename=~/\S/ @@canned_search_url=if checked_all =~/checked/ "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" - else "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&u=1&e=1" + else "#@base?#{s1}#{key}#{ti}#{au}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}" end if checked_case=~/\S/ @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1 @@ -663,7 +665,7 @@ module SiSU_CGI_sql @search[:text][1]=%{documents.clean~*'#{@search_for.text1}'} #s1 @search[:endnotes][1]=%{endnotes.clean~*'#{@search_for.text1}'} #s1 end - canned_note='previous search url:' + canned_note='search url:' else @@canned_search_url="#@base?s1=United+Nations&db=documents&view=index" canned_note='search url example:' @@ -684,7 +686,7 @@ 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_keywords=p_title=p_author=p_subject=p_description=p_publisher=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_subject=p_filename='' p_text=%{text: #{green}#{@search_for.text1}

} if @search_for.text1 =~/\S+/ p_keywords=%{keywords: #{green}#{@search_for.keywords}

} if @search_for.keywords =~/\S+/ @@ -708,15 +710,14 @@ module SiSU_CGI_sql p_filename=%{filename: #{green}#{@search_for.filename}
} if @search_for.filename =~/\S+/ search_note=<<-WOK -
previous selection:
- database: #{green}#@db
; selected view: #{green}#{cgi['view']}
- search string: "#{green}#{analyze_format}"
+ database: #{green}#@db; selected view: #{green}#{cgi['view']} + search string: "#{green}#{analyze_format}"
#{p_text} #{p_keywords} #{p_title} #{p_author} #{p_subject} #{p_description} #{p_publisher} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename} WOK #eg = %{canned search e.g.:
#{url}
find: #{analyze}
database: #{database}} #dbi_canning - @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_ignore,search_note,the_can).submission_form #% form + @header=Form.new(@base,search_field,selected_db,checked_index,checked_text,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can).submission_form #% form unless q['s1'] =~/\S/ or q['au'] =~/\S/ or @search[:text][1] =~/\S/ print "Content-type: text/html\n\n" puts (@header+@tail) @@ -763,7 +764,7 @@ module SiSU_CGI_sql end #metadata_found_body if c['tid'].to_i != oldtid.to_i - title=%{#{c['title']} by #{c['creator']} pdf portraitpdf landscape manifest ?
} if file_suffix=~/s/ #hmm watch file_suffix + title=%{#{c['title']} by #{c['creator']} pdf portraitpdf landscape manifest
} if file_suffix=~/s/ #hmm watch file_suffix if @text_search_flag; title='

'+title else title='
'+title end @@ -796,7 +797,7 @@ module SiSU_CGI_sql end matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) matched=if c['body'] =~/\\1})) + else (c['body'].gsub(/(#@search_regx)/i,%{\\1})) end matched else c['body'] @@ -830,7 +831,10 @@ module SiSU_CGI_sql else output=title end @counters_txt=if @counter_txt_doc > 0 - %{Found in the main body of #@counter_txt_doc documents, and at #@counter_txt_ocn locations within.
} + if checked_stats =~/\S/ + %{
Found in the main body of #@counter_txt_doc documents, and at #@counter_txt_ocn locations within.
} + else '' + end else '' end @body_main << output #+ details @@ -849,7 +853,7 @@ module SiSU_CGI_sql #metadata_found_endnotes if @text_search_flag if e['metadata_tid'].to_i != oldtid.to_i - title=%{

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

#{e['title']} by #{e['creator']} pdf portraitpdf landscape manifest
} if file_suffix=~/s/ @counter_endn_doc+=1 oldtid=e['metadata_tid'].to_i else title = '' @@ -858,7 +862,7 @@ module SiSU_CGI_sql @counter_endn_ocn+=1 matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) matched=if e['body'] =~/\\1}) + else e['body'].gsub(/(#@search_regx)/i,%{\\1}) #e['body'] end matched @@ -870,7 +874,10 @@ module SiSU_CGI_sql output=%{#{title}#{e['nr']}#{e['ocn']}], } end @counters_endn=if @counter_endn_doc > 0 - %{Found in the endnotes of #@counter_endn_doc documents, and at #@counter_endn_ocn locations within.
} + if checked_stats =~/\S/ + %{Found in the endnotes of #@counter_endn_doc documents, and at #@counter_endn_ocn locations within.
} + else '' + end end @endnotes << output #+ details else @endnotes=[] #does not take out yet @@ -896,32 +903,3 @@ module SiSU_CGI_sql end end __END__ -#@counter_txt_ocn -#@counter_endn_ocn - - - if cgi['checks'] =~/check_all/ or cgi['check_all'] =~/\S/ or cgi['a'].to_i==1 - checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='checked' - checked_none='' - #elsif cgi['checks'] =~/check_fixed/ or cgi['check_fixed'] =~/\S/ - # #checked_ignore='checked' - # checked_fixed='checked' - # checked_url='checked' - # checked_searched='checked' - # checked_echo='checked' - # #checked_tip='checked' - # #checked_sql='checked' - # checked_tip=checked_sql=checked_none='' - #elsif cgi['checks'] =~/check_ignore/ or cgi['check_ignore'] =~/\S/ - # checked_ignore='checked' - # checked_url='checked' if cgi['url'] =~/\S/ or cgi['u'].to_i==1 - # checked_searched='checked' if cgi['searched'] =~/\S/ - # checked_tip='checked' if cgi['tip'] =~/\S/ - # checked_echo='checked' if cgi['echo'] =~/\S/ - # checked_sql='checked' if cgi['sql'] =~/\S/ - # checked_none='' - elsif cgi['checks'] =~/check_none/ or cgi['a'].to_i==0 - checked_none='checked' - checked_all=checked_url=checked_searched=checked_tip=checked_echo=checked_sql='' - else checked_ignore='checked' - end diff --git a/lib/sisu/v0/cgi_sqlite.rb b/lib/sisu/v0/cgi_sqlite.rb index 4565ebe2..56b1e588 100644 --- a/lib/sisu/v0/cgi_sqlite.rb +++ b/lib/sisu/v0/cgi_sqlite.rb @@ -92,7 +92,7 @@ module SiSU_CGI_sqlite f3 << " end\n" if FileTest.writable?('.') output=File.open('sisu_sqlite.cgi','w') - output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << buttons3 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << f3 << dbi_connect << @common.main2 + output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << f3 << dbi_connect << @common.main2 a=%{ generated sisu_sqlite.cgi, BASED ON ALREADY CREATED sisu_sqlite.db OUTPUT, (-d) } diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 66333528..694b2e83 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -377,7 +377,7 @@ module SiSU_Viz 'sisu.png' end def icon_manifest - 'bullet_red.png' + 'b_info.png' end def icon_doc 'b_doc.png' @@ -911,7 +911,7 @@ module SiSU_Viz end def nav_txt_manifest %{ - #{png_manifest}  ?  + #{png_manifest}  } end def nav_txt_concordance @@ -1528,7 +1528,6 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), LaTeX, PDF, SQ
- idx txt diff --git a/lib/sisu/v0/help.rb b/lib/sisu/v0/help.rb index 9c10c27e..768a52cf 100644 --- a/lib/sisu/v0/help.rb +++ b/lib/sisu/v0/help.rb @@ -1053,7 +1053,7 @@ WOK latex to pdf: #{program_found?(@env.program.pdflatex)} postgresql: #{program_found?(@env.program.postgresql)} sqlite: #{program_found?(@env.program.sqlite)} - (these can be turned off if unavailable in sisurc.yaml under program_set:) + (these can be turned off if unavailable in sisurc.yml under program_set:) #{@cX.green}processing shortcut defaults set to:#{@cX.off} color defaut set (on==true) #{@cX.blue}#{cf_defaults.color}#{@cX.off} sisu -0 #{@cX.blue}#{cf_defaults.cf_0}#{@cX.off} [default] diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index c2d694f2..ddd84aaa 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -881,7 +881,6 @@ module SiSU_Env
- idx @@ -917,7 +916,6 @@ module SiSU_Env
- idx @@ -995,7 +993,6 @@ module SiSU_Env
- idx txt @@ -1011,7 +1008,6 @@ module SiSU_Env
- idx txt diff --git a/lib/sisu/v0/xml_scaffold.rb b/lib/sisu/v0/xml_scaffold.rb index 93987840..21ce1231 100644 --- a/lib/sisu/v0/xml_scaffold.rb +++ b/lib/sisu/v0/xml_scaffold.rb @@ -68,7 +68,7 @@ module SiSU_XML_scaffold def read begin @md=SiSU_Param::Parameters.new(@opt).get - @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here + @dal_array=SiSU_DAL::Source.new(@opt).get SiSU_XML_scaffold::Source::Scroll.new(@dal_array,@md).songsheet rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure -- cgit v1.2.3