Skip to content

Commit 3af3971

Browse files
committed
Soften Nokogiri dependency to versions ">= 1.4"
Many Ruby / Rails projects already use Nokogiri 1.6.6.x series. <= 1.6.5 make these projects impossible to integrate html-pipeline. Use real XPath with search() in emoji_filter and mention_filter Use #search with a real XPath expression to avoid the need to convert CSS into a hacky XPath expression. This workaround mentioned in http://git.io/vmp2F
1 parent b73afbe commit 3af3971

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

html-pipeline.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
1515
gem.test_files = gem.files.grep(%r{^test})
1616
gem.require_paths = ["lib"]
1717

18-
gem.add_dependency "nokogiri", [">= 1.4", "<= 1.6.5"]
18+
gem.add_dependency "nokogiri", ">= 1.4"
1919
gem.add_dependency "activesupport", [">= 2", "< 5"]
2020

2121
gem.post_install_message = <<msg

lib/html/pipeline/@mention_filter.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def self.mentioned_logins_in(text, username_pattern=UsernamePattern)
7070
def call
7171
result[:mentioned_usernames] ||= []
7272

73-
doc.search('text()').each do |node|
73+
doc.search('.//text()').each do |node|
7474
content = node.to_html
7575
next if !content.include?('@')
7676
next if has_ancestor?(node, IGNORE_PARENTS)

lib/html/pipeline/emoji_filter.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class EmojiFilter < Filter
1919
DEFAULT_IGNORED_ANCESTOR_TAGS = %w(pre code tt).freeze
2020

2121
def call
22-
doc.search('text()').each do |node|
22+
doc.search('.//text()').each do |node|
2323
content = node.to_html
2424
next unless content.include?(':')
2525
next if has_ancestor?(node, ignored_ancestor_tags)

0 commit comments

Comments
 (0)