Sha256: 283680bf82a19de17ba8d2233f1a2c7ea98c88a1f36f387a0edfda2ce33a7a54
Contents?: true
Size: 651 Bytes
Versions: 1
Compression:
Stored size: 651 Bytes
Contents
require 'fast_haml/filter_compilers/base' module FastHaml module FilterCompilers class Preserve < Base include Temple::Utils def compile(texts) temple = [:multi, [:newline]] # I don't know why only :preserve filter keeps the last empty lines. compile_texts(temple, texts, keep_last_empty_lines: true) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fast_haml-0.1.10 | lib/fast_haml/filter_compilers/preserve.rb |