More Ruby 1.9 String Encoding Fun
This commit is contained in:
parent
2c5c6dc78a
commit
faac8951a3
2 changed files with 4 additions and 1 deletions
|
@ -41,7 +41,7 @@ end
|
||||||
#--
|
#--
|
||||||
if "".respond_to?(:force_encoding)
|
if "".respond_to?(:force_encoding)
|
||||||
def purify
|
def purify
|
||||||
text = check_ncrs.as_utf8
|
text = self.dup.check_ncrs.as_utf8
|
||||||
text.chars.collect{|c| c.as_bytes}.grep(UTF8_REGEX).join.as_utf8
|
text.chars.collect{|c| c.as_bytes}.grep(UTF8_REGEX).join.as_utf8
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,6 +7,7 @@ require_dependency 'chunks/wiki'
|
||||||
require_dependency 'chunks/literal'
|
require_dependency 'chunks/literal'
|
||||||
require 'chunks/nowiki'
|
require 'chunks/nowiki'
|
||||||
require 'sanitizer'
|
require 'sanitizer'
|
||||||
|
require 'stringsupport'
|
||||||
|
|
||||||
|
|
||||||
# Wiki content is just a string that can process itself with a chain of
|
# Wiki content is just a string that can process itself with a chain of
|
||||||
|
@ -189,6 +190,7 @@ class WikiContent < String
|
||||||
def render!
|
def render!
|
||||||
pre_render!
|
pre_render!
|
||||||
@options[:engine].apply_to(self)
|
@options[:engine].apply_to(self)
|
||||||
|
as_bytes
|
||||||
# unmask in one go. $~[1] is the chunk id
|
# unmask in one go. $~[1] is the chunk id
|
||||||
gsub!(MASK_RE[ACTIVE_CHUNKS]) do
|
gsub!(MASK_RE[ACTIVE_CHUNKS]) do
|
||||||
chunk = @chunks_by_id[$~[1].to_i]
|
chunk = @chunks_by_id[$~[1].to_i]
|
||||||
|
@ -200,6 +202,7 @@ class WikiContent < String
|
||||||
chunk.unmask_text
|
chunk.unmask_text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
as_utf8
|
||||||
self.replace xhtml_sanitize(self)
|
self.replace xhtml_sanitize(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue