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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.9 stable relax tests for rouge and pygments #8448

Closed
wants to merge 5 commits into from
Closed

3.9 stable relax tests for rouge and pygments #8448

wants to merge 5 commits into from

Conversation

dleidert
Copy link
Contributor

This is a 馃悰 bug fix. It fixes two tests.

[x] The test suite passes on travis https://travis-ci.com/github/dleidert/jekyll/builds/192890708

Summary

The php lexer was rewritten in Rouge 3.22 leading to a slightly different output. One test is relaxed to fit both rouge before and after version 3.22.

Also an update of pygments (we have 2.7.1) leads to a slightly different test result. The test is fixed to accept old and new pygments output too.

Context

This is related to and closes #8436.

Copy link
Member

@ashmaroli ashmaroli left a comment

Choose a reason for hiding this comment

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

  • In case you didn't know, %() is interpreted into strings and %r{} is interpreted onto regexes.
  • Our regex-style is %r!! instead of %r{}. (I don't know why RuboCop isn't flagging these as offenses..).
  • When converting a heredoc into a regex, you need to add the /x qualifier to disregard the newline whitespace:
    %r!
      <pre>
        foo
      </pre>
    !x

@dleidert
Copy link
Contributor Author

dleidert commented Oct 26, 2020

  • In case you didn't know, %() is interpreted into strings and %r{} is interpreted onto regexes.

I know. The change is intentional. Both affected tests need regexes. For pygments the putput changes from

- <span class="lineno">1 </span>
+ <span class="linenos">1</span>
  • Our regex-style is %r!! instead of %r{}. (I don't know why RuboCop isn't flagging these as offenses..).

Didn't know that. Fixed it.

  • When converting a heredoc into a regex, you need to add the /x qualifier to disregard the newline whitespace:
    %r!
      <pre>
        foo
      </pre>
    !x

I don't think this applies here. /x would strip all whitespace. Also the newlines in the rouge regex are correct and have to be there. I haven't found any way to preserve the newline in the pygments output and still match both output results. So the only way was to unify the two lines into one.

@dleidert dleidert closed this by deleting the head repository Jan 20, 2023
@jekyll jekyll locked and limited conversation to collaborators Jan 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants