简体   繁体   中英

How can I do syntax highlighting in JRuby?

I'd like to use something like ultraviolet in JRuby. It (obviously) does not compile, however:

$ gem install ultraviolet
Fetching: oniguruma-1.1.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing ultraviolet:
  ERROR: Failed to build gem native extension.

        ~/.rvm/rubies/jruby-1.6.7/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
checking for main() in -lonig... yes
creating Makefile

make
cc -I. -I. -I~/.rvm/rubies/jruby-1.6.7/lib/native/include/ruby -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE        -Wall  -arch x86_64 -c oregexp.c

Is there a similar library?

I really like pygments.rb . Pygments itself is written in Python, but the integration has worked well for me. It's really fast, and best of all it supports tons of languages.

Perhaps Coderay ? It's pure-Ruby so no native extensions fuss. It lists support for JRuby 1.5.2+.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM