aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/shared_xml.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/shared_xml.rb')
-rw-r--r--lib/sisu/v0/shared_xml.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb
index 9203f0df..228a5c14 100644
--- a/lib/sisu/v0/shared_xml.rb
+++ b/lib/sisu/v0/shared_xml.rb
@@ -166,6 +166,8 @@ module SiSU_XML_munge
#¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷
##para.gsub!(//, '&#;')
##para.gsub!(//, '&;')
+ para.gsub!(/</u, '&#60;') # '&lt;' # &#060;
+ para.gsub!(/>/u, '&#62;') # '&gt;' # &#062;
para.gsub!(/¢/u, '&#162;') # '&cent;' # &#162;
para.gsub!(/£/u, '&#163;') # '&pound;' # &#163;
para.gsub!(/¥/u, '&#165;') # '&yen;' # &#165;
@@ -250,10 +252,23 @@ module SiSU_XML_munge
para.gsub!(/ü/u, '&#253;') # '&uuml;' # &#253;
para.gsub!(/þ/u, '&#254;') # '&thorn;' # &#254;
para.gsub!(/ÿ/u, '&#255;') # '&yuml;' # &#255;
+ para.gsub!(/‘/u, '&#8216;') # '&lsquo;' # &#8216;
+ para.gsub!(/’/u, '&#8217;') # '&rsquo;' # &#8217;
+ para.gsub!(/–/u, '&#8211;') # &ndash; # &#8211;
+ para.gsub!(/—/u, '&#8212;') # &mdash; # &#8212;
+ para.gsub!(/∝/u, '&#8733;') # &prop; # &#8733;
+ para.gsub!(/∞/u, '&#8734;') # &infin; # &#8734;
+ para.gsub!(/™/u, '&#8482;') # &trade; # &#8482;
+ para.gsub!(/✠/u, '&#8224;') # &dagger; # &#8224; incorrect replacement! †
+ para.gsub!(/ /u, ' ') # space identify
+ para.gsub!(/ /u, ' ') # space identify
end
end
def html(para='')
if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn
+ para.gsub!(/ /u, ' ') # space identify
+ para.gsub!(/ /u, ' ') # space identify
+ else
para.gsub!(/¢/u, '&cent;') # &#162;
para.gsub!(/£/u, '&pound;') # &#163;
para.gsub!(/¥/u, '&yen;') # &#165;
@@ -338,6 +353,16 @@ module SiSU_XML_munge
para.gsub!(/ü/u, '&uuml;') # &#253;
para.gsub!(/þ/u, '&thorn;') # &#254;
para.gsub!(/ÿ/u, '&yuml;') # &#255;
+ para.gsub!(/‘/u, '&#lsquo;') # &lsquo; # &#8216;
+ para.gsub!(/’/u, '&#rsquo;') # &rsquo; # &#8217;
+ para.gsub!(/–/u, '&ndash;') # &ndash; # &#8211;
+ para.gsub!(/—/u, '&mdash;') # &mdash; # &#8212;
+ para.gsub!(/∝/u, '&prop;') # &prop; # &#8733;
+ para.gsub!(/∞/u, '&infin;') # &infin; # &#8734;
+ para.gsub!(/™/u, '&trade;') # &trade; # &#8482;
+ para.gsub!(/✠/u, '&dagger;') # &dagger; # &#8224; incorrect replacement †
+ para.gsub!(/ /u, ' ') # space identify
+ para.gsub!(/ /u, ' ') # space identify
end
end
self
@@ -381,6 +406,10 @@ module SiSU_XML_munge
%{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1" width="\\2" height="\\3" />[\\1] \\4})
para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?#{Mx[:lnk_c]}(https?:\/\/\S+)/,
%{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1"/>\\1})
+ para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/,
+ %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1" width="\\2" height="\\3" />[\\1] \\4})
+ para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?#{Mx[:lnk_c]}image/,
+ %{<image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:actuate="onLoad" xlink:show="embed" xlink:href="#{@dir.url.images_local}/\\1"/>\\1})
para.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/,
'\1<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="\3">\2</link>\4') #watch, compare html_tune
para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,