asciidoctor-pdf: `calc_line_metrics': undefined method `*' for nil:NilClass (NoMethodError)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

asciidoctor-pdf: `calc_line_metrics': undefined method `*' for nil:NilClass (NoMethodError)

wimalopaan
Hi all,

I tried to customize the output of asciidoctor-pdf a bit and I got intro trouble.

My little test.adoc looks ok, since standard converting it looks good:

⌁68% [lmeier:] ppc ‡ ~/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/bin/asciidoctor-pdf -r asciidoctor-diagram --trace -a data-uri -o test_r.pdf test.adoc

But if I use a simple theme file, I got this error:

⌁68% [lmeier:] ppc ‡ ~/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/bin/asciidoctor-pdf -r asciidoctor-diagram --trace -a pdf-stylesdir=themes -a pdf-style=basic.yml -a data-uri -o test_r.pdf test.adoc
/home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/prawn_ext/extensions.rb:170:in `calc_line_metrics': undefined method `*' for nil:NilClass (NoMethodError)
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1451:in `layout_heading'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1371:in `block (2 levels) in layout_title_page'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1923:in `block in theme_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:63:in `block in font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:208:in `save_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:61:in `font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/prawn_ext/extensions.rb:115:in `font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1922:in `theme_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1370:in `block in layout_title_page'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1923:in `block in theme_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:63:in `block in font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:208:in `save_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:61:in `font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/prawn_ext/extensions.rb:115:in `font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1922:in `theme_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1363:in `layout_title_page'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:118:in `convert_document'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:76:in `convert'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:1028:in `convert'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1499:in `convert'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor/cli/invoker.rb:94:in `block in invoke!'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor/cli/invoker.rb:86:in `each'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor/cli/invoker.rb:86:in `invoke!'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/bin/asciidoctor-pdf:14:in `<main>'

This is the content of the theme file:

footer:
  font_color: $base_font_color

Any hints?
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf: `calc_line_metrics': undefined method `*' for nil:NilClass (NoMethodError)

mojavelinux
Administrator
Wilhelm,

Currently, you have to specify all the keys in your custom theme for which a default value is not provided. This is one of the primary reasons Asciidoctor PDF is still alpha. The plan is to load a base theme so that a custom theme only needs to declare keys that it wants to override from the base theme (like CSS). (Related issue: https://github.com/asciidoctor/asciidoctor-pdf/issues/132).

To make your custom theme work today, you need to start with the minimal theme recommended in the theming guide (warning: there are still some keys missing even from that sample, but it should work for most documents).


Cheers,

-Dan

On Wed, Jun 17, 2015 at 6:48 AM, wimalopaan [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi all,

I tried to customize the output of asciidoctor-pdf a bit and I got intro trouble.

My little test.adoc looks ok, since standard converting it looks good:

⌁68% [lmeier:] ppc ‡ ~/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/bin/asciidoctor-pdf -r asciidoctor-diagram --trace -a data-uri -o test_r.pdf test.adoc

But if I use a simple theme file, I got this error:

⌁68% [lmeier:] ppc ‡ ~/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/bin/asciidoctor-pdf -r asciidoctor-diagram --trace -a pdf-stylesdir=themes -a pdf-style=basic.yml -a data-uri -o test_r.pdf test.adoc
/home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/prawn_ext/extensions.rb:170:in `calc_line_metrics': undefined method `*' for nil:NilClass (NoMethodError)
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1451:in `layout_heading'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1371:in `block (2 levels) in layout_title_page'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1923:in `block in theme_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:63:in `block in font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:208:in `save_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:61:in `font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/prawn_ext/extensions.rb:115:in `font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1922:in `theme_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1370:in `block in layout_title_page'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1923:in `block in theme_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:63:in `block in font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:208:in `save_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/prawn-1.2.1/lib/prawn/font.rb:61:in `font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/prawn_ext/extensions.rb:115:in `font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1922:in `theme_font'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:1363:in `layout_title_page'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:118:in `convert_document'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/lib/asciidoctor-pdf/converter.rb:76:in `convert'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:1028:in `convert'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1499:in `convert'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor/cli/invoker.rb:94:in `block in invoke!'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor/cli/invoker.rb:86:in `each'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-1.5.2/lib/asciidoctor/cli/invoker.rb:86:in `invoke!'
        from /home/lmeier/.gem/ruby/2.2.0/gems/asciidoctor-pdf-1.5.0.alpha.7/bin/asciidoctor-pdf:14:in `<main>'

This is the content of the theme file:

footer:
  font_color: $base_font_color

Any hints?



To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: asciidoctor-pdf: `calc_line_metrics': undefined method `*' for nil:NilClass (NoMethodError)

wimalopaan
Thanks for the hints! Looks ok now.

The problem was that I used an old theme file from an older asciidoctor-pdf installation.

--
Wilhelm