Login  Register

Problem using Slim HTML5 templates

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Problem using Slim HTML5 templates

Brady
1 post
I want to customize the HTML output from Asciidoctor, so I have made a local copy of the templates from https://github.com/asciidoctor/asciidoctor-backends and pointed to them via --template-dir.  I made sure to install slim version 2.1.0.

My environment is Windows 10.  The command I use is:

call asciidoctor.bat ^
--trace ^
--verbose ^
--warnings ^
--attribute stylesheet=%IncludesFolder%\MyStyle.css ^
--require asciidoctor-diagram ^
--template-dir %IncludesFolder%\asciidoctor-backends\slim\html5 ^
%SourceDoc% 

Execution fails with this output:

C:/Subversion/Incubation/Includes/asciidoctor-backends/slim/html5/document.html.slim:51: warning: possibly useless use of a variable in void context
C:/Subversion/Incubation/Includes/asciidoctor-backends/slim/html5/document.html.slim:21: warning: possibly useless use of a variable in void context
Traceback (most recent call last):
        22: from C:/Ruby26-x64/bin/asciidoctor:23:in `<main>'
        21: from C:/Ruby26-x64/bin/asciidoctor:23:in `load'
        20: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/bin/asciidoctor:15:in `<top (required)>'
        19: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
        18: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
        17: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
        16: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
        15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
        14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
        13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:118:in `convert'
        12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:951:in `convert'
        11: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/converter/composite.rb:28:in `convert'
        10: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/converter/template.rb:107:in `convert'
         9: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:109:in `render'
         8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `evaluate'
         7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `call'
         6: from C:/Subversion/Incubation/Includes/asciidoctor-backends/slim/html5/document.html.slim:54:in `__tilt_18244800'
         5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/converter/composite.rb:28:in `convert'
         4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/converter/template.rb:109:in `convert'
         3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:109:in `render'
         2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `evaluate'
         1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `call'
C:/Subversion/Incubation/Includes/asciidoctor-backends/slim/html5/block_outline.html.slim:2:in `__tilt_18244800': uninitialized constant Asciidoctor::Document::DEFAULT_TOCLEVELS (NameError)
Did you mean?  Asciidoctor::DEFAULT_DOCTYPE

Am I using the correct or most up-to-date templates?  Any suggestions on how to resolve this?

Thanks


Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Problem using Slim HTML5 templates

mojavelinux
Administrator
2681 posts
The templates in asciidoctor-backends aren't kept up to date anymore (due to time constraints). However, you don't need all of them anyway. It's better to start with a single template and build from there.


The instructions are geared towards using Jekyll. The only difference is that instead of setting the templates dir in _config.yml, you pass it using the -T flag:

asciidoctor -T path/to/templates -E slim doc.adoc


-Dan

p.s. If someone wants to maintain asciidoctor-backends, I'd be happy to hand over the responsibility.

On Sun, Oct 27, 2019 at 8:13 PM Brady [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I want to customize the HTML output from Asciidoctor, so I have made a local copy of the templates from https://github.com/asciidoctor/asciidoctor-backends and pointed to them via --template-dir.  I made sure to install slim version 2.1.0.

My environment is Windows 10.  The command I use is:

call asciidoctor.bat ^
--trace ^
--verbose ^
--warnings ^
--attribute stylesheet=%IncludesFolder%\MyStyle.css ^
--require asciidoctor-diagram ^
--template-dir %IncludesFolder%\asciidoctor-backends\slim\html5 ^
%SourceDoc% 

Execution fails with this output:

C:/Subversion/Incubation/Includes/asciidoctor-backends/slim/html5/document.html.slim:51: warning: possibly useless use of a variable in void context
C:/Subversion/Incubation/Includes/asciidoctor-backends/slim/html5/document.html.slim:21: warning: possibly useless use of a variable in void context
Traceback (most recent call last):
        22: from C:/Ruby26-x64/bin/asciidoctor:23:in `<main>'
        21: from C:/Ruby26-x64/bin/asciidoctor:23:in `load'
        20: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/bin/asciidoctor:15:in `<top (required)>'
        19: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
        18: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
        17: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
        16: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
        15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
        14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
        13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:118:in `convert'
        12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:951:in `convert'
        11: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/converter/composite.rb:28:in `convert'
        10: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/converter/template.rb:107:in `convert'
         9: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:109:in `render'
         8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `evaluate'
         7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `call'
         6: from C:/Subversion/Incubation/Includes/asciidoctor-backends/slim/html5/document.html.slim:54:in `__tilt_18244800'
         5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/converter/composite.rb:28:in `convert'
         4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/asciidoctor-2.0.10/lib/asciidoctor/converter/template.rb:109:in `convert'
         3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:109:in `render'
         2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `evaluate'
         1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/tilt-2.0.10/lib/tilt/template.rb:170:in `call'
C:/Subversion/Incubation/Includes/asciidoctor-backends/slim/html5/block_outline.html.slim:2:in `__tilt_18244800': uninitialized constant Asciidoctor::Document::DEFAULT_TOCLEVELS (NameError)
Did you mean?  Asciidoctor::DEFAULT_DOCTYPE

Am I using the correct or most up-to-date templates?  Any suggestions on how to resolve this?

Thanks





If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Problem-using-Slim-HTML5-templates-tp7309.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