Ruby代码段-FrozenError有什么问题?

时间:2019-06-22 03:04:45

标签: ruby

我不熟悉Ruby语言,当我尝试使用asciidoctor转换为pdf文件时,它将报告以下错误,并且我发现该错误发生在asciidoctor数学库中:

有人知道如何解决此问题吗?谢谢

Traceback (most recent call last):
        20: from /home/eric/.gem/ruby/2.5.0/bin/asciidoctor:23:in `<main>'
        19: from /home/eric/.gem/ruby/2.5.0/bin/asciidoctor:23:in `load'
        18: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/bin/asciidoctor:15:in `<top (required)>'
        17: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
        16: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
        15: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
        14: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
        13: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
        12: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
        11: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in `convert'
        10: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in `load'
         9: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `parse'
         8: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `each'
         7: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `block in parse'
         6: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `[]'
         5: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-mathematical-0.3.0/lib/asciidoctor-mathematical/extension.rb:40:in `process'
         4: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-mathematical-0.3.0/lib/asciidoctor-mathematical/extension.rb:40:in `each'
         3: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-mathematical-0.3.0/lib/asciidoctor-mathematical/extension.rb:41:in `block in process'
         2: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-mathematical-0.3.0/lib/asciidoctor-mathematical/extension.rb:100:in `handle_prose_block'
         1: from /home/eric/.gem/ruby/2.5.0/gems/asciidoctor-mathematical-0.3.0/lib/asciidoctor-mathematical/extension.rb:135:in `handle_inline_stem'
/home/eric/.gem/ruby/2.5.0/gems/asciidoctor-mathematical-0.3.0/lib/asciidoctor-mathematical/extension.rb:135:in `gsub!': asciidoctor: FAILED:  Failed to load AsciiDoc document - can't modify frozen String (FrozenError)
135    text.gsub!(stem_rx) {
136      if (m = $~)[0].start_with? '\\'
137        next m[0][1..-1]
138      end
139
140      if (eq_data = m[2].rstrip).empty?
141        next
142      else
143        source_modified = true
144      end
145
146      eq_data.gsub! '\]', ']'
147      subs = m[1].nil_or_empty? ? (to_html ? [:specialcharacters] : []) : (node.resolve_pass_subs m[1])
148      eq_data = node.apply_subs eq_data, subs unless subs.empty?
149      img_target, img_width, img_height = make_equ_image eq_data, nil, true, mathematical, image_output_dir, image_target_dir, format, inline
150      if inline
151        %(pass:[<span class="steminline"> #{img_target} </span>])
152      else
153        %(image:#{img_target}[width=#{img_width},height=#{img_height}])
154      end
155    } if (text != nil) && (text.include? ':') && ((support_stem_prefix && (text.include? 'stem:')) || (text.include? 'latexmath:'))```

0 个答案:

没有答案