Sha256: ab45520507545224504b723693e2fea9516277d7db0fd4758be98af6e8e2939a
Contents?: true
Size: 678 Bytes
Versions: 2
Compression:
Stored size: 678 Bytes
Contents
require 'fast_haml/filter_compilers/base' module FastHaml module FilterCompilers class Preserve < Base include Temple::Utils def compile(texts) temple = [:multi] texts.each do |text| temple << text_compiler.compile(text) unless texts.last.equal?(text) temple << [:static, "\n"] end end sym = unique_name [:multi, [:capture, sym, temple], [:dynamic, "::FastHaml::FilterCompilers::Preserve.preserve(#{sym})"], ] end def self.preserve(str) str.gsub("\n", '
') end end register(:preserve, Preserve) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fast_haml-0.1.1 | lib/fast_haml/filter_compilers/preserve.rb |
fast_haml-0.1.0 | lib/fast_haml/filter_compilers/preserve.rb |