Skip to content

Commit

Permalink
Soften Nokogiri dependency to versions ">= 1.4"
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JuanitoFatas committed Sep 29, 2015
1 parent b73afbe commit 3af3971
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion html-pipeline.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
gem.test_files = gem.files.grep(%r{^test})
gem.require_paths = ["lib"]

gem.add_dependency "nokogiri", [">= 1.4", "<= 1.6.5"]
gem.add_dependency "nokogiri", ">= 1.4"
gem.add_dependency "activesupport", [">= 2", "< 5"]

gem.post_install_message = <<msg
Expand Down
2 changes: 1 addition & 1 deletion lib/html/pipeline/@mention_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def self.mentioned_logins_in(text, username_pattern=UsernamePattern)
def call
result[:mentioned_usernames] ||= []

doc.search('text()').each do |node|
doc.search('.//text()').each do |node|
content = node.to_html
next if !content.include?('@')
next if has_ancestor?(node, IGNORE_PARENTS)
Expand Down
2 changes: 1 addition & 1 deletion lib/html/pipeline/emoji_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class EmojiFilter < Filter
DEFAULT_IGNORED_ANCESTOR_TAGS = %w(pre code tt).freeze

def call
doc.search('text()').each do |node|
doc.search('.//text()').each do |node|
content = node.to_html
next unless content.include?(':')
next if has_ancestor?(node, ignored_ancestor_tags)
Expand Down

0 comments on commit 3af3971

Please sign in to comment.