html_truncator 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/html_truncator.rb +3 -1
  2. metadata +34 -62
@@ -32,7 +32,9 @@ class Nokogiri::XML::Node
32
32
  def truncate(max, opts)
33
33
  return ["", 1, opts] if max == 0 && !ellipsable?
34
34
  inner, remaining, opts = inner_truncate(max, opts)
35
- return ["", max - remaining, opts] if inner.empty?
35
+ if inner.empty?
36
+ return [name == "br" ? to_html : "", max - remaining, opts]
37
+ end
36
38
  children.remove
37
39
  add_child Nokogiri::HTML::DocumentFragment.parse(inner)
38
40
  [to_html(:indent => 0), max - remaining, opts]
metadata CHANGED
@@ -1,100 +1,72 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: html_truncator
3
- version: !ruby/object:Gem::Version
4
- hash: 19
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.3
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 2
10
- version: 0.2.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Bruno Michel
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-04-19 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-08-24 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: nokogiri
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &74157190 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 1
32
- - 4
33
- version: "1.4"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.4'
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rspec
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *74157190
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &74156330 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
29
+ requirements:
42
30
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 11
45
- segments:
46
- - 2
47
- - 4
48
- version: "2.4"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.4'
49
33
  type: :development
50
- version_requirements: *id002
34
+ prerelease: false
35
+ version_requirements: *74156330
51
36
  description: Wants to truncate an HTML string properly? This gem is for you.
52
37
  email: bmichel@menfin.info
53
38
  executables: []
54
-
55
39
  extensions: []
56
-
57
- extra_rdoc_files:
40
+ extra_rdoc_files:
58
41
  - README.md
59
- files:
42
+ files:
60
43
  - MIT-LICENSE
61
44
  - README.md
62
45
  - Gemfile
63
46
  - lib/html_truncator.rb
64
47
  - init.rb
65
- has_rdoc: true
66
48
  homepage: http://github.com/nono/HTML-Truncator
67
49
  licenses: []
68
-
69
50
  post_install_message:
70
51
  rdoc_options: []
71
-
72
- require_paths:
52
+ require_paths:
73
53
  - lib
74
- required_ruby_version: !ruby/object:Gem::Requirement
54
+ required_ruby_version: !ruby/object:Gem::Requirement
75
55
  none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- hash: 3
80
- segments:
81
- - 0
82
- version: "0"
83
- required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
61
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
92
66
  requirements: []
93
-
94
67
  rubyforge_project:
95
- rubygems_version: 1.5.2
68
+ rubygems_version: 1.8.5
96
69
  signing_key:
97
70
  specification_version: 3
98
71
  summary: Wants to truncate an HTML string properly? This gem is for you.
99
72
  test_files: []
100
-