lib/bridgetown-slim/slim_templates.rb in bridgetown-slim-1.1.0 vs lib/bridgetown-slim/slim_templates.rb in bridgetown-slim-1.1.1
- old
+ new
@@ -17,20 +17,23 @@
end
end
module Converters
class SlimTemplates < Converter
+ priority :highest
input :slim
# Logic to do the Slim content conversion.
#
# @param content [String] Content of the file (without front matter).
# @params convertible [Bridgetown::Page, Bridgetown::Document, Bridgetown::Layout]
# The instantiated object which is processing the file.
#
# @return [String] The converted content.
def convert(content, convertible)
+ return content if convertible.data[:template_engine] != "slim"
+
slim_view = Bridgetown::SlimView.new(convertible)
slim_renderer = Slim::Template.new(convertible.relative_path) { content }
if convertible.is_a?(Bridgetown::Layout)
@@ -43,10 +46,12 @@
end
def matches(ext, convertible)
return true if convertible.data[:template_engine] == "slim"
- super(ext)
+ super(ext).tap do |ext_matches|
+ convertible.data[:template_engine] = "slim" if ext_matches
+ end
end
def output_ext(ext)
ext == ".slim" ? ".html" : ext
end