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

Update to latest pygments #122

Closed
wants to merge 2 commits into from
Closed

Conversation

bkeepers
Copy link

Ran rake vendor:update.

There is one failing test that seems like a legitimate failure. The test was added in d6a8f2a, which appears to be testing pipes and not necessarily the expected output.

[26/48] PygmentsHighlightTest#test_highlight_works_with_single_character_input = 0.01 s                    
  1) Error:
test_highlight_works_with_single_character_input(PygmentsHighlightTest):
MentosError: Traceback (most recent call last):
  File "/Users/brandon/github/pygments.rb/lib/pygments/mentos.py", line 303, in start
    res = self.get_data(method, lexer, args, kwargs, text)
  File "/Users/brandon/github/pygments.rb/lib/pygments/mentos.py", line 171, in get_data
    res = self.highlight_text(text, lexer, formatter_name, args, _convert_keys(opts))
  File "/Users/brandon/github/pygments.rb/lib/pygments/mentos.py", line 122, in highlight_text
    lexer = self.return_lexer(lexer, args, kwargs, code)
  File "/Users/brandon/github/pygments.rb/lib/pygments/mentos.py", line 102, in return_lexer
    return lexers.guess_lexer(code, **inputs)
  File "/Users/brandon/github/pygments.rb/vendor/pygments-main/pygments/lexers/__init__.py", line 242, in guess_lexer
    raise ClassNotFound('no lexer matching the text found')
ClassNotFound: no lexer matching the text found

@bkeepers
Copy link
Author

/cc @tnm @tmm1 @rick @arfon

@thomasboyt
Copy link

👍 it's not in the Pygments changelog, but this also includes a new Handlebars lexer.

@cstrahan
Copy link

cstrahan commented Jun 1, 2014

The NixOS project could really benefit from the new tokenizer in the latest pygments, which would bring syntax highlighting to tens of thousands of Nix packages.

@tmm1 If this PR looks good, would you mind merging and rolling a new release, please?

@cstrahan
Copy link

cstrahan commented Jun 1, 2014

/cc @tnm @rick @arfon

@rick
Copy link

rick commented Jun 2, 2014

Not sure why I didn't see the original cc: -- yay Inbox 3000.

Confirmed that I still see that test failure locally. I'll 👀 this and see if any wisdom arises.

@rick
Copy link

rick commented Jun 2, 2014

That test will pass if we provide a lexer argument:

diff --git a/test/test_pygments.rb b/test/test_pygments.rb
index 61df666..37c9835 100644
--- a/test/test_pygments.rb
+++ b/test/test_pygments.rb
@@ -88,7 +88,7 @@ class PygmentsHighlightTest < Test::Unit::TestCase
   end

   def test_highlight_works_with_single_character_input
-    code = P.highlight("a")
+    code = P.highlight("a", :lexer => 'rb')
     assert_match 'a</span>', code
   end

@@ -283,5 +283,3 @@ class PygmentsConfigTest < Test::Unit::TestCase
     assert list['Html'][:aliases].include?('html')
   end
 end
-
-

I'm coming at this very fresh, though, so I don't know if requiring a test change is a bad sign, something related to the upgrade, or just noise.

@cstrahan
Copy link

cstrahan commented Jun 2, 2014

@rick Thanks for looking into this!

@bkeepers
Copy link
Author

Done in #127

@bkeepers bkeepers closed this Jun 20, 2014
@bkeepers bkeepers deleted the update-pygments branch June 20, 2014 14:04
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.

None yet

4 participants