Sha256: 34595bd9f10b378bb07e82bffc3f917c7afbc3b172a34f3251324d7a29dc2314
Contents?: true
Size: 641 Bytes
Versions: 35
Compression:
Stored size: 641 Bytes
Contents
module Hamlit module Compilers module Strip def on_haml_strip(*exps) stripped = strip_newline(exps) on_multi(*stripped) end private def strip_newline(content) indexes = newline_indexes(content) return content if indexes.length < 2 content = content.dup content.delete_at(indexes.last) content.delete_at(indexes.first) content end def newline_indexes(exps) indexes = [] exps.each_with_index do |exp, index| indexes << index if exp == [:static, "\n"] end indexes end end end end
Version data entries
35 entries across 35 versions & 1 rubygems