From 04b9d6153d1e289bd450a2f52bffde754ef4d1b0 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Tue, 17 Nov 2015 11:17:16 -0200 Subject: [PATCH] Initialize slim-related attributes regardless of when slim was loaded Setting instance attributes of the Template class cannot depend on whether slim has been loaded before or not. --- lib/asciidoctor/converter/template.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/asciidoctor/converter/template.rb b/lib/asciidoctor/converter/template.rb index 10eaa99..43be87b 100644 --- a/lib/asciidoctor/converter/template.rb +++ b/lib/asciidoctor/converter/template.rb @@ -253,10 +253,10 @@ def scan_dir template_dir, pattern, template_cache = nil unless defined? ::Slim # slim doesn't get loaded by Tilt, so we have to load it explicitly Helpers.require_library 'slim' - if @safe && ::Slim::VERSION >= '3.0' - slim_asciidoc_opts = (@engine_options[:slim][:asciidoc] ||= {}) - slim_asciidoc_opts[:safe] ||= @safe - end + end + if @safe && ::Slim::VERSION >= '3.0' + slim_asciidoc_opts = (@engine_options[:slim][:asciidoc] ||= {}) + slim_asciidoc_opts[:safe] ||= @safe end # load include plugin when using Slim >= 2.1 require 'slim/include' unless (defined? ::Slim::Include) || ::Slim::VERSION < '2.1'