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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d96152720cbe2dba9390e0692d9b2c3169dcd97
4
- data.tar.gz: edc730971828fcb4fb7b511ebec006f2622c109c
3
+ metadata.gz: 82446e4b6bf9ce5b4fbec7f084b1321f362d1740
4
+ data.tar.gz: 580ae0e3e63b317089d1cf0205faf04f5ff7681e
5
5
  SHA512:
6
- metadata.gz: eb3796e791a9452dd1052010bc6c7ddea099524ef30c508b4efc505668d787127cc6ec740100e77355c88366417664c4ead3fe1a67e594b6aed97916713aabec
7
- data.tar.gz: 6dca125444593a883804a9e78c8cfd0d1bd9ad2468ea721420b20bd2621ec0efffbbba911e4ec26fdb3fc3099384b59d15a68706fe6b6b621875a5a823c9b735
6
+ metadata.gz: 05ed96f270f434dc418a6e5a6a49f65704ccdf32a79ef1779084f98bc6525fc14fe01c863c21882531aec9338163a72ff5ca71dbdd9e40e7c0984d67f36f75b9
7
+ data.tar.gz: cb8290d4314cc75061378c89c1f8ffedd812eb8d8c2e2391ea87749bcfeed3ca5dd0405c49d275c39a9574e1d3ae561486321ae805ab2b0dafdfc44032db4317
@@ -40,7 +40,12 @@ module Anchors
40
40
  end
41
41
 
42
42
  def dom_id(el)
43
- id = el.content.downcase.gsub(/[^\d\w\s_]/m, '').strip.gsub(' ', seperator)
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
 
@@ -1,3 +1,3 @@
1
1
  module Anchors
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anchors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler