middleman-widont 1.0.0 → 1.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/middleman-widont.rb +11 -11
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2518fa4cf669b948d87bb42da838da72e6154480
4
- data.tar.gz: 6094ea88be88e2e658eb1e30b1c11a7c31591d5c
3
+ metadata.gz: 36eaab45d1b9e58cc24c37a8b46e48f3b71d2858
4
+ data.tar.gz: 081b9d69a2f419361a78d3716c5a4c6ed6b5ff02
5
5
  SHA512:
6
- metadata.gz: fb2408320fab5a80b349cc18ccd52056074fcec45ac4bb40c2c07cb4345992a54d4647a08f8ee31353d4c6d43f8dd9eebc6778206dea4f75e8d1800c4962ae45
7
- data.tar.gz: 76ca08e93ab5cfedd7458555ce1d6b40b47c7611d4f7bf4a5ebbdb4d25565d77ba27badb0c1f3ddb01f35e52775113d0c5be7dd649ab348d331af1bac3cee13e
6
+ metadata.gz: 9b6fc4a0a22931c5d13a59bd8741ca045e1c85990125ff0440ef0139e53c27dbd8abfd08d5998637b4b629e1ac5cf8b3798fb9938a1f4f780e0c39e6de36582b
7
+ data.tar.gz: 7c23023653210b196647588d568b75bba43e4b0932b4618bdd508ab8907c4d174bec79c855aa2be3772bef5bc140887fe693f77457a35a9cbc210956bf250175
@@ -2,7 +2,7 @@ require "middleman-core"
2
2
  require "nokogiri"
3
3
 
4
4
  class Widont < ::Middleman::Extension
5
- VERSION = "1.0.0"
5
+ VERSION = "1.0.1"
6
6
 
7
7
  option :tags, %w[p h1 h2 h3 h4 h5 h6], "Tags to apply widont"
8
8
 
@@ -23,16 +23,15 @@ class Widont < ::Middleman::Extension
23
23
  path = env["PATH_INFO"]
24
24
 
25
25
  if type == "text/html"
26
- html = ::Middleman::Util.extract_response_text(response)
27
- html_doc = Nokogiri::HTML(html)
28
-
29
- space = "\u00A0"
30
- html_doc.css(@tags.join(", ")).each do |tag|
31
- content = tag.inner_html.strip
32
- index = content.rindex(" ")
33
- content = content.insert(index, space)
34
- content[index + space.length] = ""
35
- tag.inner_html = content
26
+ html = ::Middleman::Util.extract_response_text(response)
27
+ html_doc = Nokogiri::HTML(html)
28
+
29
+ space = "\u00A0"
30
+ html_doc.css(@tags.join(", ")).each do |tag|
31
+ content = tag.inner_html.strip
32
+ index = content.rindex(/\s/)
33
+ content[index] = space
34
+ tag.inner_html = content
36
35
  end
37
36
  response = html_doc.to_html
38
37
  end
@@ -48,3 +47,4 @@ class Widont < ::Middleman::Extension
48
47
  end
49
48
 
50
49
  ::Middleman::Extensions.register(:widont, Widont)
50
+
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.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Boles