Giter Club home page Giter Club logo

Comments (10)

nlowe avatar nlowe commented on September 15, 2024

This line seems to be the culprit. We need to find a way to tell pygments to use a default lexer if it can't find the one specified. I'm not sure if this is a patch that needs made here or upstream.

Perhaps we can do something similar that asciidoctor does, that is, try to determine the lexer ourselves and default to the text lexer if we can't find one.

If I can get some assistance with #152, I'll try to write up a PR if I can find a fix.

from gollum-lib.

nlowe avatar nlowe commented on September 15, 2024

Using the asciidoctor fix, replacing:

hl_code = Pygments.highlight(code, :lexer => lang, :options => { :encoding => encoding.to_s, :startinline => true })

with:

lexer = Pygments::Lexer[(lang)] || Pygments::Lexer['text']
hl_code = lexer.highlight(code, :options => { :encoding => encoding.to_s, :startinline => true })

Seems to have fixed it, although this stops pygments from trying to derive what lexer to use by looking at the code.

EDIT: This seems to break the live-preview editor, not sure why
Edit: So I undid my changes and the live-preview editor still doesn't work:

Uncaught SyntaxError: Unexpected token ILLEGAL
static_highlight.js:34 Uncaught TypeError: Cannot read property 'EditSession' of undefined(anonymous function) @ static_highlight.js:34j.s.newContext.h.execCb @ requirejs.min.js:31j.s.newContext.X.check @ requirejs.min.js:21(anonymous function) @ requirejs.min.js:25c @ requirejs.min.js:8(anonymous function) @ requirejs.min.js:26q @ requirejs.min.js:7j.s.newContext.X.emit @ requirejs.min.js:26j.s.newContext.X.check @ requirejs.min.js:22j.s.newContext.X.enable @ requirejs.min.js:26j.s.newContext.X.init @ requirejs.min.js:19(anonymous function) @ requirejs.min.js:23c @ requirejs.min.js:8(anonymous function) @ requirejs.min.js:26q @ requirejs.min.js:7j.s.newContext.X.emit @ requirejs.min.js:26j.s.newContext.X.check @ requirejs.min.js:22j.s.newContext.X.enable @ requirejs.min.js:26j.s.newContext.X.init @ requirejs.min.js:19(anonymous function) @ requirejs.min.js:23c @ requirejs.min.js:8exports.get.xhr.onreadystatechange @ net.js:19
editor.js:44 Uncaught TypeError: Cannot read property 'EditSession' of undefined

from gollum-lib.

nlowe avatar nlowe commented on September 15, 2024

You can ignore my comment about it breaking the live-preview editor, it seems my cache was somehow corrupted and it failed to completely cache one of the JS files for ace.

from gollum-lib.

bartkamphorst avatar bartkamphorst commented on September 15, 2024

although this stops pygments from trying to derive what lexer to use by looking at the code.

True, but given this comment I wouldn't be too worried about that. 😄

from gollum-lib.

nlowe avatar nlowe commented on September 15, 2024

Sounds good. Now that I can get the gem building I'll try to get a PR written up this week.

from gollum-lib.

bartkamphorst avatar bartkamphorst commented on September 15, 2024

Nice! 👍

from gollum-lib.

nlowe avatar nlowe commented on September 15, 2024

Huh, so master is failing a test on my arch machine (this is before making any changes):

[nathan@nathan-arch gollum-lib]$ bundle exec rake test
/usr/bin/ruby -I"lib:lib:test:."  "/usr/lib/ruby/2.2.0/rake/rake_test_loader.rb" "test/**/test_*.rb" 
Loaded suite /usr/lib/ruby/2.2.0/rake/rake_test_loader
Started
.....................................................................................................................................................
...................F
=====================================================================================================================================================
Failure: test_push_and_pull(Pushing_and_pulling)
/home/nathan/projects/gollum-lib/test/test_hook.rb:93:in `block (2 levels) in <top (required)>'
<false> expected but was
<true>

diff:
? false
? tru  
=====================================================================================================================================================
.................................................................................................

Finished in 3.552655921 seconds.
-----------------------------------------------------------------------------------------------------------------------------------------------------
266 tests, 603 assertions, 1 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
99.6241% passed
-----------------------------------------------------------------------------------------------------------------------------------------------------
74.87 tests/s, 169.73 assertions/s
rake aborted!
Command failed with status (1): [ruby -I"lib:lib:test:."  "/usr/lib/ruby/2.2.0/rake/rake_test_loader.rb" "test/**/test_*.rb" ]

Tasks: TOP => test
(See full trace by running task with --trace)

but was passing earlier today on an ubuntu machine. Open a separate bug or ignore it because it's probably my environment?

from gollum-lib.

dometto avatar dometto commented on September 15, 2024

Huh, weird. I'm also getting this on a fresh vagrant box on arch, so yes, please open an issue.

from gollum-lib.

nlowe avatar nlowe commented on September 15, 2024

Do you have an estimate as to when the next release for gollum and gollum-lib will be cut?

from gollum-lib.

dometto avatar dometto commented on September 15, 2024

We were initially waiting for some some CSS changes to make it into gollum 4.1, so we could also release some of the macros in gollum-lib rc, but it looks like that's going to have to wait a bit longer. We can see if we can do a smaller bugfix release at a sooner date though.

from gollum-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.