Что не так с частью кода Ruby - FrozenError? - PullRequest
0 голосов
/ 22 июня 2019

Я не знаком с языком 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:'))```
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...