Upgrade to latest REXML
Sync with REXML svn.
This commit is contained in:
parent
6d46e16ee1
commit
1d5faf4a84
2
vendor/plugins/rexml/lib/rexml/attribute.rb
vendored
2
vendor/plugins/rexml/lib/rexml/attribute.rb
vendored
|
@ -17,6 +17,8 @@ module REXML
|
|||
attr_writer :normalized
|
||||
PATTERN = /\s*(#{NAME_STR})\s*=\s*(["'])(.*?)\2/um
|
||||
|
||||
NEEDS_A_SECOND_CHECK = /(<|&((#{Entity::NAME});|(#0*((?:\d+)|(?:x[a-fA-F0-9]+)));)?)/um
|
||||
|
||||
# Constructor.
|
||||
# FIXME: The parser doesn't catch illegal characters in attributes
|
||||
#
|
||||
|
|
3
vendor/plugins/rexml/lib/rexml/document.rb
vendored
3
vendor/plugins/rexml/lib/rexml/document.rb
vendored
|
@ -10,6 +10,7 @@ require "rexml/output"
|
|||
require "rexml/parsers/baseparser"
|
||||
require "rexml/parsers/streamparser"
|
||||
require "rexml/parsers/treeparser"
|
||||
require "rexml/formatters/transitive"
|
||||
|
||||
module REXML
|
||||
# Represents a full XML document, including PIs, a doctype, etc. A
|
||||
|
@ -184,7 +185,7 @@ module REXML
|
|||
output = Output.new( output, xml_decl.encoding )
|
||||
end
|
||||
formatter = if indent > -1
|
||||
if trans
|
||||
if transitive
|
||||
REXML::Formatters::Transitive.new( indent, ie_hack )
|
||||
else
|
||||
REXML::Formatters::Pretty.new( indent, ie_hack )
|
||||
|
|
|
@ -13,8 +13,8 @@ module REXML
|
|||
rescue LoadError
|
||||
require 'nkf'
|
||||
|
||||
SJISTOU8 = '-Swm0'
|
||||
U8TOSJIS = '-Wsm0'
|
||||
SJISTOU8 = '-Swm0x'
|
||||
U8TOSJIS = '-Wsm0x'
|
||||
|
||||
def decode_sjis(str)
|
||||
NKF.nkf(SJISTOU8, str)
|
||||
|
|
|
@ -12,8 +12,9 @@ module REXML
|
|||
# formatted. Since this formatter does not alter whitespace nodes, the
|
||||
# results of formatting already formatted XML will be odd.
|
||||
class Transitive < Default
|
||||
def initialize( indentation=2 )
|
||||
def initialize( indentation=2, ie_hack=false )
|
||||
@indentation = indentation
|
||||
@ie_hack = ie_hack
|
||||
@level = 0
|
||||
end
|
||||
|
||||
|
@ -29,6 +30,7 @@ module REXML
|
|||
output << "\n"
|
||||
output << ' '*@level
|
||||
if node.children.empty?
|
||||
output << " " if @ie_hack
|
||||
output << "/"
|
||||
else
|
||||
output << ">"
|
||||
|
|
|
@ -482,7 +482,7 @@ module REXML
|
|||
rv.gsub!( /\r\n?/, "\n" )
|
||||
matches = rv.scan( REFERENCE_RE )
|
||||
return rv if matches.size == 0
|
||||
rv.gsub!( /�*((?:\d+)|(?:x[a-fA-F0-9]+));/ ) {|m|
|
||||
rv.gsub!( /�*((?:\d+)|(?:x[a-fA-F0-9]+));/ ) {
|
||||
m=$1
|
||||
m = "0#{m}" if m[0] == ?x
|
||||
[Integer(m)].pack('U*')
|
||||
|
|
9
vendor/plugins/rexml/lib/rexml/quickpath.rb
vendored
9
vendor/plugins/rexml/lib/rexml/quickpath.rb
vendored
|
@ -170,15 +170,12 @@ module REXML
|
|||
rest = path[ind+1..-1]
|
||||
|
||||
# have to change 'a [=<>] b [=<>] c' into 'a [=<>] b and b [=<>] c'
|
||||
predicate.gsub!( /([^\s(and)(or)<>=]+)\s*([<>=])\s*([^\s(and)(or)<>=]+)\s*([<>=])\s*([^\s(and)(or)<>=]+)/u ) {
|
||||
"#$1 #$2 #$3 and #$3 #$4 #$5"
|
||||
}
|
||||
predicate.gsub!( /([^\s(and)(or)<>=]+)\s*([<>=])\s*([^\s(and)(or)<>=]+)\s*([<>=])\s*([^\s(and)(or)<>=]+)/u,
|
||||
'\1 \2 \3 and \3 \4 \5' )
|
||||
# Let's do some Ruby trickery to avoid some work:
|
||||
predicate.gsub!( /&/u, "&&" )
|
||||
predicate.gsub!( /=/u, "==" )
|
||||
predicate.gsub!( /@(\w[-\w.]*)/u ) {
|
||||
"attribute(\"#$1\")"
|
||||
}
|
||||
predicate.gsub!( /@(\w[-\w.]*)/u, 'attribute("\1")' )
|
||||
predicate.gsub!( /\bmod\b/u, "%" )
|
||||
predicate.gsub!( /\b(\w[-\w.]*\()/u ) {
|
||||
fname = $1
|
||||
|
|
12
vendor/plugins/rexml/lib/rexml/rexml.rb
vendored
12
vendor/plugins/rexml/lib/rexml/rexml.rb
vendored
|
@ -11,8 +11,8 @@
|
|||
#
|
||||
# Main page:: http://www.germane-software.com/software/rexml
|
||||
# Author:: Sean Russell <serATgermaneHYPHENsoftwareDOTcom>
|
||||
# Version:: 3.1.7.2
|
||||
# Date:: 2007/275
|
||||
# Version:: 3.1.7.4
|
||||
# Date:: 2008/100
|
||||
#
|
||||
# This API documentation can be downloaded from the REXML home page, or can
|
||||
# be accessed online[http://www.germane-software.com/software/rexml_doc]
|
||||
|
@ -21,10 +21,10 @@
|
|||
# or can be accessed
|
||||
# online[http://www.germane-software.com/software/rexml/docs/tutorial.html]
|
||||
module REXML
|
||||
COPYRIGHT = "Copyright © 2001-2007 Sean Russell <ser@germane-software.com>"
|
||||
DATE = "2007/275"
|
||||
VERSION = "3.1.7.2"
|
||||
REVISION = "$Revision: 1284 $".gsub(/\$Revision:|\$/,'').strip
|
||||
COPYRIGHT = "Copyright © 2001-2008 Sean Russell <ser@germane-software.com>"
|
||||
DATE = "2008/100"
|
||||
VERSION = "3.1.7.4"
|
||||
REVISION = "$Revision: 1312 $".gsub(/\$Revision:|\$/,'').strip
|
||||
|
||||
Copyright = COPYRIGHT
|
||||
Version = VERSION
|
||||
|
|
9
vendor/plugins/rexml/lib/rexml/text.rb
vendored
9
vendor/plugins/rexml/lib/rexml/text.rb
vendored
|
@ -50,7 +50,7 @@ module REXML
|
|||
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
|
||||
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
|
||||
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
|
||||
)*$/x;
|
||||
)*$/nx;
|
||||
end
|
||||
|
||||
# Constructor
|
||||
|
@ -139,7 +139,7 @@ module REXML
|
|||
end
|
||||
end
|
||||
else
|
||||
string.scan(/[\x00-\x7F]|[\x80-\xBF][\xC0-\xF0]*|[\xC0-\xF0]/) do |c|
|
||||
string.scan(/[\x00-\x7F]|[\x80-\xBF][\xC0-\xF0]*|[\xC0-\xF0]/n) do |c|
|
||||
case c.unpack('U')
|
||||
when *VALID_CHAR
|
||||
else
|
||||
|
@ -345,7 +345,7 @@ module REXML
|
|||
copy.gsub!( SETUTITSBUS[2], SLAICEPS[2] )
|
||||
copy.gsub!( SETUTITSBUS[3], SLAICEPS[3] )
|
||||
copy.gsub!( SETUTITSBUS[4], SLAICEPS[4] )
|
||||
copy.gsub!( /�*((?:\d+)|(?:x[a-f0-9]+));/ ) {|m|
|
||||
copy.gsub!( /�*((?:\d+)|(?:x[a-f0-9]+));/ ) {
|
||||
m=$1
|
||||
#m='0' if m==''
|
||||
m = "0#{m}" if m[0] == ?x
|
||||
|
@ -380,7 +380,8 @@ module REXML
|
|||
|
||||
# Unescapes all possible entities
|
||||
def Text::unnormalize( string, doctype=nil, filter=nil, illegal=nil )
|
||||
string.gsub( /\r\n?/, "\n" ).gsub( REFERENCE ) { |ref|
|
||||
string.gsub( /\r\n?/, "\n" ).gsub( REFERENCE ) {
|
||||
ref = $&
|
||||
if ref[1] == ?#
|
||||
if ref[2] == ?x
|
||||
[ref[3...-1].to_i(16)].pack('U*')
|
||||
|
|
Loading…
Reference in a new issue