Skip to content

Commit 0c5e1c1

Browse files
committed
stop escaping here since nokogiri does it, and update the regexp to match utf-8
1 parent b13ed2f commit 0c5e1c1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/html/pipeline/toc_filter.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ def call
1111
headers = Hash.new(0)
1212
doc.css('h1, h2, h3, h4, h5, h6').each do |node|
1313
name = node.text.downcase
14-
name.gsub!(/[^\w\- ]/, '') # remove punctuation
14+
name.gsub!(/[^\p{Word}\- ]/u, '') # remove punctuation
1515
name.gsub!(' ', '-') # replace spaces with dash
16-
name = EscapeUtils.escape_uri(name) # escape extended UTF-8 chars
1716

1817
uniq = (headers[name] > 0) ? "-#{headers[name]}" : ''
1918
headers[name] += 1
@@ -25,4 +24,4 @@ def call
2524
end
2625
end
2726
end
28-
end
27+
end

0 commit comments

Comments
 (0)