middleman-widont 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/middleman-widont.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8581fb267cf0989323f6255b8931888c92972b1c
|
4
|
+
data.tar.gz: c330bec2a8c1a95ecc6ca368fdeb3febacfc00b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 255ae567ec4a6f80e1588f637c77632738fa0f2299ce3ead4e03394ccc1187eb4962b65df98877de9fbb9ef81d0be56268c2e3701582c6aec948029a0358ef26
|
7
|
+
data.tar.gz: 84f8ba31862fe360d39474587fba5a523ac273f67b95fdf9aa1bef694e6631b617de744cc5a7923594334ce17fe41d9af5d195d9f5ae3dc0d4af1f06690606f1
|
data/README.md
CHANGED
data/lib/middleman-widont.rb
CHANGED
@@ -2,7 +2,7 @@ require "middleman-core"
|
|
2
2
|
require "nokogiri"
|
3
3
|
|
4
4
|
class Widont < ::Middleman::Extension
|
5
|
-
VERSION = "1.0.
|
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
|
-
|
35
|
-
|
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
|