oga 2.0.0 → 2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad0601109c6774e73117f744efa07c2dea7ec963
4
- data.tar.gz: 31a83ef3715c7cd6114c7607c38fc7e2c43c71db
3
+ metadata.gz: dcab3403e0fe14385a3d49586b93b072411cde77
4
+ data.tar.gz: 260b438d5af4359fdb8e5942df310c9a00865a5d
5
5
  SHA512:
6
- metadata.gz: 0c6394851a38fe0e51843e492f6d8b789ca1f62e174a78a39a3a3a72cdda9aac00044bf34b1123f34688ee97efea611db3f46578357b56aea4eef4149574f074
7
- data.tar.gz: 50886c2493804cf1136d853a316bdfc8f974f3f45859c68c6ca148984c69a2a53a5f066bf1ebc517726b489932a9a6ec95420a5719cd77baa6fe52ec776b0560
6
+ metadata.gz: e6c7481726a96ca38f5a847009347d5793ea7ec36467c11fd9fad839e7acbf4c25e2b8b47db8f98b88081222744917b848f22ba5ca2c0d7b7f4b2c68e569d2bf
7
+ data.tar.gz: 9b2ebffc901618e8fea939d7bb2f7ed50d5461308ba37f53ddb449b355bddb3d25822c05797ea4a7b55b21ead9155a9b289e9fc7123259d4c47443f863157aa4
data/README.md CHANGED
@@ -18,9 +18,17 @@ From [Wikipedia][oga-wikipedia]:
18
18
 
19
19
  The name is a pun on [Nokogiri][nokogiri].
20
20
 
21
- Oga uses [Semantic Versioning 2.0][semver] as its versioning scheme. All
22
- classes, modules and methods are part of the public API _unless_ they are
23
- declared as private using Ruby's `private` keyword or YARD's `@api private` tag.
21
+ ## Versioning Policy
22
+
23
+ Oga uses the version format `MAJOR.MINOR` (e.g. `2.1`). An increase of the MAJOR
24
+ version indicates backwards incompatible changes were introduced. The MINOR
25
+ version is _only_ increased when changes are backwards compatible, regardless of
26
+ whether those changes are bugfixes or new features. Up until version 1.0 the
27
+ code should be considered unstable meaning it can change (and break) at any
28
+ given moment.
29
+
30
+ APIs explicitly tagged as private (e.g. using Ruby's `private` keyword or YARD's
31
+ `@api private` tag) are not covered by these rules.
24
32
 
25
33
  ## Examples
26
34
 
@@ -318,4 +326,3 @@ found the file "LICENSE" or at <https://www.mozilla.org/MPL/2.0/>.
318
326
  [oga-wikipedia]: https://en.wikipedia.org/wiki/Japanese_saw#Other_Japanese_saws
319
327
  [ox]: https://github.com/ohler55/ox
320
328
  [doc-website]: http://code.yorickpeterse.com/oga/latest/
321
- [semver]: http://semver.org/spec/v2.0.0.html
data/lib/oga/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Oga
2
- VERSION = '2.0.0'
2
+ VERSION = '2.1'
3
3
  end # Oga
@@ -74,14 +74,14 @@ module Oga
74
74
  input = input.gsub(REGULAR_ENTITY, mapping)
75
75
 
76
76
  if input.include?(AMPERSAND)
77
- input = input.gsub(NUMERIC_CODE_POINT_ENTITY) do
78
- [Integer($1, 10)].pack('U*')
77
+ input = input.gsub(NUMERIC_CODE_POINT_ENTITY) do |found|
78
+ pack_string($1, 10) || found
79
79
  end
80
80
  end
81
81
 
82
82
  if input.include?(AMPERSAND)
83
- input = input.gsub(HEX_CODE_POINT_ENTITY) do
84
- [Integer($1, 16)].pack('U*')
83
+ input = input.gsub(HEX_CODE_POINT_ENTITY) do |found|
84
+ pack_string($1, 16) || found
85
85
  end
86
86
  end
87
87
 
@@ -104,6 +104,17 @@ module Oga
104
104
  def self.encode_attribute(input)
105
105
  input.gsub(ENCODE_ATTRIBUTE_REGEXP, ENCODE_ATTRIBUTE_MAPPING)
106
106
  end
107
+
108
+ private
109
+
110
+ # @param [String] input
111
+ # @param [Fixnum] base
112
+ # @return [String]
113
+ def self.pack_string(input, base)
114
+ packed = [Integer(input, base)].pack('U*')
115
+
116
+ packed.valid_encoding? ? packed : nil
117
+ end
107
118
  end # Entities
108
119
  end # XML
109
120
  end # Oga
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oga
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: '2.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yorick Peterse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-26 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  version: '0'
225
225
  requirements: []
226
226
  rubyforge_project:
227
- rubygems_version: 2.4.8
227
+ rubygems_version: 2.5.1
228
228
  signing_key:
229
229
  specification_version: 4
230
230
  summary: Oga is an XML/HTML parser written in Ruby.