github / albino Goto Github PK
View Code? Open in Web Editor NEWRuby wrapper for the Pygments syntax highlighter.
License: MIT License
Ruby wrapper for the Pygments syntax highlighter.
License: MIT License
I installed pygments on arch linux via
sudo pacman -S python-pygments
and then fired up the albino gem and got a empty string.
$ irb
require 'albino'
=> true
Albino.new( 'puts "hi"', :ruby ).to_s
=> ""
Playing arround with albino's source code I found if I remove the encoding from the options that are passed to POSIX::Spawn::Child, Albino.new( .. ).to_s returns the expected code.
Could someone please look into this?
Hi,
I've tried Albino 1.2.3 with an utf-8 encoded target
string and Ruby 1.9.2, and it raises an exception:
> Albino.new("# é", "bash").colorize
NoMethodError: undefined method `size' for nil:NilClass
from /home/nono/.rvm/gems/ruby-1.9.2-p136/gems/albino-1.2.3/lib/albino/process.rb:167:in `block in read_and_write'
from /home/nono/.rvm/gems/ruby-1.9.2-p136/gems/albino-1.2.3/lib/albino/process.rb:159:in `each'
from /home/nono/.rvm/gems/ruby-1.9.2-p136/gems/albino-1.2.3/lib/albino/process.rb:159:in `read_and_write'
from /home/nono/.rvm/gems/ruby-1.9.2-p136/gems/albino-1.2.3/lib/albino/process.rb:100:in `exec!'
from /home/nono/.rvm/gems/ruby-1.9.2-p136/gems/albino-1.2.3/lib/albino/process.rb:68:in `initialize'
from /home/nono/.rvm/gems/ruby-1.9.2-p136/gems/albino-1.2.3/lib/albino.rb:72:in `new'
from /home/nono/.rvm/gems/ruby-1.9.2-p136/gems/albino-1.2.3/lib/albino.rb:72:in `execute'
from /home/nono/.rvm/gems/ruby-1.9.2-p136/gems/albino-1.2.3/lib/albino.rb:76:in `colorize'
from (irb):2
from /home/nono/.rvm/rubies/ruby-1.9.2-p136/bin/irb:16:in `<main>'
I think the problem is on these two lines:
size = fd.write_nonblock(input)
input = input[size, input.size]
The first line is the number of bytes writen, but input.size
is the length in characters
and input[]
also manipulates characters. So, if input is complety read, size can be superior to input.size and then input becomes nil.
Fixed here: http://github.com/henrik/albino/commits/master
Hey... I'm using ruby 1.9.3 with Rails v3.2. If I do
Albino.colorize('puts "Hello World"', :ruby)
I get an empty string.
I also found this: http://stackoverflow.com/questions/5945522/rails-syntax-highlighter-albino-is-not-working
I am not able to use hl_lines parameter since this parameter involves using quotation marks such as follows:
{ % highlight ruby hl_lines="2 3 4" }
However, using quotation marks in the value parameter is considered invalid as per the regular expression.
Hi. There's a bug in Albino that leads to anyone using jekyll on Windows getting a 'liquid error: bad file descriptor' when they enable syntax highlighting. It's well publicised, there's even a patch to fix it, but I don't know if anyone has told you about it.
https://gist.github.com/1185645 patch
http://www.madhur.co.in/blog/2011/09/01/runningjekyllwindows.html
http://bradleygrainger.com/2011/09/07/how-to-use-github-pages-on-windows.html
Hi, I have no output with albino 1.3.2 and posix-spawn 0.3.4 but if I downgrade posix-spawn to 0.3.3, albino works fine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.