middleman-widont 1.0.2 → 1.0.3

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/middleman-widont.rb +5 -3
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96370a7900c7593aa1a3d32417be5847e0274ac6
4
- data.tar.gz: 210f0439c14be285e54a43e1e8a857cb02ee2ce5
3
+ metadata.gz: 8581fb267cf0989323f6255b8931888c92972b1c
4
+ data.tar.gz: c330bec2a8c1a95ecc6ca368fdeb3febacfc00b1
5
5
  SHA512:
6
- metadata.gz: 557d7051de9495038b6358963f3f8a176e85d52446ff66351dd0a0f50d1e1feea28226fe1fb434cc4d28079266e4209d49dcb9e6bdb6180a4fa3001159be1ecc
7
- data.tar.gz: 2aa86d87c5ae2a353fab1655c6bf19578d244b6eb7a71de20699d6651eee8fde862fe2c0d6d830eb450a26e999c930ac014ebb565a2dcbbed5b8137a2c73b23b
6
+ metadata.gz: 255ae567ec4a6f80e1588f637c77632738fa0f2299ce3ead4e03394ccc1187eb4962b65df98877de9fbb9ef81d0be56268c2e3701582c6aec948029a0358ef26
7
+ data.tar.gz: 84f8ba31862fe360d39474587fba5a523ac273f67b95fdf9aa1bef694e6631b617de744cc5a7923594334ce17fe41d9af5d195d9f5ae3dc0d4af1f06690606f1
data/README.md CHANGED
@@ -17,7 +17,7 @@ activate :widont
17
17
 
18
18
  The tags which to apply Widon't to can be specified:
19
19
  ```ruby
20
- activate :widont, tags: %w[p li]
20
+ activate :widont, tags: ["p", "li"]
21
21
  ```
22
22
 
23
23
  By default, Widon't places the Unicode non-breaking space character
@@ -2,7 +2,7 @@ require "middleman-core"
2
2
  require "nokogiri"
3
3
 
4
4
  class Widont < ::Middleman::Extension
5
- VERSION = "1.0.2"
5
+ VERSION = "1.0.3"
6
6
 
7
7
  option :nbsp, "\u00A0", "String to use between the last two words"
8
8
  option :tags, %w[p h1 h2 h3 h4 h5 h6], "Tags to apply widont"
@@ -31,8 +31,10 @@ class Widont < ::Middleman::Extension
31
31
  html_doc.css(@tags.join(", ")).each do |tag|
32
32
  content = tag.inner_html.strip
33
33
  index = content.rindex(/\s/)
34
- content[index] = @nbsp
35
- tag.inner_html = content
34
+ if index
35
+ content[index] = @nbsp
36
+ tag.inner_html = content
37
+ end
36
38
  end
37
39
  response = html_doc.to_html
38
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-widont
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Boles