Login  Register

Re: asciidoctor-pdf: frozen string issue (not asciidoctor-mathtematical) with source-blocks

Posted by mojavelinux on Aug 28, 2019; 11:01am
URL: https://discuss.asciidoctor.org/asciidoctor-pdf-frozen-string-issue-not-asciidoctor-mathtematical-with-source-blocks-tp7119p7121.html

I see the problem. It has to do with how the indentation after the line numbers gets processed. And yes, it happens when the number of digits in the line number varies. In that case, it ends up trying to modify a string that was previously frozen (due to the frozen string literal setting on the source file).

Please file an issue in the project and I'll include a fix in 1.5.0.beta.3.

Best,

-Dan

On Wed, Aug 28, 2019 at 12:00 AM wimalopaan [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi all,

I have an urgent showstopper on all my documents:

if one uses source blocks with linenumbers enabled and more than 9 (>= 10) lines inside the block, I get an error.
This small adoc preproduces the error (see below):

= Test
:lang: de
:numbered:
:source-highlighter: pygments
:pygments-css: class

[source,java,linenums,indent=0]
----
1
2
3
4
5
6
7
8
9
0
----
The call:

~/.gem/ruby/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.2/bin/asciidoctor-pdf  --trace  -o test.pdf test.adoc

The error is:

Traceback (most recent call last):
22: from /home/lmeier/.gem/ruby/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.2/bin/asciidoctor-pdf:32:in `<main>'
21: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
20: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
19: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
18: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
17: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
16: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
15: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:118:in `convert'
14: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:951:in `convert'
13: from /home/lmeier/.gem/ruby/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.2/lib/asciidoctor-pdf/converter.rb:134:in `convert'
12: from /home/lmeier/.gem/ruby/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.2/lib/asciidoctor-pdf/converter.rb:260:in `convert_document'
11: from /home/lmeier/.gem/ruby/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.2/lib/asciidoctor-pdf/converter.rb:150:in `convert_content_for_block'
10: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:1020:in `content'
9: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/abstract_block.rb:84:in `content'
8: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/abstract_block.rb:84:in `map'
7: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/abstract_block.rb:84:in `block in content'
6: from /usr/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/abstract_block.rb:75:in `convert'
5: from /home/lmeier/.gem/ruby/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.2/lib/asciidoctor-pdf/converter.rb:134:in `convert'
4: from /home/lmeier/.gem/ruby/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.2/lib/asciidoctor-pdf/converter.rb:1579:in `convert_listing_or_literal'
3: from /home/lmeier/.gem/ruby/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.2/lib/asciidoctor-pdf/converter.rb:1741:in `guard_indentation'
2: from /home/lmeier/.gem/ruby/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.2/lib/asciidoctor-pdf/converter.rb:1741:in `each'
1: from /home/lmeier/.gem/ruby/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.2/lib/asciidoctor-pdf/converter.rb:1743:in `block in guard_indentation'
/home/lmeier/.gem/ruby/2.6.0/gems/asciidoctor-pdf-1.5.0.beta.2/lib/asciidoctor-pdf/converter.rb:1743:in `[]=': can't modify frozen String (FrozenError)



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/asciidoctor-pdf-frozen-string-issue-not-asciidoctor-mathtematical-with-source-blocks-tp7119.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux