diff options
author | Ralph Amissah <ralph@amissah.com> | 2010-10-01 08:52:09 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2010-10-01 08:52:16 -0400 |
commit | fa30536190f5698b4da3d2e478e00778b94688b5 (patch) | |
tree | 6e8dcb6f736f21f00d01e452ef7bc39dd3a19b63 /lib | |
parent | manifest, typo fix (diff) |
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)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v2/shared_metadata.rb | 16 |
1 files changed, 11 insertions, 5 deletions
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!(/<br>/,'<br />') + @inf.gsub!(/</,'<'); @inf.gsub!(/>/,'>') + @inf.gsub!(/<br(?: \/)?>/,'<br />') @inf.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration @inf.gsub!(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>') #special case \{ e.g. \}http://url - @inf.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{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}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration + else + @inf.gsub!(/(https?:\/\/\S+)/, + %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration + end @inf.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, %{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{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 \ |