Sha256: b4f805b3f3ea4356c7f11c9793106de37473d3aee523dbf94ca9e579a5016232
Contents?: true
Size: 1.52 KB
Versions: 3
Compression:
Stored size: 1.52 KB
Contents
# frozen_string_literal: true require "slim" module Hanami class View module Tilt # @api private module SlimAdapter # Add options to Slim::Engine to match the options from its default generator. # # The default generator for Slim::Engine is configurable via an engine option, like so: # # use(:Generator) { options[:generator] } # # Because this Temple filter is set as a proc, the resulting effect within Temple's EngineDSL # is that the generator's valid options are not merged into the full set of options available # on Slim::Engine itself. This means we receive a "Option :capture_generator is invalid" # warning when we set our `capture_generator:` below. # # However, this option is perfectly valid, so here we merge all the options for Slim's default # generator into the top-level engine's options, avoiding the warning. ::Slim::Engine.define_options(::Slim::Engine.options[:generator].options.valid_keys) # Slim template renderer for Hanami::View. # # This differs from the standard Slim::Template by automatically escaping HTML based on a # given string's `#html_safe?`, regardless of when "hanami/view/html" is required. # # @see Hanami::View::Tilt # @api private Template = Temple::Templates::Tilt( ::Slim::Engine, use_html_safe: true, capture_generator: HTMLSafeStringBuffer, ) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanami-view-2.1.0.rc1 | lib/hanami/view/tilt/slim_adapter.rb |
hanami-view-2.1.0.beta2 | lib/hanami/view/tilt/slim_adapter.rb |
hanami-view-2.1.0.beta1 | lib/hanami/view/tilt/slim_adapter.rb |