abbreviato 3.1.0 → 3.1.4

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
  SHA256:
3
- metadata.gz: b37bb6d2d4c722a6e1e5bc5cd8258c01ba0bea5daf2fa8176263691c1097b009
4
- data.tar.gz: e1d2d0049ad15fc4a111d87af741b09abc3b44cff01d9dd99c49023fed4d23d9
3
+ metadata.gz: 3dc0a26daec20a29fe9676003419678b879c5c41512992411029944f20f7b903
4
+ data.tar.gz: c28d9a50416d40e963995340a6d5126ac3d4ff35486c02e89c6d07693d94ee95
5
5
  SHA512:
6
- metadata.gz: 109da67eb634152303f0f54234ab3a450b2a0751da44b88b3c72828b2fa95d30ef52f2039da4172f6e4fc81f375f04e31a140bf493c0d6329bc16ea2b4a4c1b9
7
- data.tar.gz: 4f1148a0edfda7e7829b306749bf9e500b8a0f85f3ed79ed63214b21c89cf02f9946dae0ce6d4e4e54ce10d8f8432eaefbaad6c9bf4291eb4a169259341bff23
6
+ metadata.gz: f99329d746eab3e6bec6f0caeed47a101d08e096089e045ec57753977a6a844286a813e15308331f0b8e78462a6fe59dc478cbfa87b2aca5f7771d5196e0a657
7
+ data.tar.gz: 6093223017d8cf9f559ed1a5bf5f51280569410dbdee09d3d444a987e811a609f246fe09f4dbeb06fbc67dfd8cc393a0964e0229ffbe556d1a70761ac79650eb
@@ -22,11 +22,12 @@ module Abbreviato
22
22
  # or an entire document (with `HTML`, `HEAD` & `BODY` tags). Setting to true prevents automatic addition of
23
23
  # these tags if they are missing. Defaults to `true`.
24
24
  # @return [[String] the truncated string, [boolean] whether the string was truncated]
25
- def self.truncate(source = '', user_options = {})
25
+ def self.truncate(source = '', user_options = {}, encoding = 'UTF-8')
26
26
  return [nil, false] if source.nil?
27
+ return ['', false] if source.blank?
27
28
 
28
29
  truncated_sax_document = TruncatedSaxDocument.new(DEFAULT_OPTIONS.merge(user_options))
29
- parser = Nokogiri::HTML::SAX::Parser.new(truncated_sax_document)
30
+ parser = Nokogiri::HTML::SAX::Parser.new(truncated_sax_document, encoding)
30
31
  parser.parse(source) { |context| context.replace_entities = false }
31
32
 
32
33
  if truncated_sax_document.truncated && user_options[:truncate_incomplete_row]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Abbreviato
4
- VERSION = '3.1.0'
4
+ VERSION = '3.1.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abbreviato
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Manrubia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-13 00:00:00.000000000 Z
11
+ date: 2025-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.16.2
33
+ version: 1.17.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.16.2
40
+ version: 1.17.2
41
41
  description: Truncate HTML to a specific bytesize, while keeping valid markup
42
42
  email: jorge.manrubia@gmail.com
43
43
  executables: []
@@ -57,7 +57,7 @@ homepage: https://github.com/zendesk/abbreviato
57
57
  licenses:
58
58
  - MIT
59
59
  metadata: {}
60
- post_install_message:
60
+ post_install_message:
61
61
  rdoc_options: []
62
62
  require_paths:
63
63
  - lib
@@ -72,8 +72,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
- rubygems_version: 3.5.11
76
- signing_key:
75
+ rubygems_version: 3.5.22
76
+ signing_key:
77
77
  specification_version: 4
78
78
  summary: A tool for efficiently truncating HTML strings to a specific bytesize
79
79
  test_files: []