【问题标题】:Octopress include code crashOctopress 包含代码崩溃
【发布时间】:2012-12-16 08:53:23
【问题描述】:

我使用 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$

【问题讨论】:

    标签: ruby linux gem jekyll octopress


    【解决方案1】:

    如果我将 /usr/lib/ruby/gems/1.9.1/gems/pygments.rb-0.3.4/lib/pygments/mentos.py 的第一行更改为运行,它适用于 Arch Linux python2" 而不是 "python"。

    【讨论】:

      【解决方案2】:

      这可能会有所帮助:
      https://github.com/tmm1/pygments.rb/issues/35

      您似乎正在运行旧版本的pygments
      在撰写本文时,0.3.2 看起来像是最新的:

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

      【讨论】:

      • 这导致我出现另一个错误,说Failed to get header. (MentosError)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-08
      • 2015-09-16
      • 1970-01-01
      相关资源
      最近更新 更多