Comments (10)
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.
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.
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.
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.
Sounds good. Now that I can get the gem building I'll try to get a PR written up this week.
from gollum-lib.
Nice! 👍
from gollum-lib.
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.
Huh, weird. I'm also getting this on a fresh vagrant box on arch, so yes, please open an issue.
from gollum-lib.
Do you have an estimate as to when the next release for gollum
and gollum-lib
will be cut?
from gollum-lib.
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)
- sanitize lib needs update (CVE-2018-3740) HOT 4
- Recent versions of sanitize break jruby HOT 1
- Depends on an old version of sanitize HOT 14
- Make file search case insensitive HOT 1
- 5.x: TOC doesn't show up in subpages HOT 2
- Set commit date on committing changes HOT 12
- Gollum should register ".adoc" as a valid file extension for AsciiDoc
- Series macro can't be used in subpages
- pandoc-citeproc no longer supported HOT 2
- Improve Navigation or TOC.
- Make dependency on twitter optional HOT 1
- markups @master still referring to python2 for rst support HOT 2
- Possible to append to default filter chain? HOT 5
- More efficient sanitization
- Customization (like sorting and filtering) of the navigation or TOC macros? HOT 1
- Default CommonMarker options?
- Advanced search HOT 5
- Add page categorization (or concept tagging) feature HOT 8
- Macro filter turned boolean arguments into string HOT 2
- Rethink logic for Macro sanitization HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gollum-lib.