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

'lexer' is removed from github-linguist #217

Closed
aptx4869 opened this issue Sep 7, 2015 · 7 comments
Closed

'lexer' is removed from github-linguist #217

aptx4869 opened this issue Sep 7, 2015 · 7 comments

Comments

@aptx4869
Copy link

aptx4869 commented Sep 7, 2015

We get a

NoMethodError:
       undefined method `lexer' for #<Linguist::Language name=Ruby>

since github-linguist/linguist@5d0e948 the `lexer' api is no longer exists
Should we change

(Linguist::Language[lang] && Linguist::Language[lang].lexer) || Pygments::Lexer[lang]

into

 (Linguist::Language[lang] && Linguist::Language[lang].try(:lexer)) || Pygments::Lexer[lang]

or add some code to check github-linguist version?

@jch
Copy link
Contributor

jch commented Sep 8, 2015

That fallback is already pretty confusing, so I'd rather not add another try to the mix. We could update the warning at the require, but it would still error out early. It's tricky because we don't require explicit versions for linguist.

@royzinn
Copy link

royzinn commented Sep 20, 2015

Hi,
So, from the above, what would be the better solution to keep using SyntaxHighlighter? should I move to some specific earlier version of Linguist or is there another solution?
Thanks in advance

@jch
Copy link
Contributor

jch commented Sep 21, 2015

@aptx4869 I haven't come up with a better way to address this, so in the interest of maintaining semver, would you be up for creating a PR with your fix?

@royzinn as a temporary fix, I suggest applying @aptx4869's changes locally to your project. Alternatively, you can use an older version of linguist.

@bmikol
Copy link

bmikol commented Sep 21, 2015

Alternatively, you could also just use the HTML::Pipeline-rouge_filter - it's been working great for me.

@jch
Copy link
Contributor

jch commented Sep 21, 2015

@bmikol 👍 totally forgot about that one.

@royzinn
Copy link

royzinn commented Sep 22, 2015

@bmikol @jch - thanks both! it works for me with rouge filter

@gjtorikian
Copy link
Owner

Old issue

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

No branches or pull requests

5 participants