From 4aff107c62488189004fdca535d4720d2e97b931 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 26 May 2010 17:39:12 -0400 Subject: epub & odf, regex matches for http: to include https: --- lib/sisu/v2/epub_tune.rb | 2 +- lib/sisu/v2/odf.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/epub_tune.rb b/lib/sisu/v2/epub_tune.rb index 9115a14d..035a453b 100644 --- a/lib/sisu/v2/epub_tune.rb +++ b/lib/sisu/v2/epub_tune.rb @@ -297,7 +297,7 @@ module SiSU_EPUB_Tune u.gsub!(/^:/,"#{@env.url.root}/") elsif u =~/^\.\.\// u.gsub!(/^\.\.\//,"#{@env.url.root}/") - elsif u =~/http:\/\// + elsif u =~/https?:\/\// else p "NOT FOUND name_tags: #{u}" end ins=%{#{link}} diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb index 24f45f50..a7c77639 100644 --- a/lib/sisu/v2/odf.rb +++ b/lib/sisu/v2/odf.rb @@ -238,7 +238,7 @@ module SiSU_ODF url.gsub!(/(\\\+)/,'+') #this is convoluted, and risky :-( map_nametags=SiSU_Particulars::Combined_singleton.instance.get_map_nametags(@md).nametags_map t=case url - when /^http:/ + when /^https?:/ %{#{txt.strip}#{trail}} when /^:/ # site same document collection html link url.gsub!(/^:/,"#{@env.url.root}/") @@ -294,7 +294,7 @@ module SiSU_ODF dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) if dob.obj !~/http:\/\// # improve upon, document crash where url contains '@' symbol + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) if dob.obj !~/https?:\/\// # improve upon, document crash where url contains '@' symbol dob.obj= if dob.is=='para' and dob.indent.to_s =~/[0-9]/ # and t_o.bullet_==true %{#{dob.obj}} else %{#{dob.obj}} @@ -369,7 +369,7 @@ module SiSU_ODF dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) if dob.obj !~/http:\/\// # improve upon, document crash where url contains '@' symbol + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) if dob.obj !~/https?:\/\// # improve upon, document crash where url contains '@' symbol dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock| parablock=group_clean(parablock) parablock.gsub!(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,'') -- cgit v1.2.3 From 2f5a240e08899f6f800244a15ed599005424eae8 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 26 May 2010 17:42:36 -0400 Subject: texpdf_format, https: url match with tilde, fix --- lib/sisu/v2/texpdf_format.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index 68190407..32ac7aa5 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -72,7 +72,7 @@ module SiSU_TeX_Pdf end def bare_urls_in_code @dob.tmp.gsub!(/(^|[^\\])_/m,'\1\_') #watch may not work - @dob.tmp.gsub!(/(http:\/\/\S+?)([{]|[.,;)\]]?(?: |$))/m, + @dob.tmp.gsub!(/(https?:\/\/\S+?)([{]|[.,;)\]]?(?: |$))/m, '\begin{scriptsize}\url{\1}\end{scriptsize}\2') @dob end @@ -1060,18 +1060,18 @@ WOK str.gsub!(/<=lt>/m,'{\UseTextSymbol{OML}{<}}') str.gsub!(/<=gt>/m,'{\UseTextSymbol{OML}{>}}') str.gsub!(/<=underscore>/,'\_') - while str =~/(http:\/\/\S+?)(?:<=tilde>\S+)+/ #tilde in urls \href treated differently from text #FIX - str.gsub!(/(http:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2') + while str =~/(https?:\/\/\S+?)(?:<=tilde>\S+)+/ #tilde in urls \href treated differently from text #FIX + str.gsub!(/(https?:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2') end str.gsub!(/<=tilde>/,'{$\tilde$}') str.gsub!(/<=pipe>/,'{\textbar}') str.gsub!(/<=caret>/,'{\^{~}}') str.gsub!(/<=exclaim>/,'\Verbatim{!}') - str.gsub!(/(http:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2') #hash in urls \href treated differently from text #FIX + str.gsub!(/(https?:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2') #hash in urls \href treated differently from text #FIX str.gsub!(/<=hash>/,'{\#}') str.gsub!(/<=hardspace>/,'{~}') #changed ... 2005 - while str =~/(http:\/\/\S+?)(?:<=amp>\S+)+/ #amp in urls \href treated differently from text #FIX - str.gsub!(/(http:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2') + while str =~/(https?:\/\/\S+?)(?:<=amp>\S+)+/ #amp in urls \href treated differently from text #FIX + str.gsub!(/(https?:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2') end str.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005 str.gsub!(/<=slash>/,'{/}') -- cgit v1.2.3 From 1084e67511a39928d8f9c7a0af6ae36bcdb08b80 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 26 May 2010 19:12:44 -0400 Subject: dal syntax, doc_str, http: matches to include https: also dal_syntax fix, no auto-bold or italics on relative or internal links --- lib/sisu/v2/dal_doc_str.rb | 2 +- lib/sisu/v2/dal_syntax.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/dal_doc_str.rb b/lib/sisu/v2/dal_doc_str.rb index e35baf5a..1dc6076e 100644 --- a/lib/sisu/v2/dal_doc_str.rb +++ b/lib/sisu/v2/dal_doc_str.rb @@ -87,7 +87,7 @@ module SiSU_document_structure_extract end end def image_test(str) - boolean=(str=~/\{\s*\S+?\.png.+?\}http:\/\/\S+/ ? true : false) + boolean=(str=~/\{\s*\S+?\.png.+?\}https?:\/\/\S+/ ? true : false) end def bullet_test(str) bool=((str=~/\*/) ? true : false) diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb index 07186d67..0b7c6541 100644 --- a/lib/sisu/v2/dal_syntax.rb +++ b/lib/sisu/v2/dal_syntax.rb @@ -87,7 +87,7 @@ module SiSU_Syntax {:o =>Mx[:fa_underscore_o], :c =>Mx[:fa_underscore_c] } else p __LINE__.to_s + '::' + __FILE__ end - @http_m=%r{\{.+?\}https?://\S+|https?:\S+|\.\.\/\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}} + @http_m=%r{\{.+?\}https?://\S+|https?:\S+|:\S+|\.\.\/\S+|#\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}} @manmkp_ital=emph_italics \ ? '[i/*]\\{.+?\\}[i/*]' \ : '[i/]\\{.+?\\}[i/]' @@ -166,9 +166,9 @@ module SiSU_Syntax dob end def embolden(given) - given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})http:\/\/\S+.*?)(
|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, + given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*?)(
|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}\\2") - given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})http:\/\/\S+.*)/, + given.gsub!(/^!_\s+((?:\{|#{Mx[:lnk_o]})(?:~^ )?.+?(?:\}|#{Mx[:lnk_o]})https?:\/\/\S+.*)/, "#{Mx[:fa_bold_o]} \\1 #{Mx[:fa_bold_c]}") given.gsub!(/(?:^!_|^#{Mx[:lv_o]}[7-9]:\S*?#{Mx[:lv_c]})\s*(.+?)(
|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}])/, "#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") @@ -267,7 +267,7 @@ module SiSU_Syntax word=dob.obj.scan(/\S+|\n/) #unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit if word word.each do |w| # _ - / # | : ! ^ ~ - unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|http:\/\/\S+/ # do something earlier about table!! + unless w =~/~\{|\}~|~\[|\]~|^\^~|~\^|\*~\S+|~#|\{t?~|\{table|https?:\/\/\S+/ # do something earlier about table!! w.gsub!(/\\?~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character end w.gsub!(/^\<$/,"#{Mx[:gl_o]}#lt#{Mx[:gl_c]}") #escaped special character -- cgit v1.2.3 From 752cfd30e986d8a77bfcef51ee4a15ba3c044059 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 26 May 2010 19:16:02 -0400 Subject: general extension of regex matches for http: to include https: --- lib/sisu/v2/composite.rb | 2 +- lib/sisu/v2/html_format.rb | 4 ++-- lib/sisu/v2/html_promo.rb | 10 +++++----- lib/sisu/v2/param.rb | 2 +- lib/sisu/v2/remote.rb | 4 ++-- lib/sisu/v2/shared_html_lite.rb | 2 +- lib/sisu/v2/sisupod_make.rb | 2 +- lib/sisu/v2/texpdf.rb | 2 +- lib/sisu/v2/xml_format.rb | 4 ++-- 9 files changed, 16 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/composite.rb b/lib/sisu/v2/composite.rb index 44518957..4ff53498 100644 --- a/lib/sisu/v2/composite.rb +++ b/lib/sisu/v2/composite.rb @@ -179,7 +179,7 @@ module SiSU_Assemble if file[:images].length > 0 file[:images].flatten! file[:images].uniq! - file[:images].delete_if {|x| x =~/http:\/\// } + file[:images].delete_if {|x| x =~/https?:\/\// } end file end diff --git a/lib/sisu/v2/html_format.rb b/lib/sisu/v2/html_format.rb index 00706192..b3712690 100644 --- a/lib/sisu/v2/html_format.rb +++ b/lib/sisu/v2/html_format.rb @@ -408,7 +408,7 @@ WOK end end def links_guide_vertical_open #??? - url=((defined? @vz.url_hp) && @vz.url_hp =~/^http:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) + url=((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/ ? @vz.url_hp : @vz.url_home) %{