aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/xml_shared.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/xml_shared.rb')
-rw-r--r--lib/sisu/v5/xml_shared.rb107
1 files changed, 6 insertions, 101 deletions
diff --git a/lib/sisu/v5/xml_shared.rb b/lib/sisu/v5/xml_shared.rb
index bd0e383b..d059cd7b 100644
--- a/lib/sisu/v5/xml_shared.rb
+++ b/lib/sisu/v5/xml_shared.rb
@@ -232,104 +232,6 @@ module SiSU_XML_Munge
if @sys.locale =~/utf-?8/i # instead ucs for utf8 # String#encode Iñtërnâtiônàlizætiøn
dob.obj=dob.obj.gsub(/ /u,' '). # space identify
gsub(/ /u,' ') # space identify
- else
- dob.obj=dob.obj.gsub(/¢/u,'¢'). # ¢
- gsub(/£/u,'£'). # £
- gsub(/¥/u,'¥'). # ¥
- gsub(/§/u,'§'). # §
- gsub(/©/u,'©'). # ©
- gsub(/ª/u,'ª'). # ª
- gsub(/«/u,'«'). # «
- gsub(/®/u,'®'). # ®
- gsub(/°/u,'°'). # °
- gsub(/±/u,'±'). # ±
- gsub(/²/u,'²'). # ²
- gsub(/³/u,'³'). # ³
- gsub(/µ/u,'µ'). # µ
- gsub(/¶/u,'¶'). # ¶
- gsub(/¹/u,'¹'). # ¹
- gsub(/º/u,'º'). # º
- gsub(/»/u,'»'). # »
- gsub(/¼/u,'¼'). # ¼
- gsub(/½/u,'½'). # ½
- gsub(/¾/u,'¾'). # ¾
- gsub(/×/u,'×'). # ×
- gsub(/÷/u,'÷'). # ÷
- gsub(/¿/u,'¿'). # ¿
- gsub(/À/u,'À'). # À
- gsub(/Á/u,'Á'). # Á
- gsub(/Â/u,'Â'). # Â
- gsub(/Ã/u,'Ã'). # Ã
- gsub(/Ä/u,'Ä'). # Ä
- gsub(/Å/u,'Å'). # Å
- gsub(/Æ/u,'Æ'). # Æ
- gsub(/Ç/u,'Ç'). # Ç
- gsub(/È/u,'È'). # È
- gsub(/É/u,'É'). # É
- gsub(/Ê/u,'Ê'). # Ê
- gsub(/Ë/u,'Ë'). # Ë
- gsub(/Ì/u,'Ì'). # Ì
- gsub(/Í/u,'Í'). # Í
- gsub(/Î/u,'Î'). # Î
- gsub(/Ï/u,'Ï'). # Ï
- gsub(/Ð/u,'Ð'). # Ð
- gsub(/Ñ/u,'Ñ'). # Ñ
- gsub(/Ò/u,'Ò'). # Ò
- gsub(/Ó/u,'Ó'). # Ó
- gsub(/Ô/u,'Ô'). # Ô
- gsub(/Õ/u,'Õ'). # Õ
- gsub(/Ö/u,'Ö'). # Ö
- gsub(/Ø/u,'Ø'). # Ø
- gsub(/Ù/u,'Ù'). # Ù
- gsub(/Ú/u,'Ú'). # Ú
- gsub(/Û/u,'Û'). # Û
- gsub(/Ü/u,'Ü'). # Ü
- gsub(/Ý/u,'Ý'). # Ý
- gsub(/Þ/u,'Þ'). # Þ
- gsub(/ß/u,'ß'). # ß
- gsub(/à/u,'à'). # à
- gsub(/á/u,'á'). # á
- gsub(/â/u,'â'). # â
- gsub(/ã/u,'ã'). # ã
- gsub(/ä/u,'ä'). # ä
- gsub(/å/u,'å'). # å
- gsub(/æ/u,'æ'). # æ
- gsub(/ç/u,'ç'). # ç
- gsub(/è/u,'è'). # è
- gsub(/é/u,'´'). # é
- gsub(/ê/u,'ˆ'). # ê
- gsub(/ë/u,'ë'). # ë
- gsub(/ì/u,'ì'). # ì
- gsub(/í/u,'´'). # í
- gsub(/î/u,'î'). # î
- gsub(/ï/u,'ï'). # ï
- gsub(/ð/u,'ð'). # ð
- gsub(/ñ/u,'ñ'). # ñ
- gsub(/ò/u,'ò'). # ò
- gsub(/ó/u,'ó'). # ó
- gsub(/ô/u,'ô'). # ô
- gsub(/õ/u,'õ'). # õ
- gsub(/ö/u,'ö'). # ö
- gsub(/ø/u,'ø'). # ø
- gsub(/ù/u,'ù'). # ú
- gsub(/ú/u,'ú'). # û
- gsub(/û/u,'û'). # ü
- gsub(/ü/u,'ü'). # ý
- gsub(/þ/u,'þ'). # þ
- gsub(/ÿ/u,'ÿ'). # ÿ
- gsub(/‘/u,'&#lsquo;'). # ‘ # ‘
- gsub(/’/u,'&#rsquo;'). # ’ # ’
- gsub(/“/u,'“'). # “ # “
- gsub(/”/u,'”'). # ” # ”
- gsub(/–/u,'–'). # – # –
- gsub(/—/u,'—'). # — # —
- gsub(/∝/u,'∝'). # ∝ # ∝
- gsub(/∞/u,'∞'). # ∞ # ∞
- gsub(/™/u,'™'). # ™ # ™
- gsub(/✠/u,'✠'). # ✠
- #gsub(/✠/u '†'). # † # † incorrect replacement †
- gsub(/ /u,' '). # space identify
- gsub(/ /u,' ') # space identify
end
end
self
@@ -411,7 +313,8 @@ module SiSU_XML_Munge
%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}).
gsub(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}").
gsub(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}").
- gsub(/ |#{Mx[:nbsp]}/m,' ')
+ gsub(/ |#{Mx[:nbsp]}/m,' ').
+ gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&\1') # pattern not to match
dob
end
def markup_light(dob='')
@@ -426,7 +329,8 @@ module SiSU_XML_Munge
gsub(/&([^;]{1,5})/,'&\1'). #sort, rough estimate, revisit #WATCH found in node not sax
gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,
"<image.path>#{@md.file.output_path.xml.rel_image}\/\\1</image.path>").
- gsub(/&nbsp;|#{Mx[:nbsp]}/,'&#160;')
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,'&#160;').
+ gsub(/;&([^#]|(?:[^gl][^t]|[^a][^m][^p]|[^n][^b][^s][^p])[^;])/,';&amp;\1') # pattern not to match
wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
dob.obj=tidywords(wordlist).join(' ').strip
dob
@@ -698,7 +602,8 @@ module SiSU_XML_Tags #Format
end
def meta_content_clean(content='')
content=if not content.nil?
- content=content.tr('"',"'")
+ content=content.tr('"',"'").
+ gsub(/&/,'&amp;')
content=SiSU_XML_Munge::Trans.new(@md).char_enc.utf8(content)
else content
end