Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soften Nokogiri dependency to versions ">= 1.4" #208

Merged
merged 2 commits into from
Sep 29, 2015

Conversation

JuanitoFatas
Copy link
Contributor

Many Ruby / Rails projects already use Nokogiri 1.6.6.x series.
<= 1.6.5 constraint make these projects impossible to integrate html-pipeline.
This pull request uses the workaround mentioned in sparklemotion/nokogiri#1233 (comment).

If this change is okay, then will need:

  • an CHANGELOG entry + Release 2.2.1
  • Backport this change to 1.11.0, Release 1.11.1 + an CHANGELOG entry Found out no need to do this because at v1.10.0, the Nokogiri dependency is locked at ~> 1.4.

Related: #176

@@ -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() | text()').each do |node|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change here? Since the tests pass, the behavior is the same, but I'm curious if this is the preferred convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change, tests failed with Nokogiri 1.6.6.x:

Nokogiri::XML::XPath::SyntaxError:
Invalid expression: .//child::text() | self::child::text()

Please, as a workaround, use #xpath with a real XPath expression (as above) to avoid having to convert CSS into a hacky XPath expression to work around unrelated DocumentFragment issues.
sparklemotion/nokogiri#1233 (comment)

Nokogiri author suggested use real XPath to avoid this.

@jch
Copy link
Contributor

jch commented Jul 24, 2015

@JuanitoFatas 👍 to your task list. Sorry it took a while for me to get around to this.

@alexandrnikitin
Copy link

@JuanitoFatas Thanks for the PR. This one is actual for me. I cannot use the latest Jekyll with Jemoji plugin because of that. Can we merge it please?

@JuanitoFatas
Copy link
Contributor Author

The CI failure is due to failed to install Nokogiri 1.4.7.

@jch I wrote a script to show that this pull request won't failed in most Nokogiri versions, as per #208 (comment).

Do you think it is worth to setup https://github.com/thoughtbot/appraisal for testing many nokogiri versions?

If you think this Pull Request is good, I will remove 39d9488 and 940959a. Then finish my todo list listed in #208 (comment).

@jch
Copy link
Contributor

jch commented Sep 29, 2015

@JuanitoFatas 👍 to getting this PR merged. There's some test failures in travis you should fix before merging, but I think your plan is good.

Do you think it is worth to setup https://github.com/thoughtbot/appraisal for testing many nokogiri versions?

You could open a separate PR to experiment with it. I'm open to it.

@JuanitoFatas JuanitoFatas force-pushed the feature/soften-nokogiri-dependency branch 3 times, most recently from c432583 to d052ca7 Compare September 29, 2015 15:08
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
@JuanitoFatas JuanitoFatas force-pushed the feature/soften-nokogiri-dependency branch from d052ca7 to c26c429 Compare September 29, 2015 15:09
@JuanitoFatas
Copy link
Contributor Author

@jch I think is good to merge and release. I'll work on the apprasial thing for testing multiple Nokogiris this weekend. Thank you and sorry this took so long...

@jch
Copy link
Contributor

jch commented Sep 29, 2015

Thank you and sorry this took so long...

No, thank you. It's open source, and I'm glad to you as a contributor 😉

jch added a commit that referenced this pull request Sep 29, 2015
Soften Nokogiri dependency to versions ">= 1.4"
@jch jch merged commit a02673b into master Sep 29, 2015
@jch jch deleted the feature/soften-nokogiri-dependency branch September 29, 2015 16:44
@JuanitoFatas JuanitoFatas mentioned this pull request Oct 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants