Update RDOC documentation.
Update the documentation for sanitize.rb, to match current behaviour.
This commit is contained in:
parent
1911d18f65
commit
de125367b0
|
@ -2266,7 +2266,7 @@ class String
|
||||||
}
|
}
|
||||||
#:startdoc:
|
#:startdoc:
|
||||||
|
|
||||||
# Converts XHTML+MathML named entities to Numeric Character References
|
# Converts XHTML+MathML named entities in string to Numeric Character References
|
||||||
#
|
#
|
||||||
# :call-seq:
|
# :call-seq:
|
||||||
# string.to_ncr -> string
|
# string.to_ncr -> string
|
||||||
|
@ -2275,17 +2275,18 @@ class String
|
||||||
self.gsub(/&(?:(lt|gt|amp|quot|apos)|[a-zA-Z0-9]+);/){|s| $1 ? s : s.convert_to_ncr}
|
self.gsub(/&(?:(lt|gt|amp|quot|apos)|[a-zA-Z0-9]+);/){|s| $1 ? s : s.convert_to_ncr}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Converts XHTML+MathML named entities to Numeric Character References
|
# Converts XHTML+MathML named entities in string to Numeric Character References
|
||||||
#
|
#
|
||||||
# :call-seq:
|
# :call-seq:
|
||||||
# string.to_ncr! -> str or nil
|
# string.to_ncr! -> str or nil
|
||||||
#
|
#
|
||||||
# Substitution is done in-place.
|
# Substitution is done in-place.
|
||||||
|
#
|
||||||
def to_ncr!
|
def to_ncr!
|
||||||
self.gsub!(/&(?:(lt|gt|amp|quot|apos)|[a-zA-Z0-9]+);/){|s| $1 ? s : s.convert_to_ncr}
|
self.gsub!(/&(?:(lt|gt|amp|quot|apos)|[a-zA-Z0-9]+);/){|s| $1 ? s : s.convert_to_ncr}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Converts XHTML+MathML named entities to UTF-8
|
# Converts XHTML+MathML named entities in string to UTF-8
|
||||||
#
|
#
|
||||||
# :call-seq:
|
# :call-seq:
|
||||||
# string.to_utf8 -> string
|
# string.to_utf8 -> string
|
||||||
|
@ -2294,12 +2295,13 @@ class String
|
||||||
self.gsub(/&(?:(lt|gt|amp|quot|apos)|[a-zA-Z0-9]+);/){|s| $1 ? s : s.convert_to_utf8}
|
self.gsub(/&(?:(lt|gt|amp|quot|apos)|[a-zA-Z0-9]+);/){|s| $1 ? s : s.convert_to_utf8}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Converts XHTML+MathML named entities to UTF-8
|
# Converts XHTML+MathML named entities in string to UTF-8
|
||||||
#
|
#
|
||||||
# :call-seq:
|
# :call-seq:
|
||||||
# string.to_ncr! -> str or nil
|
# string.to_ncr! -> str or nil
|
||||||
#
|
#
|
||||||
# Substitution is done in-place.
|
# Substitution is done in-place.
|
||||||
|
#
|
||||||
def to_utf8!
|
def to_utf8!
|
||||||
self.gsub!(/&(?:(lt|gt|amp|quot|apos)|[a-zA-Z0-9]+);/){|s| $1 ? s : s.convert_to_utf8}
|
self.gsub!(/&(?:(lt|gt|amp|quot|apos)|[a-zA-Z0-9]+);/){|s| $1 ? s : s.convert_to_utf8}
|
||||||
end
|
end
|
||||||
|
@ -2332,6 +2334,11 @@ module REXML #:nodoc:
|
||||||
#
|
#
|
||||||
# REXML, typically, converts NCRs to utf-8 characters, which is what you'll see when you
|
# REXML, typically, converts NCRs to utf-8 characters, which is what you'll see when you
|
||||||
# access the resulting REXML document.
|
# access the resulting REXML document.
|
||||||
|
#
|
||||||
|
# Note that this method needs to traverse the entire tree, converting text nodes and attributes
|
||||||
|
# for each element. This can be SLOW. It will often be faster to serialize to a string and then
|
||||||
|
# use String.to_ncr instead.
|
||||||
|
#
|
||||||
def to_ncr
|
def to_ncr
|
||||||
self.each_element { |el|
|
self.each_element { |el|
|
||||||
el.texts.each_index {|i|
|
el.texts.each_index {|i|
|
||||||
|
@ -2349,6 +2356,10 @@ module REXML #:nodoc:
|
||||||
#
|
#
|
||||||
# :call-seq:
|
# :call-seq:
|
||||||
# tree.to_utf8 -> REXML::Element
|
# tree.to_utf8 -> REXML::Element
|
||||||
|
#
|
||||||
|
# Note that this method needs to traverse the entire tree, converting text nodes and attributes
|
||||||
|
# for each element. This can be SLOW. It will often be faster to serialize to a string and then
|
||||||
|
# use String.to_utf8 instead.
|
||||||
#
|
#
|
||||||
def to_utf8
|
def to_utf8
|
||||||
self.each_element { |el|
|
self.each_element { |el|
|
||||||
|
@ -2366,7 +2377,7 @@ module REXML #:nodoc:
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module HTML5 #:nodoc:
|
module HTML5 #:nodoc: all
|
||||||
module TreeWalkers
|
module TreeWalkers
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in a new issue