aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/odf.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2011-03-10 08:43:44 -0500
committerRalph Amissah <ralph@amissah.com>2011-03-10 08:43:57 -0500
commit755acef8c7673081e9fb946d789d394afaee68ee (patch)
tree961e24d40e555b1ab5b0472f8e06029fd3a563eb /lib/sisu/v3/odf.rb
parentv2, v3: texpdf, url (regex) pattern match fix (diff)
v2, v3: dal_syntax + downstream output, email regex revised
* revised pattern match for email address, (removes occasional interference with urls having embedded email addresses) (dal_syntax and affected downstream output modules)
Diffstat (limited to 'lib/sisu/v3/odf.rb')
-rw-r--r--lib/sisu/v3/odf.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb
index 204f0e50..c14a6c91 100644
--- a/lib/sisu/v3/odf.rb
+++ b/lib/sisu/v3/odf.rb
@@ -294,10 +294,10 @@ module SiSU_ODF
def normal(dob,p_num='') #P1 - P3
dob.obj.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
+ dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}})
dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
%{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@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
%{<text:p text:style-name="P1#{dob.indent}">#{dob.obj}#{p_num}</text:p>}
else %{<text:p text:style-name="P1">#{dob.obj}#{p_num}</text:p>}
@@ -377,10 +377,10 @@ module SiSU_ODF
parray=[]
dob.obj.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
+ dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}})
dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
%{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@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!(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">')
@@ -400,10 +400,10 @@ module SiSU_ODF
parray=[]
dob.obj.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
+ dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
+ %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}})
dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
%{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration
- dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,
- %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@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!(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">')