From fa30536190f5698b4da3d2e478e00778b94688b5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 1 Oct 2010 08:52:09 -0400 Subject: shared_metadata, odt fix breakage where angle brackets used in metadata headers; & a typo fix * odt protect against breakage from angle brackets in metadata headers (requested fix) --- lib/sisu/v2/shared_metadata.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/shared_metadata.rb b/lib/sisu/v2/shared_metadata.rb index cd46bd1d..69a92070 100644 --- a/lib/sisu/v2/shared_metadata.rb +++ b/lib/sisu/v2/shared_metadata.rb @@ -192,7 +192,7 @@ module Metadata end if defined? @md.notes.comment \ and @md.notes.comment=~/\S+/ - @tag,@inf,@class=tr.comments,@md.notes.comments,'ext' + @tag,@inf,@class=tr.comments,@md.notes.comment,'ext' meta << self.meta_para end if defined? @md.notes.prefix_a \ @@ -474,13 +474,19 @@ WOK def meta_para url_brace=SiSU_Viz::Skin.new.url_decoration if @inf.class==String - @inf.gsub!(/
/,'
') + @inf.gsub!(//,'>') + @inf.gsub!(/<br(?: \/)?>/,'
') @inf.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1') #http ftp matches escaped, no decoration @inf.gsub!(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, '\1\2') #special case \{ e.g. \}http://url - @inf.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration + if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/ + @inf.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, + %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration + else + @inf.gsub!(/(https?:\/\/\S+)/, + %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration + end @inf.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol end @@ -672,7 +678,7 @@ WOK end if defined? @md.notes.comment \ and @md.notes.comment=~/\S+/ - tag,inf=tr.comments,@md.notes.comments + tag,inf=tr.comments,@md.notes.comment meta << meta_para(tag,inf) end if defined? @md.notes.prefix_a \ -- cgit v1.2.3