rexml 3.4.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 582bb5339257c81f2ce9c076155c01d7adfe8fb169c09bc7f5f489f6a76bca80
4
- data.tar.gz: 160de8899d8d1f995bafca23631e9e4ab928ebbffa21684e3b61dad805a6187b
3
+ metadata.gz: a9dc6a26dcc5ba93c112d65fa910e49ca970108c726cdce28324d7771a0831a3
4
+ data.tar.gz: b03ad34d3180aeeaa1ecc7ab21bf5ffe5f2845107a2c35ca3198653f80b932fa
5
5
  SHA512:
6
- metadata.gz: e2b095792523f54301e8a6af2f1682a9ad24d92cdd5d94c9e6088b27520e3c03b68fe06061b6ff2fd96b001b9cb947c57e4095244d83206a83fc2a1829dd4243
7
- data.tar.gz: 4f335d2b1e58c1da233c3f0a0588def502c8cb2660633e0e06b4d0930bbcedcaae36b52dc550923704b4525d94a1011f4b5f4e87a81e5d689cce24ee89210a23
6
+ metadata.gz: c0d493943fab795f3c8fc8490a40750382e3c4cf38c73532b1f850612384795c2bb916afc70ebff0bd26e9e2f304ea6a22299a0481523bd0322d5655df05edbd
7
+ data.tar.gz: bfb02a2bfadb24cbdeed951e06e113e17b123015271cabfffacc3ecc4bbb1bd7c7f56e358d42173feb8b333309f725d57b76f155fea814d70c6decae3b791165
data/NEWS.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # News
2
2
 
3
+ ## 3.4.1 - 2025-02-16 {#version-3-4-1}
4
+
5
+ ### Improvement
6
+
7
+ * Improved performance.
8
+ * GH-226
9
+ * GH-227
10
+ * GH-237
11
+ * Patch by NAITOH Jun
12
+
13
+ ### Fixes
14
+
15
+ * Fix serialization of ATTLIST is incorrect
16
+ * GH-233
17
+ * GH-234
18
+ * Patch by OlofKalufs
19
+ * Reported by OlofKalufs
20
+
21
+ ### Thanks
22
+
23
+ * NAITOH Jun
24
+
25
+ * OlofKalufs
26
+
3
27
  ## 3.4.0 - 2024-12-15 {#version-3-4-0}
4
28
 
5
29
  ### Improvement
@@ -297,10 +297,11 @@ module REXML
297
297
  raise REXML::ParseException.new(message, @source)
298
298
  end
299
299
  name = parse_name(base_error_message)
300
- if @source.match?(/\s*\[/um, true)
300
+ @source.match?(/\s*/um, true) # skip spaces
301
+ if @source.match?("[", true)
301
302
  id = [nil, nil, nil]
302
303
  @document_status = :in_doctype
303
- elsif @source.match?(/\s*>/um, true)
304
+ elsif @source.match?(">", true)
304
305
  id = [nil, nil, nil]
305
306
  @document_status = :after_doctype
306
307
  @source.ensure_buffer
@@ -312,9 +313,10 @@ module REXML
312
313
  # For backward compatibility
313
314
  id[1], id[2] = id[2], nil
314
315
  end
315
- if @source.match?(/\s*\[/um, true)
316
+ @source.match?(/\s*/um, true) # skip spaces
317
+ if @source.match?("[", true)
316
318
  @document_status = :in_doctype
317
- elsif @source.match?(/\s*>/um, true)
319
+ elsif @source.match?(">", true)
318
320
  @document_status = :after_doctype
319
321
  @source.ensure_buffer
320
322
  else
@@ -378,7 +380,7 @@ module REXML
378
380
  md = @source.match(Private::ATTLISTDECL_END, true)
379
381
  raise REXML::ParseException.new( "Bad ATTLIST declaration!", @source ) if md.nil?
380
382
  element = md[1]
381
- contents = md[0]
383
+ contents = "<!ATTLIST" + md[0]
382
384
 
383
385
  pairs = {}
384
386
  values = md[0].strip.scan( ATTDEF_RE )
@@ -409,7 +411,8 @@ module REXML
409
411
  id = parse_id(base_error_message,
410
412
  accept_external_id: true,
411
413
  accept_public_id: true)
412
- unless @source.match?(/\s*>/um, true)
414
+ @source.match?(/\s*/um, true) # skip spaces
415
+ unless @source.match?(">", true)
413
416
  message = "#{base_error_message}: garbage before end >"
414
417
  raise REXML::ParseException.new(message, @source)
415
418
  end
@@ -766,6 +769,25 @@ module REXML
766
769
  [:processing_instruction, name, content]
767
770
  end
768
771
 
772
+ if StringScanner::Version < "3.1.1"
773
+ def scan_quote
774
+ @source.match(/(['"])/, true)&.[](1)
775
+ end
776
+ else
777
+ def scan_quote
778
+ case @source.peek_byte
779
+ when 34 # '"'.ord
780
+ @source.scan_byte
781
+ '"'
782
+ when 39 # "'".ord
783
+ @source.scan_byte
784
+ "'"
785
+ else
786
+ nil
787
+ end
788
+ end
789
+ end
790
+
769
791
  def parse_attributes(prefixes)
770
792
  attributes = {}
771
793
  expanded_names = {}
@@ -785,11 +807,10 @@ module REXML
785
807
  message = "Missing attribute equal: <#{name}>"
786
808
  raise REXML::ParseException.new(message, @source)
787
809
  end
788
- unless match = @source.match(/(['"])/, true)
810
+ unless quote = scan_quote
789
811
  message = "Missing attribute value start quote: <#{name}>"
790
812
  raise REXML::ParseException.new(message, @source)
791
813
  end
792
- quote = match[1]
793
814
  start_position = @source.position
794
815
  value = @source.read_until(quote)
795
816
  unless value.chomp!(quote)
data/lib/rexml/rexml.rb CHANGED
@@ -31,7 +31,7 @@
31
31
  module REXML
32
32
  COPYRIGHT = "Copyright © 2001-2008 Sean Russell <ser@germane-software.com>"
33
33
  DATE = "2008/019"
34
- VERSION = "3.4.0"
34
+ VERSION = "3.4.1"
35
35
  REVISION = ""
36
36
 
37
37
  Copyright = COPYRIGHT
data/lib/rexml/source.rb CHANGED
@@ -68,8 +68,14 @@ module REXML
68
68
  SCANNER_RESET_SIZE = 100000
69
69
  PRE_DEFINED_TERM_PATTERNS = {}
70
70
  pre_defined_terms = ["'", '"', "<"]
71
- pre_defined_terms.each do |term|
72
- PRE_DEFINED_TERM_PATTERNS[term] = /#{Regexp.escape(term)}/
71
+ if StringScanner::Version < "3.1.1"
72
+ pre_defined_terms.each do |term|
73
+ PRE_DEFINED_TERM_PATTERNS[term] = /#{Regexp.escape(term)}/
74
+ end
75
+ else
76
+ pre_defined_terms.each do |term|
77
+ PRE_DEFINED_TERM_PATTERNS[term] = term
78
+ end
73
79
  end
74
80
  end
75
81
  private_constant :Private
@@ -152,6 +158,14 @@ module REXML
152
158
  @scanner.pos = pos
153
159
  end
154
160
 
161
+ def peek_byte
162
+ @scanner.peek_byte
163
+ end
164
+
165
+ def scan_byte
166
+ @scanner.scan_byte
167
+ end
168
+
155
169
  # @return true if the Source is exhausted
156
170
  def empty?
157
171
  @scanner.eos?
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexml
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-15 00:00:00.000000000 Z
10
+ date: 2025-02-16 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: An XML toolkit for Ruby
14
13
  email:
@@ -103,8 +102,7 @@ homepage: https://github.com/ruby/rexml
103
102
  licenses:
104
103
  - BSD-2-Clause
105
104
  metadata:
106
- changelog_uri: https://github.com/ruby/rexml/releases/tag/v3.4.0
107
- post_install_message:
105
+ changelog_uri: https://github.com/ruby/rexml/releases/tag/v3.4.1
108
106
  rdoc_options:
109
107
  - "--main"
110
108
  - README.md
@@ -121,8 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
119
  - !ruby/object:Gem::Version
122
120
  version: '0'
123
121
  requirements: []
124
- rubygems_version: 3.5.22
125
- signing_key:
122
+ rubygems_version: 3.6.2
126
123
  specification_version: 4
127
124
  summary: An XML toolkit for Ruby
128
125
  test_files: []