anchors 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/anchors.rb +6 -1
- data/lib/anchors/version.rb +1 -1
- 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: 82446e4b6bf9ce5b4fbec7f084b1321f362d1740
|
4
|
+
data.tar.gz: 580ae0e3e63b317089d1cf0205faf04f5ff7681e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05ed96f270f434dc418a6e5a6a49f65704ccdf32a79ef1779084f98bc6525fc14fe01c863c21882531aec9338163a72ff5ca71dbdd9e40e7c0984d67f36f75b9
|
7
|
+
data.tar.gz: cb8290d4314cc75061378c89c1f8ffedd812eb8d8c2e2391ea87749bcfeed3ca5dd0405c49d275c39a9574e1d3ae561486321ae805ab2b0dafdfc44032db4317
|
data/lib/anchors.rb
CHANGED
@@ -40,7 +40,12 @@ module Anchors
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def dom_id(el)
|
43
|
-
id = el.content.downcase
|
43
|
+
id = el.content.downcase
|
44
|
+
.gsub(/[^\d\w\s#{seperator}]/m, '') # Remove all non ASCII chars
|
45
|
+
.strip # Remove leading/trailing spaces/newlines
|
46
|
+
.split(' ') # Break apart the string into pieces
|
47
|
+
.compact # Remove empty pieces, caused by headers that span multiple lines
|
48
|
+
.join(seperator) # Join the pieces with the seperator
|
44
49
|
[id, id_count(id)].compact.join(seperator)
|
45
50
|
end
|
46
51
|
|
data/lib/anchors/version.rb
CHANGED