Code Monkey home page Code Monkey logo

albino's Issues

Cannot use hl_lines parameter

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.

default encoding option causing pygments not to render any content

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?

Albino 1.2.3 doesn't play nicely with utf8 and Ruby 1.9.2

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.

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.