1

我使用 Octopress (jekyll) 作为博客引擎/生成器。当我包含一段代码时

{% include_code foo.bar %}

语法,它完全崩溃了。如果我使用其他语法在标记内编写代码,也会发生这种情况

``` ruby
puts foo
```

但只有当我指定一种语言时。

我不知道如何解决它,stackoverflow上类似问题的答案并没有让我找到解决方案!修补 gem 不起作用,插入插件RubyPython::Interpreter.configure等等也不起作用。

我正在运行 ArchLinux。

这是错误输出:

~/blog$ rake generate
## Generating Site with Jekyll
unchanged sass/screen.scss
Configuration from /home/matthias/blog/_config.yml
/usr/lib/ruby/gems/1.9.1/gems/blankslate-3.1.2/lib/blankslate.rb:51: warning: undefining `object_id' may cause serious problems
Building site: source -> public
  File "<string>", line 1
    import sys; print sys.executable
                        ^
SyntaxError: invalid syntax
sh: - : Ungültige Option
Benutzung:      sh [Lange GNU Option] [Option] ...
                sh [Lange GNU Option] [Option] Script-Datei ...
Lange GNU Optionen:
        --debug
        --debugger
        --dump-po-strings
        --dump-strings
        --help
        --init-file
        --login
        --noediting
        --noprofile
        --norc
        --posix
        --protected
        --rcfile
        --restricted
        --verbose
        --version
Shell-Optionen:
        -irsD oder -c Kommando          (Nur Aufruf)
        -abefhkmnptuvxBCHP oder Option -o
sh: - : Ungültige Option
Benutzung:      sh [Lange GNU Option] [Option] ...
                sh [Lange GNU Option] [Option] Script-Datei ...
Lange GNU Optionen:
        --debug
        --debugger
        --dump-po-strings
        --dump-strings
        --help
        --init-file
        --login
        --noediting
        --noprofile
        --norc
        --posix
        --protected
        --rcfile
        --restricted
        --verbose
        --version
Shell-Optionen:
        -irsD oder -c Kommando          (Nur Aufruf)
        -abefhkmnptuvxBCHP oder Option -o
/usr/lib/ruby/gems/1.9.1/gems/ffi-1.0.11/lib/ffi/library.rb:121:in `block in ffi_lib': Could not open library 'lib.so': lib.so: cannot open shared object file: No such file or directory (LoadError)
        from /usr/lib/ruby/gems/1.9.1/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `map'
        from /usr/lib/ruby/gems/1.9.1/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `ffi_lib'
        from /usr/lib/ruby/gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython/python.rb:29:in `<module:Python>'
        from /usr/lib/ruby/gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython/python.rb:21:in `<top (required)>'
        from /usr/lib/ruby/gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython.rb:261:in `load'
        from /usr/lib/ruby/gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython.rb:261:in `reload_library'
        from /usr/lib/ruby/gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython.rb:104:in `start'
        from /usr/lib/ruby/gems/1.9.1/gems/pygments.rb-0.2.13/lib/pygments/ffi.rb:8:in `start'
        from /usr/lib/ruby/gems/1.9.1/gems/pygments.rb-0.2.13/lib/pygments/ffi.rb:82:in `highlight'
        from /home/matthias/blog/plugins/pygments_code.rb:24:in `pygments'
        from /home/matthias/blog/plugins/pygments_code.rb:14:in `highlight'
        from /home/matthias/blog/plugins/backtick_code_block.rb:37:in `block in render_code_block'
        from /home/matthias/blog/plugins/backtick_code_block.rb:13:in `gsub'
        from /home/matthias/blog/plugins/backtick_code_block.rb:13:in `render_code_block'
        from /home/matthias/blog/plugins/octopress_filters.rb:12:in `pre_filter'
        from /home/matthias/blog/plugins/octopress_filters.rb:28:in `pre_render'
        from /home/matthias/blog/plugins/post_filters.rb:112:in `block in pre_render'
        from /home/matthias/blog/plugins/post_filters.rb:111:in `each'
        from /home/matthias/blog/plugins/post_filters.rb:111:in `pre_render'
        from /home/matthias/blog/plugins/post_filters.rb:166:in `do_layout'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/post.rb:189:in `render'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:193:in `block in render'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:192:in `each'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:192:in `render'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:40:in `process'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in `<top (required)>'
        from /usr/bin/jekyll:19:in `load'
        from /usr/bin/jekyll:19:in `<main>'
~/blog$
4

2 回答 2

1

如果我将 /usr/lib/ruby/gems/1.9.1/gems/pygments.rb-0.3.4/lib/pygments/mentos.py 的第一行改为运行“python2”,它适用于 Arch Linux “蟒蛇”。

于 2013-03-03T14:58:02.770 回答
0

This might help:
https://github.com/tmm1/pygments.rb/issues/35

You seem to be running an old(er) version of pygments.
As of this writing 0.3.2 looks like the newest one:

http://rubygems.org/gems/pygments.rb

于 2012-12-16T09:13:07.370 回答