rexml 3.1.7.3 → 3.1.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rexml might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76db133f3cf02da57b3a0745ca0901720481eb747221f6f66e5752ab422ba9bc
4
- data.tar.gz: c000ee99c1d08c9f5be7e93df159af8b7c4682a8d5c339fb0633bae9ee9c10a5
3
+ metadata.gz: 1dcadd127823192aacae193e64382c9fa13744416ac0f390d94d0f3b1edf178c
4
+ data.tar.gz: 56aa2b4cfd0e6b47f8f30ab116740d4eef9bf89dd65939f0c961918bdaa0ae16
5
5
  SHA512:
6
- metadata.gz: aca2b95bb726f5457f602ca006251d2c8d52cfdb6e8514814660802bb3a1ac646e59a98c0beb3b479c64dd61e54f6671f614f8ce8803279d8b17a5ab3540d6d0
7
- data.tar.gz: 6e6bd7310393d5c6c27194d7c456382bfe75ee2f9b31c85ec4de38da5767e1cafa44878a89f51e87632fb4f6c2fdd5d2c49ba3def51656fe33f4b95b2551598e
6
+ metadata.gz: '0085d9c56f4e45cdefc403839714e0dfc5ca77c98cc75edd9d547b4d5510c38cccd32eacc2037e54becc307944fda7de9b85ce5873f85bcedee3f5c8952b9bf4'
7
+ data.tar.gz: eeb2c83c8ad9f335e6a7193bf2323ef811dd5fff1776681dd78d7728dfa4a4c65b805657cda6766ec8ba67f93cac22c7497b04247945f0693b083492e78b214b
@@ -1,10 +1,24 @@
1
1
  notifications:
2
2
  webhooks:
3
3
  - https://webhook.commit-email.info/
4
- rvm:
5
- - 2.3
6
- - 2.4.4
7
- - 2.5.1
8
- - ruby-head
9
- before_install:
10
- - gem update bundler
4
+ matrix:
5
+ include:
6
+ - name: "2.3"
7
+ rvm: 2.3
8
+ - name: "2.4"
9
+ rvm: 2.4.5
10
+ - name: "2.5"
11
+ rvm: 2.5.2
12
+ - name: "2.6"
13
+ rvm: 2.6.0-rc2
14
+ - name: "trunk"
15
+ rvm: ruby-head
16
+ - name: "gem"
17
+ rvm: 2.6
18
+ install:
19
+ - rake install
20
+ script:
21
+ - mkdir -p tmp
22
+ - cd tmp
23
+ - cp -a ../test/ ./
24
+ - ../run-test.rb
data/README.md CHANGED
@@ -47,7 +47,7 @@ So parsing a string is just as easy as parsing a file.
47
47
 
48
48
  ## Development
49
49
 
50
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
50
+ After checking out the repo, run `rake test` to run the tests.
51
51
 
52
52
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
53
53
 
data/Rakefile CHANGED
@@ -1,10 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
- require "rake/testtask"
3
2
 
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib" << "test/lib"
7
- t.test_files = FileList["test/**/test_*.rb"]
3
+ desc "Run test"
4
+ task :test do
5
+ ruby("run-test.rb")
8
6
  end
9
7
 
10
8
  task :default => :test
@@ -108,13 +108,19 @@ module REXML
108
108
  # Ignored
109
109
  def write( output, indent=0, transitive=false, ie_hack=false )
110
110
  f = REXML::Formatters::Default.new
111
+ c = context
112
+ if c and c[:prologue_quote] == :apostrophe
113
+ quote = "'"
114
+ else
115
+ quote = "\""
116
+ end
111
117
  indent( output, indent )
112
118
  output << START
113
119
  output << ' '
114
120
  output << @name
115
- output << " #@external_id" if @external_id
116
- output << " #{@long_name.inspect}" if @long_name
117
- output << " #{@uri.inspect}" if @uri
121
+ output << " #{@external_id}" if @external_id
122
+ output << " #{quote}#{@long_name}#{quote}" if @long_name
123
+ output << " #{quote}#{@uri}#{quote}" if @uri
118
124
  unless @children.empty?
119
125
  output << ' ['
120
126
  @children.each { |child|
@@ -127,7 +133,11 @@ module REXML
127
133
  end
128
134
 
129
135
  def context
130
- @parent.context
136
+ if @parent
137
+ @parent.context
138
+ else
139
+ nil
140
+ end
131
141
  end
132
142
 
133
143
  def entity( name )
@@ -249,9 +259,16 @@ module REXML
249
259
  end
250
260
 
251
261
  def to_s
262
+ c = nil
263
+ c = parent.context if parent
264
+ if c and c[:prologue_quote] == :apostrophe
265
+ quote = "'"
266
+ else
267
+ quote = "\""
268
+ end
252
269
  notation = "<!NOTATION #{@name} #{@middle}"
253
- notation << " #{@public.inspect}" if @public
254
- notation << " #{@system.inspect}" if @system
270
+ notation << " #{quote}#{@public}#{quote}" if @public
271
+ notation << " #{quote}#{@system}#{quote}" if @system
255
272
  notation << ">"
256
273
  notation
257
274
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: false
2
+
2
3
  module REXML
3
4
  module Formatters
4
5
  class Default
@@ -66,7 +67,7 @@ module REXML
66
67
 
67
68
  node.attributes.to_a.map { |a|
68
69
  Hash === a ? a.values : a
69
- }.flatten.sort_by {|attr| attr.name || '' }.each do |attr|
70
+ }.flatten.sort_by {|attr| attr.name}.each do |attr|
70
71
  output << " "
71
72
  attr.write( output )
72
73
  end unless node.attributes.empty?
@@ -101,11 +102,14 @@ module REXML
101
102
  end
102
103
 
103
104
  def write_instruction( node, output )
104
- output << Instruction::START.sub(/\\/u, '')
105
- output << (node.target || '')
106
- output << ' '
107
- output << (node.content || '')
108
- output << Instruction::STOP.sub(/\\/u, '')
105
+ output << Instruction::START
106
+ output << node.target
107
+ content = node.content
108
+ if content
109
+ output << ' '
110
+ output << content
111
+ end
112
+ output << Instruction::STOP
109
113
  end
110
114
  end
111
115
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: false
2
+
2
3
  require_relative "child"
3
4
  require_relative "source"
4
5
 
@@ -6,8 +7,8 @@ module REXML
6
7
  # Represents an XML Instruction; IE, <? ... ?>
7
8
  # TODO: Add parent arg (3rd arg) to constructor
8
9
  class Instruction < Child
9
- START = '<\?'
10
- STOP = '\?>'
10
+ START = "<?"
11
+ STOP = "?>"
11
12
 
12
13
  # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
13
14
  # content is everything else.
@@ -17,20 +18,25 @@ module REXML
17
18
  # @param target can be one of a number of things. If String, then
18
19
  # the target of this instruction is set to this. If an Instruction,
19
20
  # then the Instruction is shallowly cloned (target and content are
20
- # copied). If a Source, then the source is scanned and parsed for
21
- # an Instruction declaration.
21
+ # copied).
22
22
  # @param content Must be either a String, or a Parent. Can only
23
23
  # be a Parent if the target argument is a Source. Otherwise, this
24
24
  # String is set as the content of this instruction.
25
25
  def initialize(target, content=nil)
26
- if target.kind_of? String
26
+ case target
27
+ when String
27
28
  super()
28
29
  @target = target
29
30
  @content = content
30
- elsif target.kind_of? Instruction
31
+ when Instruction
31
32
  super(content)
32
33
  @target = target.target
33
34
  @content = target.content
35
+ else
36
+ message =
37
+ "processing instruction target must be String or REXML::Instruction: "
38
+ message << "<#{target.inspect}>"
39
+ raise ArgumentError, message
34
40
  end
35
41
  @content.strip! if @content
36
42
  end
@@ -45,11 +51,13 @@ module REXML
45
51
  def write writer, indent=-1, transitive=false, ie_hack=false
46
52
  Kernel.warn( "#{self.class.name}.write is deprecated", uplevel: 1)
47
53
  indent(writer, indent)
48
- writer << START.sub(/\\/u, '')
54
+ writer << START
49
55
  writer << @target
50
- writer << ' '
51
- writer << @content
52
- writer << STOP.sub(/\\/u, '')
56
+ if @content
57
+ writer << ' '
58
+ writer << @content
59
+ end
60
+ writer << STOP
53
61
  end
54
62
 
55
63
  # @return true if other is an Instruction, and the content and target
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: false
2
+
2
3
  require_relative 'xmltokens'
3
4
 
4
5
  module REXML
@@ -14,14 +15,24 @@ module REXML
14
15
  # Sets the name and the expanded name
15
16
  def name=( name )
16
17
  @expanded_name = name
17
- name =~ NAMESPLIT
18
- if $1
19
- @prefix = $1
18
+ case name
19
+ when NAMESPLIT
20
+ if $1
21
+ @prefix = $1
22
+ else
23
+ @prefix = ""
24
+ @namespace = ""
25
+ end
26
+ @name = $2
27
+ when ""
28
+ @prefix = nil
29
+ @namespace = nil
30
+ @name = nil
20
31
  else
21
- @prefix = ""
22
- @namespace = ""
32
+ message = "name must be \#{PREFIX}:\#{LOCAL_NAME} or \#{LOCAL_NAME}: "
33
+ message += "<#{name.inspect}>"
34
+ raise ArgumentError, message
23
35
  end
24
- @name = $2
25
36
  end
26
37
 
27
38
  # Compares names optionally WITH namespaces
@@ -1,4 +1,4 @@
1
- # -*- encoding: utf-8 -*-
1
+ # -*- coding: utf-8 -*-
2
2
  # frozen_string_literal: false
3
3
  # REXML is an XML toolkit for Ruby[http://www.ruby-lang.org], in Ruby.
4
4
  #
@@ -24,7 +24,7 @@
24
24
  module REXML
25
25
  COPYRIGHT = "Copyright © 2001-2008 Sean Russell <ser@germane-software.com>"
26
26
  DATE = "2008/019"
27
- VERSION = "3.1.7.3"
27
+ VERSION = "3.1.8"
28
28
  REVISION = ""
29
29
 
30
30
  Copyright = COPYRIGHT
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: false
2
+
2
3
  require_relative 'encoding'
3
4
  require_relative 'source'
4
5
 
@@ -7,11 +8,11 @@ module REXML
7
8
  class XMLDecl < Child
8
9
  include Encoding
9
10
 
10
- DEFAULT_VERSION = "1.0";
11
- DEFAULT_ENCODING = "UTF-8";
12
- DEFAULT_STANDALONE = "no";
13
- START = '<\?xml';
14
- STOP = '\?>';
11
+ DEFAULT_VERSION = "1.0"
12
+ DEFAULT_ENCODING = "UTF-8"
13
+ DEFAULT_STANDALONE = "no"
14
+ START = "<?xml"
15
+ STOP = "?>"
15
16
 
16
17
  attr_accessor :version, :standalone
17
18
  attr_reader :writeencoding, :writethis
@@ -46,9 +47,9 @@ module REXML
46
47
  # Ignored
47
48
  def write(writer, indent=-1, transitive=false, ie_hack=false)
48
49
  return nil unless @writethis or writer.kind_of? Output
49
- writer << START.sub(/\\/u, '')
50
+ writer << START
50
51
  writer << " #{content encoding}"
51
- writer << STOP.sub(/\\/u, '')
52
+ writer << STOP
52
53
  end
53
54
 
54
55
  def ==( other )
@@ -102,14 +103,26 @@ module REXML
102
103
  end
103
104
 
104
105
  def inspect
105
- START.sub(/\\/u, '') + " ... " + STOP.sub(/\\/u, '')
106
+ "#{START} ... #{STOP}"
106
107
  end
107
108
 
108
109
  private
109
110
  def content(enc)
110
- rv = "version='#@version'"
111
- rv << " encoding='#{enc}'" if @writeencoding || enc !~ /\Autf-8\z/i
112
- rv << " standalone='#@standalone'" if @standalone
111
+ context = nil
112
+ context = parent.context if parent
113
+ if context and context[:prologue_quote] == :quote
114
+ quote = "\""
115
+ else
116
+ quote = "'"
117
+ end
118
+
119
+ rv = "version=#{quote}#{@version}#{quote}"
120
+ if @writeencoding or enc !~ /\Autf-8\z/i
121
+ rv << " encoding=#{quote}#{enc}#{quote}"
122
+ end
123
+ if @standalone
124
+ rv << " standalone=#{quote}#{@standalone}#{quote}"
125
+ end
113
126
  rv
114
127
  end
115
128
  end
@@ -16,23 +16,66 @@ Gem::Specification.new do |spec|
16
16
  spec.homepage = "https://github.com/ruby/rexml"
17
17
  spec.license = "BSD-2-Clause"
18
18
 
19
- spec.files = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile",
20
- "bin/console", "bin/setup", "lib/rexml/attlistdecl.rb", "lib/rexml/attribute.rb", "lib/rexml/cdata.rb",
21
- "lib/rexml/child.rb", "lib/rexml/comment.rb", "lib/rexml/doctype.rb", "lib/rexml/document.rb",
22
- "lib/rexml/dtd/attlistdecl.rb", "lib/rexml/dtd/dtd.rb", "lib/rexml/dtd/elementdecl.rb",
23
- "lib/rexml/dtd/entitydecl.rb", "lib/rexml/dtd/notationdecl.rb", "lib/rexml/element.rb",
24
- "lib/rexml/encoding.rb", "lib/rexml/entity.rb", "lib/rexml/formatters/default.rb",
25
- "lib/rexml/formatters/pretty.rb", "lib/rexml/formatters/transitive.rb", "lib/rexml/functions.rb",
26
- "lib/rexml/instruction.rb", "lib/rexml/light/node.rb", "lib/rexml/namespace.rb", "lib/rexml/node.rb",
27
- "lib/rexml/output.rb", "lib/rexml/parent.rb", "lib/rexml/parseexception.rb", "lib/rexml/parsers/baseparser.rb",
28
- "lib/rexml/parsers/lightparser.rb", "lib/rexml/parsers/pullparser.rb", "lib/rexml/parsers/sax2parser.rb",
29
- "lib/rexml/parsers/streamparser.rb", "lib/rexml/parsers/treeparser.rb",
30
- "lib/rexml/parsers/ultralightparser.rb", "lib/rexml/parsers/xpathparser.rb", "lib/rexml/quickpath.rb",
31
- "lib/rexml/rexml.rb", "lib/rexml/sax2listener.rb", "lib/rexml/security.rb", "lib/rexml/source.rb",
32
- "lib/rexml/streamlistener.rb", "lib/rexml/syncenumerator.rb", "lib/rexml/text.rb",
33
- "lib/rexml/undefinednamespaceexception.rb", "lib/rexml/validation/relaxng.rb",
34
- "lib/rexml/validation/validation.rb", "lib/rexml/validation/validationexception.rb", "lib/rexml/xmldecl.rb",
35
- "lib/rexml/xmltokens.rb", "lib/rexml/xpath.rb", "lib/rexml/xpath_parser.rb", "rexml.gemspec"]
19
+ spec.files = [
20
+ ".gitignore",
21
+ ".travis.yml",
22
+ "Gemfile",
23
+ "LICENSE.txt",
24
+ "README.md",
25
+ "Rakefile",
26
+ "lib/rexml/attlistdecl.rb",
27
+ "lib/rexml/attribute.rb",
28
+ "lib/rexml/cdata.rb",
29
+ "lib/rexml/child.rb",
30
+ "lib/rexml/comment.rb",
31
+ "lib/rexml/doctype.rb",
32
+ "lib/rexml/document.rb",
33
+ "lib/rexml/dtd/attlistdecl.rb",
34
+ "lib/rexml/dtd/dtd.rb",
35
+ "lib/rexml/dtd/elementdecl.rb",
36
+ "lib/rexml/dtd/entitydecl.rb",
37
+ "lib/rexml/dtd/notationdecl.rb",
38
+ "lib/rexml/element.rb",
39
+ "lib/rexml/encoding.rb",
40
+ "lib/rexml/entity.rb",
41
+ "lib/rexml/formatters/default.rb",
42
+ "lib/rexml/formatters/pretty.rb",
43
+ "lib/rexml/formatters/transitive.rb",
44
+ "lib/rexml/functions.rb",
45
+ "lib/rexml/instruction.rb",
46
+ "lib/rexml/light/node.rb",
47
+ "lib/rexml/namespace.rb",
48
+ "lib/rexml/node.rb",
49
+ "lib/rexml/output.rb",
50
+ "lib/rexml/parent.rb",
51
+ "lib/rexml/parseexception.rb",
52
+ "lib/rexml/parsers/baseparser.rb",
53
+ "lib/rexml/parsers/lightparser.rb",
54
+ "lib/rexml/parsers/pullparser.rb",
55
+ "lib/rexml/parsers/sax2parser.rb",
56
+ "lib/rexml/parsers/streamparser.rb",
57
+ "lib/rexml/parsers/treeparser.rb",
58
+ "lib/rexml/parsers/ultralightparser.rb",
59
+ "lib/rexml/parsers/xpathparser.rb",
60
+ "lib/rexml/quickpath.rb",
61
+ "lib/rexml/rexml.rb",
62
+ "lib/rexml/sax2listener.rb",
63
+ "lib/rexml/security.rb",
64
+ "lib/rexml/source.rb",
65
+ "lib/rexml/streamlistener.rb",
66
+ "lib/rexml/syncenumerator.rb",
67
+ "lib/rexml/text.rb",
68
+ "lib/rexml/undefinednamespaceexception.rb",
69
+ "lib/rexml/validation/relaxng.rb",
70
+ "lib/rexml/validation/validation.rb",
71
+ "lib/rexml/validation/validationexception.rb",
72
+ "lib/rexml/xmldecl.rb",
73
+ "lib/rexml/xmltokens.rb",
74
+ "lib/rexml/xpath.rb",
75
+ "lib/rexml/xpath_parser.rb",
76
+ "rexml.gemspec",
77
+ "run-test.rb",
78
+ ]
36
79
  spec.bindir = "exe"
37
80
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
81
  spec.require_paths = ["lib"]
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift("test")
4
+ $LOAD_PATH.unshift("test/lib")
5
+ $LOAD_PATH.unshift("lib")
6
+
7
+ Dir.glob("test/rexml/**/*test_*.rb") do |test_rb|
8
+ require File.expand_path(test_rb)
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexml
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.7.3
4
+ version: 3.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-04 00:00:00.000000000 Z
11
+ date: 2018-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -51,8 +51,6 @@ files:
51
51
  - LICENSE.txt
52
52
  - README.md
53
53
  - Rakefile
54
- - bin/console
55
- - bin/setup
56
54
  - lib/rexml/attlistdecl.rb
57
55
  - lib/rexml/attribute.rb
58
56
  - lib/rexml/cdata.rb
@@ -104,6 +102,7 @@ files:
104
102
  - lib/rexml/xpath.rb
105
103
  - lib/rexml/xpath_parser.rb
106
104
  - rexml.gemspec
105
+ - run-test.rb
107
106
  homepage: https://github.com/ruby/rexml
108
107
  licenses:
109
108
  - BSD-2-Clause
@@ -124,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
123
  version: '0'
125
124
  requirements: []
126
125
  rubyforge_project:
127
- rubygems_version: 2.7.6
126
+ rubygems_version: 3.0.0.beta3
128
127
  signing_key:
129
128
  specification_version: 4
130
129
  summary: An XML toolkit for Ruby
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "rexml"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here