Sha256: 07e8c84edfe62c969f87dbd5d89e651af3b5777499a5e58f89ca2e1443dec932

Contents?: true

Size: 594 Bytes

Versions: 2

Compression:

Stored size: 594 Bytes

Contents

# frozen_string_literal: true
require_relative 'base'

module Faml
  module FilterCompilers
    class Escaped < Base
      include Temple::Utils

      def compile(ast)
        temple = [:multi, [:newline]]
        compile_texts(temple, ast.lineno, ast.texts)
        temple << [:static, "\n"]
        escape_code = Temple::Filters::Escapable.new(use_html_safe: false).instance_variable_get(:@escape_code)
        sym = unique_name
        [:multi,
         [:capture, sym, temple],
         [:dynamic, escape_code % sym],
        ]
      end
    end

    register(:escaped, Escaped)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
faml-0.8.1 lib/faml/filter_compilers/escaped.rb
faml-0.8.0 lib/faml/filter_compilers/escaped.rb